~ubuntu-branches/ubuntu/karmic/fltk1.1/karmic

1 by Aaron M. Ucko
Import upstream version 1.1.4+1.1.5rc1
1
dnl -*- sh -*-
2
dnl the "configure" script is made from this by running GNU "autoconf"
3
dnl
1.1.1 by Aaron M. Ucko
Import upstream version 1.1.6
4
dnl "$Id: configure.in,v 1.33.2.31.2.122 2004/11/20 03:44:17 easysw Exp $"
1 by Aaron M. Ucko
Import upstream version 1.1.4+1.1.5rc1
5
dnl
6
dnl Configuration script for the Fast Light Tool Kit (FLTK).
7
dnl
8
dnl Copyright 1998-2004 by Bill Spitzak and others.
9
dnl
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.
14
dnl
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.
19
dnl
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
23
dnl USA.
24
dnl
25
dnl Please report all bugs and problems to "fltk-bugs@fltk.org".
26
dnl
27
28
dnl We need at least autoconf 2.13...
29
AC_PREREQ(2.13)
30
31
dnl Required file in package...
32
AC_INIT(src/Fl.cxx)
33
34
dnl FLTK library versions...
35
FL_MAJOR_VERSION=1
36
FL_MINOR_VERSION=1
1.1.1 by Aaron M. Ucko
Import upstream version 1.1.6
37
FL_PATCH_VERSION=6
38
FL_RELEASE_VERSION=
1 by Aaron M. Ucko
Import upstream version 1.1.4+1.1.5rc1
39
FL_API_VERSION=${FL_MAJOR_VERSION}.${FL_MINOR_VERSION}
40
41
AC_SUBST(FL_MAJOR_VERSION)
42
AC_SUBST(FL_MINOR_VERSION)
43
AC_SUBST(FL_PATCH_VERSION)
44
AC_SUBST(FL_RELEASE_VERSION)
45
AC_SUBST(FL_API_VERSION)
46
47
dnl Get the operating system and version number...
48
uname=`uname`
49
uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'`
50
if test "x$uname" = xIRIX64; then
51
    uname="IRIX"
52
fi
53
if test "x$uname" = x; then
54
    # MingW doesn't provide any output when uname is run, even with "-s"...
55
    uname="CYGWIN"
56
fi
57
58
dnl Don't automatically add "-g" to compiler options...
59
CFLAGS="${CFLAGS:=}"
60
CPPFLAGS="${CPPFLAGS:=}"
61
CXXFLAGS="${CXXFLAGS:=}"
62
OPTIM="${OPTIM:=}"
63
64
AC_SUBST(OPTIM)
65
66
dnl OS-specific pre-tests...
67
case $uname in
68
    CYGWIN* | MINGW*)
69
        # Handle Cygwin option *first*, before all other tests.
70
	AC_ARG_ENABLE(cygwin, [  --enable-cygwin         use the CygWin libraries [default=no]])
71
	if test x$enable_cygwin != xyes; then
72
	    CFLAGS="$CFLAGS -mno-cygwin"
73
	    CPPFLAGS="$CPPFLAGS -mno-cygwin"
74
	    CXXFLAGS="$CXXFLAGS -mno-cygwin"
1.1.1 by Aaron M. Ucko
Import upstream version 1.1.6
75
	    LDFLAGS="$LDFLAGS -mno-cygwin"
1 by Aaron M. Ucko
Import upstream version 1.1.4+1.1.5rc1
76
	fi
77
	;;
78
esac
79
80
dnl Define the libraries and link options we'll need.
81
LINKFLTK="-lfltk"
82
LINKFLTKGL="-lfltk_gl"
83
LINKFLTKIMG="-lfltk_images"
84
GLDEMOS="gldemos"
85
1.1.1 by Aaron M. Ucko
Import upstream version 1.1.6
86
LIBEXT=".a"
1 by Aaron M. Ucko
Import upstream version 1.1.4+1.1.5rc1
87
LIBNAME="../lib/libfltk.a"
88
FLLIBNAME="../lib/libfltk_forms.a"
89
GLLIBNAME="../lib/libfltk_gl.a"
90
IMGLIBNAME="../lib/libfltk_images.a"
91
92
AC_SUBST(FLLIBNAME)
93
AC_SUBST(GLDEMOS)
94
AC_SUBST(GLLIBNAME)
95
AC_SUBST(IMGLIBNAME)
1.1.1 by Aaron M. Ucko
Import upstream version 1.1.6
96
AC_SUBST(LIBEXT)
1 by Aaron M. Ucko
Import upstream version 1.1.4+1.1.5rc1
97
AC_SUBST(LIBNAME)
98
AC_SUBST(LINKFLTK)
99
AC_SUBST(LINKFLTKGL)
100
AC_SUBST(LINKFLTKIMG)
101
102
dnl Handle compile-time options...
103
AC_ARG_ENABLE(debug, [  --enable-debug          turn on debugging [default=no]])
104
if test x$enable_debug = xyes; then
105
    DEBUGFLAG="-g "
106
else
107
    DEBUGFLAG=""
