source: rtems-graphics-toolkit/fltk-1.3.0/configure.in @ 9183239

Last change on this file since 9183239 was d280eda, checked in by Alexandru-Sever Horin <alex.sever.h@…>, on 08/20/12 at 16:50:43

Added freetype library to link list for fltk

  • Property mode set to 100644
File size: 39.6 KB
Line 
1dnl -*- sh -*-
2dnl the "configure" script is made from this by running GNU "autoconf"
3dnl
4dnl "$Id: configure.in 8511 2011-03-06 16:54:58Z manolo $"
5dnl
6dnl Configuration script for the Fast Light Tool Kit (FLTK).
7dnl
8dnl Copyright 1998-2010 by Bill Spitzak and others.
9dnl
10dnl This library is free software; you can redistribute it and/or
11dnl modify it under the terms of the GNU Library General Public
12dnl License as published by the Free Software Foundation; either
13dnl version 2 of the License, or (at your option) any later version.
14dnl
15dnl This library is distributed in the hope that it will be useful,
16dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
17dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18dnl Library General Public License for more details.
19dnl
20dnl You should have received a copy of the GNU Library General Public
21dnl License along with this library; if not, write to the Free Software
22dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23dnl USA.
24dnl
25dnl Please report all bugs and problems on the following page:
26dnl
27dnl      http://www.fltk.org/str.php
28dnl
29
30dnl We need at least autoconf 2.50...
31AC_PREREQ(2.50)
32
33dnl Required file in package...
34AC_INIT(src/Fl.cxx)
35
36dnl So --with-archflags option is used during "checking size of long"
37if test `uname` = Darwin; then
38  if test "x$with_archflags" != x ; then
39    CFLAGS="$CFLAGS $with_archflags"
40  fi
41  USEMMFILES="Yes"
42else
43  USEMMFILES="No"
44fi
45AC_SUBST(USEMMFILES)
46
47dnl FLTK library versions...
48FL_MAJOR_VERSION=1
49FL_MINOR_VERSION=3
50FL_PATCH_VERSION=0
51FL_API_VERSION=${FL_MAJOR_VERSION}.${FL_MINOR_VERSION}
52
53AC_SUBST(FL_MAJOR_VERSION)
54AC_SUBST(FL_MINOR_VERSION)
55AC_SUBST(FL_PATCH_VERSION)
56AC_SUBST(FL_API_VERSION)
57
58dnl Get the operating system and version number...
59uname=`uname`
60uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'`
61if test "x$uname" = xIRIX64; then
62    uname="IRIX"
63fi
64if 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...
67    uname="MINGW"
68fi
69
70dnl Do not automatically add "-g" to compiler options...
71ARCHFLAGS="${ARCHFLAGS:=}"
72CFLAGS="${CFLAGS:=}"
73CPPFLAGS="${CPPFLAGS:=}"
74CXXFLAGS="${CXXFLAGS:=}"
75DSOFLAGS="${DSOFLAGS:=}"
76LDFLAGS="${LDFLAGS:=}"
77OPTIM="${OPTIM:=}"
78
79AC_SUBST(ARCHFLAGS)
80AC_SUBST(OPTIM)
81
82dnl in case of cross-compiling mingw32 under linux we must change uname for Win32 GUI
83dnl run ./configure --host=i686-pc-ming32 try use X11 without change uname
84if test "x$cross_compiling" != xno ; then
85  case $host_alias in
86    *mingw*)
87    uname=MINGW
88    ;;
89  esac
90fi
91
92dnl OS-specific pre-tests...
93dnl uname_GUI equals $uname unless we target Cygwin in combination with X11.
94uname_GUI=$uname
95case $uname in
96    CYGWIN*)
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"
109        else
110            # we target Cygwin in combination with X11
111            if test x$enable_x11 = xyes; then
112                uname_GUI="X11$uname"
113            fi
114        fi
115        ;;
116esac
117
118dnl Define the libraries and link options we will need.
119LINKFLTK="../lib/libfltk.a"
120LINKFLTKFORMS="../lib/libfltk_forms.a"
121LINKFLTKGL="../lib/libfltk_gl.a"
122LINKFLTKIMG="../lib/libfltk_images.a"
123GLDEMOS="gldemos"
124
125LIBEXT=".a"
126LIBNAME="../lib/libfltk.a"
127FLLIBNAME="../lib/libfltk_forms.a"
128GLLIBNAME="../lib/libfltk_gl.a"
129IMGLIBNAME="../lib/libfltk_images.a"
130CAIROLIBNAME="../lib/libfltk_cairo.a"
131
132LIBBASENAME="libfltk.a"
133FLLIBBASENAME="libfltk_forms.a"
134GLLIBBASENAME="libfltk_gl.a"
135IMGLIBBASENAME="libfltk_images.a"
136CAIROLIBBASENAME="libfltk_cairo.a"
137
138dnl Check for Cairo library unless disabled...
139CAIRODIR=""
140CAIROFLAGS=""
141LINKFLTKCAIRO=""
142FLTKCAIROOPTION=""
143CAIROLIBS=""
144
145AC_ARG_ENABLE(cairoext,[  --enable-cairoext       use fltk code instrumentation for cairo extended use (default=no)])
146AC_ARG_ENABLE(cairo,[  --enable-cairo          use lib Cairo  (default=no)])
147
148if 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 .
153          CAIRODIR="cairo"
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"
160          dnl $LINKFLTKCAIRO
161          LINKFLTK+=" $LINKFLTKCAIRO"
162else
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 .
167          CAIRODIR="cairo"
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"
173    fi
174fi
175
176AC_SUBST(CAIRODIR)
177AC_SUBST(CAIROFLAGS)
178AC_SUBST(CAIROLIBS)
179AC_SUBST(LINKFLTKCAIRO)
180AC_SUBST(FLTKCAIROOPTION)
181
182
183AC_SUBST(FLLIBNAME)
184AC_SUBST(GLDEMOS)
185AC_SUBST(GLLIBNAME)
186AC_SUBST(IMGLIBNAME)
187AC_SUBST(CAIROLIBNAME)
188AC_SUBST(LIBEXT)
189AC_SUBST(LIBNAME)
190AC_SUBST(LINKFLTK)
191AC_SUBST(LINKFLTKFORMS)
192AC_SUBST(LINKFLTKGL)
193AC_SUBST(LINKFLTKIMG)
194
195AC_SUBST(LIBBASENAME)
196AC_SUBST(FLLIBBASENAME)
197AC_SUBST(GLLIBBASENAME)
198AC_SUBST(IMGLIBBASENAME)
199AC_SUBST(CAIROLIBBASENAME)
200
201dnl Handle compile-time options...
202AC_ARG_ENABLE(debug, [  --enable-debug          turn on debugging [default=no]])
203if test x$enable_debug = xyes; then
204    DEBUGFLAG="-g "
205else
206    DEBUGFLAG=""
207fi
208
209AC_ARG_ENABLE(cp936, [  --enable-cp936          turn on CP936 [default=no]])
210if test x$enable_cp936 = xyes; then
211    CFLAGS="$CFLAGS -DCP936"
212fi
213
214
215AC_ARG_ENABLE(gl, [  --enable-gl             turn on OpenGL support [default=yes]])
216
217AC_ARG_ENABLE(shared, [  --enable-shared         turn on shared libraries [default=no]])
218if test x$enable_shared = xyes; then
219    PICFLAG=1
220    SHAREDSUFFIX=""
221    FLUID="fluid-shared"
222
223    case $uname in
224        Darwin*)
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"
231            ;;
232
233        SunOS* | UNIX_S*)
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
241                    DSOLINK="-R$libdir"
242            fi
243            ;;
244        HP-UX*)
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"
253            fi
254            ;;
255        IRIX*)
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"
264            fi
265            ;;
266        OSF1*)
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"
275            fi
276            ;;
277        Linux* | *BSD*)
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"
286            fi
287            ;;
288        AIX*)
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"
295            SHAREDSUFFIX="_s"
296            ;;
297        CYGWIN* | MINGW*)
298            PICFLAG=0
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"
305            else
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"
312                else
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"
318                fi
319            fi
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 \$@"
329            ;;
330        *)
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"
338            ;;
339    esac
340
341    LINKSHARED="-L../src $FLTKCAIROOPTION -lfltk_images$SHAREDSUFFIX -lfltk_forms$SHAREDSUFFIX -lfltk$SHAREDSUFFIX"
342else
343    DSOCOMMAND="echo"
344    DSOLINK=""
345    DSONAME=""
346    FLDSONAME=""
347    GLDSONAME=""
348    IMGDSONAME=""
349    CAIRODSONAME=""
350    PICFLAG=0
351    SHAREDSUFFIX=""
352    FLUID="fluid"
353    LINKSHARED="$LINKFLTKCAIRO ../lib/libfltk_images.a ../lib/libfltk_forms.a ../lib/libfltk.a"
354fi
355
356AC_SUBST(DSOCOMMAND)
357AC_SUBST(DSOFLAGS)
358AC_SUBST(DSOLINK)
359AC_SUBST(DSONAME)
360AC_SUBST(FLDSONAME)
361AC_SUBST(GLDSONAME)
362AC_SUBST(IMGDSONAME)
363AC_SUBST(CAIRODSONAME)
364AC_SUBST(SHAREDSUFFIX)
365AC_SUBST(LINKSHARED)
366AC_SUBST(FLUID)
367
368AC_ARG_ENABLE(threads, [  --enable-threads        enable multi-threading support (default=yes)])
369
370AC_ARG_WITH(optim, [  --with-optim="flags"    use custom optimization flags])
371
372AC_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")
376case $uname in
377    Darwin*)
378# QD is not supported anymore since 1.3
379        AC_DEFINE(__APPLE_QUARTZ__)
380        ;;
381esac
382
383dnl Find commands...
384AC_PROG_CC
385AC_PROG_CXX
386AC_PROG_INSTALL
387case $uname in
388    OSF1*)
389        INSTALL="`pwd`/install-sh -c"
390        ;;
391esac
392if test "$INSTALL" = "$ac_install_sh"; then
393    # Use full path to install-sh script...
394    INSTALL="`pwd`/install-sh -c"
395fi
396AC_PATH_PROG(NROFF,nroff)
397if test "x$NROFF" = "x:"; then
398    # Try groff instead of nroff...
399    AC_PATH_PROG(GROFF,groff)
400    if test "x$GROFF" = "x:"; then
401        NROFF="echo"
402    else
403        NROFF="$GROFF -T ascii"
404    fi
405fi
406AC_PATH_PROG(HTMLDOC,htmldoc)
407AC_PATH_PROG(DOXYDOC,doxygen)
408
409dnl How do we make libraries?
410AC_PROG_RANLIB
411AC_PATH_TOOL(AR, ar)
412
413if test "x$AR" = "x:"; then
414    AC_MSG_ERROR(Configure could not find the library archiver, aborting.)
415fi
416
417if test "x$RANLIB" != "x:"; then
418    LIBCOMMAND="$AR cr"
419else
420    LIBCOMMAND="$AR crs"
421fi
422
423AC_SUBST(LIBCOMMAND)
424
425dnl how to compile (Windows) resource files
426dnl this will only be used to compile resources for Windows .exe files
427AC_PATH_TOOL(RC,windres)
428
429dnl Architecture checks...
430if test "$uname" != Darwin; then
431  AC_C_BIGENDIAN
432fi
433
434AC_CHECK_SIZEOF(short, 2)
435AC_CHECK_SIZEOF(int, 4)
436AC_CHECK_SIZEOF(long, 4)
437if test $ac_cv_sizeof_short -eq 2; then
438    AC_DEFINE(U16,unsigned short)
439fi
440if test $ac_cv_sizeof_int -eq 4; then
441    AC_DEFINE(U32,unsigned)
442else
443    if test $ac_cv_sizeof_long -eq 4; then
444        AC_DEFINE(U32,unsigned long)
445    fi
446fi
447if test "$uname" != Darwin; then
448        if test $ac_cv_sizeof_int -eq 8; then
449                AC_DEFINE(U64,unsigned)
450        else
451                if test $ac_cv_sizeof_long -eq 8; then
452                        AC_DEFINE(U64,unsigned long)
453                fi
454        fi
455fi
456
457dnl Does the C++ compiler support the bool type?
458AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type,
459    ac_cv_cxx_bool,[
460        AC_LANG_SAVE
461        AC_LANG_CPLUSPLUS
462        AC_TRY_COMPILE([
463            int f(int  x){return 1;}
464            int f(char x){return 1;}
465            int f(bool x){return 1;}
466        ],[
467            bool b = true;
468            return f(b);
469        ], ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no)
470        AC_LANG_RESTORE
471    ])
472
473if test "$ac_cv_cxx_bool" != yes; then
474    CXXFLAGS="-Dbool=char -Dfalse=0 -Dtrue=1 $CXXFLAGS"
475fi
476
477dnl Standard headers and functions...
478AC_HEADER_DIRENT
479AC_CHECK_HEADER(sys/select.h,AC_DEFINE(HAVE_SYS_SELECT_H))
480AC_CHECK_HEADER(sys/stdtypes.h,AC_DEFINE(HAVE_SYS_SELECT_H))
481
482dnl Do we have the POSIX compatible scandir() prototype?
483AC_CACHE_CHECK([whether we have the POSIX compatible scandir() prototype],
484    ac_cv_cxx_scandir_posix,[
485        AC_LANG_SAVE
486        AC_LANG_CPLUSPLUS
487        AC_TRY_COMPILE([
488          #include <dirent.h>
489          int func (const char *d, dirent ***list, void *sort) {
490            int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort);
491          }
492        ],[
493        ], ac_cv_cxx_scandir_posix=yes, ac_cv_cxx_scandir_posix=no)
494        AC_LANG_RESTORE
495    ])
496
497dnl Define both HAVE_SCANDIR... macros, if the POSIX compatible function is
498dnl available. Otherwise: check, whether any scandir prototype is available,
499dnl but don't use it on SunOS and QNX because of an incompatibility in pre-Y2K
500dnl SunOS scandir versions. We assume, though, that the POSIX compatible
501dnl version on newer SunOS/Solaris versions works as expected.
502if test "$ac_cv_cxx_scandir_posix" = yes; then
503    AC_DEFINE(HAVE_SCANDIR)
504    AC_DEFINE(HAVE_SCANDIR_POSIX)
505else
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.)
509        else
510            AC_DEFINE(HAVE_SCANDIR)
511        fi)
512fi
513
514AC_CHECK_FUNC(vsnprintf,[
515    case "$uname" in
516        HP-UX*)
517            if test "$uversion" = "1020"; then
518                AC_MSG_WARN(Not using built-in vsnprintf function because you are running HP-UX 10.20.)
519            else
520                AC_DEFINE(HAVE_VSNPRINTF)
521            fi
522            ;;
523
524        OSF1*)
525            if test "$uversion" = "40"; then
526                AC_MSG_WARN(Not using built-in vsnprintf function because you are running Tru64 4.0.)
527            else
528                AC_DEFINE(HAVE_VSNPRINTF)
529            fi
530            ;;
531
532        *)
533            AC_DEFINE(HAVE_VSNPRINTF)
534            ;;
535    esac])
536AC_CHECK_FUNC(snprintf,[
537    case "$uname" in
538        HP-UX*)
539            if test "$uversion" = "1020"; then
540                AC_MSG_WARN(Not using built-in snprintf function because you are running HP-UX 10.20.)
541            else
542                AC_DEFINE(HAVE_SNPRINTF)
543            fi
544            ;;
545
546        OSF1*)
547            if test "$uversion" = "40"; then
548                AC_MSG_WARN(Not using built-in snprintf function because you are running Tru64 4.0.)
549            else
550                AC_DEFINE(HAVE_SNPRINTF)
551            fi
552            ;;
553
554        *)
555            AC_DEFINE(HAVE_SNPRINTF)
556            ;;
557    esac])
558AC_CHECK_HEADER(strings.h, AC_DEFINE(HAVE_STRINGS_H))
559AC_CHECK_FUNCS(strcasecmp strlcat strlcpy)
560
561AC_CHECK_HEADER(locale.h, AC_DEFINE(HAVE_LOCALE_H))
562AC_CHECK_FUNCS(localeconv)
563
564dnl FLTK library uses math library functions...
565AC_SEARCH_LIBS(pow, m)
566
567dnl Check for largefile support...
568AC_SYS_LARGEFILE
569
570dnl Define largefile options as needed...
571LARGEFILE=""
572if test x$enable_largefile != xno; then
573        LARGEFILE="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
574
575        if test x$ac_cv_sys_large_files = x1; then
576                LARGEFILE="$LARGEFILE -D_LARGE_FILES"
577        fi
578
579        if test x$ac_cv_sys_file_offset_bits = x64; then
580                LARGEFILE="$LARGEFILE -D_FILE_OFFSET_BITS=64"
581        fi
582fi
583AC_SUBST(LARGEFILE)
584
585dnl Check for "long long" support...
586AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
587        [if test "$GCC" = yes; then
588                ac_cv_c_long_long=yes
589        else
590                AC_TRY_COMPILE(,[long long int i;],
591                        ac_cv_c_long_long=yes,
592                        ac_cv_c_long_long=no)
593        fi])
594
595if test $ac_cv_c_long_long = yes; then
596        AC_DEFINE(HAVE_LONG_LONG)
597fi
598
599AC_CHECK_FUNC(strtoll, AC_DEFINE(HAVE_STRTOLL))
600
601dnl Check for dlopen/dlsym...
602AC_SEARCH_LIBS(dlsym, dl, AC_DEFINE(HAVE_DLSYM))
603AC_CHECK_HEADER(dlfcn.h, AC_DEFINE(HAVE_DLFCN_H))
604
605dnl Check for audio libraries...
606AUDIOLIBS=""
607
608case $uname in
609    CYGWIN* | MINGW*)
610        dnl Cygwin environment...
611        AUDIOLIBS="-lwinmm"
612        ;;
613
614    Darwin*)
615        AUDIOLIBS="-framework CoreAudio"
616        ;;
617
618    *)
619        AC_CHECK_HEADER(alsa/asoundlib.h,
620            AC_DEFINE(HAVE_ALSA_ASOUNDLIB_H)
621            AUDIOLIBS="-lasound")
622        ;;
623esac
624
625AC_SUBST(AUDIOLIBS)
626
627dnl Check for image libraries...
628SAVELIBS="$LIBS"
629IMAGELIBS=""
630STATICIMAGELIBS=""
631
632AC_SUBST(IMAGELIBS)
633AC_SUBST(STATICIMAGELIBS)
634
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
638AC_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
640sysjpeglib_ok=no
641sysjpeginc_ok=no
642if test x$enable_localjpeg != xyes; then
643    AC_CHECK_LIB(jpeg,jpeg_CreateCompress,
644        [AC_CHECK_HEADER(jpeglib.h,
645            sysjpeginc_ok=yes)
646            if test x$sysjpeginc_ok = xyes; then
647                sysjpeglib_ok=yes
648                fi])
649fi
650# Now set the jpeg lib and include flags according to the requested mode and availability
651if test x$enable_localjpeg = xyes -o x$sysjpeglib_ok = xno; then
652    JPEGINC="-I../jpeg"
653    JPEG="jpeg"
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.)
661    fi
662else
663    JPEGINC=""
664    JPEG=""
665    IMAGELIBS="-ljpeg $IMAGELIBS"
666    STATICIMAGELIBS="-ljpeg $STATICIMAGELIBS"
667    AC_DEFINE(HAVE_LIBJPEG)
668fi
669
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
673AC_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
675syszlib_ok=no
676syszinc_ok=no
677if test x$enable_localzlib != xyes; then
678    AC_CHECK_LIB(z,z_gzgets,
679        [AC_CHECK_HEADER(zlib.h,
680                syszinc_ok=yes)
681        if test x$syszinc_ok = xyes; then
682            syszlib_ok=yes
683            fi])
684fi
685# Now set the Z lib and include flags according to the requested mode and availability
686if test x$enable_localzlib = xyes -o x$syszlib_ok = xno ; then
687    ZLIBINC="-I../zlib"
688    ZLIB="zlib"
689    LIBS="-lfltk_z $LIBS"
690    IMAGELIBS="-lfltk_z $IMAGELIBS"
691    STATICIMAGELIBS="\$libdir/libfltk_z.a $STATICIMAGELIBS"
692    AC_DEFINE(HAVE_LIBZ)
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.)
697    fi
698else
699    ZLIBINC=""
700    ZLIB=""
701    LIBS="-lz $LIBS"
702    IMAGELIBS="-lz $IMAGELIBS"
703    STATICIMAGELIBS="-lz $STATICIMAGELIBS"
704    AC_DEFINE(HAVE_LIBZ)
705fi
706
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
710AC_ARG_ENABLE(localpng, [  --enable-localpng       use local PNG library, default=auto])
711
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
714syspnglib_ok=no
715syspnginc_ok=no
716if 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)
720        syspnginc_ok=yes)
721    AC_CHECK_HEADER(libpng/png.h,
722        AC_DEFINE(HAVE_LIBPNG_PNG_H)
723        syspnginc_ok=yes)
724    if test x$syspnginc_ok = xyes; then
725        syspnglib_ok=yes
726    fi])
727fi
728
729# The following is executed if the lib was not found usable or if local lib is required explicitly
730if test x$enable_localpng = xyes -o x$syspnglib_ok = xno ; then
731    PNGINC="-I../png"
732    PNG="png"
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.)
742    fi
743else
744    PNGINC=""
745    PNG=""
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))
751fi
752
753AC_SUBST(JPEG)
754AC_SUBST(JPEGINC)
755AC_SUBST(PNG)
756AC_SUBST(PNGINC)
757AC_SUBST(ZLIB)
758AC_SUBST(ZLIBINC)
759
760dnl Restore original LIBS settings...
761LIBS="$SAVELIBS"
762
763dnl See if we need a .exe extension on executables...
764AC_EXEEXT
765
766dnl Check for pthreads for multi-threaded apps...
767have_pthread=no
768PTHREAD_FLAGS=""
769
770dnl Test whether we want to check for pthreads. We must not do it on Windows
771dnl unless we run under Cygwin with --enable-cygwin, since we always use
772dnl native threads on Windows (even if libpthread is available)
773check_pthread=yes
774case $uname in
775    MINGW*)
776        check_pthread=no
777        ;;
778    CYGWIN*)
779        if test "x$enable_cygwin" != xyes; then
780            check_pthread=no
781        fi
782        ;;
783    *)
784        ;;
785esac
786
787if test "x$enable_threads" != xno -a x$check_pthread = xyes; then
788    AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
789
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])
794            SAVELIBS="$LIBS"
795            LIBS="$flag $LIBS"
796            AC_TRY_LINK([#include <pthread.h>],
797                [pthread_create(0, 0, 0, 0);],
798                have_pthread=yes,
799                LIBS="$SAVELIBS")
800            AC_MSG_RESULT([$have_pthread])
801
802            if test $have_pthread = yes; then
803                AC_DEFINE(HAVE_PTHREAD)
804                PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT"
805
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"
810                fi
811                break
812            fi
813        done
814    fi
815fi
816
817AC_SUBST(PTHREAD_FLAGS)
818
819dnl Define OS-specific stuff...
820HLINKS=
821OSX_ONLY=:
822THREADS=
823
824AC_ARG_WITH(links, [  --with-links            make header links for common misspellings (default=no)])
825
826INSTALL_DESKTOP=""
827UNINSTALL_DESKTOP=""
828
829case $uname_GUI in
830    CYGWIN* | MINGW*)
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
843            with_optim="-O3"
844        fi
845
846        if test x$enable_gl != xno; then
847            AC_CHECK_HEADER(GL/gl.h,
848                AC_DEFINE(HAVE_GL)
849                GLLIB="-lopengl32")
850            AC_CHECK_HEADER(GL/glu.h,
851                AC_DEFINE(HAVE_GL_GLU_H)
852                GLLIB="-lglu32 $GLLIB")
853        else
854            LINKFLTKGL=""
855            GLLIBNAME=""
856            GLDSONAME=""
857            GLDEMOS=""
858        fi
859
860        if test "x$enable_threads" != xno; then
861            if test x$have_pthread = xyes; then
862                AC_DEFINE(HAVE_PTHREAD)
863            fi
864        fi
865
866        THREADS="threads$EXEEXT"
867
868        # Don't make symlinks since Windows is not case sensitive.
869        if test "x$with_links" != xyes; then
870                HLINKS="#"
871        fi
872        ;;
873
874    Darwin*)
875        # MacOS X uses Cocoa for graphics.
876        LIBS="$LIBS -framework Cocoa"
877
878        if test x$have_pthread = xyes; then
879            AC_DEFINE(HAVE_PTHREAD)
880            THREADS="threads$EXEEXT"
881        fi
882
883        if test x$enable_gl != xno; then
884            AC_DEFINE(HAVE_GL)
885            AC_DEFINE(HAVE_GL_GLU_H)
886            GLLIB="-framework AGL -framework OpenGL -framework ApplicationServices"
887        else
888            LINKFLTKGL=""
889            GLLIBNAME=""
890            GLDSONAME=""
891            GLDEMOS=""
892        fi
893
894        # Don't make symlinks because HFS+ is not case sensitive...
895        if test "x$with_links" != xyes; then
896                HLINKS="#"
897        fi
898
899        # Some steps are only done for OS X package management
900        OSX_ONLY=
901
902        # Install/Uninstall FLUID application
903        INSTALL_DESKTOP="install-osx"
904        UNINSTALL_DESKTOP="uninstall-osx"
905        ;;
906
907    *)
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"
913        fi
914
915        dnl Check for X11...
916        AC_PATH_XTRA
917
918        if test x$no_x = xyes; then
919            AC_MSG_ERROR(Configure could not find required X11 libraries, aborting.)
920        fi
921
922        if test "x$X_PRE_LIBS" != x; then
923            AC_MSG_WARN(Ignoring libraries \"$X_PRE_LIBS\" requested by configure.)
924        fi
925
926        LIBS="$LIBS -lX11 -lnano-X -ltiff -lfreetype -lt1 $X_EXTRA_LIBS"
927        CFLAGS="$CFLAGS $X_CFLAGS"
928        CXXFLAGS="$CXXFLAGS $X_CFLAGS"
929        LDFLAGS="$X_LIBS $LDFLAGS"
930        DSOFLAGS="$X_LIBS $DSOFLAGS"
931        AC_DEFINE(USE_X11)
932        if test "x$x_includes" != x; then
933            ac_cpp="$ac_cpp -I$x_includes"
934        fi
935
936        dnl Check for OpenGL unless disabled...
937        GLLIB=
938
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",,
944                        -lm),
945                    -lm)
946                AC_CHECK_LIB(GL, glXGetProcAddressARB,
947                             AC_DEFINE(HAVE_GLXGETPROCADDRESSARB),, -lm)
948            )
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
952                    GLLIB="-lGLU $GLLIB"
953                fi
954                if test x$ac_cv_lib_MesaGL_glXMakeCurrent = xyes; then
955                    GLLIB="-lMesaGLU $GLLIB"
956                fi
957            )
958
959            if test x$ac_cv_lib_GL_glXMakeCurrent != xyes -a x$ac_cv_lib_MesaGL_glXMakeCurrent != xyes; then
960                    LINKFLTKGL=""
961                    GLLIBNAME=""
962                    GLDSONAME=""
963                    GLDEMOS=""
964            fi
965        else
966            LINKFLTKGL=""
967            GLLIBNAME=""
968            GLDSONAME=""
969            GLDEMOS=""
970        fi
971
972        dnl Check for Xinerama support unless disabled...
973        AC_ARG_ENABLE(xinerama, [  --enable-xinerama       turn on Xinerama support [default=yes]])
974
975        if test x$enable_xinerama != xno; then
976            AC_CHECK_LIB(Xinerama,XineramaIsActive,
977                    AC_DEFINE(HAVE_XINERAMA)
978                    LIBS="-lXinerama $LIBS")
979        fi
980
981        dnl Check for the Xft library unless disabled...
982        AC_ARG_ENABLE(xft, [  --enable-xft            turn on Xft support [default=yes]])
983
984        if test x$enable_xft != xno; then
985            AC_PATH_PROG(FTCONFIG,freetype-config)
986
987            if test "x$FTCONFIG" != x; then
988                CPPFLAGS="`$FTCONFIG --cflags` $CPPFLAGS"
989                CXXFLAGS="`$FTCONFIG --cflags` $CXXFLAGS"
990
991                AC_CHECK_LIB(fontconfig, FcPatternCreate)
992                AC_CHECK_HEADER(X11/Xft/Xft.h,
993                    AC_CHECK_LIB(Xft, XftDrawCreate,
994                        AC_DEFINE(USE_XFT)
995                        LIBS="-lXft $LIBS"))
996            fi
997        fi
998
999        dnl Check for the Xdbe extension unless disabled...
1000        AC_ARG_ENABLE(xdbe, [  --enable-xdbe           turn on Xdbe support [default=yes]])
1001
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")
1007        fi
1008
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
1015                else
1016                    ac_cv_have_overlay=no
1017                fi
1018            else
1019                ac_cv_have_overlay=no
1020            fi)
1021
1022        if test x$ac_cv_have_overlay = xyes; then
1023            AC_DEFINE(HAVE_OVERLAY)
1024        fi
1025
1026        # Make symlinks since UNIX/Linux is case sensitive,
1027        # but Cygwin in general not.
1028        case $uname in
1029            CYGWIN*)
1030                HLINKS="#"
1031            ;;
1032            *)
1033            ;;
1034        esac
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
1038                HLINKS="#"
1039        fi
1040
1041        # Install/Uninstall FLUID application support files
1042        INSTALL_DESKTOP="install-linux"
1043        UNINSTALL_DESKTOP="uninstall-linux"
1044        ;;
1045esac
1046
1047AC_SUBST(GLDEMOS)
1048AC_SUBST(GLLIB)
1049AC_SUBST(HLINKS)
1050AC_SUBST(OSX_ONLY)
1051AC_SUBST(THREADS)
1052
1053AC_SUBST(INSTALL_DESKTOP)
1054AC_SUBST(UNINSTALL_DESKTOP)
1055
1056dnl Figure out the appropriate formatted man page extension...
1057case "$uname" in
1058    *BSD* | Darwin*)
1059        # *BSD
1060        CAT1EXT=0
1061        CAT3EXT=0
1062        CAT6EXT=0
1063        ;;
1064    IRIX*)
1065        # SGI IRIX
1066        CAT1EXT=z
1067        CAT3EXT=z
1068        CAT6EXT=z
1069        ;;
1070    *)
1071        # All others
1072        CAT1EXT=1
1073        CAT3EXT=3
1074        CAT6EXT=6
1075        ;;
1076esac
1077
1078AC_SUBST(CAT1EXT)
1079AC_SUBST(CAT3EXT)
1080AC_SUBST(CAT6EXT)
1081
1082dnl Fix "mandir" variable...
1083if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then
1084    case "$uname" in
1085        *BSD* | Darwin* | Linux*)
1086            # *BSD, Darwin, and Linux
1087            mandir="\${prefix}/share/man"
1088            ;;
1089        IRIX*)
1090            # SGI IRIX
1091            mandir="\${prefix}/share/catman"
1092            ;;
1093    esac
1094fi
1095
1096dnl Fix "libdir" variable...
1097if test "$prefix" = NONE; then
1098    prefix=/usr/local
1099fi
1100
1101if test "$exec_prefix" = NONE; then
1102    exec_prefix="\${prefix}"
1103fi
1104
1105if test "$uname" = "IRIX" -a $uversion -ge 62 -a "$libdir" = "\${exec_prefix}/lib" -a "$exec_prefix" = "\${prefix}" -a "$prefix" = "/usr"; then
1106    libdir="/usr/lib32"
1107fi
1108
1109dnl Define the command used to update the dependencies (this option
1110dnl mainly for FLTK core developers - not necessary for users)
1111MAKEDEPEND="\$(CXX) -M"
1112AC_SUBST(MAKEDEPEND)
1113
1114dnl Add warnings to compiler switches:
1115dnl do this last so messing with switches does not break tests
1116
1117if 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"
1121
1122    # The following additional warnings are useful for tracking down problems...
1123    #OPTIM="-Wshadow -Wconversion $OPTIM"
1124
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"
1129    fi
1130
1131    # Set the default compiler optimizations...
1132    if test -z "$DEBUGFLAG"; then
1133        #
1134        # Note: Can't use -fomit-frame-pointer - prevents tools like
1135        #       libsafe from working!
1136        #
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.
1140        #
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
1144        #       library 10+%.
1145        #
1146
1147        if test "x$with_optim" != x; then
1148            OPTIM="$with_optim $OPTIM"
1149        else
1150            OPTIM="-Os $OPTIM"
1151        fi
1152    fi
1153
1154    # Generate position-independent code when needed...
1155    if test $PICFLAG = 1; then
1156        OPTIM="$OPTIM -fPIC"
1157    fi
1158
1159    # See if GCC supports -fno-exceptions...
1160    AC_MSG_CHECKING(if GCC supports -fno-exceptions)
1161    OLDCFLAGS="$CFLAGS"
1162    CFLAGS="$CFLAGS -fno-exceptions"
1163    AC_TRY_COMPILE(,,
1164        OPTIM="$OPTIM -fno-exceptions"
1165        AC_MSG_RESULT(yes),
1166        AC_MSG_RESULT(no))
1167    CFLAGS="$OLDCFLAGS"
1168
1169    # See if GCC supports -fno-strict-aliasing...
1170    AC_MSG_CHECKING(if GCC supports -fno-strict-aliasing)
1171    OLDCFLAGS="$CFLAGS"
1172    CFLAGS="$CFLAGS -fno-strict-aliasing"
1173    AC_TRY_COMPILE(,,
1174        OPTIM="$OPTIM -fno-strict-aliasing"
1175        AC_MSG_RESULT(yes),
1176        AC_MSG_RESULT(no))
1177    CFLAGS="$OLDCFLAGS"
1178
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.
1182    #
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)
1188
1189        OLDCFLAGS="$CFLAGS"
1190        CFLAGS="$CFLAGS -fpermissive"
1191        AC_TRY_COMPILE(,,
1192            CXXFLAGS="$CXXFLAGS -fpermissive"
1193            AC_MSG_RESULT(yes),
1194            CFLAGS="$OLDCFLAGS"
1195            AC_MSG_RESULT(no))
1196    fi
1197else
1198    case "$uname" in
1199        IRIX*)
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:
1205                #
1206                #     CXX="CC -n32 -mips3"
1207                #     CC="cc -n32 -mips3"
1208                #     LD="ld -n32 -mips3"
1209                #     MAKEDEPEND="CC -M"
1210
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\")
1213                fi
1214
1215                OPTIM="-fullwarn $OPTIM"
1216            fi
1217            if test -z "$DEBUGFLAG"; then
1218                if test "x$with_optim" != x; then
1219                    OPTIM="$with_optim $OPTIM"
1220                else
1221                    OPTIM="-O2 $OPTIM"
1222                    if test $uversion -gt 62; then
1223                        OPTIM="-OPT:Olimit=4000 $OPTIM"
1224                    fi
1225                fi
1226            fi
1227            ;;
1228        HP-UX*)
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"
1233                else
1234                    OPTIM="+O2 $OPTIM"
1235                fi
1236            fi
1237
1238            if test $PICFLAG = 1; then
1239                OPTIM="+z $OPTIM"
1240            fi
1241
1242            CXXFLAGS="$CXXFLAGS +W336,501,736,740,749,829"
1243            ;;
1244        OSF1*)
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"
1250                else
1251                    OPTIM="-O2 $OPTIM"
1252                fi
1253            fi
1254            ;;
1255        SunOS*)
1256            # Solaris
1257            if test -z "$DEBUGFLAG"; then
1258                if test "x$with_optim" != x; then
1259                    OPTIM="$with_optim $OPTIM"
1260                else
1261                    OPTIM="-xO3 $OPTIM"
1262                fi
1263            fi
1264
1265            if test $PICFLAG = 1; then
1266                OPTIM="-KPIC $OPTIM"
1267            fi
1268            ;;
1269        AIX*)
1270            if test -z "$DEBUGFLAG"; then
1271                if test "x$with_optim" != x; then
1272                    OPTIM="$with_optim $OPTIM"
1273                else
1274                    OPTIM="-O2 $OPTIM"
1275                fi
1276            fi
1277
1278            AC_MSG_WARN(The AIX C and C++ compilers are known not to correctly compile the FLTK library.)
1279            ;;
1280        *)
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)
1285            ;;
1286    esac
1287fi
1288
1289OPTIM="$DEBUGFLAG $OPTIM"
1290
1291dnl Take archflags away from CFLAGS (makefiles use ARCHFLAGS explicitly)
1292if test `uname` = Darwin; then
1293  if test "x$with_archflags" != x ; then
1294    CFLAGS="`echo $CFLAGS | sed -e "s/$with_archflags//g"`"
1295  fi
1296fi
1297
1298dnl Define the FLTK documentation directory...
1299case $uname in
1300  MINGW*)
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")
1305    ;;
1306  *)
1307    if test x$prefix = xNONE; then
1308        AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "/usr/local/share/doc/fltk")
1309    else
1310        AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "$prefix/share/doc/fltk")
1311    fi
1312    ;;
1313esac
1314
1315dnl Define the FLTK data directory...
1316if test x$prefix = xNONE; then
1317    AC_DEFINE_UNQUOTED(FLTK_DATADIR, "/usr/local/share/fltk")
1318else
1319    AC_DEFINE_UNQUOTED(FLTK_DATADIR, "$prefix/share/fltk")
1320fi
1321
1322dnl Summarize results of configure tests...
1323echo ""
1324echo "Configuration Summary"
1325echo "-------------------------------------------------------------------------"
1326
1327case $uname_GUI in
1328    CYGWIN* | MINGW*)
1329        graphics="GDI"
1330        ;;
1331    Darwin*)
1332        graphics="Quartz"
1333        ;;
1334    *)
1335        graphics="X11"
1336        if test x$enable_xft != xno; then
1337            graphics="$graphics+Xft"
1338        fi
1339        if test x$enable_xdbe != xno; then
1340            graphics="$graphics+Xdbe"
1341        fi
1342        if test x$enable_xinerama != xno; then
1343            graphics="$graphics+Xinerama"
1344        fi
1345        ;;
1346esac
1347
1348echo "    Directories: prefix=$prefix"
1349echo "                 bindir=$bindir"
1350echo "                 datadir=$datadir"
1351echo "                 datarootdir=$datarootdir"
1352echo "                 exec_prefix=$exec_prefix"
1353echo "                 includedir=$includedir"
1354echo "                 libdir=$libdir"
1355echo "                 mandir=$mandir"
1356case $uname in
1357  MINGW*)
1358    echo "                 MSys docpath=$msyspath/local/share/doc/fltk"
1359  ;;
1360esac
1361echo "       Graphics: $graphics"
1362
1363if test x$JPEG = x; then
1364    echo "Image Libraries: JPEG=System"
1365else
1366    echo "Image Libraries: JPEG=Builtin"
1367fi
1368if test x$PNG = x; then
1369    echo "                 PNG=System"
1370else
1371    echo "                 PNG=Builtin"
1372fi
1373if test x$ZLIB = x; then
1374    echo "                 ZLIB=System"
1375else
1376    echo "                 ZLIB=Builtin"
1377fi
1378if test x$enable_cairo = xyes; then
1379    echo "                 CAIRO=lib"
1380fi
1381if test x$enable_cairoext = xyes; then
1382    echo "                 CAIRO=internal_use"
1383fi
1384
1385
1386if test x$enable_largefile != xno; then
1387    echo "    Large Files: YES"
1388else
1389    echo "    Large Files: NO"
1390fi
1391
1392if test x$GLDEMOS = x; then
1393    echo "         OpenGL: NO"
1394else
1395    echo "         OpenGL: YES"
1396fi
1397
1398if test x$THREADS = x; then
1399    echo "        Threads: NO"
1400else
1401    echo "        Threads: YES"
1402fi
1403
1404dnl Write all of the files...
1405AC_CONFIG_HEADER(config.h:configh.in)
1406AC_OUTPUT(makeinclude fltk.list fltk-config fltk.spec FL/Makefile)
1407
1408dnl Make sure the fltk-config script is executable...
1409chmod +x fltk-config
1410
1411dnl
1412dnl End of "$Id: configure.in 8511 2011-03-06 16:54:58Z manolo $".
1413dnl
Note: See TracBrowser for help on using the repository browser.