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.fltk.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/libfltk.a"
120 LINKFLTKFORMS="../lib/libfltk_forms.a"
121 LINKFLTKGL="../lib/libfltk_gl.a"
122 LINKFLTKIMG="../lib/libfltk_images.a"
126 LIBNAME="../lib/libfltk.a"
127 FLLIBNAME="../lib/libfltk_forms.a"
128 GLLIBNAME="../lib/libfltk_gl.a"
129 IMGLIBNAME="../lib/libfltk_images.a"
130 CAIROLIBNAME="../lib/libfltk_cairo.a"
132 LIBBASENAME="libfltk.a"
133 FLLIBBASENAME="libfltk_forms.a"
134 GLLIBBASENAME="libfltk_gl.a"
135 IMGLIBBASENAME="libfltk_images.a"
136 CAIROLIBBASENAME="libfltk_cairo.a"
138 dnl Check for Cairo library unless disabled...
145 AC_ARG_ENABLE(cairoext,[ --enable-cairoext use fltk code instrumentation for cairo extended use (default=no)])
146 AC_ARG_ENABLE(cairo,[ --enable-cairo use lib Cairo (default=no)])
148 if test x$enable_cairoext = xyes; then
149 AC_DEFINE(FLTK_USE_CAIRO)
150 AC_DEFINE(FLTK_HAVE_CAIRO)
151 dnl FIXME This part should be fixed so configure do not depend on
152 dnl we do not rely on pkg-config .
154 CAIROFLAGS="`pkg-config --cflags cairo`"
155 CAIROLIBS="-lcairo -lpixman-1"
156 CXXFLAGS="$CAIROFLAGS $CXXFLAGS"
157 LINKFLTKCAIRO="../lib/libfltk_cairo.a"
158 FLTKCAIROOPTION="-L ../cairo -lfltk_cairo$SHAREDSUFFIX"
159 LIBS="$CAIROLIBS $LIBS"
161 LINKFLTK+=" $LINKFLTKCAIRO"
163 if test x$enable_cairo = xyes; then
164 AC_DEFINE(FLTK_HAVE_CAIRO)
165 dnl FIXME This part should be fixed so configure do not depend on
166 dnl we do not rely on pkg-config .
168 CAIROFLAGS="`pkg-config --cflags cairo`"
169 CAIROLIBS="-lcairo -lpixman-1"
170 CXXFLAGS="$CAIROFLAGS $CXXFLAGS"
171 LINKFLTKCAIRO="../lib/libfltk_cairo.a"
172 FLTKCAIROOPTION="-L ../cairo -lfltk_cairo$SHAREDSUFFIX"
179 AC_SUBST(LINKFLTKCAIRO)
180 AC_SUBST(FLTKCAIROOPTION)
187 AC_SUBST(CAIROLIBNAME)
191 AC_SUBST(LINKFLTKFORMS)
193 AC_SUBST(LINKFLTKIMG)
195 AC_SUBST(LIBBASENAME)
196 AC_SUBST(FLLIBBASENAME)
197 AC_SUBST(GLLIBBASENAME)
198 AC_SUBST(IMGLIBBASENAME)
199 AC_SUBST(CAIROLIBBASENAME)
201 dnl Handle compile-time options...
202 AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]])
203 if test x$enable_debug = xyes; then
209 AC_ARG_ENABLE(cp936, [ --enable-cp936 turn on CP936 [default=no]])
210 if test x$enable_cp936 = xyes; then
211 CFLAGS="$CFLAGS -DCP936"
215 AC_ARG_ENABLE(gl, [ --enable-gl turn on OpenGL support [default=yes]])
217 AC_ARG_ENABLE(shared, [ --enable-shared turn on shared libraries [default=no]])
218 if test x$enable_shared = xyes; then
225 DSONAME="libfltk.$FL_API_VERSION.dylib"
226 FLDSONAME="libfltk_forms.$FL_API_VERSION.dylib"
227 GLDSONAME="libfltk_gl.$FL_API_VERSION.dylib"
228 IMGDSONAME="libfltk_images.$FL_API_VERSION.dylib"
229 CAIRODSONAME="libfltk_cairo.$FL_API_VERSION.dylib"
230 DSOCOMMAND="\$(CXX) \$(ARCHFLAGS) \$(DSOFLAGS) -dynamiclib -lc -o"
234 DSONAME="libfltk.so.$FL_API_VERSION"
235 FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
236 GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
237 IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
238 CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
239 DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -h \$@ \$(LDLIBS) -G $DEBUGFLAG -o"
240 if test "x$libdir" != "x/usr/lib"; then
245 DSONAME="libfltk.sl.$FL_API_VERSION"
246 FLDSONAME="libfltk_forms.sl.$FL_API_VERSION"
247 GLDSONAME="libfltk_gl.sl.$FL_API_VERSION"
248 IMGDSONAME="libfltk_images.sl.$FL_API_VERSION"
249 CAIRODSONAME="libfltk_cairo.sl.$FL_API_VERSION"
250 DSOCOMMAND="ld \$(DSOFLAGS) -b -z +h \$@ $DEBUGFLAG -o"
251 if test "x$libdir" != "x/usr/lib"; then
252 DSOLINK="-Wl,-rpath,$libdir"
256 DSONAME="libfltk.so.$FL_API_VERSION"
257 FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
258 GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
259 IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
260 CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
261 DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@,-set_version,sgi1.1 \$(LDLIBS) -shared $DEBUGFLAG -o"
262 if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib32" -a "x$libdir" != "x/usr/lib64"; then
263 DSOLINK="-Wl,-rpath,$libdir"
267 DSONAME="libfltk.so.$FL_API_VERSION"
268 FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
269 GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
270 IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
271 CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
272 DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared $DEBUGFLAG -o"
273 if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib32"; then
274 DSOLINK="-Wl,-rpath,$libdir"
278 DSONAME="libfltk.so.$FL_API_VERSION"
279 FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
280 GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
281 IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
282 CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
283 DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared -fPIC $DEBUGFLAG -o"
284 if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib64"; then
285 DSOLINK="-Wl,-rpath,$libdir"
289 DSONAME="libfltk_s.a"
290 FLDSONAME="libfltk_forms_s.a"
291 GLDSONAME="libfltk_gl_s.a"
292 IMGDSONAME="libfltk_images_s.a"
293 CAIRODSONAME="libfltk_cairo_s.a"
294 DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-bexpall,-bM:SRE,-bnoentry -o"
299 if test x$enable_cygwin != xyes; then
300 DSONAME="mgwfltknox-$FL_API_VERSION.dll"
301 FLDSONAME="mgwfltknox_forms-$FL_API_VERSION.dll"
302 GLDSONAME="mgwfltknox_gl-$FL_API_VERSION.dll"
303 IMGDSONAME="mgwfltknox_images-$FL_API_VERSION.dll"
304 CAIRODSONAME="mgwfltknox_cairo-$FL_API_VERSION.dll"
306 if test x$enable_x11 = xyes; then
307 DSONAME="cygfltk-$FL_API_VERSION.dll"
308 FLDSONAME="cygfltk_forms-$FL_API_VERSION.dll"
309 GLDSONAME="cygfltk_gl-$FL_API_VERSION.dll"
310 IMGDSONAME="cygfltk_images-$FL_API_VERSION.dll"
311 CAIRODSONAME="cygfltk_cairo-$FL_API_VERSION.dll"
313 DSONAME="cygfltknox-$FL_API_VERSION.dll"
314 FLDSONAME="cygfltknox_forms-$FL_API_VERSION.dll"
315 GLDSONAME="cygfltknox_gl-$FL_API_VERSION.dll"
316 IMGDSONAME="cygfltknox_images-$FL_API_VERSION.dll"
317 CAIRODSONAME="cygfltknox_cairo-$FL_API_VERSION.dll"
320 #-----------------------------------------------------------
321 # -Wl,--enable-runtime-pseudo-reloc: See str 1585
322 # appears to be necessary for older binutils versions < 2.16
323 #-----------------------------------------------------------
324 LDFLAGS="$LDFLAGS -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
325 DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -shared \
326 -Wl,--whole-archive -Wl,--export-all-symbols \
327 -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-import \
328 -Wl,--enable-auto-image-base -o \$@"
331 AC_MSG_WARN(Shared libraries may not be supported. Trying -shared option with compiler.)
332 DSONAME="libfltk.so.$FL_API_VERSION"
333 FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
334 GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
335 IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
336 CAIRODSONAME="libfltk_cairo.so.$FL_API_VERSION"
337 DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared $DEBUGFLAG -o"
341 LINKSHARED="-L../src $FLTKCAIROOPTION -lfltk_images$SHAREDSUFFIX -lfltk_forms$SHAREDSUFFIX -lfltk$SHAREDSUFFIX"
353 LINKSHARED="$LINKFLTKCAIRO ../lib/libfltk_images.a ../lib/libfltk_forms.a ../lib/libfltk.a"
363 AC_SUBST(CAIRODSONAME)
364 AC_SUBST(SHAREDSUFFIX)
368 AC_ARG_ENABLE(threads, [ --enable-threads enable multi-threading support (default=yes)])
370 AC_ARG_WITH(optim, [ --with-optim="flags" use custom optimization flags])
372 AC_ARG_WITH(archflags, [ --with-archflags="flags"
373 use custom architecture flags
374 (possible Mac OS X values include -arch i386, -arch x86_64, -arch ppc)],
375 ARCHFLAGS="$withval")
378 # QD is not supported anymore since 1.3
379 AC_DEFINE(__APPLE_QUARTZ__)
389 INSTALL="`pwd`/install-sh -c"
392 if test "$INSTALL" = "$ac_install_sh"; then
393 # Use full path to install-sh script...
394 INSTALL="`pwd`/install-sh -c"
396 AC_PATH_PROG(NROFF,nroff)
397 if test "x$NROFF" = "x:"; then
398 # Try groff instead of nroff...
399 AC_PATH_PROG(GROFF,groff)
400 if test "x$GROFF" = "x:"; then
403 NROFF="$GROFF -T ascii"
406 AC_PATH_PROG(HTMLDOC,htmldoc)
407 AC_PATH_PROG(DOXYDOC,doxygen)
409 dnl How do we make libraries?
413 if test "x$AR" = "x:"; then
414 AC_MSG_ERROR(Configure could not find the library archiver, aborting.)
417 if test "x$RANLIB" != "x:"; then
425 dnl how to compile (Windows) resource files
426 dnl this will only be used to compile resources for Windows .exe files
427 AC_PATH_TOOL(RC,windres)
429 dnl Architecture checks...
430 if test "$uname" != Darwin; then
434 AC_CHECK_SIZEOF(short, 2)
435 AC_CHECK_SIZEOF(int, 4)
436 AC_CHECK_SIZEOF(long, 4)
437 if test $ac_cv_sizeof_short -eq 2; then
438 AC_DEFINE(U16,unsigned short)
440 if test $ac_cv_sizeof_int -eq 4; then
441 AC_DEFINE(U32,unsigned)
443 if test $ac_cv_sizeof_long -eq 4; then
444 AC_DEFINE(U32,unsigned long)
447 if test "$uname" != Darwin; then
448 if test $ac_cv_sizeof_int -eq 8; then
449 AC_DEFINE(U64,unsigned)
451 if test $ac_cv_sizeof_long -eq 8; then
452 AC_DEFINE(U64,unsigned long)
457 dnl Does the C++ compiler support the bool type?
458 AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type,
463 int f(int x){return 1;}
464 int f(char x){return 1;}
465 int f(bool x){return 1;}
469 ], ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no)
473 if test "$ac_cv_cxx_bool" != yes; then
474 CXXFLAGS="-Dbool=char -Dfalse=0 -Dtrue=1 $CXXFLAGS"
477 dnl Standard headers and functions...
479 AC_CHECK_HEADER(sys/select.h,AC_DEFINE(HAVE_SYS_SELECT_H))
480 AC_CHECK_HEADER(sys/stdtypes.h,AC_DEFINE(HAVE_SYS_SELECT_H))
482 dnl Do we have the POSIX compatible scandir() prototype?
483 AC_CACHE_CHECK([whether we have the POSIX compatible scandir() prototype],
484 ac_cv_cxx_scandir_posix,[
489 int func (const char *d, dirent ***list, void *sort) {
490 int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort);
493 ], ac_cv_cxx_scandir_posix=yes, ac_cv_cxx_scandir_posix=no)
497 dnl Define both HAVE_SCANDIR... macros, if the POSIX compatible function is
498 dnl available. Otherwise: check, whether any scandir prototype is available,
499 dnl but don't use it on SunOS and QNX because of an incompatibility in pre-Y2K
500 dnl SunOS scandir versions. We assume, though, that the POSIX compatible
501 dnl version on newer SunOS/Solaris versions works as expected.
502 if test "$ac_cv_cxx_scandir_posix" = yes; then
503 AC_DEFINE(HAVE_SCANDIR)
504 AC_DEFINE(HAVE_SCANDIR_POSIX)
506 AC_CHECK_FUNC(scandir,
507 if test "x$uname" = xSunOS -o "x$uname" = xQNX; then
508 AC_MSG_WARN(Not using $uname scandir emulation function.)
510 AC_DEFINE(HAVE_SCANDIR)
514 AC_CHECK_FUNC(vsnprintf,[
517 if test "$uversion" = "1020"; then
518 AC_MSG_WARN(Not using built-in vsnprintf function because you are running HP-UX 10.20.)
520 AC_DEFINE(HAVE_VSNPRINTF)
525 if test "$uversion" = "40"; then
526 AC_MSG_WARN(Not using built-in vsnprintf function because you are running Tru64 4.0.)
528 AC_DEFINE(HAVE_VSNPRINTF)
533 AC_DEFINE(HAVE_VSNPRINTF)
536 AC_CHECK_FUNC(snprintf,[
539 if test "$uversion" = "1020"; then
540 AC_MSG_WARN(Not using built-in snprintf function because you are running HP-UX 10.20.)
542 AC_DEFINE(HAVE_SNPRINTF)
547 if test "$uversion" = "40"; then
548 AC_MSG_WARN(Not using built-in snprintf function because you are running Tru64 4.0.)
550 AC_DEFINE(HAVE_SNPRINTF)
555 AC_DEFINE(HAVE_SNPRINTF)
558 AC_CHECK_HEADER(strings.h, AC_DEFINE(HAVE_STRINGS_H))
559 AC_CHECK_FUNCS(strcasecmp strlcat strlcpy)
561 AC_CHECK_HEADER(locale.h, AC_DEFINE(HAVE_LOCALE_H))
562 AC_CHECK_FUNCS(localeconv)
564 dnl FLTK library uses math library functions...
565 AC_SEARCH_LIBS(pow, m)
567 dnl Check for largefile support...
570 dnl Define largefile options as needed...
572 if test x$enable_largefile != xno; then
573 LARGEFILE="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
575 if test x$ac_cv_sys_large_files = x1; then
576 LARGEFILE="$LARGEFILE -D_LARGE_FILES"
579 if test x$ac_cv_sys_file_offset_bits = x64; then
580 LARGEFILE="$LARGEFILE -D_FILE_OFFSET_BITS=64"
585 dnl Check for "long long" support...
586 AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
587 [if test "$GCC" = yes; then
588 ac_cv_c_long_long=yes
590 AC_TRY_COMPILE(,[long long int i;],
591 ac_cv_c_long_long=yes,
592 ac_cv_c_long_long=no)
595 if test $ac_cv_c_long_long = yes; then
596 AC_DEFINE(HAVE_LONG_LONG)
599 AC_CHECK_FUNC(strtoll, AC_DEFINE(HAVE_STRTOLL))
601 dnl Check for dlopen/dlsym...
602 AC_SEARCH_LIBS(dlsym, dl, AC_DEFINE(HAVE_DLSYM))
603 AC_CHECK_HEADER(dlfcn.h, AC_DEFINE(HAVE_DLFCN_H))
605 dnl Check for audio libraries...
610 dnl Cygwin environment...
615 AUDIOLIBS="-framework CoreAudio"
619 AC_CHECK_HEADER(alsa/asoundlib.h,
620 AC_DEFINE(HAVE_ALSA_ASOUNDLIB_H)
621 AUDIOLIBS="-lasound")
627 dnl Check for image libraries...
633 AC_SUBST(STATICIMAGELIBS)
635 # Handle the JPEG lib linking mode (use fltk local or system lib)
636 # If --enable-(resp. --disable-)localjpeg parameter is not set by user
637 # Then we check the JPEG lib usability, with result in sysjpeglib_ok variable
638 AC_ARG_ENABLE(localjpeg, [ --enable-localjpeg use local JPEG library, default=auto])
639 # Check for System lib use if automatic mode or --disable-localjpeg is requested
642 if test x$enable_localjpeg != xyes; then
643 AC_CHECK_LIB(jpeg,jpeg_CreateCompress,
644 [AC_CHECK_HEADER(jpeglib.h,
646 if test x$sysjpeginc_ok = xyes; then
650 # Now set the jpeg lib and include flags according to the requested mode and availability
651 if test x$enable_localjpeg = xyes -o x$sysjpeglib_ok = xno; then
654 IMAGELIBS="-lfltk_jpeg $IMAGELIBS"
655 STATICIMAGELIBS="\$libdir/libfltk_jpeg.a $STATICIMAGELIBS"
656 AC_DEFINE(HAVE_LIBJPEG)
657 #ac_cv_lib_jpeg_jpeg_CreateCompress=no # from ima: should not be necessary
658 # Finally, warn user if system lib was requested but not found
659 if test x$enable_localjpeg = xno; then
660 AC_MSG_WARN(Cannot find system jpeg lib or header: choosing the local lib mode.)
665 IMAGELIBS="-ljpeg $IMAGELIBS"
666 STATICIMAGELIBS="-ljpeg $STATICIMAGELIBS"
667 AC_DEFINE(HAVE_LIBJPEG)
670 # Handle the ZLIB lib linking mode (use fltk local or system lib)
671 # If --enable-(resp. --disable-)localzlib parameter is not set by user
672 # Then we check the ZLIB lib usability, with result in syszlib_ok variable
673 AC_ARG_ENABLE(localzlib, [ --enable-localzlib use local ZLIB library, default=auto])
674 # Check for System lib use if automatic mode or --disable-localzlib is requested
677 if test x$enable_localzlib != xyes; then
678 AC_CHECK_LIB(z,gzgets,
679 [AC_CHECK_HEADER(zlib.h,
681 if test x$syszinc_ok = xyes; then
685 # Now set the Z lib and include flags according to the requested mode and availability
686 if test x$enable_localzlib = xyes -o x$syszlib_ok = xno ; then
689 LIBS="-lfltk_z $LIBS"
690 IMAGELIBS="-lfltk_z $IMAGELIBS"
691 STATICIMAGELIBS="\$libdir/libfltk_z.a $STATICIMAGELIBS"
693 ac_cv_lib_z_gzgets=no # fc: is still necessary ?
694 # Finally, warn user if system lib was requested but not found
695 if test x$enable_localzlib = xno; then
696 AC_MSG_WARN(Cannot find system z lib or header: choosing the local lib mode.)
702 IMAGELIBS="-lz $IMAGELIBS"
703 STATICIMAGELIBS="-lz $STATICIMAGELIBS"
707 # Handle the PNG lib linking mode (use fltk local or system lib)
708 # If --enable-(resp. --disable-)localpng parameter is not set by user
709 # Then we check the png lib usability with result in syspng_lib variable
710 AC_ARG_ENABLE(localpng, [ --enable-localpng use local PNG library, default=auto])
712 # Now check if system lib is usable, we check Lib AND include availability with inc variant,
713 # but only, if the builtin lib is not requested
716 if test x$enable_localpng != xyes; then
717 AC_CHECK_LIB(png, png_read_info,
718 [AC_CHECK_HEADER(png.h,
719 AC_DEFINE(HAVE_PNG_H)
721 AC_CHECK_HEADER(libpng/png.h,
722 AC_DEFINE(HAVE_LIBPNG_PNG_H)
724 if test x$syspnginc_ok = xyes; then
729 # The following is executed if the lib was not found usable or if local lib is required explicitly
730 if test x$enable_localpng = xyes -o x$syspnglib_ok = xno ; then
733 IMAGELIBS="-lfltk_png $IMAGELIBS"
734 STATICIMAGELIBS="\$libdir/libfltk_png.a $STATICIMAGELIBS"
735 AC_DEFINE(HAVE_LIBPNG)
736 AC_DEFINE(HAVE_PNG_H)
737 AC_DEFINE(HAVE_PNG_GET_VALID)
738 AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA)
739 # Finally, warn user if system lib was requested but not found
740 if test x$enable_localpng = xno; then
741 AC_MSG_WARN(Cannot find system png lib or header: choosing the local lib mode.)
746 IMAGELIBS="-lpng $IMAGELIBS"
747 STATICIMAGELIBS="-lpng $STATICIMAGELIBS"
748 AC_DEFINE(HAVE_LIBPNG)
749 AC_CHECK_LIB(png,png_get_valid, AC_DEFINE(HAVE_PNG_GET_VALID))
750 AC_CHECK_LIB(png,png_set_tRNS_to_alpha, AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA))
760 dnl Restore original LIBS settings...
763 dnl See if we need a .exe extension on executables...
766 dnl Check for pthreads for multi-threaded apps...
770 dnl Test whether we want to check for pthreads. We must not do it on Windows
771 dnl unless we run under Cygwin with --enable-cygwin, since we always use
772 dnl native threads on Windows (even if libpthread is available)
779 if test "x$enable_cygwin" != xyes; then
787 if test "x$enable_threads" != xno -a x$check_pthread = xyes; then
788 AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
790 if test x$ac_cv_header_pthread_h = xyes; then
791 dnl Check various threading options for the platforms we support
792 for flag in -lpthreads -lpthread -pthread; do
793 AC_MSG_CHECKING([for pthread_create using $flag])
796 AC_TRY_LINK([#include <pthread.h>],
797 [pthread_create(0, 0, 0, 0);],
800 AC_MSG_RESULT([$have_pthread])
802 if test $have_pthread = yes; then
803 AC_DEFINE(HAVE_PTHREAD)
804 PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT"
806 # Solaris requires -D_POSIX_PTHREAD_SEMANTICS to
807 # be POSIX-compliant... :(
808 if test $uname = SunOS; then
809 PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
817 AC_SUBST(PTHREAD_FLAGS)
819 dnl Define OS-specific stuff...
824 AC_ARG_WITH(links, [ --with-links make header links for common misspellings (default=no)])
831 dnl Cygwin environment, using windows GDI ...
832 # Recent versions of Cygwin are seriously broken and the size
833 # checks don't work because the shell puts out \r\n instead of
834 # \n. Here we just force U32 to be defined to "unsigned"...
835 AC_DEFINE(U32,unsigned)
836 CFLAGS="-mwindows -DWIN32 -DUSE_OPENGL32 $CFLAGS"
837 CXXFLAGS="-mwindows -DWIN32 -DUSE_OPENGL32 $CXXFLAGS"
838 LDFLAGS="-mwindows $LDFLAGS"
839 DSOFLAGS="-mwindows $DSOFLAGS"
840 LIBS="$LIBS -lole32 -luuid -lcomctl32"
841 if test "x$with_optim" = x; then
842 dnl Avoid -Os optimization on Cygwin/MinGW
846 if test x$enable_gl != xno; then
847 AC_CHECK_HEADER(GL/gl.h,
850 AC_CHECK_HEADER(GL/glu.h,
851 AC_DEFINE(HAVE_GL_GLU_H)
852 GLLIB="-lglu32 $GLLIB")
860 if test "x$enable_threads" != xno; then
861 if test x$have_pthread = xyes; then
862 AC_DEFINE(HAVE_PTHREAD)
866 THREADS="threads$EXEEXT"
868 # Don't make symlinks since Windows is not case sensitive.
869 if test "x$with_links" != xyes; then
875 # MacOS X uses Cocoa for graphics.
876 LIBS="$LIBS -framework Cocoa"
878 if test x$have_pthread = xyes; then
879 AC_DEFINE(HAVE_PTHREAD)
880 THREADS="threads$EXEEXT"
883 if test x$enable_gl != xno; then
885 AC_DEFINE(HAVE_GL_GLU_H)
886 GLLIB="-framework AGL -framework OpenGL -framework ApplicationServices"
894 # Don't make symlinks because HFS+ is not case sensitive...
895 if test "x$with_links" != xyes; then
899 # Some steps are only done for OS X package management
902 # Install/Uninstall FLUID application
903 INSTALL_DESKTOP="install-osx"
904 UNINSTALL_DESKTOP="uninstall-osx"
908 # All others are UNIX/X11...
909 # This includes Cygwin target combined with X11
910 if test x$have_pthread = xyes; then
911 AC_DEFINE(HAVE_PTHREAD)
912 THREADS="threads$EXEEXT"
918 if test x$no_x = xyes; then
919 AC_MSG_ERROR(Configure could not find required X11 libraries, aborting.)
922 if test "x$X_PRE_LIBS" != x; then
923 AC_MSG_WARN(Ignoring libraries \"$X_PRE_LIBS\" requested by configure.)
926 LIBS="$LIBS -lX11 $X_EXTRA_LIBS"
927 CFLAGS="$CFLAGS $X_CFLAGS"
928 CXXFLAGS="$CXXFLAGS $X_CFLAGS"
929 LDFLAGS="$X_LIBS $LDFLAGS"
930 DSOFLAGS="$X_LIBS $DSOFLAGS"
932 if test "x$x_includes" != x; then
933 ac_cpp="$ac_cpp -I$x_includes"
936 dnl Check for OpenGL unless disabled...
939 if test x$enable_gl != xno; then
940 AC_SEARCH_LIBS(dlopen, dl)
941 AC_CHECK_HEADER(GL/gl.h,
942 AC_CHECK_LIB(GL, glXMakeCurrent, AC_DEFINE(HAVE_GL) GLLIB="-lGL",
943 AC_CHECK_LIB(MesaGL,glXMakeCurrent, AC_DEFINE(HAVE_GL) GLLIB=" -lMesaGL",,
946 AC_CHECK_LIB(GL, glXGetProcAddressARB,
947 AC_DEFINE(HAVE_GLXGETPROCADDRESSARB),, -lm)
949 AC_CHECK_HEADER(GL/glu.h,
950 AC_DEFINE(HAVE_GL_GLU_H)
951 if test x$ac_cv_lib_GL_glXMakeCurrent = xyes; then
954 if test x$ac_cv_lib_MesaGL_glXMakeCurrent = xyes; then
955 GLLIB="-lMesaGLU $GLLIB"
959 if test x$ac_cv_lib_GL_glXMakeCurrent != xyes -a x$ac_cv_lib_MesaGL_glXMakeCurrent != xyes; then
972 dnl Check for Xinerama support unless disabled...
973 AC_ARG_ENABLE(xinerama, [ --enable-xinerama turn on Xinerama support [default=yes]])
975 if test x$enable_xinerama != xno; then
976 AC_CHECK_LIB(Xinerama,XineramaIsActive,
977 AC_DEFINE(HAVE_XINERAMA)
978 LIBS="-lXinerama $LIBS")
981 dnl Check for the Xft library unless disabled...
982 AC_ARG_ENABLE(xft, [ --enable-xft turn on Xft support [default=yes]])
984 if test x$enable_xft != xno; then
985 AC_PATH_PROG(FTCONFIG,freetype-config)
987 if test "x$FTCONFIG" != x; then
988 CPPFLAGS="`$FTCONFIG --cflags` $CPPFLAGS"
989 CXXFLAGS="`$FTCONFIG --cflags` $CXXFLAGS"
991 AC_CHECK_LIB(fontconfig, FcPatternCreate)
992 AC_CHECK_HEADER(X11/Xft/Xft.h,
993 AC_CHECK_LIB(Xft, XftDrawCreate,
999 dnl Check for the Xdbe extension unless disabled...
1000 AC_ARG_ENABLE(xdbe, [ --enable-xdbe turn on Xdbe support [default=yes]])
1002 if test x$enable_xdbe != xno; then
1003 AC_CHECK_HEADER(X11/extensions/Xdbe.h, AC_DEFINE(HAVE_XDBE),,
1004 [#include <X11/Xlib.h>])
1005 AC_CHECK_LIB(Xext, XdbeQueryExtension,
1006 LIBS="-lXext $LIBS")
1009 dnl Check for overlay visuals...
1010 AC_PATH_PROG(XPROP, xprop)
1011 AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay,
1012 if test "x$XPROP" != x; then
1013 if $XPROP -root 2>/dev/null | grep -c "SERVER_OVERLAY_VISUALS" >/dev/null; then
1014 ac_cv_have_overlay=yes
1016 ac_cv_have_overlay=no
1019 ac_cv_have_overlay=no
1022 if test x$ac_cv_have_overlay = xyes; then
1023 AC_DEFINE(HAVE_OVERLAY)
1026 # Make symlinks since UNIX/Linux is case sensitive,
1027 # but Cygwin in general not.
1035 # Make symlinks since UNIX/Linux is case sensitive,
1036 # but only if explicitly configured (default=no)
1037 if test "x$with_links" != xyes; then
1041 # Install/Uninstall FLUID application support files
1042 INSTALL_DESKTOP="install-linux"
1043 UNINSTALL_DESKTOP="uninstall-linux"
1053 AC_SUBST(INSTALL_DESKTOP)
1054 AC_SUBST(UNINSTALL_DESKTOP)
1056 dnl Figure out the appropriate formatted man page extension...
1082 dnl Fix "mandir" variable...
1083 if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then
1085 *BSD* | Darwin* | Linux*)
1086 # *BSD, Darwin, and Linux
1087 mandir="\${prefix}/share/man"
1091 mandir="\${prefix}/share/catman"
1096 dnl Fix "libdir" variable...
1097 if test "$prefix" = NONE; then
1101 if test "$exec_prefix" = NONE; then
1102 exec_prefix="\${prefix}"
1105 if test "$uname" = "IRIX" -a $uversion -ge 62 -a "$libdir" = "\${exec_prefix}/lib" -a "$exec_prefix" = "\${prefix}" -a "$prefix" = "/usr"; then
1109 dnl Define the command used to update the dependencies (this option
1110 dnl mainly for FLTK core developers - not necessary for users)
1111 MAKEDEPEND="\$(CXX) -M"
1112 AC_SUBST(MAKEDEPEND)
1114 dnl Add warnings to compiler switches:
1115 dnl do this last so messing with switches does not break tests
1117 if test -n "$GCC"; then
1118 # Show all standard warnings + unused variables, conversion errors,
1119 # and inlining problems when compiling...
1120 OPTIM="-Wall -Wunused -Wno-format-y2k $OPTIM"
1122 # The following additional warnings are useful for tracking down problems...
1123 #OPTIM="-Wshadow -Wconversion $OPTIM"
1125 # We know that Carbon is deprecated on OS X 10.4. To avoid hundreds of warnings
1126 # we will temporarily disable 'deprecated' warnings on OS X.
1127 if test "$uname" = "Darwin" -a $uversion -ge 800; then
1128 OPTIM="-Wno-deprecated-declarations $OPTIM"
1131 # Set the default compiler optimizations...
1132 if test -z "$DEBUGFLAG"; then
1134 # Note: Can't use -fomit-frame-pointer - prevents tools like
1135 # libsafe from working!
1137 # Don't use -fforce-mem, -fforce-addr, or -fcaller-saves.
1138 # They all seem to make either no difference or enlarge
1139 # the code by a few hundred bytes.
1141 # "-Os" seems to be the best compromise between speed and
1142 # code size. "-O3" and higher seem to make no effective
1143 # difference in the speed of the code, but does bloat the
1147 if test "x$with_optim" != x; then
1148 OPTIM="$with_optim $OPTIM"
1154 # Generate position-independent code when needed...
1155 if test $PICFLAG = 1; then
1156 OPTIM="$OPTIM -fPIC"
1159 # See if GCC supports -fno-exceptions...
1160 AC_MSG_CHECKING(if GCC supports -fno-exceptions)
1162 CFLAGS="$CFLAGS -fno-exceptions"
1164 OPTIM="$OPTIM -fno-exceptions"
1169 # See if GCC supports -fno-strict-aliasing...
1170 AC_MSG_CHECKING(if GCC supports -fno-strict-aliasing)
1172 CFLAGS="$CFLAGS -fno-strict-aliasing"
1174 OPTIM="$OPTIM -fno-strict-aliasing"
1179 # See if we are running Solaris; if so, try the -fpermissive option...
1180 # This option is required on some versions of Solaris to work around
1181 # bugs in the X headers up through Solaris 7.
1183 # Unlike the other compiler/optimization settings, this one is placed
1184 # in CFLAGS and CXXFLAGS so that fltk-config will provide the option
1185 # to clients - otherwise client apps will not compile properly...
1186 if test "$uname" = SunOS; then
1187 AC_MSG_CHECKING(if GCC supports -fpermissive)
1190 CFLAGS="$CFLAGS -fpermissive"
1192 CXXFLAGS="$CXXFLAGS -fpermissive"
1200 # Running some flavor of IRIX; see which version and
1201 # set things up according...
1202 if test "$uversion" -ge 62; then
1203 # We are running IRIX 6.2 or higher; uncomment the following
1204 # lines if you don't have IDO 7.2 or higher:
1206 # CXX="CC -n32 -mips3"
1207 # CC="cc -n32 -mips3"
1208 # LD="ld -n32 -mips3"
1209 # MAKEDEPEND="CC -M"
1211 if test "x`grep abi=n32 /etc/compiler.defaults`" = x; then
1212 AC_MSG_WARN(FOR BEST RESULTS BEFORE COMPILING: setenv SGI_ABI \"-n32 -mips3\")
1215 OPTIM="-fullwarn $OPTIM"
1217 if test -z "$DEBUGFLAG"; then
1218 if test "x$with_optim" != x; then
1219 OPTIM="$with_optim $OPTIM"
1222 if test $uversion -gt 62; then
1223 OPTIM="-OPT:Olimit=4000 $OPTIM"
1229 # Running HP-UX; these options should work for the HP compilers.
1230 if test -z "$DEBUGFLAG"; then
1231 if test "x$with_optim" != x; then
1232 OPTIM="$with_optim $OPTIM"
1238 if test $PICFLAG = 1; then
1242 CXXFLAGS="$CXXFLAGS +W336,501,736,740,749,829"
1245 # Running Digital/Tru64 UNIX; these options should work for the
1246 # Digital/Compaq/NewHP compilers.
1247 if test -z "$DEBUGFLAG"; then
1248 if test "x$with_optim" != x; then
1249 OPTIM="$with_optim $OPTIM"
1257 if test -z "$DEBUGFLAG"; then
1258 if test "x$with_optim" != x; then
1259 OPTIM="$with_optim $OPTIM"
1265 if test $PICFLAG = 1; then
1266 OPTIM="-KPIC $OPTIM"
1270 if test -z "$DEBUGFLAG"; then
1271 if test "x$with_optim" != x; then
1272 OPTIM="$with_optim $OPTIM"
1278 AC_MSG_WARN(The AIX C and C++ compilers are known not to correctly compile the FLTK library.)
1281 # Running some other operating system; inform the user they
1282 # should contribute the necessary options via the STR form..
1283 AC_MSG_WARN(Building FLTK with default compiler optimizations)
1284 AC_MSG_WARN(Send the FLTK developers your uname and compiler options via http://www.fltk.org/str.php)
1289 OPTIM="$DEBUGFLAG $OPTIM"
1291 dnl Take archflags away from CFLAGS (makefiles use ARCHFLAGS explicitly)
1292 if test `uname` = Darwin; then
1293 if test "x$with_archflags" != x ; then
1294 CFLAGS="`echo $CFLAGS | sed -e "s/$with_archflags//g"`"
1298 dnl Define the FLTK documentation directory...
1301 # Determine the path where MSys has /usr installed
1302 msyspath=`mount | grep '\/usr' | grep -v '\/usr\/bin' | cut -d ' ' -f -1 | sed -e 's/\\\/\// g'`
1303 # Then substitute that in the WIN32 path instead of /usr
1304 AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "$msyspath/local/share/doc/fltk")
1307 if test x$prefix = xNONE; then
1308 AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "/usr/local/share/doc/fltk")
1310 AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "$prefix/share/doc/fltk")
1315 dnl Define the FLTK data directory...
1316 if test x$prefix = xNONE; then
1317 AC_DEFINE_UNQUOTED(FLTK_DATADIR, "/usr/local/share/fltk")
1319 AC_DEFINE_UNQUOTED(FLTK_DATADIR, "$prefix/share/fltk")
1322 dnl Summarize results of configure tests...
1324 echo "Configuration Summary"
1325 echo "-------------------------------------------------------------------------"
1336 if test x$enable_xft != xno; then
1337 graphics="$graphics+Xft"
1339 if test x$enable_xdbe != xno; then
1340 graphics="$graphics+Xdbe"
1342 if test x$enable_xinerama != xno; then
1343 graphics="$graphics+Xinerama"
1348 echo " Directories: prefix=$prefix"
1349 echo " bindir=$bindir"
1350 echo " datadir=$datadir"
1351 echo " datarootdir=$datarootdir"
1352 echo " exec_prefix=$exec_prefix"
1353 echo " includedir=$includedir"
1354 echo " libdir=$libdir"
1355 echo " mandir=$mandir"
1358 echo " MSys docpath=$msyspath/local/share/doc/fltk"
1361 echo " Graphics: $graphics"
1363 if test x$JPEG = x; then
1364 echo "Image Libraries: JPEG=System"
1366 echo "Image Libraries: JPEG=Builtin"
1368 if test x$PNG = x; then
1373 if test x$ZLIB = x; then
1376 echo " ZLIB=Builtin"
1378 if test x$enable_cairo = xyes; then
1381 if test x$enable_cairoext = xyes; then
1382 echo " CAIRO=internal_use"
1386 if test x$enable_largefile != xno; then
1387 echo " Large Files: YES"
1389 echo " Large Files: NO"
1392 if test x$GLDEMOS = x; then
1398 if test x$THREADS = x; then
1401 echo " Threads: YES"
1404 dnl Write all of the files...
1405 AC_CONFIG_HEADER(config.h:configh.in)
1406 AC_OUTPUT(makeinclude fltk.list fltk-config fltk.spec FL/Makefile)
1408 dnl Make sure the fltk-config script is executable...
1409 chmod +x fltk-config
1412 dnl End of "$Id: configure.in 8511 2011-03-06 16:54:58Z manolo $".