108
fi
109
110
AC_ARG_ENABLE(gl, [  --enable-gl             turn on OpenGL support [default=yes]])
111
112
AC_ARG_ENABLE(shared, [  --enable-shared         turn on shared libraries [default=no]])
113
if test x$enable_shared = xyes; then
114
    PICFLAG=1
115
    SHAREDSUFFIX=""
116
    FLUID="fluid-shared"
117
118
    case $uname in
119
	Darwin*)
120
            DSONAME="libfltk.$FL_API_VERSION.dylib"
121
            FLDSONAME="libfltk_forms.$FL_API_VERSION.dylib"
122
            GLDSONAME="libfltk_gl.$FL_API_VERSION.dylib"
123
            IMGDSONAME="libfltk_images.$FL_API_VERSION.dylib"
124
	    DSOCOMMAND="\$(CC) $DSOFLAGS -dynamiclib -lc -o"
125
	    ;;
126
127
	SunOS* | UNIX_S*)
128
            DSONAME="libfltk.so.$FL_API_VERSION"
129
            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
130
            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
131
            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
132
	    DSOCOMMAND="\$(CXX) -h \$@ \$(LDLIBS) -G $DEBUGFLAG -o"
133
	    if test "x$libdir" != "x/usr/lib"; then
134
		    DSOLINK="-R$libdir"
135
            fi
136
	    ;;
137
	HP-UX*)
138
            DSONAME="libfltk.sl.$FL_API_VERSION"
139
            FLDSONAME="libfltk_forms.sl.$FL_API_VERSION"
140
            GLDSONAME="libfltk_gl.sl.$FL_API_VERSION"
141
            IMGDSONAME="libfltk_images.sl.$FL_API_VERSION"
142
	    DSOCOMMAND="ld -b -z +h \$@ $DEBUGFLAG -o"
143
	    if test "x$libdir" != "x/usr/lib"; then
144
		    DSOLINK="-Wl,-rpath,$libdir"
145
            fi
146
	    ;;
147
	IRIX*)
148
            DSONAME="libfltk.so.$FL_API_VERSION"
149
            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
150
            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
151
            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
152
            DSOCOMMAND="\$(CXX) -Wl,-soname,\$@,-set_version,sgi1.1 \$(LDLIBS) -shared $DEBUGFLAG -o"
153
	    if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib32" -a "x$libdir" != "x/usr/lib64"; then
154
		    DSOLINK="-Wl,-rpath,$libdir"
155
            fi
156
	    ;;
157
	OSF1*)
158
            DSONAME="libfltk.so.$FL_API_VERSION"
159
            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
160
            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
161
            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
162
            DSOCOMMAND="\$(CXX) -Wl,-soname,\$@ \$(LDLIBS) -shared $DEBUGFLAG -o"
163
	    if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib32"; then
164
		    DSOLINK="-Wl,-rpath,$libdir"
165
            fi
166
	    ;;
167
	Linux* | *BSD*)
168
            DSONAME="libfltk.so.$FL_API_VERSION"
169
            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
170
            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
171
            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
172
            DSOCOMMAND="\$(CXX) -Wl,-soname,\$@ \$(LDLIBS) -shared -fPIC $DEBUGFLAG -o"
2 by Aaron M. Ucko
* New upstream release candidate, incorporating the fix for #226014.
173
#	    if test "x$libdir" != "x/usr/lib"; then
174
#		    DSOLINK="-Wl,-rpath,$libdir"
175
#           fi
1 by Aaron M. Ucko
Import upstream version 1.1.4+1.1.5rc1
176
	    ;;
177
	AIX*)
178
            DSONAME="libfltk_s.a"
179
            FLDSONAME="libfltk_forms_s.a"
180
            GLDSONAME="libfltk_gl_s.a"
181
            IMGDSONAME="libfltk_images_s.a"
182
            DSOCOMMAND="\$(CXX) -Wl,-bexpall,-bM:SRE,-bnoentry -o"
183
            SHAREDSUFFIX="_s"
184
            ;;
185
        CYGWIN* | MINGW*)
186
            AC_MSG_WARN(Shared libraries are not supported under CygWin.)
187
	    ;;
188
	*)
189
            AC_MSG_WARN(Shared libraries may not be supported.  Trying -shared option with compiler.)
190
            DSONAME="libfltk.so.$FL_API_VERSION"
191
            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
192
            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
193
            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
194
            DSOCOMMAND="\$(CXX) -Wl,-soname,\$@ \$(LDLIBS) -shared $DEBUGFLAG -o"
195
	    ;;
196
    esac
197
198
    LINKSHARED="-L../src -lfltk_images$SHAREDSUFFIX -lfltk_forms$SHAREDSUFFIX -lfltk$SHAREDSUFFIX"
199
else
200
    DSOCOMMAND="echo"
201
    DSOLINK=""
202
    DSONAME=""
203
    FLDSONAME=""
204
    GLDSONAME=""
205
    IMGDSONAME=""
206
    PICFLAG=0
207
    SHAREDSUFFIX=""
208
    FLUID="fluid"
209
    LINKSHARED="-L../lib -lfltk_images -lfltk_forms -lfltk"
