2 dnl the "configure" script is made from this by running GNU "autoconf"
4 dnl "$Id: configure.in 8511 2011-03-06 16:54:58Z manolo $"
6 dnl Configuration script for the Fast Light Tool Kit (FLTK).
8 dnl Copyright 1998-2010 by Bill Spitzak and others.
10 dnl This library is free software; you can redistribute it and/or
11 dnl modify it under the terms of the GNU Library General Public
12 dnl License as published by the Free Software Foundation; either
13 dnl version 2 of the License, or (at your option) any later version.
15 dnl This library is distributed in the hope that it will be useful,
16 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
17 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 dnl Library General Public License for more details.
20 dnl You should have received a copy of the GNU Library General Public
21 dnl License along with this library; if not, write to the Free Software
22 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 dnl Please report all bugs and problems on the following page:
27 dnl http://www.ntk.org/str.php
30 dnl We need at least autoconf 2.50...
33 dnl Required file in package...
36 dnl So --with-archflags option is used during "checking size of long"
37 if test `uname` = Darwin; then
38 if test "x$with_archflags" != x ; then
39 CFLAGS="$CFLAGS $with_archflags"
47 dnl FLTK library versions...
51 FL_API_VERSION=${FL_MAJOR_VERSION}.${FL_MINOR_VERSION}
53 AC_SUBST(FL_MAJOR_VERSION)
54 AC_SUBST(FL_MINOR_VERSION)
55 AC_SUBST(FL_PATCH_VERSION)
56 AC_SUBST(FL_API_VERSION)
58 dnl Get the operating system and version number...
60 uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'`
61 if test "x$uname" = xIRIX64; then
64 if test "x$uname" = x; then
65 # Older MinGW doesn't provide any output when uname is run, even with "-s".
66 # Current MinGW (as of Jan. 2011) however does, so this is not necessary anymore...
70 dnl Do not automatically add "-g" to compiler options...
71 ARCHFLAGS="${ARCHFLAGS:=}"
73 CPPFLAGS="${CPPFLAGS:=}"
74 CXXFLAGS="${CXXFLAGS:=}"
75 DSOFLAGS="${DSOFLAGS:=}"
76 LDFLAGS="${LDFLAGS:=}"
82 dnl in case of cross-compiling mingw32 under linux we must change uname for Win32 GUI
83 dnl run ./configure --host=i686-pc-ming32 try use X11 without change uname
84 if test "x$cross_compiling" != xno ; then
92 dnl OS-specific pre-tests...
93 dnl uname_GUI equals $uname unless we target Cygwin in combination with X11.
97 # Handle Cygwin option *first*, before all other tests.
98 AC_ARG_ENABLE(cygwin, [ --enable-cygwin use the Cygwin libraries [(default=no)]])
99 AC_ARG_ENABLE(x11, [ --enable-x11 use Cygwin with X11 [(default=no)]])
100 if test x$enable_cygwin != xyes; then
101 # NOTE: We can't use ARCHFLAGS for this, since it does not work
102 # with some of the function tests - Cygwin uses a
103 # different C library...
104 CFLAGS="$CFLAGS -mno-cygwin"
105 CPPFLAGS="$CPPFLAGS -mno-cygwin"
106 CXXFLAGS="$CXXFLAGS -mno-cygwin"
107 LDFLAGS="$LDFLAGS -mno-cygwin"
108 DSOFLAGS="$DSOFLAGS -mno-cygwin"
110 # we target Cygwin in combination with X11
111 if test x$enable_x11 = xyes; then
112 uname_GUI="X11$uname"
118 dnl Define the libraries and link options we will need.
119 LINKFLTK="../lib/libntk.a"
120 LINKFLTKGL="../lib/libntk_gl.a"
121 LINKFLTKIMG="../lib/libntk_images.a"
125 LIBNAME="../lib/libntk.a"
126 GLLIBNAME="../lib/libntk_gl.a"
127 IMGLIBNAME="../lib/libntk_images.a"
129 LIBBASENAME="libntk.a"
130 GLLIBBASENAME="libntk_gl.a"
131 IMGLIBBASENAME="libntk_images.a"
133 dnl Check for Cairo library unless disabled...
140 AC_ARG_ENABLE(cairoext,[ --enable-cairoext use ntk code instrumentation for cairo extended use (default=no)])
141 AC_ARG_ENABLE(cairo,[ --enable-cairo use lib Cairo (default=no)])
143 if test x$enable_cairoext = xyes; then
144 AC_DEFINE(FLTK_USE_CAIRO)
145 AC_DEFINE(FLTK_HAVE_CAIRO)
146 dnl FIXME This part should be fixed so configure do not depend on
147 dnl we do not rely on pkg-config .
149 CAIROFLAGS="`pkg-config --cflags cairo`"
150 CAIROLIBS="-lcairo -lpixman-1"
151 CXXFLAGS="$CAIROFLAGS $CXXFLAGS"
152 LIBS="$CAIROLIBS $LIBS"
154 LINKFLTK+=" $LINKFLTKCAIRO"
156 if test x$enable_cairo = xyes; then
157 AC_DEFINE(FLTK_HAVE_CAIRO)
158 dnl FIXME This part should be fixed so configure do not depend on
159 dnl we do not rely on pkg-config .
161 CAIROFLAGS="`pkg-config --cflags cairo`"
162 CAIROLIBS="-lcairo -lpixman-1"
163 CXXFLAGS="$CAIROFLAGS $CXXFLAGS"
170 AC_SUBST(LINKFLTKCAIRO)
171 AC_SUBST(FLTKCAIROOPTION)
178 AC_SUBST(CAIROLIBNAME)
182 AC_SUBST(LINKFLTKFORMS)
184 AC_SUBST(LINKFLTKIMG)
186 AC_SUBST(LIBBASENAME)
187 AC_SUBST(FLLIBBASENAME)
188 AC_SUBST(GLLIBBASENAME)
189 AC_SUBST(IMGLIBBASENAME)
190 AC_SUBST(CAIROLIBBASENAME)
192 dnl Handle compile-time options...
193 AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]])
194 if test x$enable_debug = xyes; then
200 AC_ARG_ENABLE(cp936, [ --enable-cp936 turn on CP936 [default=no]])
201 if test x$enable_cp936 = xyes; then
202 CFLAGS="$CFLAGS -DCP936"
206 AC_ARG_ENABLE(gl, [ --enable-gl turn on OpenGL support [default=yes]])
208 AC_ARG_ENABLE(shared, [ --enable-shared turn on shared libraries [default=no]])
209 if test x$enable_shared = xyes; then
216 DSONAME="libntk.$FL_API_VERSION.dylib"
217 GLDSONAME="libntk_gl.$FL_API_VERSION.dylib"
218 IMGDSONAME="libntk_images.$FL_API_VERSION.dylib"
219 DSOCOMMAND="\$(CXX) \$(ARCHFLAGS) \$(DSOFLAGS) -dynamiclib -lc -o"
223 DSONAME="libntk.so.$FL_API_VERSION"
224 GLDSONAME="libntk_gl.so.$FL_API_VERSION"
225 IMGDSONAME="libntk_images.so.$FL_API_VERSION"
226 DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -h \$@ \$(LDLIBS) -G $DEBUGFLAG -o"
227 if test "x$libdir" != "x/usr/lib"; then
232 DSONAME="libntk.sl.$FL_API_VERSION"
233 GLDSONAME="libntk_gl.sl.$FL_API_VERSION"
234 IMGDSONAME="libntk_images.sl.$FL_API_VERSION"
235 DSOCOMMAND="ld \$(DSOFLAGS) -b -z +h \$@ $DEBUGFLAG -o"
236 if test "x$libdir" != "x/usr/lib"; then
237 DSOLINK="-Wl,-rpath,$libdir"
241 DSONAME="libntk.so.$FL_API_VERSION"
242 GLDSONAME="libntk_gl.so.$FL_API_VERSION"
243 IMGDSONAME="libntk_images.so.$FL_API_VERSION"
244 DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@,-set_version,sgi1.1 \$(LDLIBS) -shared $DEBUGFLAG -o"
245 if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib32" -a "x$libdir" != "x/usr/lib64"; then
246 DSOLINK="-Wl,-rpath,$libdir"
250 DSONAME="libntk.so.$FL_API_VERSION"
251 GLDSONAME="libntk_gl.so.$FL_API_VERSION"
252 IMGDSONAME="libntk_images.so.$FL_API_VERSION"
253 DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared $DEBUGFLAG -o"
254 if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib32"; then
255 DSOLINK="-Wl,-rpath,$libdir"
259 DSONAME="libntk.so.$FL_API_VERSION"
260 GLDSONAME="libntk_gl.so.$FL_API_VERSION"
261 IMGDSONAME="libntk_images.so.$FL_API_VERSION"
262 DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared -fPIC $DEBUGFLAG -o"
263 if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib64"; then
264 DSOLINK="-Wl,-rpath,$libdir"
269 GLDSONAME="libntk_gl_s.a"
270 IMGDSONAME="libntk_images_s.a"
271 DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-bexpall,-bM:SRE,-bnoentry -o"
276 if test x$enable_cygwin != xyes; then
277 DSONAME="mgwntknox-$FL_API_VERSION.dll"
278 GLDSONAME="mgwntknox_gl-$FL_API_VERSION.dll"
279 IMGDSONAME="mgwntknox_images-$FL_API_VERSION.dll"
280 CAIRODSONAME="mgwntknox_cairo-$FL_API_VERSION.dll"
282 if test x$enable_x11 = xyes; then
283 DSONAME="cygntk-$FL_API_VERSION.dll"
284 GLDSONAME="cygntk_gl-$FL_API_VERSION.dll"
285 IMGDSONAME="cygntk_images-$FL_API_VERSION.dll"
287 DSONAME="cygntknox-$FL_API_VERSION.dll"
288 GLDSONAME="cygntknox_gl-$FL_API_VERSION.dll"
289 IMGDSONAME="cygntknox_images-$FL_API_VERSION.dll"
290 CAIRODSONAME="cygntknox_cairo-$FL_API_VERSION.dll"
293 #-----------------------------------------------------------
294 # -Wl,--enable-runtime-pseudo-reloc: See str 1585
295 # appears to be necessary for older binutils versions < 2.16
296 #-----------------------------------------------------------
297 LDFLAGS="$LDFLAGS -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
298 DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -shared \
299 -Wl,--whole-archive -Wl,--export-all-symbols \
300 -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-import \
301 -Wl,--enable-auto-image-base -o \$@"
304 AC_MSG_WARN(Shared libraries may not be supported. Trying -shared option with compiler.)
305 DSONAME="libntk.so.$FL_API_VERSION"
306 GLDSONAME="libntk_gl.so.$FL_API_VERSION"
307 IMGDSONAME="libntk_images.so.$FL_API_VERSION"
308 DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared $DEBUGFLAG -o"
312 LINKSHARED="-L../src $FLTKCAIROOPTION -lntk_images$SHAREDSUFFIX -lntk$SHAREDSUFFIX"
324 LINKSHARED="$LINKFLTKCAIRO ../lib/libntk_images.a ../lib/libntk.a"
334 AC_SUBST(CAIRODSONAME)
335 AC_SUBST(SHAREDSUFFIX)
339 AC_ARG_ENABLE(threads, [ --enable-threads enable multi-threading support (default=yes)])
341 AC_ARG_WITH(optim, [ --with-optim="flags" use custom optimization flags])
343 AC_ARG_WITH(archflags, [ --with-archflags="flags"
344 use custom architecture flags
345 (possible Mac OS X values include -arch i386, -arch x86_64, -arch ppc)],
346 ARCHFLAGS="$withval")
349 # QD is not supported anymore since 1.3
350 AC_DEFINE(__APPLE_QUARTZ__)
360 INSTALL="`pwd`/install-sh -c"
363 if test "$INSTALL" = "$ac_install_sh"; then
364 # Use full path to install-sh script...
365 INSTALL="`pwd`/install-sh -c"
367 AC_PATH_PROG(NROFF,nroff)
368 if test "x$NROFF" = "x:"; then
369 # Try groff instead of nroff...
370 AC_PATH_PROG(GROFF,groff)
371 if test "x$GROFF" = "x:"; then
374 NROFF="$GROFF -T ascii"
377 AC_PATH_PROG(HTMLDOC,htmldoc)
378 AC_PATH_PROG(DOXYDOC,doxygen)
380 dnl How do we make libraries?
384 if test "x$AR" = "x:"; then
385 AC_MSG_ERROR(Configure could not find the library archiver, aborting.)
388 if test "x$RANLIB" != "x:"; then
396 dnl how to compile (Windows) resource files
397 dnl this will only be used to compile resources for Windows .exe files
398 AC_PATH_TOOL(RC,windres)
400 dnl Architecture checks...
401 if test "$uname" != Darwin; then
405 AC_CHECK_SIZEOF(short, 2)
406 AC_CHECK_SIZEOF(int, 4)
407 AC_CHECK_SIZEOF(long, 4)
408 if test $ac_cv_sizeof_short -eq 2; then
409 AC_DEFINE(U16,unsigned short)
411 if test $ac_cv_sizeof_int -eq 4; then
412 AC_DEFINE(U32,unsigned)
414 if test $ac_cv_sizeof_long -eq 4; then
415 AC_DEFINE(U32,unsigned long)
418 if test "$uname" != Darwin; then
419 if test $ac_cv_sizeof_int -eq 8; then
420 AC_DEFINE(U64,unsigned)
422 if test $ac_cv_sizeof_long -eq 8; then
423 AC_DEFINE(U64,unsigned long)
428 dnl Does the C++ compiler support the bool type?
429 AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type,
434 int f(int x){return 1;}
435 int f(char x){return 1;}
436 int f(bool x){return 1;}
440 ], ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no)
444 if test "$ac_cv_cxx_bool" != yes; then
445 CXXFLAGS="-Dbool=char -Dfalse=0 -Dtrue=1 $CXXFLAGS"
448 dnl Standard headers and functions...
450 AC_CHECK_HEADER(sys/select.h,AC_DEFINE(HAVE_SYS_SELECT_H))
451 AC_CHECK_HEADER(sys/stdtypes.h,AC_DEFINE(HAVE_SYS_SELECT_H))
453 dnl Do we have the POSIX compatible scandir() prototype?
454 AC_CACHE_CHECK([whether we have the POSIX compatible scandir() prototype],
455 ac_cv_cxx_scandir_posix,[
460 int func (const char *d, dirent ***list, void *sort) {
461 int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort);
464 ], ac_cv_cxx_scandir_posix=yes, ac_cv_cxx_scandir_posix=no)
468 dnl Define both HAVE_SCANDIR... macros, if the POSIX compatible function is
469 dnl available. Otherwise: check, whether any scandir prototype is available,
470 dnl but don't use it on SunOS and QNX because of an incompatibility in pre-Y2K
471 dnl SunOS scandir versions. We assume, though, that the POSIX compatible
472 dnl version on newer SunOS/Solaris versions works as expected.
473 if test "$ac_cv_cxx_scandir_posix" = yes; then
474 AC_DEFINE(HAVE_SCANDIR)
475 AC_DEFINE(HAVE_SCANDIR_POSIX)
477 AC_CHECK_FUNC(scandir,
478 if test "x$uname" = xSunOS -o "x$uname" = xQNX; then
479 AC_MSG_WARN(Not using $uname scandir emulation function.)
481 AC_DEFINE(HAVE_SCANDIR)
485 AC_CHECK_FUNC(vsnprintf,[
488 if test "$uversion" = "1020"; then
489 AC_MSG_WARN(Not using built-in vsnprintf function because you are running HP-UX 10.20.)
491 AC_DEFINE(HAVE_VSNPRINTF)
496 if test "$uversion" = "40"; then
497 AC_MSG_WARN(Not using built-in vsnprintf function because you are running Tru64 4.0.)
499 AC_DEFINE(HAVE_VSNPRINTF)
504 AC_DEFINE(HAVE_VSNPRINTF)
507 AC_CHECK_FUNC(snprintf,[
510 if test "$uversion" = "1020"; then
511 AC_MSG_WARN(Not using built-in snprintf function because you are running HP-UX 10.20.)
513 AC_DEFINE(HAVE_SNPRINTF)
518 if test "$uversion" = "40"; then
519 AC_MSG_WARN(Not using built-in snprintf function because you are running Tru64 4.0.)
521 AC_DEFINE(HAVE_SNPRINTF)
526 AC_DEFINE(HAVE_SNPRINTF)
529 AC_CHECK_HEADER(strings.h, AC_DEFINE(HAVE_STRINGS_H))
530 AC_CHECK_FUNCS(strcasecmp strlcat strlcpy)
532 AC_CHECK_HEADER(locale.h, AC_DEFINE(HAVE_LOCALE_H))
533 AC_CHECK_FUNCS(localeconv)
535 dnl FLTK library uses math library functions...
536 AC_SEARCH_LIBS(pow, m)
538 dnl Check for largefile support...
541 dnl Define largefile options as needed...
543 if test x$enable_largefile != xno; then
544 LARGEFILE="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
546 if test x$ac_cv_sys_large_files = x1; then
547 LARGEFILE="$LARGEFILE -D_LARGE_FILES"
550 if test x$ac_cv_sys_file_offset_bits = x64; then
551 LARGEFILE="$LARGEFILE -D_FILE_OFFSET_BITS=64"
556 dnl Check for "long long" support...
557 AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
558 [if test "$GCC" = yes; then
559 ac_cv_c_long_long=yes
561 AC_TRY_COMPILE(,[long long int i;],
562 ac_cv_c_long_long=yes,
563 ac_cv_c_long_long=no)
566 if test $ac_cv_c_long_long = yes; then
567 AC_DEFINE(HAVE_LONG_LONG)
570 AC_CHECK_FUNC(strtoll, AC_DEFINE(HAVE_STRTOLL))
572 dnl Check for dlopen/dlsym...
573 AC_SEARCH_LIBS(dlsym, dl, AC_DEFINE(HAVE_DLSYM))
574 AC_CHECK_HEADER(dlfcn.h, AC_DEFINE(HAVE_DLFCN_H))
576 dnl Check for audio libraries...
581 dnl Cygwin environment...
586 AUDIOLIBS="-framework CoreAudio"
590 AC_CHECK_HEADER(alsa/asoundlib.h,
591 AC_DEFINE(HAVE_ALSA_ASOUNDLIB_H)
592 AUDIOLIBS="-lasound")
598 dnl Check for image libraries...
604 AC_SUBST(STATICIMAGELIBS)
606 # Handle the JPEG lib linking mode (use ntk local or system lib)
607 # If --enable-(resp. --disable-)localjpeg parameter is not set by user
608 # Then we check the JPEG lib usability, with result in sysjpeglib_ok variable
609 AC_ARG_ENABLE(localjpeg, [ --enable-localjpeg use local JPEG library, default=auto])
610 # Check for System lib use if automatic mode or --disable-localjpeg is requested
613 if test x$enable_localjpeg != xyes; then
614 AC_CHECK_LIB(jpeg,jpeg_CreateCompress,
615 [AC_CHECK_HEADER(jpeglib.h,
617 if test x$sysjpeginc_ok = xyes; then
621 # Now set the jpeg lib and include flags according to the requested mode and availability
622 if test x$enable_localjpeg = xyes -o x$sysjpeglib_ok = xno; then
625 IMAGELIBS="-lntk_jpeg $IMAGELIBS"
626 STATICIMAGELIBS="\$libdir/libntk_jpeg.a $STATICIMAGELIBS"
627 AC_DEFINE(HAVE_LIBJPEG)
628 #ac_cv_lib_jpeg_jpeg_CreateCompress=no # from ima: should not be necessary
629 # Finally, warn user if system lib was requested but not found
630 if test x$enable_localjpeg = xno; then
631 AC_MSG_WARN(Cannot find system jpeg lib or header: choosing the local lib mode.)
636 IMAGELIBS="-ljpeg $IMAGELIBS"
637 STATICIMAGELIBS="-ljpeg $STATICIMAGELIBS"
638 AC_DEFINE(HAVE_LIBJPEG)
641 # Handle the ZLIB lib linking mode (use ntk local or system lib)
642 # If --enable-(resp. --disable-)localzlib parameter is not set by user
643 # Then we check the ZLIB lib usability, with result in syszlib_ok variable
644 AC_ARG_ENABLE(localzlib, [ --enable-localzlib use local ZLIB library, default=auto])
645 # Check for System lib use if automatic mode or --disable-localzlib is requested
648 if test x$enable_localzlib != xyes; then
649 AC_CHECK_LIB(z,gzgets,
650 [AC_CHECK_HEADER(zlib.h,
652 if test x$syszinc_ok = xyes; then
656 # Now set the Z lib and include flags according to the requested mode and availability
657 if test x$enable_localzlib = xyes -o x$syszlib_ok = xno ; then
661 IMAGELIBS="-lntk_z $IMAGELIBS"
662 STATICIMAGELIBS="\$libdir/libntk_z.a $STATICIMAGELIBS"
664 ac_cv_lib_z_gzgets=no # fc: is still necessary ?
665 # Finally, warn user if system lib was requested but not found
666 if test x$enable_localzlib = xno; then
667 AC_MSG_WARN(Cannot find system z lib or header: choosing the local lib mode.)
673 IMAGELIBS="-lz $IMAGELIBS"
674 STATICIMAGELIBS="-lz $STATICIMAGELIBS"
678 # Handle the PNG lib linking mode (use ntk local or system lib)
679 # If --enable-(resp. --disable-)localpng parameter is not set by user
680 # Then we check the png lib usability with result in syspng_lib variable
681 AC_ARG_ENABLE(localpng, [ --enable-localpng use local PNG library, default=auto])
683 # Now check if system lib is usable, we check Lib AND include availability with inc variant,
684 # but only, if the builtin lib is not requested
687 if test x$enable_localpng != xyes; then
688 AC_CHECK_LIB(png, png_read_info,
689 [AC_CHECK_HEADER(png.h,
690 AC_DEFINE(HAVE_PNG_H)
692 AC_CHECK_HEADER(libpng/png.h,
693 AC_DEFINE(HAVE_LIBPNG_PNG_H)
695 if test x$syspnginc_ok = xyes; then
700 # The following is executed if the lib was not found usable or if local lib is required explicitly
701 if test x$enable_localpng = xyes -o x$syspnglib_ok = xno ; then
704 IMAGELIBS="-lntk_png $IMAGELIBS"
705 STATICIMAGELIBS="\$libdir/libntk_png.a $STATICIMAGELIBS"
706 AC_DEFINE(HAVE_LIBPNG)
707 AC_DEFINE(HAVE_PNG_H)
708 AC_DEFINE(HAVE_PNG_GET_VALID)
709 AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA)
710 # Finally, warn user if system lib was requested but not found
711 if test x$enable_localpng = xno; then
712 AC_MSG_WARN(Cannot find system png lib or header: choosing the local lib mode.)
717 IMAGELIBS="-lpng $IMAGELIBS"
718 STATICIMAGELIBS="-lpng $STATICIMAGELIBS"
719 AC_DEFINE(HAVE_LIBPNG)
720 AC_CHECK_LIB(png,png_get_valid, AC_DEFINE(HAVE_PNG_GET_VALID))
721 AC_CHECK_LIB(png,png_set_tRNS_to_alpha, AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA))
731 dnl Restore original LIBS settings...
734 dnl See if we need a .exe extension on executables...
737 dnl Check for pthreads for multi-threaded apps...
741 dnl Test whether we want to check for pthreads. We must not do it on Windows
742 dnl unless we run under Cygwin with --enable-cygwin, since we always use
743 dnl native threads on Windows (even if libpthread is available)
750 if test "x$enable_cygwin" != xyes; then
758 if test "x$enable_threads" != xno -a x$check_pthread = xyes; then
759 AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
761 if test x$ac_cv_header_pthread_h = xyes; then
762 dnl Check various threading options for the platforms we support
763 for flag in -lpthreads -lpthread -pthread; do
764 AC_MSG_CHECKING([for pthread_create using $flag])
767 AC_TRY_LINK([#include <pthread.h>],
768 [pthread_create(0, 0, 0, 0);],
771 AC_MSG_RESULT([$have_pthread])
773 if test $have_pthread = yes; then
774 AC_DEFINE(HAVE_PTHREAD)
775 PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT"
777 # Solaris requires -D_POSIX_PTHREAD_SEMANTICS to
778 # be POSIX-compliant... :(
779 if test $uname = SunOS; then
780 PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
788 AC_SUBST(PTHREAD_FLAGS)
790 dnl Define OS-specific stuff...
795 AC_ARG_WITH(links, [ --with-links make header links for common misspellings (default=no)])
802 dnl Cygwin environment, using windows GDI ...
803 # Recent versions of Cygwin are seriously broken and the size
804 # checks don't work because the shell puts out \r\n instead of
805 # \n. Here we just force U32 to be defined to "unsigned"...
806 AC_DEFINE(U32,unsigned)
807 CFLAGS="-mwindows -DWIN32 -DUSE_OPENGL32 $CFLAGS"
808 CXXFLAGS="-mwindows -DWIN32 -DUSE_OPENGL32 $CXXFLAGS"
809 LDFLAGS="-mwindows $LDFLAGS"
810 DSOFLAGS="-mwindows $DSOFLAGS"
811 LIBS="$LIBS -lole32 -luuid -lcomctl32"
812 if test "x$with_optim" = x; then
813 dnl Avoid -Os optimization on Cygwin/MinGW
817 if test x$enable_gl != xno; then
818 AC_CHECK_HEADER(GL/gl.h,
821 AC_CHECK_HEADER(GL/glu.h,
822 AC_DEFINE(HAVE_GL_GLU_H)
823 GLLIB="-lglu32 $GLLIB")
831 if test "x$enable_threads" != xno; then
832 if test x$have_pthread = xyes; then
833 AC_DEFINE(HAVE_PTHREAD)
837 THREADS="threads$EXEEXT"
839 # Don't make symlinks since Windows is not case sensitive.
840 if test "x$with_links" != xyes; then
846 # MacOS X uses Cocoa for graphics.
847 LIBS="$LIBS -framework Cocoa"
849 if test x$have_pthread = xyes; then
850 AC_DEFINE(HAVE_PTHREAD)
851 THREADS="threads$EXEEXT"
854 if test x$enable_gl != xno; then
856 AC_DEFINE(HAVE_GL_GLU_H)
857 GLLIB="-framework AGL -framework OpenGL -framework ApplicationServices"
865 # Don't make symlinks because HFS+ is not case sensitive...
866 if test "x$with_links" != xyes; then
870 # Some steps are only done for OS X package management
873 # Install/Uninstall FLUID application
874 INSTALL_DESKTOP="install-osx"
875 UNINSTALL_DESKTOP="uninstall-osx"
879 # All others are UNIX/X11...
880 # This includes Cygwin target combined with X11
881 if test x$have_pthread = xyes; then
882 AC_DEFINE(HAVE_PTHREAD)
883 THREADS="threads$EXEEXT"
889 if test x$no_x = xyes; then
890 AC_MSG_ERROR(Configure could not find required X11 libraries, aborting.)
893 if test "x$X_PRE_LIBS" != x; then
894 AC_MSG_WARN(Ignoring libraries \"$X_PRE_LIBS\" requested by configure.)
897 LIBS="$LIBS -lX11 $X_EXTRA_LIBS"
898 CFLAGS="$CFLAGS $X_CFLAGS"
899 CXXFLAGS="$CXXFLAGS $X_CFLAGS"
900 LDFLAGS="$X_LIBS $LDFLAGS"
901 DSOFLAGS="$X_LIBS $DSOFLAGS"
903 if test "x$x_includes" != x; then
904 ac_cpp="$ac_cpp -I$x_includes"
907 dnl Check for OpenGL unless disabled...
910 if test x$enable_gl != xno; then
911 AC_SEARCH_LIBS(dlopen, dl)
912 AC_CHECK_HEADER(GL/gl.h,
913 AC_CHECK_LIB(GL, glXMakeCurrent, AC_DEFINE(HAVE_GL) GLLIB="-lGL",
914 AC_CHECK_LIB(MesaGL,glXMakeCurrent, AC_DEFINE(HAVE_GL) GLLIB=" -lMesaGL",,
917 AC_CHECK_LIB(GL, glXGetProcAddressARB,
918 AC_DEFINE(HAVE_GLXGETPROCADDRESSARB),, -lm)
920 AC_CHECK_HEADER(GL/glu.h,
921 AC_DEFINE(HAVE_GL_GLU_H)
922 if test x$ac_cv_lib_GL_glXMakeCurrent = xyes; then
925 if test x$ac_cv_lib_MesaGL_glXMakeCurrent = xyes; then
926 GLLIB="-lMesaGLU $GLLIB"
930 if test x$ac_cv_lib_GL_glXMakeCurrent != xyes -a x$ac_cv_lib_MesaGL_glXMakeCurrent != xyes; then
943 dnl Check for Xinerama support unless disabled...
944 AC_ARG_ENABLE(xinerama, [ --enable-xinerama turn on Xinerama support [default=yes]])
946 if test x$enable_xinerama != xno; then
947 AC_CHECK_LIB(Xinerama,XineramaIsActive,
948 AC_DEFINE(HAVE_XINERAMA)
949 LIBS="-lXinerama $LIBS")
952 dnl Check for the Xft library unless disabled...
953 AC_ARG_ENABLE(xft, [ --enable-xft turn on Xft support [default=yes]])
955 if test x$enable_xft != xno; then
956 AC_PATH_PROG(FTCONFIG,freetype-config)
958 if test "x$FTCONFIG" != x; then
959 CPPFLAGS="`$FTCONFIG --cflags` $CPPFLAGS"
960 CXXFLAGS="`$FTCONFIG --cflags` $CXXFLAGS"
962 AC_CHECK_LIB(fontconfig, FcPatternCreate)
963 AC_CHECK_HEADER(X11/Xft/Xft.h,
964 AC_CHECK_LIB(Xft, XftDrawCreate,
970 dnl Check for overlay visuals...
971 AC_PATH_PROG(XPROP, xprop)
972 AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay,
973 if test "x$XPROP" != x; then
974 if $XPROP -root 2>/dev/null | grep -c "SERVER_OVERLAY_VISUALS" >/dev/null; then
975 ac_cv_have_overlay=yes
977 ac_cv_have_overlay=no
980 ac_cv_have_overlay=no
983 if test x$ac_cv_have_overlay = xyes; then
984 AC_DEFINE(HAVE_OVERLAY)
987 # Make symlinks since UNIX/Linux is case sensitive,
988 # but Cygwin in general not.
996 # Make symlinks since UNIX/Linux is case sensitive,
997 # but only if explicitly configured (default=no)
998 if test "x$with_links" != xyes; then
1002 # Install/Uninstall FLUID application support files
1003 INSTALL_DESKTOP="install-linux"
1004 UNINSTALL_DESKTOP="uninstall-linux"
1014 AC_SUBST(INSTALL_DESKTOP)
1015 AC_SUBST(UNINSTALL_DESKTOP)
1017 dnl Figure out the appropriate formatted man page extension...
1043 dnl Fix "mandir" variable...
1044 if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then
1046 *BSD* | Darwin* | Linux*)
1047 # *BSD, Darwin, and Linux
1048 mandir="\${prefix}/share/man"
1052 mandir="\${prefix}/share/catman"
1057 dnl Fix "libdir" variable...
1058 if test "$prefix" = NONE; then
1062 if test "$exec_prefix" = NONE; then
1063 exec_prefix="\${prefix}"
1066 if test "$uname" = "IRIX" -a $uversion -ge 62 -a "$libdir" = "\${exec_prefix}/lib" -a "$exec_prefix" = "\${prefix}" -a "$prefix" = "/usr"; then
1070 dnl Define the command used to update the dependencies (this option
1071 dnl mainly for FLTK core developers - not necessary for users)
1072 MAKEDEPEND="\$(CXX) -M"
1073 AC_SUBST(MAKEDEPEND)
1075 dnl Add warnings to compiler switches:
1076 dnl do this last so messing with switches does not break tests
1078 if test -n "$GCC"; then
1079 # Show all standard warnings + unused variables, conversion errors,
1080 # and inlining problems when compiling...
1081 OPTIM="-Wall -Wunused -Wno-format-y2k $OPTIM"
1083 # The following additional warnings are useful for tracking down problems...
1084 #OPTIM="-Wshadow -Wconversion $OPTIM"
1086 # We know that Carbon is deprecated on OS X 10.4. To avoid hundreds of warnings
1087 # we will temporarily disable 'deprecated' warnings on OS X.
1088 if test "$uname" = "Darwin" -a $uversion -ge 800; then
1089 OPTIM="-Wno-deprecated-declarations $OPTIM"
1092 # Set the default compiler optimizations...
1093 if test -z "$DEBUGFLAG"; then
1095 # Note: Can't use -fomit-frame-pointer - prevents tools like
1096 # libsafe from working!
1098 # Don't use -fforce-mem, -fforce-addr, or -fcaller-saves.
1099 # They all seem to make either no difference or enlarge
1100 # the code by a few hundred bytes.
1102 # "-Os" seems to be the best compromise between speed and
1103 # code size. "-O3" and higher seem to make no effective
1104 # difference in the speed of the code, but does bloat the
1108 if test "x$with_optim" != x; then
1109 OPTIM="$with_optim $OPTIM"
1115 # Generate position-independent code when needed...
1116 if test $PICFLAG = 1; then
1117 OPTIM="$OPTIM -fPIC"
1120 # See if GCC supports -fno-exceptions...
1121 AC_MSG_CHECKING(if GCC supports -fno-exceptions)
1123 CFLAGS="$CFLAGS -fno-exceptions"
1125 OPTIM="$OPTIM -fno-exceptions"
1130 # See if GCC supports -fno-strict-aliasing...
1131 AC_MSG_CHECKING(if GCC supports -fno-strict-aliasing)
1133 CFLAGS="$CFLAGS -fno-strict-aliasing"
1135 OPTIM="$OPTIM -fno-strict-aliasing"
1140 # See if we are running Solaris; if so, try the -fpermissive option...
1141 # This option is required on some versions of Solaris to work around
1142 # bugs in the X headers up through Solaris 7.
1144 # Unlike the other compiler/optimization settings, this one is placed
1145 # in CFLAGS and CXXFLAGS so that ntk-config will provide the option
1146 # to clients - otherwise client apps will not compile properly...
1147 if test "$uname" = SunOS; then
1148 AC_MSG_CHECKING(if GCC supports -fpermissive)
1151 CFLAGS="$CFLAGS -fpermissive"
1153 CXXFLAGS="$CXXFLAGS -fpermissive"
1161 # Running some flavor of IRIX; see which version and
1162 # set things up according...
1163 if test "$uversion" -ge 62; then
1164 # We are running IRIX 6.2 or higher; uncomment the following
1165 # lines if you don't have IDO 7.2 or higher:
1167 # CXX="CC -n32 -mips3"
1168 # CC="cc -n32 -mips3"
1169 # LD="ld -n32 -mips3"
1170 # MAKEDEPEND="CC -M"
1172 if test "x`grep abi=n32 /etc/compiler.defaults`" = x; then
1173 AC_MSG_WARN(FOR BEST RESULTS BEFORE COMPILING: setenv SGI_ABI \"-n32 -mips3\")
1176 OPTIM="-fullwarn $OPTIM"
1178 if test -z "$DEBUGFLAG"; then
1179 if test "x$with_optim" != x; then
1180 OPTIM="$with_optim $OPTIM"
1183 if test $uversion -gt 62; then
1184 OPTIM="-OPT:Olimit=4000 $OPTIM"
1190 # Running HP-UX; these options should work for the HP compilers.
1191 if test -z "$DEBUGFLAG"; then
1192 if test "x$with_optim" != x; then
1193 OPTIM="$with_optim $OPTIM"
1199 if test $PICFLAG = 1; then
1203 CXXFLAGS="$CXXFLAGS +W336,501,736,740,749,829"
1206 # Running Digital/Tru64 UNIX; these options should work for the
1207 # Digital/Compaq/NewHP compilers.
1208 if test -z "$DEBUGFLAG"; then
1209 if test "x$with_optim" != x; then
1210 OPTIM="$with_optim $OPTIM"
1218 if test -z "$DEBUGFLAG"; then
1219 if test "x$with_optim" != x; then
1220 OPTIM="$with_optim $OPTIM"
1226 if test $PICFLAG = 1; then
1227 OPTIM="-KPIC $OPTIM"
1231 if test -z "$DEBUGFLAG"; then
1232 if test "x$with_optim" != x; then
1233 OPTIM="$with_optim $OPTIM"
1239 AC_MSG_WARN(The AIX C and C++ compilers are known not to correctly compile the FLTK library.)
1242 # Running some other operating system; inform the user they
1243 # should contribute the necessary options via the STR form..
1244 AC_MSG_WARN(Building FLTK with default compiler optimizations)
1245 AC_MSG_WARN(Send the FLTK developers your uname and compiler options via http://www.ntk.org/str.php)
1250 OPTIM="$DEBUGFLAG $OPTIM"
1252 dnl Take archflags away from CFLAGS (makefiles use ARCHFLAGS explicitly)
1253 if test `uname` = Darwin; then
1254 if test "x$with_archflags" != x ; then
1255 CFLAGS="`echo $CFLAGS | sed -e "s/$with_archflags//g"`"
1259 dnl Define the FLTK documentation directory...
1262 # Determine the path where MSys has /usr installed
1263 msyspath=`mount | grep '\/usr' | grep -v '\/usr\/bin' | cut -d ' ' -f -1 | sed -e 's/\\\/\// g'`
1264 # Then substitute that in the WIN32 path instead of /usr
1265 AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "$msyspath/local/share/doc/ntk")
1268 if test x$prefix = xNONE; then
1269 AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "/usr/local/share/doc/ntk")
1271 AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "$prefix/share/doc/ntk")
1276 dnl Define the FLTK data directory...
1277 if test x$prefix = xNONE; then
1278 AC_DEFINE_UNQUOTED(FLTK_DATADIR, "/usr/local/share/ntk")
1280 AC_DEFINE_UNQUOTED(FLTK_DATADIR, "$prefix/share/ntk")
1283 dnl Summarize results of configure tests...
1285 echo "Configuration Summary"
1286 echo "-------------------------------------------------------------------------"
1297 if test x$enable_xft != xno; then
1298 graphics="$graphics+Xft"
1300 if test x$enable_xinerama != xno; then
1301 graphics="$graphics+Xinerama"
1306 echo " Directories: prefix=$prefix"
1307 echo " bindir=$bindir"
1308 echo " datadir=$datadir"
1309 echo " datarootdir=$datarootdir"
1310 echo " exec_prefix=$exec_prefix"
1311 echo " includedir=$includedir"
1312 echo " libdir=$libdir"
1313 echo " mandir=$mandir"
1316 echo " MSys docpath=$msyspath/local/share/doc/ntk"
1319 echo " Graphics: $graphics"
1321 if test x$JPEG = x; then
1322 echo "Image Libraries: JPEG=System"
1324 echo "Image Libraries: JPEG=Builtin"
1326 if test x$PNG = x; then
1331 if test x$ZLIB = x; then
1334 echo " ZLIB=Builtin"
1336 if test x$enable_cairo = xyes; then
1339 if test x$enable_cairoext = xyes; then
1340 echo " CAIRO=internal_use"
1344 if test x$enable_largefile != xno; then
1345 echo " Large Files: YES"
1347 echo " Large Files: NO"
1350 if test x$GLDEMOS = x; then
1356 if test x$THREADS = x; then
1359 echo " Threads: YES"
1362 dnl Write all of the files...
1363 AC_CONFIG_HEADER(config.h:configh.in)
1364 AC_OUTPUT(makeinclude ntk.list ntk-config ntk.spec FL/Makefile)
1366 dnl Make sure the ntk-config script is executable...
1370 dnl End of "$Id: configure.in 8511 2011-03-06 16:54:58Z manolo $".