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"] ,
@@ -156,6 +161,11 @@ function buildSDL() {
156161 AC_MSG_ERROR ( [ libfreetype6-dev not installed: configure failed.] )
157162 fi
158163
164+ AC_CHECK_PROG ( have_xxd , xxd , [ yes] , [ no] )
165+ if test "${have_xxd}" = "no" ; then
166+ AC_MSG_ERROR ( [ xxd command not installed: configure failed.] )
167+ fi
168+
159169 case "${host_os}" in
160170 *mingw* | cygwin*)
161171 dnl avoid using MSCRT versions of printf for long double
@@ -206,15 +216,13 @@ function buildSDL() {
206216 dnl preconfigured values for SDL build
207217 AC_DEFINE ( _SDL , 1 , [ Defined when building SDL version] )
208218 AC_DEFINE ( _UnixOS , 1 , [ Building under Unix like systems.] )
209- AC_DEFINE ( IMPL_DEV_DELAY , 1 , [ Driver implements dev_delay()] )
210- AC_DEFINE ( IMPL_LOG_WRITE , 1 , [ Driver implements lwrite()] )
211219 AC_DEFINE ( IMPL_DEV_READ , 1 , [ Implement dev_read()] )
220+ AC_DEFINE ( IMPL_DEV_DELAY , 1 , [ Driver implements dev_delay()] )
212221 AC_DEFINE ( IMPL_LOG_WRITE , 1 , [ Driver implements lwrite()] )
213222
214223 BUILD_SUBDIRS="src/common src/platform/sdl"
215224 AC_SUBST ( BUILD_SUBDIRS )
216225 (cd src/platform/android/app/src/main/assets && xxd -i main.bas > ../../../../../../../src/platform/sdl/main_bas.h)
217- (cd documentation && g++ -o build_kwp build_kwp.cpp && ./build_kwp > ../src/ui/kwp.h)
218226}
219227
220228function buildAndroid() {
@@ -233,8 +241,6 @@ function buildAndroid() {
233241
234242 TEST_DIR="src/platform/android"
235243 AC_SUBST ( TEST_DIR )
236-
237- (cd documentation && g++ -o build_kwp build_kwp.cpp && ./build_kwp > ../src/ui/kwp.h)
238244}
239245
240246function buildConsole() {
@@ -294,8 +300,6 @@ function buildConsole() {
294300 fi
295301
296302 AC_SUBST ( BUILD_SUBDIRS )
297-
298- (cd documentation && g++ -o build_kwp build_kwp.cpp && ./build_kwp > ../src/ui/kwp.h)
299303}
300304
301305function buildWeb() {
@@ -321,16 +325,74 @@ function buildWeb() {
321325 AC_SUBST ( BUILD_SUBDIRS )
322326}
323327
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+
324382if test x$ac_build_sdl = xyes; then
325383 buildSDL
326384elif test x$ac_build_android = xyes; then
327385 buildAndroid
328386elif test x$ac_build_web = xyes; then
329387 buildWeb
388+ elif test x$ac_build_fltk = xyes; then
389+ buildFLTK
330390else
331391 buildConsole
332392fi
333393
394+ (cd documentation && g++ -o build_kwp build_kwp.cpp && ./build_kwp > ../src/ui/kwp.h)
395+
334396checkPCRE
335397checkTermios
336398checkDebugMode
@@ -363,6 +425,7 @@ src/platform/android/Makefile
363425src/platform/console/Makefile
364426src/platform/sdl/Makefile
365427src/platform/web/Makefile
428+ src/platform/fltk/Makefile
366429] )
367430AC_OUTPUT
368431
0 commit comments