210
fi
211
212
AC_SUBST(DSOCOMMAND)
213
AC_SUBST(DSOLINK)
214
AC_SUBST(DSONAME)
215
AC_SUBST(FLDSONAME)
216
AC_SUBST(GLDSONAME)
217
AC_SUBST(IMGDSONAME)
218
AC_SUBST(SHAREDSUFFIX)
219
AC_SUBST(LINKSHARED)
220
AC_SUBST(FLUID)
221
222
AC_ARG_ENABLE(threads, [  --enable-threads        enable multi-threading support])
223
224
AC_ARG_WITH(optim, [  --with-optim="flags"    use custom optimization flags])
225
1.1.1 by Aaron M. Ucko
Import upstream version 1.1.6
226
case $uname in
227
    Darwin*)
228
        AC_ARG_ENABLE(quartz, [  --enable-quartz         use Quartz instead of Quickdraw (default=no)])
229
        if test "x$enable_quartz" = "xyes"; then
230
            AC_DEFINE(USE_QUARTZ, 1)
231
            AC_DEFINE(__APPLE_QUARTZ__)
232
        else
233
            AC_DEFINE(__APPLE_QD__)
234
        fi
235
        ;;
236
esac
237
1 by Aaron M. Ucko
Import upstream version 1.1.4+1.1.5rc1
238
dnl Find commands...
239
AC_PROG_CC
240
AC_PROG_CXX
241
dnl AC_PROG_INSTALL
242
AC_PATH_PROG(NROFF,nroff)
243
if test "x$NROFF" = "x:"; then
244
    AC_PATH_PROG(GROFF,groff)
245
    if test "x$GROFF" = "x:"; then
246
        NROFF="echo"
247
    else
248
        NROFF="$GROFF -T ascii"
249
    fi
250
fi
251
AC_PATH_PROG(HTMLDOC,htmldoc)
252
253
dnl How do we make libraries?
254
AC_PROG_RANLIB
255
AC_PATH_PROG(AR, ar)
256
257
if test "x$AR" = "x:"; then
258
    AC_MSG_ERROR(Configure could not find the library archiver, aborting.)
259
fi
260
261
if test "x$RANLIB" != "x:"; then
262
    LIBCOMMAND="$AR cr"
263
else
264
    LIBCOMMAND="$AR crs"
265
fi
266
267
AC_SUBST(LIBCOMMAND)
268
269
dnl Architecture checks...
270
AC_C_BIGENDIAN
271
272
AC_CHECK_SIZEOF(short, 2)
273
AC_CHECK_SIZEOF(int, 4)
274
AC_CHECK_SIZEOF(long, 4)
275
if test $ac_cv_sizeof_short -eq 2; then
276
    AC_DEFINE(U16,unsigned short)
277
fi
278
if test $ac_cv_sizeof_int -eq 4; then
279
    AC_DEFINE(U32,unsigned)
280
else
281
    if test $ac_cv_sizeof_long -eq 4; then
282
        AC_DEFINE(U32,unsigned long)
283
    fi
284
fi
285
if test $ac_cv_sizeof_int -eq 8; then
286
    AC_DEFINE(U64,unsigned)
287
else
288
    if test $ac_cv_sizeof_long -eq 8; then
289
        AC_DEFINE(U64,unsigned long)
290
    fi
291
fi
292
293
dnl Does the C++ compiler support the bool type?
294
AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type,
295
    ac_cv_cxx_bool,[
296
	AC_LANG_SAVE
297
	AC_LANG_CPLUSPLUS
298
	AC_TRY_COMPILE([
299
	    int f(int  x){return 1;}
300
	    int f(char x){return 1;}
301
	    int f(bool x){return 1;}
302
	],[
303
	    bool b = true;
304
	    return f(b);
305
	], ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no)
306
	AC_LANG_RESTORE
307
    ])
308
309
if test "$ac_cv_cxx_bool" != yes; then
310
    CXXFLAGS="-Dbool=char -Dfalse=0 -Dtrue=1 $CXXFLAGS"
311
fi
312
313
dnl Standard headers and functions...
314
AC_HEADER_DIRENT
315
AC_CHECK_HEADER(sys/select.h,AC_DEFINE(HAVE_SYS_SELECT_H))
316
AC_CHECK_HEADER(sys/stdtypes.h,AC_DEFINE(HAVE_SYS_SELECT_H))
317
AC_CHECK_FUNC(scandir,
318
    if test "x$uname" = xSunOS -o "x$uname" = xQNX; then
319
        AC_MSG_WARN(Not using $uname scandir emulation function.)
320
    else
321
        AC_DEFINE(HAVE_SCANDIR)
322
    fi)
323
AC_CHECK_FUNC(vsnprintf,[
324
    case "$uname" in
325
    	HP-UX*)
326
	    if test "$uversion" = "1020"; then
327
	        AC_MSG_WARN(Not using built-in vsnprintf function because you are running HP-UX 10.20.)
328
	    else
329
        	AC_DEFINE(HAVE_VSNPRINTF)
330
	    fi
331
	    ;;
332
333
    	OSF1*)
