11dnl
22dnl Configure script for SmallBASIC
33dnl
4- dnl Copyright(C) 2001-2018 Chris Warren-Smith.
4+ dnl Copyright(C) 2001-2019 Chris Warren-Smith.
55dnl
66dnl This program is distributed under the terms of the GPL v2.0
77dnl Download the GNU Public License (GPL) from www.gnu.org
@@ -39,6 +39,11 @@ AC_ARG_ENABLE(web,
3939 [ ac_build_web="yes"] ,
4040 [ ac_build_web="no"] )
4141
42+ AC_ARG_ENABLE ( fltk ,
43+ AS_HELP_STRING ( [ --enable-fltk] ,[ build fltk version(default=no)] ) ,
44+ [ ac_build_fltk="yes"] ,
45+ [ ac_build_fltk="no"] )
46+
4247AC_ARG_ENABLE ( dist ,
4348 AS_HELP_STRING ( [ --enable-dist] ,[ prepare to run make dist(default=no)] ) ,
4449 [ ac_build_dist="yes"] ,
@@ -211,15 +216,13 @@ function buildSDL() {
211216 dnl preconfigured values for SDL build
212217 AC_DEFINE ( _SDL , 1 , [ Defined when building SDL version] )
213218 AC_DEFINE ( _UnixOS , 1 , [ Building under Unix like systems.] )
214- AC_DEFINE ( IMPL_DEV_DELAY , 1 , [ Driver implements dev_delay()] )
215- AC_DEFINE ( IMPL_LOG_WRITE , 1 , [ Driver implements lwrite()] )
216219 AC_DEFINE ( IMPL_DEV_READ , 1 , [ Implement dev_read()] )
220+ AC_DEFINE ( IMPL_DEV_DELAY , 1 , [ Driver implements dev_delay()] )
217221 AC_DEFINE ( IMPL_LOG_WRITE , 1 , [ Driver implements lwrite()] )
218222
219223 BUILD_SUBDIRS="src/common src/platform/sdl"
220224 AC_SUBST ( BUILD_SUBDIRS )
221225 (cd src/platform/android/app/src/main/assets && xxd -i main.bas > ../../../../../../../src/platform/sdl/main_bas.h)
222- (cd documentation && g++ -o build_kwp build_kwp.cpp && ./build_kwp > ../src/ui/kwp.h)
223226}
224227
225228function buildAndroid() {
@@ -238,8 +241,6 @@ function buildAndroid() {
238241
239242 TEST_DIR="src/platform/android"
240243 AC_SUBST ( TEST_DIR )
241-
242- (cd documentation && g++ -o build_kwp build_kwp.cpp && ./build_kwp > ../src/ui/kwp.h)
243244}
244245
245246function buildConsole() {
@@ -299,8 +300,6 @@ function buildConsole() {
299300 fi
300301
301302 AC_SUBST ( BUILD_SUBDIRS )
302-
303- (cd documentation && g++ -o build_kwp build_kwp.cpp && ./build_kwp > ../src/ui/kwp.h)
304303}
305304
306305function buildWeb() {
@@ -326,16 +325,74 @@ function buildWeb() {
326325 AC_SUBST ( BUILD_SUBDIRS )
327326}
328327
328+ function buildFLTK() {
329+ TARGET="Building FLTK version."
330+
331+ dnl Checks for FLTK 1.x
332+ AC_CHECK_PROG ( have_fltk , fltk-config , [ yes] , [ no] )
333+
334+ AC_CHECK_PROG ( have_xxd , xxd , [ yes] , [ no] )
335+ if test "${have_xxd}" = "no" ; then
336+ AC_MSG_ERROR ( [ xxd command not installed: configure failed.] )
337+ fi
338+
339+ dnl avoid using MSCRT versions of printf for long double
340+ case "${host_os}" in
341+ *mingw* | cygwin*)
342+ PACKAGE_CFLAGS="${PACKAGE_CFLAGS} -D__USE_MINGW_ANSI_STDIO"
343+ esac
344+
345+ FLTK_CXXFLAGS="${PACKAGE_CFLAGS} `fltk-config --cxxflags`"
346+ FLTK_CXXFLAGS="${FLTK_CXXFLAGS} -fno-exceptions -fno-rtti -std=c++11 -Wno-unknown-pragmas"
347+ PACKAGE_LIBS="${PACKAGE_LIBS} `fltk-config --ldstaticflags --use-images`"
348+
349+ dnl do not depend on cygwin.dll under cygwin build
350+ case "${host_os}" in
351+ *mingw* | cygwin*)
352+ FLTK_CXXFLAGS="${FLTK_CXXFLAGS} -mms-bitfields"
353+ PACKAGE_LIBS="-Wl,-Bstatic ${PACKAGE_LIBS} -lwsock32 -lws2_32 -static-libgcc -static-libstdc++"
354+ AC_DEFINE ( _Win32 , 1 , [ Windows build] )
355+ ;;
356+
357+ *)
358+ (cd images && xxd -i sb-desktop-128x128.png > ../src/platform/fltk/icon.h)
359+ xxd
360+ esac
361+
362+ defaultConditionals
363+
364+ dnl preconfigured values for FLTK build
365+ AC_DEFINE ( _UnixOS , 1 , [ Building under Unix like systems.] )
366+ AC_DEFINE ( _FLTK , 1 , [ Defined for FLTK build.] )
367+ AC_DEFINE ( IMPL_DEV_READ , 1 , [ Implement dev_read()] )
368+ AC_DEFINE ( IMPL_DEV_DELAY , 1 , [ Driver implements dev_delay()] )
369+ AC_DEFINE ( IMPL_LOG_WRITE , 1 , [ Driver implements lwrite()] )
370+
371+ BUILD_SUBDIRS="src/common src/platform/fltk"
372+ AC_SUBST ( BUILD_SUBDIRS )
373+ AC_SUBST ( FLTK_CXXFLAGS )
374+
375+ desktopentrydir='$(datarootdir)'/applications
376+ AC_SUBST ( desktopentrydir )
377+
378+ dnl generate kwp.h
379+ (cd src/platform/fltk && g++ -o build_kwp build_kwp.cxx && ./build_kwp)
380+ }
381+
329382if test x$ac_build_sdl = xyes; then
330383 buildSDL
331384elif test x$ac_build_android = xyes; then
332385 buildAndroid
333386elif test x$ac_build_web = xyes; then
334387 buildWeb
388+ elif test x$ac_build_fltk = xyes; then
389+ buildFLTK
335390else
336391 buildConsole
337392fi
338393
394+ (cd documentation && g++ -o build_kwp build_kwp.cpp && ./build_kwp > ../src/ui/kwp.h)
395+
339396checkPCRE
340397checkTermios
341398checkDebugMode
@@ -368,6 +425,7 @@ src/platform/android/Makefile
368425src/platform/console/Makefile
369426src/platform/sdl/Makefile
370427src/platform/web/Makefile
428+ src/platform/fltk/Makefile
371429] )
372430AC_OUTPUT
373431
0 commit comments