1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
|
dnl -*- sh -*-
dnl the "configure" script is made from this by running GNU "autoconf"
dnl
dnl "$Id: configure.in,v 1.33.2.31.2.32 2001/11/29 21:50:05 easysw Exp $"
dnl
dnl Configuration script for the Fast Light Tool Kit (FLTK).
dnl
dnl Copyright 1998-2001 by Bill Spitzak and others.
dnl
dnl This library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Library General Public
dnl License as published by the Free Software Foundation; either
dnl version 2 of the License, or (at your option) any later version.
dnl
dnl This library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Library General Public License for more details.
dnl
dnl You should have received a copy of the GNU Library General Public
dnl License along with this library; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
dnl USA.
dnl
dnl Please report all bugs and problems to "fltk-bugs@fltk.org".
dnl
dnl We need at least autoconf 2.13...
AC_PREREQ(2.13)
dnl Required file in package...
AC_INIT(src/Fl.cxx)
dnl FLTK library versions...
FL_MAJOR_VERSION=1
FL_MINOR_VERSION=1
FL_PATCH_VERSION=0
FL_RELEASE_VERSION=b6
FL_API_VERSION=${FL_MAJOR_VERSION}.${FL_MINOR_VERSION}
AC_SUBST(FL_MAJOR_VERSION)
AC_SUBST(FL_MINOR_VERSION)
AC_SUBST(FL_PATCH_VERSION)
AC_SUBST(FL_RELEASE_VERSION)
AC_SUBST(FL_API_VERSION)
dnl How do we make libraries?
AC_PROG_RANLIB
AC_PATH_PROG(AR, ar)
if test "$RANLIB" != ":"; then
LIBCOMMAND="$AR cr"
else
LIBCOMMAND="$AR crs"
fi
DSOCOMMAND="echo"
DSONAME=""
LINKFLTK="-lfltk"
LINKFLTKGL="-lfltk_gl"
GLDEMOS="gldemos"
LIBNAME="../lib/libfltk.a"
GLLIBNAME="../lib/libfltk_gl.a"
dnl Get the operating system and version number...
uname=`uname`
uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'`
if test $uname = IRIX64; then
uname="IRIX"
fi
dnl Clear debugging flags and only enable debugging if the user asks for
dnl it.
DEBUGFLAG=""
PICFLAG=0
CFLAGS="${CFLAGS:=}"
CXXFLAGS="${CXXFLAGS:=}"
case $uname in
CYGWIN*)
AC_ARG_ENABLE(cygwin, [ --enable-cygwin use the CygWin libraries [default=yes]],
[if test x$enable_cygwin = xno; then
CPPFLAGS="$CPPFLAGS -mno-cygwin"
CFLAGS="$CFLAGS -mno-cygwin"
CXXFLAGS="$CXXFLAGS -mno-cygwin"
fi])
;;
esac
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],
[if eval "test x$enable_debug = xyes"; then
DEBUGFLAG="-g "
fi])
AC_ARG_ENABLE(gl, [ --enable-gl turn on OpenGL support [default=yes]])
AC_ARG_ENABLE(shared, [ --enable-shared turn on shared libraries [default=no]],[
DSOLINK=""
AC_SUBST(DSOLINK)
if test x$enable_shared = xyes; then
PICFLAG=1
case $uname in
*BSD* | Darwin*)
DSONAME="libfltk.$FL_API_VERSION.dylib"
GLDSONAME="libfltk_gl.$FL_API_VERSION.dylib"
DSOCOMMAND="ld $DSOFLAGS -dylib /usr/lib/dylib1.o -lc"
if test "$libdir" != "/usr/lib"; then
DSOLINK="-Wl,-rpath,$libdir"
fi
;;
SunOS* | UNIX_S*)
DSONAME="libfltk.so.$FL_API_VERSION"
GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
DSOCOMMAND="\$(CXX) -h \$@ \$(LDLIBS) -G $DEBUGFLAG -o"
if test "$libdir" != "/usr/lib"; then
DSOLINK="-R$libdir"
fi
;;
HP-UX*)
DSONAME="libfltk.sl.$FL_API_VERSION"
GLDSONAME="libfltk_gl.sl.$FL_API_VERSION"
DSOCOMMAND="ld -b -z +h \$@ $DEBUGFLAG -o"
if test "$libdir" != "/usr/lib"; then
DSOLINK="-Wl,-rpath,$libdir"
fi
;;
IRIX* | OSF1*)
DSONAME="libfltk.so.$FL_API_VERSION"
GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
DSOCOMMAND="\$(CXX) -Wl,-soname,\$@ \$(LDLIBS) -shared $DEBUGFLAG -o"
if test "$libdir" != "/usr/lib" - a "$libdir" != "/usr/lib32"; then
DSOLINK="-Wl,-rpath,$libdir"
fi
;;
FreeBSD* | NetBSD* | OpenBSD* | Linux*)
DSONAME="libfltk.so.$FL_API_VERSION"
GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
DSOCOMMAND="\$(CXX) -Wl,-soname,\$@ \$(LDLIBS) -shared -fPIC $DEBUGFLAG -o"
if test "$libdir" != "/usr/lib"; then
DSOLINK="-Wl,-rpath,$libdir"
fi
;;
AIX*)
DSONAME="libfltk_s.a"
GLDSONAME="libfltk_gl_s.a"
DSOCOMMAND="\$(CXX) -Wl,-bexpall,-bM:SRE,-bnoentry -o"
;;
CYGWIN*)
AC_MSG_WARN(Shared libraries are not supported under CygWin.)
;;
*)
AC_MSG_WARN(Shared libraries may not be supported. Trying -shared option with compiler.)
DSONAME="libfltk.so.$FL_API_VERSION"
GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
DSOCOMMAND="\$(CXX) -Wl,-soname,\$@ \$(LDLIBS) -shared $DEBUGFLAG -o"
;;
esac
fi])
AC_PROG_CC
AC_PROG_CXX
dnl AC_PROG_INSTALL
AC_PATH_PROG(NROFF,nroff)
if test "$NROFF" = ""; then
AC_PATH_PROG(GROFF,groff)
if test "$GROFF" = ""; then
NROFF="echo"
else
NROFF="$GROFF -T ascii"
fi
fi
AC_PATH_PROG(HTMLDOC,htmldoc)
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
if test $ac_cv_sizeof_short -eq 2; then
AC_DEFINE(U16,unsigned short)
fi
if test $ac_cv_sizeof_int -eq 4; then
AC_DEFINE(U32,unsigned)
else
if test $ac_cv_sizeof_long -eq 4; then
AC_DEFINE(U32,unsigned long)
fi
fi
if test $ac_cv_sizeof_int -eq 8; then
AC_DEFINE(U64,unsigned)
else
if test $ac_cv_sizeof_long -eq 8; then
AC_DEFINE(U64,unsigned long)
fi
fi
AC_HEADER_DIRENT
AC_CHECK_HEADER(sys/select.h,AC_DEFINE(HAVE_SYS_SELECT_H))
AC_CHECK_HEADER(sys/stdtypes.h,AC_DEFINE(HAVE_SYS_SELECT_H))
AC_CHECK_FUNC(scandir,
if test "$uname" = SunOS -o "$uname" = QNX; then
AC_MSG_WARN(Not using $uname scandir emulation function.)
else
AC_DEFINE(HAVE_SCANDIR)
fi)
AC_CHECK_FUNC(vsnprintf,
if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
AC_MSG_WARN(Not using built-in vsnprintf function because you are running HP-UX 10.20.)
else
AC_DEFINE(HAVE_VSNPRINTF)
fi)
AC_CHECK_FUNC(snprintf,
if test "$uname" = "HP-UX" -a "$uversion" = "1020"; then
AC_MSG_WARN(Not using built-in snprintf function because you are running HP-UX 10.20.)
else
AC_DEFINE(HAVE_SNPRINTF)
fi)
AC_CHECK_FUNCS(vsprintf)
AC_CHECK_HEADER(strings.h, AC_DEFINE(HAVE_STRINGS_H))
AC_CHECK_FUNCS(strcasecmp)
dnl FLTK library uses math library functions...
AC_SEARCH_LIBS(pow, m)
dnl Check for image libraries...
SAVELIBS="$LIBS"
IMAGELIBS=""
AC_SUBST(IMAGELIBS)
AC_CHECK_HEADER(jpeglib.h,
AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
AC_DEFINE(HAVE_LIBJPEG)
IMAGELIBS="$IMAGELIBS -ljpeg"))
AC_CHECK_HEADER(zlib.h,
AC_CHECK_LIB(z, gzopen,
AC_DEFINE(HAVE_LIBZ)
IMAGELIBS="$IMAGELIBS -lz"
LIBS="$LIBS -lz"))
AC_CHECK_HEADER(png.h,
AC_CHECK_LIB(png, png_read_rows,
AC_DEFINE(HAVE_LIBPNG)
IMAGELIBS="-lpng $IMAGELIBS"
LIBS="-lpng $LIBS"
AC_CHECK_FUNCS(png_get_valid png_set_tRNS_to_alpha png_read_destroy)))
dnl Restore original LIBS settings...
LIBS="$SAVELIBS"
dnl See if we need a .exe extension on executables...
AC_EXEEXT
dnl Check for standard graphics API and OpenGL...
HLINKS=
case $uname in
CYGWIN*)
dnl Cygwin environment...
LIBS="$LIBS -mwindows -lgdi32 -lwsock32"
CFLAGS="$CFLAGS -mwindows -DWIN32"
CXXFLAGS="$CXXFLAGS -mwindows -DWIN32"
HLINKS="#"
if test x$enable_gl != xno; then
AC_CHECK_HEADER(GL/gl.h,
AC_DEFINE(HAVE_GL)
GLLIB="-lopengl32")
AC_CHECK_HEADER(GL/glu.h,
AC_DEFINE(HAVE_GL_GLU_H)
GLLIB="-lglu32 $GLLIB")
else
LINKFLTKGL=""
GLLIBNAME=""
GLDSONAME=""
GLDEMOS=""
fi
;;
Darwin*)
# MacOS X uses Carbon for graphics...
LIBS="$LIBS -framework Carbon -framework ApplicationServices"
if test x$enable_gl != xno; then
AC_DEFINE(HAVE_GL)
AC_DEFINE(HAVE_GL_GLU_H)
GLLIB="-framework OpenGL"
else
LINKFLTKGL=""
GLLIBNAME=""
GLDSONAME=""
GLDEMOS=""
fi
;;
*)
dnl Check for X11...
AC_PATH_XTRA
if test x$no_x = xyes; then
AC_MSG_ERROR(Configure could not find required X11 libraries, aborting.)
fi
if test "x$X_PRE_LIBS" != x; then
AC_MSG_WARN(Ignoring libraries \"$X_PRE_LIBS\" requested by configure.)
fi
LIBS="$LIBS -lXext -lX11 $X_EXTRA_LIBS"
CFLAGS="$CFLAGS$X_CFLAGS"
CXXFLAGS="$CXXFLAGS$X_CFLAGS"
LDFLAGS="$X_LIBS $LDFLAGS"
if test "x$x_includes" != x; then
ac_cpp="$ac_cpp -I$x_includes"
fi
dnl Check for OpenGL unless disabled...
GLLIB=
if test x$enable_gl != xno; then
AC_CHECK_HEADER(GL/gl.h,
AC_CHECK_LIB(GL, glXMakeCurrent, AC_DEFINE(HAVE_GL) GLLIB="-lGL", \
AC_CHECK_LIB(MesaGL,glXMakeCurrent, AC_DEFINE(HAVE_GL) GLLIB=" -lMesaGL",,\
-lm), \
-lm)
)
AC_CHECK_HEADER(GL/glu.h,
AC_DEFINE(HAVE_GL_GLU_H)
if test x$ac_cv_lib_GL_glXMakeCurrent = xyes; then
GLLIB="-lGLU $GLLIB"
fi
if test x$ac_cv_lib_MesaGL_glXMakeCurrent = xyes; then
GLLIB="-lMesaGLU $GLLIB"
fi
)
if test x$ac_cv_lib_GL_glXMakeCurrent = xno -a x$ac_cv_lib_MesaGL_glXMakeCurrent = xno; then
LINKFLTKGL=""
GLLIBNAME=""
GLDSONAME=""
GLDEMOS=""
fi
else
LINKFLTKGL=""
GLLIBNAME=""
GLDSONAME=""
GLDEMOS=""
fi
dnl Check for the Xdbe extension...
AC_CHECK_HEADER(X11/extensions/Xdbe.h, \
if test "$uname" != "SunOS"; then
AC_DEFINE(HAVE_XDBE)
fi)
dnl Check for overlay visuals...
AC_CACHE_CHECK("for X overlay visuals", ac_cv_have_overlay,
if xprop -root 2>/dev/null | grep -c "SERVER_OVERLAY_VISUALS" >/dev/null; then
ac_cv_have_overlay=yes
else
ac_cv_have_overlay=no
fi)
esac
AC_SUBST(HLINKS)
AC_SUBST(GLDEMOS)
AC_SUBST(GLLIB)
dnl Figure out the appropriate formatted man page extension...
case "$uname" in
*BSD* | Darwin*)
# *BSD
CAT1EXT=0
CAT3EXT=0
;;
IRIX*)
# SGI IRIX
CAT1EXT=z
CAT3EXT=z
;;
*)
# All others
CAT1EXT=1
CAT3EXT=3
;;
esac
AC_SUBST(CAT1EXT)
AC_SUBST(CAT3EXT)
dnl Fix "mandir" variable...
if test "$mandir" = "\${prefix}/man" -a "$prefix" = "/usr"; then
case "$uname" in
*BSD* | Darwin* | Linux*)
# *BSD, Darwin, and Linux
mandir="\${prefix}/share/man"
;;
IRIX*)
# SGI IRIX
mandir="\${prefix}/share/catman"
;;
esac
fi
dnl Fix "libdir" variable...
if test "$prefix" = NONE; then
prefix=/usr/local
fi
if test "$exec_prefix" = NONE; then
exec_prefix="$prefix"
fi
if test "$uname" = "IRIX" -a $uversion -ge 62 -a "$libdir" = "\${exec_prefix}/lib" -a "$exec_prefix" = "/usr"; then
libdir="/usr/lib32"
fi
dnl Add warnings to compiler switches:
dnl do this last so messing with switches does not break tests
MAKEDEPEND="\$(CXX) -M"
if test -n "$GXX"; then
# Starting with GCC 3.0, you must link C++ programs against either
# libstdc++ (shared by default), or libsupc++ (always static). If
# you care about binary portability between Linux distributions,
# you need to either 1) build your own GCC with static C++ libraries
# or 2) link using gcc and libsupc++. We choose the latter since
# FLTK doesn't (currently) use any of the stdc++ library.
#
# Also, GCC 3.0.x still has problems compiling some code. You may
# or may not have success with it. USE 3.0.x WITH EXTREME CAUTION!
#
# Previous versions of GCC do not have the reliance on the stdc++
# or g++ libraries, so the extra supc++ library is not needed.
case "`$CXX --version`" in
3*)
AC_MSG_WARN(GCC 3.0.x is known to produce incorrect code - use with caution!)
LIBS="$LIBS -lsupc++"
;;
3.1*)
LIBS="$LIBS -lsupc++"
;;
esac
CXX="$CC"
CFLAGS="-Wall $CFLAGS"
CXXFLAGS="-Wall $CXXFLAGS"
if test -z "$DEBUGFLAG"; then
#
# Note: Can't use -fomit-frame-pointer - prevents tools like
# libsafe from working!
#
# Don't use -fforce-mem, -fforce-addr, or -fcaller-saves.
# They all seem to make either no difference or enlarge
# the code by a few hundred bytes.
#
# "-O2" seems to be the best compromise between speed and
# code size. "-O3" and higher seem to make no effective
# different in the speed of the code, but does bloat the
# library 10+%.
#
CFLAGS="-O2 $CFLAGS"
CXXFLAGS="-O2 $CXXFLAGS"
fi
if test $PICFLAG = 1; then
CFLAGS="-fPIC $CFLAGS"
CXXFLAGS="-fPIC $CXXFLAGS"
fi
# See if GCC supports -fno-exceptions...
AC_MSG_CHECKING(if GCC supports -fno-exceptions)
OLDCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fno-exceptions"
AC_TRY_COMPILE(,,
OPTIM="$OPTIM -fno-exceptions"
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
CFLAGS="$OLDCFLAGS"
# See if we are running Solaris; if so, try the -fpermissive option...
if test "$uname" = SunOS; then
AC_MSG_CHECKING(if GCC supports -fpermissive)
OLDCFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fpermissive"
AC_TRY_COMPILE(,,
OPTIM="$OPTIM -fpermissive"
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
CFLAGS="$OLDCFLAGS"
fi
else
case `(uname) 2>/dev/null` in
IRIX*)
# Running some flavor of IRIX; see which version and
# set things up according...
if test "$uversion" -ge 62; then
# We are running IRIX 6.2 or higher; uncomment the following
# lines if you don't have IDO 7.2 or higher:
#
# CXX="CC -n32 -mips3"
# CC="cc -n32 -mips3"
# LD="ld -n32 -mips3"
# MAKEDEPEND="CC -M"
if test "x`grep abi=n32 /etc/compiler.defaults`" = x; then
AC_MSG_WARN(FOR BEST RESULTS BEFORE COMPILING: setenv SGI_ABI \"-n32 -mips3\")
fi
CFLAGS="-fullwarn $CFLAGS"
CXXFLAGS="-fullwarn $CXXFLAGS"
else
CXXFLAGS="+w +pp $CXXFLAGS"
fi
if test -z "$DEBUGFLAG"; then
CFLAGS="-O2 $CFLAGS"
CXXFLAGS="-O2 $CXXFLAGS"
fi
;;
HP-UX*)
# Running HP-UX; these options should work for the HP compilers.
if test -z "$DEBUGFLAG"; then
CFLAGS="+O2 $CFLAGS"
CXXFLAGS="+O2 +W336,501,736,740,749,829 $CXXFLAGS"
fi
CFLAGS="+DAportable $CFLAGS"
CXXFLAGS="+DAportable $CXXFLAGS"
;;
SunOS*)
# Solaris
if test -z "$DEBUGFLAG"; then
CFLAGS="-xO3"
CXXFLAGS="-xO3"
fi
if test $PICFLAG = 1; then
CFLAGS="-KPIC $CFLAGS"
CXXFLAGS="-PIC $CXXFLAGS"
fi
;;
AIX*)
if test -z "$DEBUGFLAG"; then
CFLAGS="-O2 $CFLAGS"
CXXFLAGS="-O2 $CXXFLAGS"
fi
AC_MSG_WARN(The AIX C and C++ compilers are known not to correctly compile the FLTK library.)
;;
*)
# Running some other operating system; inform the user they
# should contribute the necessary options to fltk-bugs@fltk.org...
AC_MSG_WARN(Building FLTK with default compiler optimizations)
AC_MSG_WARN(Contact fltk-bugs@fltk.org with uname and compiler options.)
;;
esac
fi
CFLAGS="$DEBUGFLAG $CFLAGS"
CXXFLAGS="$DEBUGFLAG $CXXFLAGS"
AC_SUBST(DSOCOMMAND)
AC_SUBST(DSONAME)
AC_SUBST(GLDSONAME)
AC_SUBST(GLLIBNAME)
AC_SUBST(LIBCOMMAND)
AC_SUBST(LIBNAME)
AC_SUBST(LINKFLTKGL)
AC_SUBST(LINKFLTK)
AC_SUBST(MAKEDEPEND)
if test x$prefix = xNONE; then
AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "/usr/local/share/doc/fltk")
else
AC_DEFINE_UNQUOTED(FLTK_DOCDIR, "$prefix/share/doc/fltk")
fi
AC_CONFIG_HEADER(config.h:configh.in)
AC_OUTPUT(makeinclude fltk.list fltk-config FL/Makefile FL/Enumerations.H)
chmod +x fltk-config
dnl
dnl End of "$Id: configure.in,v 1.33.2.31.2.32 2001/11/29 21:50:05 easysw Exp $".
dnl
|