334
	    if test "$uversion" = "40"; then
335
                AC_MSG_WARN(Not using built-in vsnprintf function because you are running Tru64 4.0.)
336
	    else
337
        	AC_DEFINE(HAVE_VSNPRINTF)
338
	    fi
339
	    ;;
340
341
        *)
342
            AC_DEFINE(HAVE_VSNPRINTF)
343
	    ;;
344
    esac])
345
AC_CHECK_FUNC(snprintf,[
346
    case "$uname" in
347
    	HP-UX*)
348
	    if test "$uversion" = "1020"; then
349
	        AC_MSG_WARN(Not using built-in snprintf function because you are running HP-UX 10.20.)
350
	    else
351
        	AC_DEFINE(HAVE_SNPRINTF)
352
	    fi
353
	    ;;
354
355
    	OSF1*)
356
	    if test "$uversion" = "40"; then
357
                AC_MSG_WARN(Not using built-in snprintf function because you are running Tru64 4.0.)
358
	    else
359
        	AC_DEFINE(HAVE_SNPRINTF)
360
	    fi
361
	    ;;
362
363
        *)
364
            AC_DEFINE(HAVE_SNPRINTF)
365
	    ;;
366
    esac])
367
AC_CHECK_HEADER(strings.h, AC_DEFINE(HAVE_STRINGS_H))
368
AC_CHECK_FUNCS(strcasecmp strlcat strlcpy)
369
370
dnl FLTK library uses math library functions...
371
AC_SEARCH_LIBS(pow, m)
372
373
dnl Check for image libraries...
374
SAVELIBS="$LIBS"
375
IMAGELIBS=""
376
377
AC_SUBST(IMAGELIBS)
378
1.1.1 by Aaron M. Ucko
Import upstream version 1.1.6
379
AC_ARG_ENABLE(localjpeg, [  --enable-localjpeg      use local JPEG library, default=auto],
380
    [if test x$enable_localjpeg = xyes; then
381
	ac_cv_lib_jpeg_jpeg_CreateCompress=no
382
    fi])
383
384
AC_CHECK_LIB(jpeg,jpeg_CreateCompress,
385
    AC_DEFINE(HAVE_LIBJPEG)
386
    JPEGINC=""
387
    JPEG=""
388
    IMAGELIBS="-ljpeg $IMAGELIBS",
389
    if test x$enable_localjpeg = xno; then
390
	JPEGINC=""
391
	JPEG=""
392
    else
1 by Aaron M. Ucko
Import upstream version 1.1.4+1.1.5rc1
393
	AC_DEFINE(HAVE_LIBJPEG)
1.1.1 by Aaron M. Ucko
Import upstream version 1.1.6
394
	JPEGINC="-I../jpeg"
395
	JPEG="jpeg"
396
	IMAGELIBS="-lfltk_jpeg $IMAGELIBS"
397
    fi)
398
399
AC_ARG_ENABLE(localzlib, [  --enable-localzlib      use local ZLIB library, default=auto],
400
    [if test x$enable_localzlib = xyes; then
401
	ac_cv_lib_z_gzgets=no
402
    fi])
403
404
AC_CHECK_LIB(z,gzgets,
405
    AC_DEFINE(HAVE_LIBZ)
406
    ZLIBINC=""
407
    ZLIB=""
408
    LIBS="-lz $LIBS"
409
    IMAGELIBS="-lz $IMAGELIBS",
410
    if test x$enable_localzlib = xno; then
411
	ZLIBINC=""
412
	ZLIB=""
413
    else
414
        AC_DEFINE(HAVE_LIBZ)
415
	ZLIBINC="-I../zlib"
416
	ZLIB="zlib"
417
	LIBS="-lfltk_z $LIBS"
418
	IMAGELIBS="-lfltk_z $IMAGELIBS"
419
    fi)
420
421
AC_ARG_ENABLE(localpng, [  --enable-localpng       use local PNG library, default=auto],
422
    [if test x$enable_localpng = xyes; then
423
	ac_cv_lib_png_png_set_tRNS_to_alpha=no
424
    fi])
425
426
AC_CHECK_LIB(png,png_set_tRNS_to_alpha, [
427
    PNGINC=""
428
    PNG=""
429
    IMAGELIBS="-lpng $IMAGELIBS"
430
    AC_DEFINE(HAVE_LIBPNG)
431
    AC_CHECK_HEADER(png.h, AC_DEFINE(HAVE_PNG_H))],[
432
    if test x$enable_localpng = xno; then
433
        PNGINC=""
434
        PNG=""
435
    else
436
	AC_DEFINE(HAVE_LIBPNG)
437
        AC_DEFINE(HAVE_PNG_H)
438
        PNGINC="-I../png"
439
        PNG="png"
440
        IMAGELIBS="-lfltk_png $IMAGELIBS"
441
    fi])
