diff options
| author | Michael R Sweet <msweet@msweet.org> | 2021-02-13 21:22:03 -0500 |
|---|---|---|
| committer | Michael R Sweet <msweet@msweet.org> | 2021-02-13 21:22:03 -0500 |
| commit | 76315a961f566430943675d778ad706994d43a47 (patch) | |
| tree | fccbf8988df3b77dcbccd554750d7ef4266d7bda | |
| parent | 44e90666d26eb0de27ba3ee1ab207b60c4627004 (diff) | |
Finish first pass of modernizing autoconf source file.
| -rw-r--r-- | configure.ac | 1518 |
1 files changed, 737 insertions, 781 deletions
diff --git a/configure.ac b/configure.ac index e72ac59d6..6fb9492c7 100644 --- a/configure.ac +++ b/configure.ac @@ -28,10 +28,6 @@ FLTK_VERSION_MAJOR=$(echo AC_PACKAGE_VERSION | awk -F. '{print $1}') FLTK_VERSION_MINOR=$(echo AC_PACKAGE_VERSION | awk -F. '{print $2}') FLTK_VERSION_PATCH=$(echo AC_PACKAGE_VERSION | awk -F. '{print $3}') -echo "FLTK_VERSION_MAJOR=$FLTK_VERSION_MAJOR" -echo "FLTK_VERSION_MINOR=$FLTK_VERSION_MINOR" -echo "FLTK_VERSION_PATCH=$FLTK_VERSION_PATCH" - FL_DSO_VERSION="${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}" FL_ABI_VERSION="${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}.0" @@ -121,7 +117,7 @@ AC_ARG_ENABLE([shared], AS_HELP_STRING([--enable-shared], [turn on shared librar AC_ARG_ENABLE([svg], AS_HELP_STRING([--disable-svg], [disable SVG support])) AS_IF([test x$enable_svg != xno], [ - AC_DEFINE([FLTK_USE_SVG], [SVG image support]) + AC_DEFINE([FLTK_USE_SVG], 1, [SVG image support]) ]) AC_ARG_ENABLE([threads], AS_HELP_STRING([--disable-threads], [turn off multi-threading support])) @@ -326,7 +322,7 @@ AS_IF([test "x$enable_shared" = xyes], [ AS_IF([test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib32"], [ DSOLINK="-Wl,-rpath,$libdir" ]) - ], [linux* | *bsd*], [ + ], [linux*|*bsd*], [ DSONAME="libfltk.so.$FL_DSO_VERSION" FLDSONAME="libfltk_forms.so.$FL_DSO_VERSION" GLDSONAME="libfltk_gl.so.$FL_DSO_VERSION" @@ -351,7 +347,7 @@ AS_IF([test "x$enable_shared" = xyes], [ ]) # See if the compiler supports -fvisibility-inlines-hidden... - AC_CACHE_CHECK([if the compiler supports -fvisibility-inlines-hidden], ac_cv_cxx_fvisibility_inlines, [ + AC_CACHE_CHECK([if the compiler supports -fvisibility-inlines-hidden], [ac_cv_cxx_fvisibility_inlines], [ OLDCXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden" AC_LANG_PUSH([C++]) @@ -362,7 +358,7 @@ AS_IF([test "x$enable_shared" = xyes], [ CXXFLAGS="$OLDCXXFLAGS" AC_LANG_POP([]) ]) - AS_IF[test x"$ac_cv_cxx_fvisibility_inlines" = xyes], [ + AS_IF([test x"$ac_cv_cxx_fvisibility_inlines" = xyes], [ CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden" ]) @@ -433,33 +429,33 @@ AS_IF([test "x$enable_shared" = xyes], [ dnl Define the fluid executable used when building the test programs. dnl In a native build we use the fluid executable created during the build, -dnl in a cross-compilation we use `fluid' which must exist on the build system +dnl in a cross-compilation we use "fluid" which must exist on the build system dnl and must be in the PATH, i.e. executable as 'fluid' (w/o $EXEEXT). AS_IF([test "x$fltk_cross_compiling" = xyes], [ FLUID_BUILD="fluid" -]. [ +], [ FLUID_BUILD="../fluid/fluid$EXEEXT" ]) -AC_SUBST(DSOCOMMAND) -AC_SUBST(DSOFLAGS) -AC_SUBST(DSOLINK) -AC_SUBST(DSONAME) -AC_SUBST(FLDSONAME) -AC_SUBST(GLDSONAME) -AC_SUBST(IMGDSONAME) -AC_SUBST(CAIRODSONAME) -AC_SUBST(SHAREDSUFFIX) -AC_SUBST(LINKSHARED) -AC_SUBST(FLUID) -AC_SUBST(FLUID_BUILD) +AC_SUBST([DSOCOMMAND]) +AC_SUBST([DSOFLAGS]) +AC_SUBST([DSOLINK]) +AC_SUBST([DSONAME]) +AC_SUBST([FLDSONAME]) +AC_SUBST([GLDSONAME]) +AC_SUBST([IMGDSONAME]) +AC_SUBST([CAIRODSONAME]) +AC_SUBST([SHAREDSUFFIX]) +AC_SUBST([LINKSHARED]) +AC_SUBST([FLUID]) +AC_SUBST([FLUID_BUILD]) dnl Find commands... AC_PROG_INSTALL AS_CASE([$host_os], [osf*], [ - INSTALL="`pwd`/install-sh -c" + INSTALL="$(pwd)/install-sh -c" ]) AS_IF([test "x$INSTALL" = "x$ac_install_sh"], [ @@ -468,11 +464,11 @@ AS_IF([test "x$INSTALL" = "x$ac_install_sh"], [ ]) AC_PATH_PROGS([NROFF], [nroff groff], [echo]) -AC_PATH_PROG(DOXYDOC,doxygen) +AC_PATH_PROG([DOXYDOC], [doxygen]) dnl How do we make libraries? AC_PROG_RANLIB -AC_PATH_TOOL(AR, ar) +AC_PATH_TOOL([AR], [ar]) AS_IF([test "x$AR" = "x:"], [ AC_MSG_ERROR([Configure could not find the library archiver, aborting.]) @@ -499,7 +495,7 @@ AS_IF([test $ac_cv_sizeof_short -eq 2], [ ]) AS_IF([test $ac_cv_sizeof_int -eq 4], [ AC_DEFINE([U32], [unsigned]) -], [test $ac_cv_sizeof_long -eq 4]. [ +], [test $ac_cv_sizeof_long -eq 4], [ AC_DEFINE([U32],[unsigned long]) ]) @@ -578,7 +574,7 @@ AS_IF([test "x$ac_cv_cxx_scandir_posix" = xyes], [ AC_CHECK_FUNC([vsnprintf], [ AS_CASE([$host_os], [hpux1020], [ AC_MSG_WARN([Not using built-in vsnprintf function because you are running HP-UX 10.20.]) - ], [osf4]. [ + ], [osf4], [ AC_MSG_WARN([Not using built-in vsnprintf function because you are running Tru64 4.0.]) ], [*], [ AC_DEFINE([HAVE_VSNPRINTF]) @@ -625,54 +621,53 @@ AC_SUBST(LARGEFILE) dnl Check for "long long" support... -AC_CACHE_CHECK(for long long int, ac_cv_c_long_long, - [if test "$GCC" = yes; then - ac_cv_c_long_long=yes - else - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[]], - [[long long int i;]])], - [ac_cv_c_long_long=yes], - [ac_cv_c_long_long=no]) - fi]) - -if test $ac_cv_c_long_long = yes; then - AC_DEFINE(HAVE_LONG_LONG) -fi +AC_CACHE_CHECK([for long long int], [ac_cv_c_long_long], [ + AS_IF([test "$GCC" = yes], [ + ac_cv_c_long_long=yes + ], [ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]], + [[long long int i;]])], + [ac_cv_c_long_long=yes], + [ac_cv_c_long_long=no]) + ]) +]) + +AS_IF([test $ac_cv_c_long_long = yes], [ + AC_DEFINE([HAVE_LONG_LONG]) +]) + dnl Check for dlopen/dlsym... -AC_SEARCH_LIBS(dlsym, dl, AC_DEFINE(HAVE_DLSYM)) -AC_CHECK_HEADER(dlfcn.h, AC_DEFINE(HAVE_DLFCN_H)) +AC_SEARCH_LIBS([dlsym], [dl], AC_DEFINE([HAVE_DLSYM])) +AC_CHECK_HEADER([dlfcn.h], AC_DEFINE([HAVE_DLFCN_H])) + dnl Check for audio libraries... AUDIOLIBS="" -case $host_os in - cygwin* | mingw*) - dnl Cygwin environment... - AUDIOLIBS="-lwinmm" - ;; - - darwin*) - AUDIOLIBS="-framework CoreAudio" - ;; - - *) - AC_CHECK_HEADER(alsa/asoundlib.h, - AC_DEFINE(HAVE_ALSA_ASOUNDLIB_H) - AUDIOLIBS="-lasound") - ;; -esac +AS_CASE([$host_os], [cygwin* | mingw*], [ + dnl Cygwin environment... + AUDIOLIBS="-lwinmm" +], [darwin*], [ + AUDIOLIBS="-framework CoreAudio" +], [*], [ + AC_CHECK_HEADER([alsa/asoundlib.h], [ + AC_DEFINE([HAVE_ALSA_ASOUNDLIB_H]) + AUDIOLIBS="-lasound" + ]) +]) AC_SUBST(AUDIOLIBS) + dnl Check for image libraries... SAVELIBS="$LIBS" IMAGELIBS="" STATICIMAGELIBS="" -AC_SUBST(IMAGELIBS) -AC_SUBST(STATICIMAGELIBS) +AC_SUBST([IMAGELIBS]) +AC_SUBST([STATICIMAGELIBS]) # Handle the ZLIB lib linking mode (use fltk local or system lib) # If --enable-(resp. --disable-)localzlib parameter is not set by user @@ -680,35 +675,37 @@ AC_SUBST(STATICIMAGELIBS) # Check for System lib use if automatic mode or --disable-localzlib is requested syszlib_ok=no syszinc_ok=no -if test x$enable_localzlib != xyes; then - AC_CHECK_LIB(z,gzgets, - [AC_CHECK_HEADER(zlib.h, - syszinc_ok=yes) - if test x$syszinc_ok = xyes; then +AS_IF([test x$enable_localzlib != xyes], [ + AC_CHECK_LIB([z], [gzgets], [ + AC_CHECK_HEADER([zlib.h], [syszinc_ok=yes]) + AS_IF([test x$syszinc_ok = xyes], [ syszlib_ok=yes - fi]) -fi + ]) + ]) +]) + # Now set the Z lib and include flags according to the requested mode and availability -if test x$enable_localzlib = xyes -o x$syszlib_ok = xno ; then +AS_IF([test x$enable_localzlib = xyes -o x$syszlib_ok = xno], [ ZLIBINC="-I../zlib" ZLIB="zlib" LIBS="-lfltk_z $LIBS" IMAGELIBS="-lfltk_z $IMAGELIBS" STATICIMAGELIBS="\$libdir/libfltk_z.a $STATICIMAGELIBS" - AC_DEFINE(HAVE_LIBZ) + AC_DEFINE([HAVE_LIBZ]) ac_cv_lib_z_gzgets=no # fc: is still necessary ? # Finally, warn user if system lib was requested but not found - if test x$enable_localzlib = xno; then + AS_IF([test x$enable_localzlib = xno], [ AC_MSG_WARN([Cannot find system z lib or header: choosing the local lib mode.]) - fi -else + ]) +], [ ZLIBINC="" ZLIB="" LIBS="-lz $LIBS" IMAGELIBS="-lz $IMAGELIBS" STATICIMAGELIBS="-lz $STATICIMAGELIBS" - AC_DEFINE(HAVE_LIBZ) -fi + AC_DEFINE([HAVE_LIBZ]) +]) + # Handle the PNG lib linking mode (use fltk local or system lib) # If --enable-(resp. --disable-)localpng parameter is not set by user @@ -718,42 +715,50 @@ fi # but only, if the builtin lib is not requested syspnglib_ok=no syspnginc_ok=no -if test x$enable_localpng != xyes; then - AC_CHECK_LIB(png, png_read_info, - [AC_CHECK_HEADER(png.h, - AC_DEFINE(HAVE_PNG_H) - syspnginc_ok=yes) - AC_CHECK_HEADER(libpng/png.h, - AC_DEFINE(HAVE_LIBPNG_PNG_H) - syspnginc_ok=yes) - if test x$syspnginc_ok = xyes; then - syspnglib_ok=yes - fi]) -fi +AS_IF([test x$enable_localpng != xyes], [ + AC_CHECK_LIB([png], [png_read_info], [ + AC_CHECK_HEADER([png.h], [ + AC_DEFINE([HAVE_PNG_H]) + syspnginc_ok=yes + ]) + AC_CHECK_HEADER([libpng/png.h], [ + AC_DEFINE([HAVE_LIBPNG_PNG_H]) + syspnginc_ok=yes + ]) + AS_IF([test x$syspnginc_ok = xyes], [ + syspnglib_ok=yes + ]) + ]) +]) # The following is executed if the lib was not found usable or if local lib is required explicitly -if test x$enable_localpng = xyes -o x$syspnglib_ok = xno ; then +AS_IF([test x$enable_localpng = xyes -o x$syspnglib_ok = xno], [ PNGINC="-I../png" PNG="png" IMAGELIBS="-lfltk_png $IMAGELIBS" STATICIMAGELIBS="\$libdir/libfltk_png.a $STATICIMAGELIBS" - AC_DEFINE(HAVE_LIBPNG) - AC_DEFINE(HAVE_PNG_H) - AC_DEFINE(HAVE_PNG_GET_VALID) - AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA) + AC_DEFINE([HAVE_LIBPNG]) + AC_DEFINE([HAVE_PNG_H]) + AC_DEFINE([HAVE_PNG_GET_VALID]) + AC_DEFINE([HAVE_PNG_SET_TRNS_TO_ALPHA]) # Finally, warn user if system lib was requested but not found - if test x$enable_localpng = xno; then + AS_IF([test x$enable_localpng = xno], [ AC_MSG_WARN([Cannot find system png lib or header: choosing the local lib mode.]) - fi -else + ]) +], [ PNGINC="" PNG="" IMAGELIBS="-lpng $IMAGELIBS" STATICIMAGELIBS="-lpng $STATICIMAGELIBS" - AC_DEFINE(HAVE_LIBPNG) - AC_CHECK_LIB(png,png_get_valid, AC_DEFINE(HAVE_PNG_GET_VALID)) - AC_CHECK_LIB(png,png_set_tRNS_to_alpha, AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA)) -fi + AC_DEFINE([HAVE_LIBPNG]) + AC_CHECK_LIB([png], [png_get_valid], [ + AC_DEFINE([HAVE_PNG_GET_VALID]) + ]) + AC_CHECK_LIB([png], [png_set_tRNS_to_alpha], [ + AC_DEFINE([HAVE_PNG_SET_TRNS_TO_ALPHA]) + ]) +]) + # Handle the JPEG lib linking mode (use fltk local or system lib) # If --enable-(resp. --disable-)localjpeg parameter is not set by user @@ -761,39 +766,41 @@ fi # Check for System lib use if automatic mode or --disable-localjpeg is requested sysjpeglib_ok=no sysjpeginc_ok=no -if test x$enable_localjpeg != xyes; then - AC_CHECK_LIB(jpeg,jpeg_CreateCompress, - [AC_CHECK_HEADER(jpeglib.h, - sysjpeginc_ok=yes) - if test x$sysjpeginc_ok = xyes; then - sysjpeglib_ok=yes - fi]) -fi +AS_IF([test x$enable_localjpeg != xyes], [ + AC_CHECK_LIB([jpeg], [jpeg_CreateCompress], [ + AC_CHECK_HEADER([jpeglib.h], [sysjpeginc_ok=yes]) + AS_IF([test x$sysjpeginc_ok = xyes], [ + sysjpeglib_ok=yes + ]) + ]) +]) + # Now set the jpeg lib and include flags according to the requested mode and availability -if test x$enable_localjpeg = xyes -o x$sysjpeglib_ok = xno; then +AS_IF([test x$enable_localjpeg = xyes -o x$sysjpeglib_ok = xno], [ JPEGINC="-I../jpeg" JPEG="jpeg" IMAGELIBS="-lfltk_jpeg $IMAGELIBS" STATICIMAGELIBS="\$libdir/libfltk_jpeg.a $STATICIMAGELIBS" - AC_DEFINE(HAVE_LIBJPEG) + AC_DEFINE([HAVE_LIBJPEG]) # Finally, warn user if system lib was requested but not found - if test x$enable_localjpeg = xno; then + AS_IF([test x$enable_localjpeg = xno], [ AC_MSG_WARN([Cannot find system jpeg lib or header: choosing the local lib mode.]) - fi -else + ]) +], [ JPEGINC="" JPEG="" IMAGELIBS="-ljpeg $IMAGELIBS" STATICIMAGELIBS="-ljpeg $STATICIMAGELIBS" - AC_DEFINE(HAVE_LIBJPEG) -fi + AC_DEFINE([HAVE_LIBJPEG]) +]) + +AC_SUBST([JPEG]) +AC_SUBST([JPEGINC]) +AC_SUBST([PNG]) +AC_SUBST([PNGINC]) +AC_SUBST([ZLIB]) +AC_SUBST([ZLIBINC]) -AC_SUBST(JPEG) -AC_SUBST(JPEGINC) -AC_SUBST(PNG) -AC_SUBST(PNGINC) -AC_SUBST(ZLIB) -AC_SUBST(ZLIBINC) # Control the usage of the nanosvg lib and SVG output @@ -811,23 +818,18 @@ dnl Test whether we want to check for pthreads. We must not do it on Windows dnl unless we run under Cygwin with --enable-cygwin, since we always use dnl native threads on Windows (even if libpthread is available) check_pthread=yes -case $host_os in - mingw*) - check_pthread=no - ;; - cygwin*) - if test "x$enable_cygwin" != xyes; then - check_pthread=no - fi - ;; - *) - ;; -esac - -if test "x$enable_threads" != xno -a x$check_pthread = xyes; then - AC_CHECK_HEADERS(pthread.h) - - if test x$ac_cv_header_pthread_h = xyes; then +AS_CASE([$host_os], [mingw*], [ + check_pthread=no +], [cygwin*], [ + AS_IF([test "x$enable_cygwin" != xyes], [ + check_pthread=no + ]) +]) + +AS_IF([test "x$enable_threads" != xno -a x$check_pthread = xyes], [ + AC_CHECK_HEADERS([pthread.h]) + + AS_IF([test x$ac_cv_header_pthread_h = xyes], [ dnl Check various threading options for the platforms we support for flag in -lpthreads -lpthread -pthread; do AC_MSG_CHECKING([for pthread_create using $flag]) @@ -841,473 +843,451 @@ if test "x$enable_threads" != xno -a x$check_pthread = xyes; then [LIBS="$SAVELIBS"]) AC_MSG_RESULT([$have_pthread]) - if test $have_pthread = yes; then - AC_DEFINE(HAVE_PTHREAD) + AS_IF([test $have_pthread = yes], [ + AC_DEFINE([HAVE_PTHREAD]) PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT" # Solaris requires -D_POSIX_PTHREAD_SEMANTICS to # be POSIX-compliant... :( - case $host_os in - solaris*) - PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS" - ;; - esac - break - fi + AS_CASE([$host_os], [solaris*], [ + PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS" + ]) + ]) done - fi -fi + ]) +]) + +AC_SUBST([PTHREAD_FLAGS]) -AC_SUBST(PTHREAD_FLAGS) dnl Define OS-specific stuff... HLINKS= OSX_ONLY=: THREADS= -AC_ARG_WITH(links, [ --with-links make header links for common misspellings [[default=no]]]) +AC_ARG_WITH([links], AS_HELP_STRING([--with-links], [make header links for common misspellings (default=no)])) INSTALL_DESKTOP="" UNINSTALL_DESKTOP="" -case $host_os_gui in - cygwin* | mingw*) - dnl Cygwin environment, using windows GDI ... - # Recent versions of Cygwin are seriously broken and the size - # checks don't work because the shell puts out \r\n instead of - # \n. Here we just force U32 to be defined to "unsigned"... - AC_DEFINE(U32,unsigned) - # We do no longer define WIN32 or _WIN32 (since FLTK 1.4.0) - # and we don't need to define USE_OPENGL32 (added in svn r6657 - # but never used, see STR #2147) - # CFLAGS="-mwindows -D_WIN32 -DUSE_OPENGL32 $CFLAGS" - # CXXFLAGS="-mwindows -D_WIN32 -DUSE_OPENGL32 $CXXFLAGS" - CFLAGS="-mwindows $CFLAGS" - CXXFLAGS="-mwindows $CXXFLAGS" - LDFLAGS="-mwindows $LDFLAGS" - DSOFLAGS="-mwindows $DSOFLAGS" - LIBS="$LIBS -lole32 -luuid -lcomctl32 -lws2_32" - BUILD="WIN" - if test "x$with_optim" = x; then - dnl Avoid -Os optimization on Cygwin/MinGW - with_optim="-O3" - fi - - if test x$enable_gl != xno; then - AC_CHECK_HEADER(GL/gl.h, - AC_DEFINE(HAVE_GL) - GLLIBS="-lopengl32") - AC_CHECK_HEADER(GL/glu.h, - AC_DEFINE(HAVE_GL_GLU_H) - GLLIBS="-lglu32 $GLLIBS") - else - LINKFLTKGL="" - GLLIBNAME="" - GLDSONAME="" - GLDEMOS="" - fi - - if test "x$enable_threads" != xno; then - if test x$have_pthread = xyes; then - AC_DEFINE(HAVE_PTHREAD) - fi - fi - - THREADS="threads$EXEEXT" - - # Don't make symlinks since Windows is not case sensitive. - if test "x$with_links" != xyes; then - HLINKS="#" - fi - ;; - - darwin*) - AC_DEFINE(__APPLE_QUARTZ__) - - BUILD="OSX" - - # MacOS X uses Cocoa for graphics. - LIBS="$LIBS -framework Cocoa" - - if test x$have_pthread = xyes; then - AC_DEFINE(HAVE_PTHREAD) - THREADS="threads$EXEEXT" - fi - - if test x$enable_gl != xno; then - AC_DEFINE(HAVE_GL) - AC_DEFINE(HAVE_GL_GLU_H) - GLLIBS="-framework OpenGL" - else - LINKFLTKGL="" - GLLIBNAME="" - GLDSONAME="" - GLDEMOS="" - fi - - # Don't make symlinks because HFS+ is not case sensitive... - if test "x$with_links" != xyes; then - HLINKS="#" - fi - - # Some steps are only done for OS X package management - OSX_ONLY= - - # Install/Uninstall FLUID application - INSTALL_DESKTOP="install-osx" - UNINSTALL_DESKTOP="uninstall-osx" - ;; - - *) - # All others are UNIX/X11... - # This includes Cygwin target combined with X11 - if test x$have_pthread = xyes; then - AC_DEFINE(HAVE_PTHREAD) - THREADS="threads$EXEEXT" - fi - - dnl Check for X11... - AC_PATH_XTRA - - if test x$no_x = xyes; then - AC_MSG_ERROR([Configure could not find required X11 libraries, aborting.]) - fi - - if test "x$X_PRE_LIBS" != x; then - AC_MSG_WARN([Ignoring libraries "$X_PRE_LIBS" requested by configure.]) - fi - - LIBS="$LIBS -lX11 $X_EXTRA_LIBS" - CFLAGS="$CFLAGS $X_CFLAGS" - CXXFLAGS="$CXXFLAGS $X_CFLAGS" - LDFLAGS="$X_LIBS $LDFLAGS" - DSOFLAGS="$X_LIBS $DSOFLAGS" - AC_DEFINE(USE_X11) - BUILD="X11" - if test "x$x_includes" != x; then - ac_cpp="$ac_cpp -I$x_includes" - fi - - dnl Check for OpenGL unless disabled... - GLLIBS= - - if test x$enable_gl != xno; then - AC_SEARCH_LIBS(dlopen, dl) - AC_CHECK_HEADER(GL/gl.h, - AC_CHECK_LIB(GL, glXMakeCurrent, - [AC_DEFINE(HAVE_GL) - GLLIBS="-lGL"], - AC_CHECK_LIB(MesaGL, glXMakeCurrent, - [AC_DEFINE(HAVE_GL) - GLLIBS="-lMesaGL"],, - [-lm]), - [-lm]) - AC_CHECK_LIB(GL, glXGetProcAddressARB, - AC_DEFINE(HAVE_GLXGETPROCADDRESSARB),, [-lm]) - ) - AC_CHECK_HEADER(GL/glu.h, - AC_DEFINE(HAVE_GL_GLU_H) - if test x$ac_cv_lib_GL_glXMakeCurrent = xyes; then - GLLIBS="-lGLU $GLLIBS" - fi - if test x$ac_cv_lib_MesaGL_glXMakeCurrent = xyes; then - GLLIBS="-lMesaGLU $GLLIBS" - fi - ) - - if test x$ac_cv_lib_GL_glXMakeCurrent != xyes -a x$ac_cv_lib_MesaGL_glXMakeCurrent != xyes; then - LINKFLTKGL="" - GLLIBNAME="" - GLDSONAME="" - GLDEMOS="" - fi - else - LINKFLTKGL="" - GLLIBNAME="" - GLDSONAME="" - GLDEMOS="" - fi - - xinerama_found=no - if test x$enable_xinerama != xno; then - AC_CHECK_LIB(Xinerama, XineramaIsActive, - [AC_DEFINE(HAVE_XINERAMA) - LIBS="-lXinerama $LIBS" - xinerama_found=yes]) - fi - - dnl Check for the Xft library unless disabled... - xft_found=no - if test x$enable_xft != xno; then - # Try pkg-config first (freetype2 deprecated freetype-config from some version on) - AC_PATH_PROG(PKGCONFIG, pkg-config) - FT_FLAGS="" - if test "x$PKGCONFIG" != x; then - FT_FLAGS="`$PKGCONFIG --cflags xft`" - if test "x$FT_FLAGS" = x; then - FT_FLAGS="`$PKGCONFIG --cflags freetype2`" - fi - fi - # if that failed, try freetype-config - if test "x$FT_FLAGS" = x; then - AC_PATH_PROG(FTCONFIG, freetype-config) - if test "x$FTCONFIG" != x; then - FT_FLAGS="`$FTCONFIG --cflags`" - else - # abort if both methods failed - AC_MSG_NOTICE([please install pkg-config or use 'configure --disable-xft'.]) - AC_MSG_ERROR([Aborting.]) - fi - fi - CPPFLAGS="$FT_FLAGS $CPPFLAGS" - CXXFLAGS="$FT_FLAGS $CXXFLAGS" - CFLAGS="$FT_FLAGS $CFLAGS" - - AC_CHECK_LIB(fontconfig, FcPatternCreate) - AC_CHECK_HEADER(X11/Xft/Xft.h, - AC_CHECK_LIB(Xft, XftDrawCreate, - [AC_DEFINE(USE_XFT) - LIBS="-lXft $LIBS" - BUILD="XFT" - xft_found=yes])) - fi - - dnl Issue a warning message if Xft was not found, abort configure - dnl if Xft was requested explicitly (but not found) - if test x$enable_xft != xno -a x$xft_found != xyes; then - AC_MSG_WARN([could not find the required Xft headers and/or libraries.]) - AC_MSG_NOTICE([please install Xft headers and libraries or use 'configure --disable-xft'.]) - if test x$enable_xft = xyes; then - AC_MSG_ERROR([Aborting.]) - fi - fi - - dnl test if pango is asked but xft was not found - if test x$enable_pango = xyes -a x$xft_found = xno; then - AC_MSG_WARN([could not find the Xft headers and/or libraries required for pango.]) - AC_MSG_NOTICE([please install Xft headers and libraries or don't use configure with '--enable-pango'.]) - AC_MSG_ERROR([Aborting.]) - fi - - dnl Check for the pango library unless disabled... - - pango_found=no - if test x$enable_pango = xyes; then - if test x$PKGCONFIG != x; then - CXXFLAGS="`$PKGCONFIG --cflags pangoxft` $CXXFLAGS" - LIBS="`$PKGCONFIG --libs pangoxft` $LIBS" - CXXFLAGS="`$PKGCONFIG --cflags pangocairo` $CXXFLAGS" - LIBS="`$PKGCONFIG --libs pangocairo` $LIBS" - case $host_os in - darwin*) - dnl make sure LDFLAGS is appropriate for cairo (and pango) - LDFLAGS="`$PKGCONFIG --libs cairo` $LDFLAGS" - ;; - esac - else - case $host_os in - linux*) - CXXFLAGS="-I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include $CXXFLAGS" - CXXFLAGS="-I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/lib/x86_64-linux-gnu/glib-2.0/include $CXXFLAGS" - ;; - freebsd*) - CXXFLAGS="-I/usr/local/include/pango-1.0 -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include $CXXFLAGS" - ;; - netbsd*) - CXXFLAGS="-I/usr/pkg/include/pango-1.0 -I/usr/pkg/include/glib-2.0 -I/usr/pkg/lib/glib-2.0/include $CXXFLAGS" - CXXFLAGS="-I/usr/pkg/include/glib/glib-2.0 $CXXFLAGS" - PANGOLIBDIR="-L/usr/pkg/lib" - LDFLAGS="-Wl,-rpath,/usr/pkg/lib $LDFLAGS" - ;; - esac - LIBS="$PANGOLIBDIR -lpango-1.0 -lpangoxft-1.0 -lgobject-2.0 $LIBS" - fi - CPPFLAGS="$CXXFLAGS" - AC_CHECK_HEADERS([pango/pango.h pango/pangoxft.h], - AC_CHECK_LIB(pango-1.0, pango_layout_new, - AC_CHECK_LIB(pangoxft-1.0, pango_xft_render_layout, - AC_DEFINE(USE_PANGO) - pango_found=yes))) - CPPFLAGS=$CXXFLAGS - fi - - dnl Check for the Xdbe extension unless disabled... - - xdbe_found=no - if test x$enable_xdbe != xno; then - AC_CHECK_HEADER( - [X11/extensions/Xdbe.h], - [AC_CHECK_LIB(Xext, XdbeQueryExtension, - [AC_DEFINE(HAVE_XDBE) - LIBS="-lXext $LIBS" - xdbe_found=yes])], - [], - [#include <X11/Xlib.h>]) - fi - - dnl Check for the Xfixes extension unless disabled... - - xfixes_found=no - if test x$enable_xfixes != xno; then - AC_CHECK_HEADER( - [X11/extensions/Xfixes.h], - [AC_CHECK_LIB(Xfixes, XFixesQueryExtension, - [AC_DEFINE(HAVE_XFIXES) - LIBS="-lXfixes $LIBS" - xfixes_found=yes])], - [], - [#include <X11/Xlib.h>]) - fi - - dnl Check for the Xcursor library unless disabled... - - xcursor_found=no - if test x$enable_xcursor != xno; then - AC_CHECK_HEADER( - [X11/Xcursor/Xcursor.h], - [AC_CHECK_LIB(Xcursor, XcursorImageCreate, - [AC_DEFINE(HAVE_XCURSOR) - LIBS="-lXcursor $LIBS" - xcursor_found=yes])], - [], - [#include <X11/Xlib.h>]) - fi - - dnl Check for the Xrender library unless disabled... - - xrender_found=no - if test x$enable_xrender != xno; then - AC_CHECK_HEADER( - [X11/extensions/Xrender.h], - [AC_CHECK_LIB(Xrender, XRenderQueryVersion, - [AC_DEFINE(HAVE_XRENDER) - LIBS="-lXrender $LIBS" - xrender_found=yes])], - [], - [#include <X11/Xlib.h>]) - fi - - dnl Check for the X11/Xregion.h header file... - AC_CHECK_HEADER(X11/Xregion.h, AC_DEFINE(HAVE_X11_XREGION_H),, - [#include <X11/Xlib.h>]) - - dnl Check for overlay visuals... - AC_PATH_PROG(XPROP, xprop) - AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay, - if test "x$XPROP" != x; then - if $XPROP -root 2>/dev/null | grep -c "SERVER_OVERLAY_VISUALS" >/dev/null; then - ac_cv_have_overlay=yes - else - ac_cv_have_overlay=no - fi - else - ac_cv_have_overlay=no - fi) - - if test x$ac_cv_have_overlay = xyes; then - AC_DEFINE(HAVE_OVERLAY) - fi - - # Make symlinks since UNIX/Linux is case sensitive, - # but Cygwin in general not. - case $host_os in - cygwin*) - HLINKS="#" - ;; - *) - ;; - esac - # Make symlinks since UNIX/Linux is case sensitive, - # but only if explicitly configured (default=no) - if test "x$with_links" != xyes; then - HLINKS="#" - fi - - # Install/Uninstall FLUID application support files - INSTALL_DESKTOP="install-linux" - UNINSTALL_DESKTOP="uninstall-linux" - ;; -esac +AS_CASE([$host_os_gui], [cygwin* | mingw*], [ + dnl Cygwin environment, using windows GDI ... + # Recent versions of Cygwin are seriously broken and the size + # checks don't work because the shell puts out \r\n instead of + # \n. Here we just force U32 to be defined to "unsigned"... + AC_DEFINE([U32], [unsigned]) + # We do no longer define WIN32 or _WIN32 (since FLTK 1.4.0) + # and we don't need to define USE_OPENGL32 (added in svn r6657 + # but never used, see STR #2147) + # CFLAGS="-mwindows -D_WIN32 -DUSE_OPENGL32 $CFLAGS" + # CXXFLAGS="-mwindows -D_WIN32 -DUSE_OPENGL32 $CXXFLAGS" + CFLAGS="-mwindows $CFLAGS" + CXXFLAGS="-mwindows $CXXFLAGS" + LDFLAGS="-mwindows $LDFLAGS" + DSOFLAGS="-mwindows $DSOFLAGS" + LIBS="$LIBS -lole32 -luuid -lcomctl32 -lws2_32" + BUILD="WIN" + AS_IF([test "x$with_optim" = x], [ + dnl Avoid -Os optimization on Cygwin/MinGW + with_optim="-O3" + ]) -AC_SUBST(GLDEMOS) -AC_SUBST(GLLIBS) -AC_SUBST(HLINKS) -AC_SUBST(OSX_ONLY) -AC_SUBST(THREADS) + AS_IF([test x$enable_gl != xno], [ + AC_CHECK_HEADER([GL/gl.h], [ + AC_DEFINE([HAVE_GL]) + GLLIBS="-lopengl32" + ]) + AC_CHECK_HEADER([GL/glu.h], [ + AC_DEFINE([HAVE_GL_GLU_H]) + GLLIBS="-lglu32 $GLLIBS" + ]) + ], [ + LINKFLTKGL="" + GLLIBNAME="" + GLDSONAME="" + GLDEMOS="" + ]) + + AS_IF([test "x$enable_threads" != xno -a x$have_pthread = xyes], [ + AC_DEFINE([HAVE_PTHREAD]) + ]) + + THREADS="threads$EXEEXT" + + # Don't make symlinks since Windows is not case sensitive. + AS_IF([test "x$with_links" != xyes], [ + HLINKS="#" + ]) +], [darwin*], [ + AC_DEFINE([__APPLE_QUARTZ__]) + + BUILD="OSX" -AC_SUBST(INSTALL_DESKTOP) -AC_SUBST(UNINSTALL_DESKTOP) + # MacOS X uses Cocoa for graphics. + LIBS="$LIBS -framework Cocoa" -AC_SUBST(BUILD) + AS_IF([test x$have_pthread = xyes], [ + AC_DEFINE([HAVE_PTHREAD]) + THREADS="threads$EXEEXT" + ]) + + AS_IF([test x$enable_gl != xno], [ + AC_DEFINE([HAVE_GL]) + AC_DEFINE([HAVE_GL_GLU_H]) + GLLIBS="-framework OpenGL" + ], [ + LINKFLTKGL="" + GLLIBNAME="" + GLDSONAME="" + GLDEMOS="" + ]) + + # Don't make symlinks because HFS+ is not case sensitive... + AS_IF([test "x$with_links" != xyes], [ + HLINKS="#" + ]) + + # Some steps are only done for OS X package management + OSX_ONLY= + + # Install/Uninstall FLUID application + INSTALL_DESKTOP="install-osx" + UNINSTALL_DESKTOP="uninstall-osx" +], [*], [ + # All others are UNIX/X11... + # This includes Cygwin target combined with X11 + AS_IF([test x$have_pthread = xyes], [ + AC_DEFINE([HAVE_PTHREAD]) + THREADS="threads$EXEEXT" + ]) + + dnl Check for X11... + AC_PATH_XTRA + + AS_IF([test x$no_x = xyes], [ + AC_MSG_ERROR([Configure could not find required X11 libraries, aborting.]) + ]) + + AS_IF([test "x$X_PRE_LIBS" != x], [ + AC_MSG_WARN([Ignoring libraries "$X_PRE_LIBS" requested by configure.]) + ]) + + LIBS="$LIBS -lX11 $X_EXTRA_LIBS" + CFLAGS="$CFLAGS $X_CFLAGS" + CXXFLAGS="$CXXFLAGS $X_CFLAGS" + LDFLAGS="$X_LIBS $LDFLAGS" + DSOFLAGS="$X_LIBS $DSOFLAGS" + AC_DEFINE([USE_X11]) + BUILD="X11" + AS_IF([test "x$x_includes" != x], [ + ac_cpp="$ac_cpp -I$x_includes" + ]) + + dnl Check for OpenGL unless disabled... + GLLIBS= + + AS_IF([test x$enable_gl != xno], [ + AC_SEARCH_LIBS([dlopen], [dl]) + AC_CHECK_HEADER([GL/gl.h], [ + AC_CHECK_LIB([GL], [glXMakeCurrent], [ + AC_DEFINE([HAVE_GL]) + GLLIBS="-lGL" + ], [ + AC_CHECK_LIB([MesaGL], [glXMakeCurrent], [ + AC_DEFINE([HAVE_GL]) + GLLIBS="-lMesaGL" + ],, [-lm]), + ], [-lm]) + AC_CHECK_LIB([GL], [glXGetProcAddressARB], [ + AC_DEFINE([HAVE_GLXGETPROCADDRESSARB]) + ],, [-lm]) + ]) + AC_CHECK_HEADER([GL/glu.h], [ + AC_DEFINE([HAVE_GL_GLU_H]) + AS_IF([test x$ac_cv_lib_GL_glXMakeCurrent = xyes], [ + GLLIBS="-lGLU $GLLIBS" + ]) + AS_IF([test x$ac_cv_lib_MesaGL_glXMakeCurrent = xyes], [ + GLLIBS="-lMesaGLU $GLLIBS" + ]) + ]) + + AS_IF([test x$ac_cv_lib_GL_glXMakeCurrent != xyes -a x$ac_cv_lib_MesaGL_glXMakeCurrent != xyes], [ + LINKFLTKGL="" + GLLIBNAME="" + GLDSONAME="" + GLDEMOS="" + ]) + ], [ + LINKFLTKGL="" + GLLIBNAME="" + GLDSONAME="" + GLDEMOS="" + ]) + + xinerama_found=no + AS_IF([test x$enable_xinerama != xno], [ + AC_CHECK_LIB([Xinerama], [XineramaIsActive], [ + AC_DEFINE([HAVE_XINERAMA]) + LIBS="-lXinerama $LIBS" + xinerama_found=yes + ]) + ]) + + dnl Check for the Xft library unless disabled... + xft_found=no + AS_IF([test x$enable_xft != xno], [ + # Try pkg-config first (freetype2 deprecated freetype-config from some version on) + FT_FLAGS="" + AS_IF([test "x$PKGCONFIG" != x], [ + FT_FLAGS="$($PKGCONFIG --cflags xft)" + AS_IF([test "x$FT_FLAGS" = x], [ + FT_FLAGS="$($PKGCONFIG --cflags freetype2)" + ]) + ]) + + # if that failed, try freetype-config + AS_IF([test "x$FT_FLAGS" = x], [ + AC_PATH_PROG([FTCONFIG], [freetype-config]) + AS_IF([test "x$FTCONFIG" != x], [ + FT_FLAGS="$($FTCONFIG --cflags)" + ], [ + # abort if both methods failed + AC_MSG_NOTICE([please install pkg-config or use 'configure --disable-xft'.]) + AC_MSG_ERROR([Aborting.]) + ]) + ]) + CPPFLAGS="$FT_FLAGS $CPPFLAGS" + CXXFLAGS="$FT_FLAGS $CXXFLAGS" + CFLAGS="$FT_FLAGS $CFLAGS" + + AC_CHECK_LIB([fontconfig], [FcPatternCreate]) + AC_CHECK_HEADER([X11/Xft/Xft.h], [ + AC_CHECK_LIB([Xft], [XftDrawCreate], [ + AC_DEFINE([USE_XFT]) + LIBS="-lXft $LIBS" + BUILD="XFT" + xft_found=yes + ]) + ]) + ]) + + dnl Issue a warning message if Xft was not found, abort configure + dnl if Xft was requested explicitly (but not found) + AS_IF([test x$enable_xft != xno -a x$xft_found != xyes], [ + AC_MSG_WARN([could not find the required Xft headers and/or libraries.]) + AC_MSG_NOTICE([please install Xft headers and libraries or use 'configure --disable-xft'.]) + AS_IF([test x$enable_xft = xyes], [ + AC_MSG_ERROR([Aborting.]) + ]) + ]) + + dnl test if pango is asked but xft was not found + AS_IF([test x$enable_pango = xyes -a x$xft_found = xno], [ + AC_MSG_WARN([could not find the Xft headers and/or libraries required for pango.]) + AC_MSG_NOTICE([please install Xft headers and libraries or don't use configure with '--enable-pango'.]) + AC_MSG_ERROR([Aborting.]) + ]) + + dnl Check for the pango library unless disabled... + pango_found=no + AS_IF([test x$enable_pango = xyes], [ + AS_IF([test x$PKGCONFIG != x], [ + CXXFLAGS="$($PKGCONFIG --cflags pangoxft) $CXXFLAGS" + LIBS="$($PKGCONFIG --libs pangoxft) $LIBS" + CXXFLAGS="$($PKGCONFIG --cflags pangocairo) $CXXFLAGS" + LIBS="$($PKGCONFIG --libs pangocairo) $LIBS" + + AS_CASE([$host_os], [darwin*], [ + dnl make sure LDFLAGS is appropriate for cairo (and pango) + LDFLAGS="$($PKGCONFIG --libs cairo) $LDFLAGS" + ]) + ], [ + AS_CASE([$host_os], [linux*], [ + CXXFLAGS="-I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include $CXXFLAGS" + CXXFLAGS="-I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/lib/x86_64-linux-gnu/glib-2.0/include $CXXFLAGS" + ], [freebsd*], [ + CXXFLAGS="-I/usr/local/include/pango-1.0 -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include $CXXFLAGS" + ], [netbsd*], [ + CXXFLAGS="-I/usr/pkg/include/pango-1.0 -I/usr/pkg/include/glib-2.0 -I/usr/pkg/lib/glib-2.0/include $CXXFLAGS" + CXXFLAGS="-I/usr/pkg/include/glib/glib-2.0 $CXXFLAGS" + PANGOLIBDIR="-L/usr/pkg/lib" + LDFLAGS="-Wl,-rpath,/usr/pkg/lib $LDFLAGS" + ]) + + LIBS="$PANGOLIBDIR -lpango-1.0 -lpangoxft-1.0 -lgobject-2.0 $LIBS" + + CPPFLAGS="$CXXFLAGS" + AC_CHECK_HEADERS([pango/pango.h pango/pangoxft.h], [ + AC_CHECK_LIB([pango-1.0], [pango_layout_new], [ + AC_CHECK_LIB([pangoxft-1.0], [pango_xft_render_layout], [ + AC_DEFINE([USE_PANGO]) + pango_found=yes + ]) + ]) + ]) + ]) + + CPPFLAGS="$CXXFLAGS" + ]) + + dnl Check for the Xdbe extension unless disabled... + xdbe_found=no + AS_IF([test x$enable_xdbe != xno], [ + AC_CHECK_HEADER([X11/extensions/Xdbe.h], [ + AC_CHECK_LIB([Xext], [XdbeQueryExtension], [ + AC_DEFINE([HAVE_XDBE]) + LIBS="-lXext $LIBS" + xdbe_found=yes + ]) + ], [], [#include <X11/Xlib.h>]) + ]) + + dnl Check for the Xfixes extension unless disabled... + xfixes_found=no + AS_IF([test x$enable_xfixes != xno], [ + AC_CHECK_HEADER([X11/extensions/Xfixes.h], [ + AC_CHECK_LIB([Xfixes], [XFixesQueryExtension], [ + AC_DEFINE([HAVE_XFIXES]) + LIBS="-lXfixes $LIBS" + xfixes_found=yes + ]) + ], [], [#include <X11/Xlib.h>]) + ]) + + dnl Check for the Xcursor library unless disabled... + xcursor_found=no + AS_IF([test x$enable_xcursor != xno], [ + AC_CHECK_HEADER([X11/Xcursor/Xcursor.h], [ + AC_CHECK_LIB([Xcursor], [XcursorImageCreate], [ + AC_DEFINE([HAVE_XCURSOR]) + LIBS="-lXcursor $LIBS" + xcursor_found=yes + ]) + ], [], [#include <X11/Xlib.h>]) + ]) + + dnl Check for the Xrender library unless disabled... + xrender_found=no + AS_IF([test x$enable_xrender != xno], [ + AC_CHECK_HEADER([X11/extensions/Xrender.h], [ + AC_CHECK_LIB([Xrender], [XRenderQueryVersion], [ + AC_DEFINE([HAVE_XRENDER]) + LIBS="-lXrender $LIBS" + xrender_found=yes + ]) + ], [], [#include <X11/Xlib.h>]) + ]) + + dnl Check for the X11/Xregion.h header file... + AC_CHECK_HEADER([X11/Xregion.h], [ + AC_DEFINE([HAVE_X11_XREGION_H]) + ], [], [#include <X11/Xlib.h>]) + + dnl Check for overlay visuals... + AC_PATH_PROG([XPROP], [xprop]) + AC_CACHE_CHECK([for X overlay visuals], [ac_cv_have_overlay], [ + AS_IF([test "x$XPROP" != x], [ + AS_IF([$XPROP -root 2>/dev/null | grep -c "SERVER_OVERLAY_VISUALS" >/dev/null], [ + ac_cv_have_overlay=yes + ], [ + ac_cv_have_overlay=no + ]) + ], [ + ac_cv_have_overlay=no + ]) + ]) + + AS_IF([test x$ac_cv_have_overlay = xyes], [ + AC_DEFINE([HAVE_OVERLAY]) + ]) + + # Make symlinks since UNIX/Linux is case sensitive, + # but Cygwin in general not. + AS_CASE([$host_os], [cygwin*], [ + HLINKS="#" + ]) + + # Make symlinks since UNIX/Linux is case sensitive, + # but only if explicitly configured (default=no) + AS_IF([test "x$with_links" != xyes], [ + HLINKS="#" + ]) + + # Install/Uninstall FLUID application support files + INSTALL_DESKTOP="install-linux" + UNINSTALL_DESKTOP="uninstall-linux" +]) + +AC_SUBST([GLDEMOS]) +AC_SUBST([GLLIBS]) +AC_SUBST([HLINKS]) +AC_SUBST([OSX_ONLY]) +AC_SUBST([THREADS]) + +AC_SUBST([INSTALL_DESKTOP]) +AC_SUBST([UNINSTALL_DESKTOP]) + +AC_SUBST([BUILD]) dnl Figure out the appropriate formatted man page extension... -case "$host_os" in - *bsd* | darwin*) - # *BSD - CAT1EXT=0 - CAT3EXT=0 - CAT6EXT=0 - ;; - irix*) - # SGI IRIX - CAT1EXT=z - CAT3EXT=z - CAT6EXT=z - ;; - *) - # All others - CAT1EXT=1 - CAT3EXT=3 - CAT6EXT=6 - ;; -esac - -AC_SUBST(CAT1EXT) -AC_SUBST(CAT3EXT) -AC_SUBST(CAT6EXT) +AS_CASE(["$host_os"], [*bsd* | darwin*], [ + # *BSD + CAT1EXT=0 + CAT3EXT=0 + CAT6EXT=0 +], [irix*], [ + # SGI IRIX + CAT1EXT=z + CAT3EXT=z + CAT6EXT=z +], [*], [ + # All others + CAT1EXT=1 + CAT3EXT=3 + CAT6EXT=6 +]) + +AC_SUBST([CAT1EXT]) +AC_SUBST([CAT3EXT]) +AC_SUBST([CAT6EXT]) dnl Fix "mandir" variable... -if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then - case "$host_os" in - *bsd* | darwin* | linux*) - # *BSD, Darwin, and Linux - mandir="\${prefix}/share/man" - ;; - irix*) - # SGI IRIX - mandir="\${prefix}/share/catman" - ;; - esac -fi +AS_IF([test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"]. [ + AS_CASE(["$host_os"], [*bsd* | darwin* | linux*], [ + # *BSD, Darwin, and Linux + mandir="\${prefix}/share/man" + ], [irix*], [ + # SGI IRIX + mandir="\${prefix}/share/catman" + ]) +]) dnl Fix "libdir" variable... -if test "$prefix" = NONE; then +AS_IF([test "$prefix" = NONE], [ prefix=/usr/local -fi +]) -if test "$exec_prefix" = NONE; then +AS_IF([test "$exec_prefix" = NONE], [ exec_prefix="\${prefix}" -fi - -case $host_os in - irix[1-5]*) - ;; - irix*) - if test "$libdir" = "\${exec_prefix}/lib" -a "$exec_prefix" = "\${prefix}" -a "$prefix" = "/usr"; then - libdir="/usr/lib32" - fi - ;; -esac +]) + +AS_CASE([$host_os], [irix[1-5]*], [ +], [irix*], [ + AS_IF([test "$libdir" = "\${exec_prefix}/lib" -a "$exec_prefix" = "\${prefix}" -a "$prefix" = "/usr"], [ + libdir="/usr/lib32" + ]) +]) dnl Define the command used to update the dependencies (this option dnl mainly for FLTK core developers - not necessary for users) MAKEDEPEND="\$(CXX) -M" -AC_SUBST(MAKEDEPEND) +AC_SUBST([MAKEDEPEND]) dnl Add warnings to compiler switches: dnl do this last so messing with switches does not break tests -if test -n "$GCC"; then +AS_IF([test -n "$GCC"], [ # Show all standard warnings + unused variables, conversion errors, # and inlining problems when compiling... OPTIM="-Wall -Wunused -Wno-format-y2k $OPTIM" @@ -1317,16 +1297,13 @@ if test -n "$GCC"; then # We know that Carbon is deprecated on OS X 10.4. To avoid hundreds of warnings # we will temporarily disable 'deprecated' warnings on OS X. - case $host_os in - darwin[1-7]) - ;; - darwin*) - OPTIM="-Wno-deprecated-declarations $OPTIM" - ;; - esac + AS_CASE([$host_os], [darwin[1-7]], [ + ], [darwin*], [ + OPTIM="-Wno-deprecated-declarations $OPTIM" + ]) # Set the default compiler optimizations... - if test -z "$DEBUGFLAG"; then + AS_IF([test -z "$DEBUGFLAG"], [ # # Note: Can't use -fomit-frame-pointer - prevents tools like # libsafe from working! @@ -1341,17 +1318,17 @@ if test -n "$GCC"; then # library 10+%. # - if test "x$with_optim" != x; then + AS_IF([test "x$with_optim" != x], [ OPTIM="$with_optim $OPTIM" - else + ], [ OPTIM="-Os $OPTIM" - fi - fi + ]) + ]) # Generate position-independent code when needed... - if test $PICFLAG = 1; then + AS_IF([test $PICFLAG = 1], [ OPTIM="$OPTIM -fPIC" - fi + ]) # See if GCC supports -fno-exceptions... AC_MSG_CHECKING([if GCC supports -fno-exceptions]) @@ -1375,7 +1352,7 @@ if test -n "$GCC"; then [AC_MSG_RESULT(no)]) CFLAGS="$OLDCFLAGS" -dnl Make sure that shared libraries don't have undefined references + dnl Make sure that shared libraries don't have undefined references # See if ld supports -no-undefined... AC_MSG_CHECKING([if ld supports -no-undefined]) OLDLDFLAGS="$LDFLAGS" @@ -1420,184 +1397,168 @@ dnl Make sure that shared libraries don't have undefined references # Unlike the other compiler/optimization settings, this one is placed # in CFLAGS and CXXFLAGS so that fltk-config will provide the option # to clients - otherwise client apps will not compile properly... - case $host_os in - solaris*) - AC_MSG_CHECKING([if GCC supports -fpermissive]) - - OLDCFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fpermissive" - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[]], [[]])], - [CXXFLAGS="$CXXFLAGS -fpermissive" - AC_MSG_RESULT(yes)], - [CFLAGS="$OLDCFLAGS" - AC_MSG_RESULT(no)]) - ;; - esac -else - case "$host_os" in - irix*) - # Running some flavor of IRIX; see which version and - # set things up according... - if test "$uversion" -ge 62; then - # We are running IRIX 6.2 or higher; uncomment the following - # lines if you don't have IDO 7.2 or higher: - # - # CXX="CC -n32 -mips3" - # CC="cc -n32 -mips3" - # LD="ld -n32 -mips3" - # MAKEDEPEND="CC -M" - - if test "x`grep abi=n32 /etc/compiler.defaults`" = x; then - AC_MSG_WARN([FOR BEST RESULTS BEFORE COMPILING: setenv SGI_ABI "-n32 -mips3"]) - fi - - OPTIM="-fullwarn $OPTIM" - fi - if test -z "$DEBUGFLAG"; then - if test "x$with_optim" != x; then - OPTIM="$with_optim $OPTIM" - else - OPTIM="-O2 $OPTIM" - if test $uversion -gt 62; then - OPTIM="-OPT:Olimit=4000 $OPTIM" - fi - fi - fi - ;; - hpux*) - # Running HP-UX; these options should work for the HP compilers. - if test -z "$DEBUGFLAG"; then - if test "x$with_optim" != x; then - OPTIM="$with_optim $OPTIM" - else - OPTIM="+O2 $OPTIM" - fi - fi - - if test $PICFLAG = 1; then - OPTIM="+z $OPTIM" - fi - - CXXFLAGS="$CXXFLAGS +W336,501,736,740,749,829" - ;; - OSF1*) - # Running Digital/Tru64 UNIX; these options should work for the - # Digital/Compaq/NewHP compilers. - if test -z "$DEBUGFLAG"; then - if test "x$with_optim" != x; then - OPTIM="$with_optim $OPTIM" - else - OPTIM="-O2 $OPTIM" - fi - fi - ;; - solaris*) - # Solaris - if test -z "$DEBUGFLAG"; then - if test "x$with_optim" != x; then - OPTIM="$with_optim $OPTIM" - else - OPTIM="-xO3 $OPTIM" - fi - fi - - if test $PICFLAG = 1; then - OPTIM="-KPIC $OPTIM" - fi - ;; - aix*) - if test -z "$DEBUGFLAG"; then - if test "x$with_optim" != x; then - OPTIM="$with_optim $OPTIM" - else - OPTIM="-O2 $OPTIM" - fi - fi - - AC_MSG_WARN([The AIX C and C++ compilers are known not to correctly compile the FLTK library.]) - ;; - *) - # Running some other operating system; inform the user they - # should contribute the necessary options via the STR form.. - AC_MSG_WARN([Building FLTK with default compiler optimizations]) - AC_MSG_WARN([Send the FLTK developers your uname and compiler options via https://www.fltk.org/bugs.php]) - ;; - esac -fi + AS_CASE([$host_os], [solaris*], [ + AC_MSG_CHECKING([if GCC supports -fpermissive]) + + OLDCFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fpermissive" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[]], [[]])], + [CXXFLAGS="$CXXFLAGS -fpermissive" + AC_MSG_RESULT(yes)], + [CFLAGS="$OLDCFLAGS" + AC_MSG_RESULT(no)]) + ]) +], [ + AS_CASE(["$host_os"], [irix*], [ + # Running some flavor of IRIX; see which version and + # set things up according... + AS_IF([test "$uversion" -ge 62], [ + # We are running IRIX 6.2 or higher; uncomment the following + # lines if you don't have IDO 7.2 or higher: + # + # CXX="CC -n32 -mips3" + # CC="cc -n32 -mips3" + # LD="ld -n32 -mips3" + # MAKEDEPEND="CC -M" + + AS_IF([test "x`grep abi=n32 /etc/compiler.defaults`" = x], [ + AC_MSG_WARN([FOR BEST RESULTS BEFORE COMPILING: setenv SGI_ABI "-n32 -mips3"]) + ]) + + OPTIM="-fullwarn $OPTIM" + ]) + + AS_IF([test -z "$DEBUGFLAG"], [ + AS_IF([test "x$with_optim" != x], [ + OPTIM="$with_optim $OPTIM" + ], [ + OPTIM="-O2 $OPTIM" + AS_IF([test $uversion -gt 62], [ + OPTIM="-OPT:Olimit=4000 $OPTIM" + ]) + ]) + ]) + ], [hpux*], [ + # Running HP-UX; these options should work for the HP compilers. + AS_IF([test -z "$DEBUGFLAG"], [ + AS_IF([test "x$with_optim" != x], [ + OPTIM="$with_optim $OPTIM" + ], [ + OPTIM="+O2 $OPTIM" + ]) + ]) + + AS_IF([test $PICFLAG = 1], [ + OPTIM="+z $OPTIM" + ]) + + CXXFLAGS="$CXXFLAGS +W336,501,736,740,749,829" + ], [OSF1*], [ + # Running Digital/Tru64 UNIX; these options should work for the + # Digital/Compaq/NewHP compilers. + AS_IF([test -z "$DEBUGFLAG"], [ + AS_IF([test "x$with_optim" != x], [ + OPTIM="$with_optim $OPTIM" + ], [ + OPTIM="-O2 $OPTIM" + ]) + ]) + ], [solaris*], [ + # Solaris + AS_IF([test -z "$DEBUGFLAG"], [ + AS_IF([test "x$with_optim" != x], [ + OPTIM="$with_optim $OPTIM" + ], [ + OPTIM="-xO3 $OPTIM" + ]) + ]) + + AS_IF([test $PICFLAG = 1], [ + OPTIM="-KPIC $OPTIM" + ]) + ], [aix*], [ + AS_IF([test -z "$DEBUGFLAG"], [ + AS_IF([test "x$with_optim" != x], [ + OPTIM="$with_optim $OPTIM" + ], [ + OPTIM="-O2 $OPTIM" + ]) + ]) + + AC_MSG_WARN([The AIX C and C++ compilers are known not to correctly compile the FLTK library.]) + ], [*], [ + # Running some other operating system; inform the user they + # should contribute the necessary options via the STR form.. + AC_MSG_WARN([Building FLTK with default compiler optimizations]) + AC_MSG_WARN([Send the FLTK developers your uname and compiler options via https://www.fltk.org/bugs.php]) + ]) +]) OPTIM="$DEBUGFLAG $OPTIM" dnl Take archflags away from CFLAGS (makefiles use ARCHFLAGS explicitly) -case $host_os in - darwin*) - if test "x$with_archflags" != x ; then - CFLAGS="`echo $CFLAGS | sed -e "s/$with_archflags//g"`" - fi - ;; -esac +AS_CASE([$host_os], [darwin*], [ + AS_IF([test "x$with_archflags" != x], [ + CFLAGS="$(echo $CFLAGS | sed -e 's/$with_archflags//g')" + ]) +]) dnl Define the FLTK documentation directory... -case $host_os in - mingw*) - # Determine the path where MSys has /usr installed - msyspath=`mount | grep '\/usr ' | cut -d ' ' -f -1 | sed -e 's/\\\/\// g'` - # Then substitute that in the Windows path instead of /usr - AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "$msyspath/local/share/doc/fltk") - ;; - *) - if test x$prefix = xNONE; then - AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "/usr/local/share/doc/fltk") - else - AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "$prefix/share/doc/fltk") - fi - ;; -esac +AS_CASE([$host_os], [mingw*], [ + # Determine the path where MSys has /usr installed + msyspath="$(mount | grep '\/usr ' | cut -d ' ' -f -1 | sed -e 's/\\\/\// g')" + # Then substitute that in the Windows path instead of /usr + AC_DEFINE_UNQUOTED([FLTK_DOCDIR], "$msyspath/local/share/doc/fltk") +], [*], [ + AS_IF([test x$prefix = xNONE], [ + AC_DEFINE_UNQUOTED([FLTK_DOCDIR], "/usr/local/share/doc/fltk") + ], [ + AC_DEFINE_UNQUOTED([FLTK_DOCDIR], "$prefix/share/doc/fltk") + ]) +]) dnl Define the FLTK data directory... -if test x$prefix = xNONE; then - AC_DEFINE_UNQUOTED(FLTK_DATADIR, "/usr/local/share/fltk") -else - AC_DEFINE_UNQUOTED(FLTK_DATADIR, "$prefix/share/fltk") -fi +AS_IF([test x$prefix = xNONE], [ + AC_DEFINE_UNQUOTED([FLTK_DATADIR], "/usr/local/share/fltk") +], [ + AC_DEFINE_UNQUOTED([FLTK_DATADIR], "$prefix/share/fltk") +]) + dnl Summarize results of configure tests... echo "" echo "Configuration Summary" echo "-------------------------------------------------------------------------" -case $host_os_gui in - cygwin* | mingw*) - graphics="GDI" - ;; - darwin*) - graphics="Quartz" - ;; - *) - graphics="X11" - if test x$xft_found = xyes; then - graphics="$graphics + Xft" - fi - if test x$xdbe_found = xyes; then - graphics="$graphics + Xdbe" - fi - if test x$xfixes_found = xyes; then - graphics="$graphics + Xfixes" - fi - if test x$xinerama_found = xyes; then - graphics="$graphics + Xinerama" - fi - if test x$xcursor_found = xyes; then - graphics="$graphics + Xcursor" - fi - if test x$xrender_found = xyes; then - graphics="$graphics + Xrender" - fi - if test x$pango_found = xyes; then - graphics="$graphics + pango" - fi - ;; -esac +AS_CASE([$host_os_gui], [cygwin* | mingw*], [ + graphics="GDI" +], [darwin*], [ + graphics="Quartz" +], [*], [ + graphics="X11" + AS_IF([test x$xft_found = xyes], [ + graphics="$graphics + Xft" + ]) + AS_IF([test x$xdbe_found = xyes], [ + graphics="$graphics + Xdbe" + ]) + AS_IF([test x$xfixes_found = xyes], [ + graphics="$graphics + Xfixes" + ]) + AS_IF([test x$xinerama_found = xyes], [ + graphics="$graphics + Xinerama" + ]) + AS_IF([test x$xcursor_found = xyes], [ + graphics="$graphics + Xcursor" + ]) + AS_IF([test x$xrender_found = xyes], [ + graphics="$graphics + Xrender" + ]) + AS_IF([test x$pango_found = xyes], [ + graphics="$graphics + pango" + ]) +]) echo " Directories: prefix=$prefix" echo " bindir=$bindir" @@ -1607,62 +1568,61 @@ echo " exec_prefix=$exec_prefix" echo " includedir=$includedir" echo " libdir=$libdir" echo " mandir=$mandir" -case $host_os in - mingw*) +AS_CASE([$host_os], [mingw*], [ echo " MSys docpath=$msyspath/local/share/doc/fltk" - ;; -esac +]) + dnl echo "Cross-compiling: $fltk_cross_compiling" -if test "$fltk_cross_compiling" = "yes"; then - echo " Build: $build -> Host: $host" -fi +AS_IF([test "$fltk_cross_compiling" = "yes"], [ + echo " Build: $build -> Host: $host" +]) dnl echo " Graphics: $graphics" dnl -if test x$JPEG = x; then +AS_IF([test x$JPEG = x], [ echo "Image Libraries: JPEG=System" -else +], [ echo "Image Libraries: JPEG=Builtin" -fi -if test x$PNG = x; then +]) +AS_IF([test x$PNG = x], [ echo " PNG=System" -else +], [ echo " PNG=Builtin" -fi -if test x$ZLIB = x; then +]) +AS_IF([test x$ZLIB = x], [ echo " ZLIB=System" -else +], [ echo " ZLIB=Builtin" -fi -if test x$enable_cairo = xyes; then +]) +AS_IF([test x$enable_cairo = xyes], [ echo " CAIRO=lib" -fi -if test x$enable_cairoext = xyes; then +]) +AS_IF([test x$enable_cairoext = xyes], [ echo " CAIRO=internal_use" -fi +]) -if test x$enable_largefile != xno; then +AS_IF([test x$enable_largefile != xno], [ echo " Large Files: YES" -else +], [ echo " Large Files: NO" -fi +]) -if test x$GLDEMOS = x; then +AS_IF([test x$GLDEMOS = x], [ echo " OpenGL: NO" -else +], [ echo " OpenGL: YES" -fi +]) -if test x$THREADS = x; then +AS_IF([test x$THREADS = x], [ echo " Threads: NO" -else +], [ echo " Threads: YES" -fi +]) dnl Set empty BINARY_DIR variable for fltk-config.in (CMake compatibility) BINARY_DIR= -AC_SUBST(BINARY_DIR) +AC_SUBST([BINARY_DIR]) dnl Write all of the files... AC_CONFIG_HEADERS([config.h:configh.in]) @@ -1672,7 +1632,3 @@ AC_OUTPUT dnl Make sure the fltk-config script is executable... chmod +x fltk-config - -dnl -dnl End of file. -dnl |
