Skip to content

Commit e19ef80

Browse files
committed
Remove bash-isms and make scripts portable and POSIX compliant
1 parent 3ed6f08 commit e19ef80

2 files changed

Lines changed: 16 additions & 15 deletions

File tree

autogen.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env sh
22

33
# This file is part of SmallBASIC
44
#

configure.ac

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ AC_ARG_ENABLE(teensy,
5858
[ac_build_teensy="yes"],
5959
[ac_build_teensy="no"])
6060

61-
function checkForWindows() {
61+
checkForWindows() {
6262
win32=no
6363
case "${host_os}" in
6464
*mingw* | pw32* | cygwin*)
@@ -72,7 +72,7 @@ function checkForWindows() {
7272
AM_CONDITIONAL(WITH_WIN32, test x"$win32" = "xyes")
7373
}
7474

75-
function checkDebugMode() {
75+
checkDebugMode() {
7676
AC_MSG_CHECKING([if debug mode is enabled])
7777
AC_ARG_WITH(debug,
7878
[ --with-debug Build the debug version default=no],
@@ -90,7 +90,7 @@ function checkDebugMode() {
9090
AC_SUBST(CFLAGS)
9191
}
9292

93-
function checkProfiling() {
93+
checkProfiling() {
9494
AC_MSG_CHECKING([if profile generate is enabled])
9595
AC_ARG_WITH(profile-generate,
9696
[ --with-profile-generate Build the profile generate default=no],
@@ -116,7 +116,7 @@ function checkProfiling() {
116116
fi
117117
}
118118

119-
function checkPCRE() {
119+
checkPCRE() {
120120
AC_CHECK_PROG(have_pcre, pcre-config, [yes], [no])
121121

122122
dnl supported under linux only for now
@@ -143,7 +143,7 @@ function checkPCRE() {
143143
fi
144144
}
145145

146-
function checkTermios() {
146+
checkTermios() {
147147
AC_CHECK_HEADERS([termios.h], [have_termios_h=yes; break;])
148148

149149
case "${host_os}" in
@@ -164,11 +164,11 @@ function checkTermios() {
164164
fi
165165
}
166166

167-
function defaultConditionals() {
167+
defaultConditionals() {
168168
AM_CONDITIONAL(WITH_CYGWIN_CONSOLE, false)
169169
}
170170

171-
function buildSDL() {
171+
buildSDL() {
172172
TARGET="Building SDL version."
173173
defaultConditionals
174174

@@ -259,7 +259,7 @@ function buildSDL() {
259259
(cd src/platform/android/app/src/main/assets && xxd -i main.bas > ../../../../../../../src/platform/sdl/main_bas.h)
260260
}
261261

262-
function buildAndroid() {
262+
buildAndroid() {
263263
defaultConditionals
264264

265265
AC_MSG_CHECKING([if library mode is enabled])
@@ -286,7 +286,7 @@ function buildAndroid() {
286286
fi
287287
}
288288

289-
function buildConsole() {
289+
buildConsole() {
290290
win32=no
291291
case "${host_os}" in
292292
*mingw* | pw32* | cygwin*)
@@ -345,7 +345,7 @@ function buildConsole() {
345345
AC_SUBST(BUILD_SUBDIRS)
346346
}
347347

348-
function buildWeb() {
348+
buildWeb() {
349349
if test $host_os = 'mingw32'; then
350350
TARGET="Building Ming32 Web server version."
351351
AC_DEFINE(__MINGW32__, 1, [as above])
@@ -375,7 +375,7 @@ function buildWeb() {
375375
AC_SUBST(BUILD_SUBDIRS)
376376
}
377377

378-
function buildEmscripten() {
378+
buildEmscripten() {
379379
TARGET="Building Emscripten version."
380380
BUILD_SUBDIRS="src/common src/platform/emcc"
381381
AC_CHECK_PROG(have_xxd, xxd, [yes], [no])
@@ -393,7 +393,7 @@ function buildEmscripten() {
393393
(cd src/platform/android/app/src/main/assets && xxd -i main.bas > ../../../../../../../src/platform/emcc/main_bas.h)
394394
}
395395

396-
function buildTEENSY() {
396+
buildTEENSY() {
397397
TARGET="Building teensy version."
398398
BUILD_SUBDIRS="src/platform/teensy"
399399
AC_CHECK_PROG(have_xxd, xxd, [yes], [no])
@@ -422,7 +422,7 @@ function buildTEENSY() {
422422
(cd src/platform/teensy && xxd -i main.bas > src/main_bas.h)
423423
}
424424

425-
function buildFLTK() {
425+
buildFLTK() {
426426
TARGET="Building FLTK version."
427427

428428
dnl Checks for FLTK 1.x
@@ -512,7 +512,8 @@ PACKAGE_CFLAGS="${PACKAGE_CFLAGS} -Wall -Werror -Wno-unused-result"
512512
BUILD_DATE=`date +"%a, %d %b %Y"`
513513
AC_DEFINE_UNQUOTED([BUILD_DATE],["$BUILD_DATE"],[Build date])
514514

515-
SB_DWORD_VER=`awk -F "." '{printf "0x%02d%02d%02d", $1,$2,$3}' <<< ${PACKAGE_VERSION}`
515+
SB_DWORD_VER=$(printf '%s' "$PACKAGE_VERSION" | awk -F. '{printf "0x%02d%02d%02d", $1,$2,$3}')
516+
516517
AC_DEFINE_UNQUOTED([SB_DWORD_VER],[$SB_DWORD_VER],[SB_DWORD_VER])
517518

518519
AC_SUBST(PACKAGE_CFLAGS)

0 commit comments

Comments
 (0)