442
443
AC_SUBST(JPEG)
444
AC_SUBST(JPEGINC)
445
AC_SUBST(PNG)
446
AC_SUBST(PNGINC)
447
AC_SUBST(ZLIB)
448
AC_SUBST(ZLIBINC)
1 by Aaron M. Ucko
Import upstream version 1.1.4+1.1.5rc1
449
450
dnl Restore original LIBS settings...
451
LIBS="$SAVELIBS"
452
453
dnl See if we need a .exe extension on executables...
454
AC_EXEEXT
455
456
dnl Check for pthreads for multi-threaded apps...
457
have_pthread=no
458
459
if test "x$enable_threads" = xyes; then
460
    AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))
461
    AC_CHECK_LIB(pthread, pthread_create)
462
463
    if test "x$ac_cv_lib_pthread_pthread_create" = xyes -a x$ac_cv_header_pthread_h = xyes; then
464
        have_pthread=yes
465
    else
466
        dnl *BSD uses -pthread option...
467
        AC_MSG_CHECKING([for pthread_create using -pthread])
468
	SAVELIBS="$LIBS"
469
	LIBS="-pthread $LIBS"
470
        AC_TRY_LINK([#include <pthread.h>],
471
	    [pthread_create(0, 0, 0, 0);],
472
            LIBS="-pthread $SAVELIBS"
473
            have_pthread=yes,
474
	    LIBS="$SAVELIBS")
475
        AC_MSG_RESULT([$have_pthread])
476
    fi
477
fi
478
479
dnl Define OS-specific stuff...
480
HLINKS=
481
POSTBUILD=:
482
THREADS=
483
484
AC_ARG_WITH(links, [  --with-links            make header links for common misspellings])
485
486
case $uname in
487
    CYGWIN* | MINGW*)
488
	dnl Cygwin environment...
489
	CFLAGS="-mwindows -DWIN32 $CFLAGS"
490
	CXXFLAGS="-mwindows -DWIN32 $CXXFLAGS"
491
	LDFLAGS="-mwindows $LDFLAGS"
492
	LIBS="$LIBS -lole32 -luuid -lcomctl32 -lwsock32"
493
	OPTIM="$OPTIM"
494
495
	if test x$enable_gl != xno; then
496
	    AC_CHECK_HEADER(GL/gl.h,
497
	        AC_DEFINE(HAVE_GL)
498
		GLLIB="-lopengl32")
499
	    AC_CHECK_HEADER(GL/glu.h,
500
        	AC_DEFINE(HAVE_GL_GLU_H)
501
		GLLIB="-lglu32 $GLLIB")
502
	else
503
	    LINKFLTKGL=""
504
	    GLLIBNAME=""
505
	    GLDSONAME=""
506
	    GLDEMOS=""
507
	fi
508
509
	if test x$have_pthread = xyes; then
510
	    AC_DEFINE(HAVE_PTHREAD)
511
	    THREADS="threads.exe"
512
	fi
513
514
	# Don't make symlinks since Windows is not case sensitive.
515
	if test "x$with_links" != xyes; then
516
		HLINKS="#"
517
	fi
518
	;;
519
520
    Darwin*)
521
        # MacOS X uses Carbon for graphics...
522
        LIBS="$LIBS -framework Carbon -framework ApplicationServices"
523
524
	if test x$have_pthread = xyes; then
525
	    AC_DEFINE(HAVE_PTHREAD)
526
	    THREADS="threads"
527
	fi
528
529
	if test x$enable_gl != xno; then
530
            AC_DEFINE(HAVE_GL)
531
            AC_DEFINE(HAVE_GL_GLU_H)
532
            GLLIB="-framework AGL -framework OpenGL"
533
        else
534
	    LINKFLTKGL=""
535
	    GLLIBNAME=""
536
	    GLDSONAME=""
537
	    GLDEMOS=""
538
        fi
539
540
	# Don't make symlinks because HFS+ is not case sensitive...
541
	if test "x$with_links" != xyes; then
542
		HLINKS="#"
543
	fi
544
545
	# Add a postbuild step after linking applications
546
	POSTBUILD="/Developer/Tools/Rez -t APPL -o"
547
	;;
548
549
    *)
550
	# All others are UNIX/X11...
551
	if test x$have_pthread = xyes; then
552
	    AC_DEFINE(HAVE_PTHREAD)
553
	    THREADS="threads"
554
	fi
555
556
	dnl Check for X11...
2 by Aaron M. Ucko
* New upstream release candidate, incorporating the fix for #226014.
557
	AC_PATH_XTRA_CORRECTED
1 by Aaron M. Ucko
Import upstream version 1.1.4+1.1.5rc1
558
559
	if test x$no_x = xyes; then
560
	    AC_MSG_ERROR(Configure could not find required X11 libraries, aborting.)
561
	fi
562
563
	if test "x$X_PRE_LIBS" != x; then
564
	    AC_MSG_WARN(Ignoring libraries \"$X_PRE_LIBS\" requested by configure.)
565
	fi
566
567
	LIBS="$LIBS -lXext -lX11 $X_EXTRA_LIBS"
568
	CFLAGS="$CFLAGS $X_CFLAGS"
569
	CXXFLAGS="$CXXFLAGS $X_CFLAGS"
570
	LDFLAGS="$X_LIBS $LDFLAGS"
571
572
	if test "x$x_includes" != x; then
573
	    ac_cpp="$ac_cpp -I$x_includes"
574
	fi
575
576
	dnl Check for OpenGL unless disabled...
577
	GLLIB=
578
579
	if test x$enable_gl != xno; then
580
	    AC_SEARCH_LIBS(dlopen, dl)
581
	    AC_CHECK_HEADER(GL/gl.h,
582
		AC_CHECK_LIB(GL, glXMakeCurrent, AC_DEFINE(HAVE_GL) GLLIB="-lGL", \
583
		    AC_CHECK_LIB(MesaGL,glXMakeCurrent, AC_DEFINE(HAVE_GL) GLLIB=" -lMesaGL",,\
584
			-lm), \
585
		    -lm)
586
	    )
587
	    AC_CHECK_HEADER(GL/glu.h,
588
        	AC_DEFINE(HAVE_GL_GLU_H)
589
		if test x$ac_cv_lib_GL_glXMakeCurrent = xyes; then
590
		    GLLIB="-lGLU $GLLIB"
591
		fi
592
		if test x$ac_cv_lib_MesaGL_glXMakeCurrent = xyes; then
593
		    GLLIB="-lMesaGLU $GLLIB"
594
		fi
595
	    )
596
597
	    if test x$ac_cv_lib_GL_glXMakeCurrent != xyes -a x$ac_cv_lib_MesaGL_glXMakeCurrent != xyes; then
598
		    LINKFLTKGL=""
599
		    GLLIBNAME=""
600
		    GLDSONAME=""
601
		    GLDEMOS=""
602
	    fi
603
	else
604
	    LINKFLTKGL=""
605
	    GLLIBNAME=""
606
	    GLDSONAME=""
607
	    GLDEMOS=""
608
	fi
609
610
	dnl Check for the Xft library unless disabled...
611
        AC_ARG_ENABLE(xft, [  --enable-xft            turn on Xft support [default=no]])
612
613
	if test x$enable_xft = xyes; then
614
            AC_PATH_PROG(FTCONFIG,freetype-config)
615
616
	    if test "x$FTCONFIG" != "x:"; then
617
	        CPPFLAGS="`$FTCONFIG --cflags` $CPPFLAGS"
618
	        CXXFLAGS="`$FTCONFIG --cflags` $CXXFLAGS"
619
620
		AC_CHECK_HEADER(X11/Xft/Xft.h,
621
		    AC_CHECK_LIB(Xft, XftDrawCreate,
622
	        	AC_DEFINE(USE_XFT)
623
			LIBS="-lXft $LIBS"))
624
	    fi
625
	fi
626
627
	dnl Check for the Xdbe extension unless disabled...
628
        AC_ARG_ENABLE(xdbe, [  --enable-xdbe           turn on Xdbe support [default=no]])
629
630
	if test x$enable_xdbe = xyes; then
631
	    AC_CHECK_HEADER(X11/extensions/Xdbe.h, AC_DEFINE(HAVE_XDBE),,
632
	        [#include <X11/Xlib.h>])
633
	fi
634
635
	dnl Check for overlay visuals...
636
	AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay,
637
	    if xprop -root 2>/dev/null | grep -c "SERVER_OVERLAY_VISUALS" >/dev/null; then
638
        	ac_cv_have_overlay=yes
639
	    else
640
        	ac_cv_have_overlay=no
641
	    fi)
642
643
        if test x$ac_cv_have_overlay = xyes; then
644
	    AC_DEFINE(HAVE_OVERLAY)
645
	fi
646
647
	# Make symlinks since UNIX/Linux is case sensitive.
648
	if test "x$with_links" = xno; then
649
		HLINKS="#"
650
	fi
651
	;;
652
esac
653
654
AC_SUBST(GLDEMOS)
655
AC_SUBST(GLLIB)
656
AC_SUBST(HLINKS)
657
AC_SUBST(POSTBUILD)
658
AC_SUBST(THREADS)
659
660
dnl Figure out the appropriate formatted man page extension...
661
case "$uname" in
662
    *BSD* | Darwin*)
663
	# *BSD
664
	CAT1EXT=0
665
	CAT3EXT=0
666
	;;
667
    IRIX*)
668
	# SGI IRIX
669
	CAT1EXT=z
670
	CAT3EXT=z
671
	;;
672
    *)
673
	# All others
674
	CAT1EXT=1
675
	CAT3EXT=3
676
	;;
677
esac
678
679
AC_SUBST(CAT1EXT)
680
AC_SUBST(CAT3EXT)
681
682
dnl Fix "mandir" variable...
683
if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then
684
    case "$uname" in
685
        *BSD* | Darwin* | Linux*)
686
            # *BSD, Darwin, and Linux
687
            mandir="\${prefix}/share/man"
688
            ;;
689
        IRIX*)
690
            # SGI IRIX
691
            mandir="\${prefix}/share/catman"
692
            ;;
693
    esac
694
fi
695
696
dnl Fix "libdir" variable...
697
if test "$prefix" = NONE; then
698
    prefix=/usr/local
699
fi
700
701
if test "$exec_prefix" = NONE; then
702
    exec_prefix="\${prefix}"
703
fi
704
705
if test "$uname" = "IRIX" -a $uversion -ge 62 -a "$libdir" = "\${exec_prefix}/lib" -a "$exec_prefix" = "\${prefix}" -a "$prefix" = "/usr"; then
706
    libdir="/usr/lib32"
707
fi
708
709
dnl Define the command used to update the dependencies (this option
710
dnl mainly for FLTK core developers - not necessary for users)
711
MAKEDEPEND="\$(CXX) -M"
712
AC_SUBST(MAKEDEPEND)
713
714
dnl Add warnings to compiler switches:
715
dnl do this last so messing with switches does not break tests
716
717
if test -n "$GCC"; then
718
    # Starting with GCC 3.0, you must link C++ programs against either
719
    # libstdc++ (shared by default), or libsupc++ (always static).  If
720
    # you care about binary portability between Linux distributions,
721
    # you need to either 1) build your own GCC with static C++ libraries
722
    # or 2) link using gcc and libsupc++.  We choose the latter since
723
    # CUPS doesn't (currently) use any of the stdc++ library.
724
    #
725
    # Also, GCC 3.0.x still has problems compiling some code.  You may
726
    # or may not have success with it.  USE 3.0.x WITH EXTREME CAUTION!
727
    #
728
    # Previous versions of GCC do not have the reliance on the stdc++
729
    # or g++ libraries, so the extra supc++ library is not needed.
730
2 by Aaron M. Ucko
* New upstream release candidate, incorporating the fix for #226014.
731
    # For debian we use option 1)
1 by Aaron M. Ucko
Import upstream version 1.1.4+1.1.5rc1
732
2 by Aaron M. Ucko
* New upstream release candidate, incorporating the fix for #226014.
733
    LIBS="$LIBS -lstdc++"
1 by Aaron M. Ucko
Import upstream version 1.1.4+1.1.5rc1
734
735
    CXX="$CC"
736
1.1.1 by Aaron M. Ucko
Import upstream version 1.1.6
737
    # Show all standard warnings + unused variables, conversion errors,
738
    # and inlining problems when compiling...
739
    OPTIM="-Wall -Wunused -Wconversion $OPTIM"
1 by Aaron M. Ucko
Import upstream version 1.1.4+1.1.5rc1
740
741
    # The following additional warnings are useful for tracking down problems...
1.1.1 by Aaron M. Ucko
Import upstream version 1.1.6
742
    #OPTIM="-Wshadow $OPTIM"
1 by Aaron M. Ucko
Import upstream version 1.1.4+1.1.5rc1
743
744
    # Set the default compiler optimizations...
745
    if test -z "$DEBUGFLAG"; then
746
    	#
747
	# Note: Can't use -fomit-frame-pointer - prevents tools like
748
	#       libsafe from working!
749
        #
750
	#       Don't use -fforce-mem, -fforce-addr, or -fcaller-saves.
751
	#       They all seem to make either no difference or enlarge
752
	#       the code by a few hundred bytes.
753
        #
754
	#       "-O2" seems to be the best compromise between speed and
755
	#       code size.  "-O3" and higher seem to make no effective
756
	#       difference in the speed of the code, but does bloat the
757
	#       library 10+%.
758
	#
759
760
        if test "x$with_optim" != x; then
761
	    OPTIM="$with_optim $OPTIM"
762
	else
763
            OPTIM="-O2 $OPTIM"
764
	fi
765
    fi
766
767
    # Generate position-independent code when needed...
768
    if test $PICFLAG = 1; then
769
    	OPTIM="$OPTIM -fPIC"
770
    fi
771
772
    # See if GCC supports -fno-exceptions...
773
    AC_MSG_CHECKING(if GCC supports -fno-exceptions)
774
    OLDCFLAGS="$CFLAGS"
775
    CFLAGS="$CFLAGS -fno-exceptions"
776
    AC_TRY_COMPILE(,,
777
	OPTIM="$OPTIM -fno-exceptions"
778
	AC_MSG_RESULT(yes),
779
	AC_MSG_RESULT(no))
780
    CFLAGS="$OLDCFLAGS"
781
782
    # See if we are running Solaris; if so, try the -fpermissive option...
783
    # This option is required on some versions of Solaris to work around
784
    # bugs in the X headers up through Solaris 7.
785
    #
786
    # Unlike the other compiler/optimization settings, this one is placed
787
    # in CFLAGS and CXXFLAGS so that fltk-config will provide the option
788
    # to clients - otherwise client apps will not compile properly...
789
    if test "$uname" = SunOS; then
790
	AC_MSG_CHECKING(if GCC supports -fpermissive)
791
792
	OLDCFLAGS="$CFLAGS"
793
	CFLAGS="$CFLAGS -fpermissive"
794
	AC_TRY_COMPILE(,,
795
	    CXXFLAGS="$CXXFLAGS -fpermissive"
796
	    AC_MSG_RESULT(yes),
797
	    CFLAGS="$OLDCFLAGS"
798
	    AC_MSG_RESULT(no))
799
    fi
800
else
801
    case "$uname" in
802
        IRIX*)
803
	    # Running some flavor of IRIX; see which version and
804
	    # set things up according...
805
	    if test "$uversion" -ge 62; then
806
	        # We are running IRIX 6.2 or higher; uncomment the following
807
		# lines if you don't have IDO 7.2 or higher:
808
		#
809
		#     CXX="CC -n32 -mips3"
810
		#     CC="cc -n32 -mips3"
811
		#     LD="ld -n32 -mips3"
812
		#     MAKEDEPEND="CC -M"
813
814
		if test "x`grep abi=n32 /etc/compiler.defaults`" = x; then
815
			AC_MSG_WARN(FOR BEST RESULTS BEFORE COMPILING: setenv SGI_ABI \"-n32 -mips3\")
816
		fi
817
818
        	OPTIM="-fullwarn $OPTIM"
819
	    fi
820
	    if test -z "$DEBUGFLAG"; then
821
        	if test "x$with_optim" != x; then
822
		    OPTIM="$with_optim $OPTIM"
823
		else
824
        	    OPTIM="-O2 $OPTIM"
825
		    if test $uversion -gt 62; then
826
        	        OPTIM="-OPT:Olimit=4000 $OPTIM"
827
	            fi
828
		fi
829
	    fi
830
	    ;;
831
	HP-UX*)
832
	    # Running HP-UX; these options should work for the HP compilers.
833
	    if test -z "$DEBUGFLAG"; then
834
        	if test "x$with_optim" != x; then
835
		    OPTIM="$with_optim $OPTIM"
836
		else
837
        	    OPTIM="+O2 $OPTIM"
838
		fi
839
	    fi
840
841
            if test "x$with_optim" = x; then
842
		OPTIM="$OPTIM +DAportable"
843
            fi
844
845
	    if test $PICFLAG = 1; then
846
		OPTIM="+z $OPTIM"
847
	    fi
848
849
	    OPTIM="$OPTIM +W336,501,736,740,749,829"
850
	    ;;
851
	OSF1*)
852
	    # Running Digital/Tru64 UNIX; these options should work for the
853
	    # Digital/Compaq/NewHP compilers.
854
	    if test -z "$DEBUGFLAG"; then
855
        	if test "x$with_optim" != x; then
856
		    OPTIM="$with_optim $OPTIM"
857
		else
858
        	    OPTIM="-O2 $OPTIM"
859
		fi
860
	    fi
861
	    ;;
862
	SunOS*)
863
	    # Solaris
864
	    if test -z "$DEBUGFLAG"; then
865
        	if test "x$with_optim" != x; then
866
		    OPTIM="$with_optim $OPTIM"
867
		else
868
        	    OPTIM="-xO3 $OPTIM"
869
		fi
870
	    fi
871
872
	    if test $PICFLAG = 1; then
873
		OPTIM="-KPIC $OPTIM"
874
	    fi
875
	    ;;
876
	AIX*)
877
	    if test -z "$DEBUGFLAG"; then
878
        	if test "x$with_optim" != x; then
879
		    OPTIM="$with_optim $OPTIM"
880
		else
881
        	    OPTIM="-O2 $OPTIM"
882
		fi
883
	    fi
884
885
	    AC_MSG_WARN(The AIX C and C++ compilers are known not to correctly compile the FLTK library.)
886
	    ;;
887
	*)
888
	    # Running some other operating system; inform the user they
889
	    # should contribute the necessary options to fltk-bugs@fltk.org...
890
	    AC_MSG_WARN(Building FLTK with default compiler optimizations)
891
	    AC_MSG_WARN(Contact fltk-bugs@fltk.org with uname and compiler options.)
892
	    ;;
893
    esac
894
fi
895
896
OPTIM="$DEBUGFLAG $OPTIM"
897
898
dnl Define the FLTK documentation directory...
899
if test x$prefix = xNONE; then
900
    AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "/usr/local/share/doc/fltk")
901
else
2 by Aaron M. Ucko
* New upstream release candidate, incorporating the fix for #226014.
902
    AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "$prefix/share/doc/fltk1.1-doc/HTML")
1 by Aaron M. Ucko
Import upstream version 1.1.4+1.1.5rc1
903
fi
904
905
dnl Define the FLTK data directory...
906
if test x$prefix = xNONE; then
907
    AC_DEFINE_UNQUOTED(FLTK_DATADIR, "/usr/local/share/fltk")
908
else
909
    AC_DEFINE_UNQUOTED(FLTK_DATADIR, "$prefix/share/fltk")
910
fi
911
912
dnl Write all of the files...
913
AC_CONFIG_HEADER(config.h:configh.in)
914
AC_OUTPUT(makeinclude fltk.list fltk-config FL/Makefile)
915
916
dnl Make sure the fltk-config script is executable...
917
chmod +x fltk-config
918
919
dnl
1.1.1 by Aaron M. Ucko
Import upstream version 1.1.6
920
dnl End of "$Id: configure.in,v 1.33.2.31.2.122 2004/11/20 03:44:17 easysw Exp $".
1 by Aaron M. Ucko
Import upstream version 1.1.4+1.1.5rc1
921
dnl