[go: up one dir, main page]

File: configure.in

package info (click to toggle)
fltk1.1 1.1.10-23
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 14,996 kB
  • ctags: 15,655
  • sloc: cpp: 76,654; ansic: 40,942; makefile: 1,683; sh: 438
file content (1262 lines) | stat: -rw-r--r-- 35,665 bytes parent folder | download | duplicates (7)
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
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
dnl -*- sh -*-
dnl the "configure" script is made from this by running GNU "autoconf"
dnl
dnl "$Id: configure.in 6892 2009-09-20 17:25:25Z AlbrechtS $"
dnl
dnl Configuration script for the Fast Light Tool Kit (FLTK).
dnl
dnl Copyright 1998-2009 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 on the following page:
dnl
dnl      http://www.fltk.org/str.php
dnl

dnl We need at least autoconf 2.50...
AC_PREREQ(2.50)

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=10
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_API_VERSION)

dnl Get the operating system and version number...
uname=`uname`
uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'`
if test "x$uname" = xIRIX64; then
    uname="IRIX"
fi
if test "x$uname" = x; then
    # MingW doesn't provide any output when uname is run, even with "-s"...
    uname="CYGWIN"
fi

dnl Don't automatically add "-g" to compiler options...
ARCHFLAGS="${ARCHFLAGS:=}"
CFLAGS="${CFLAGS:=}"
CPPFLAGS="${CPPFLAGS:=}"
CXXFLAGS="${CXXFLAGS:=}"
DSOFLAGS="${DSOFLAGS:=}"
LDFLAGS="${LDFLAGS:=}"
OPTIM="${OPTIM:=}"

AC_SUBST(ARCHFLAGS)
AC_SUBST(OPTIM)

dnl OS-specific pre-tests...
case $uname in
    CYGWIN* | MINGW*)
        # Handle Cygwin option *first*, before all other tests.
	AC_ARG_ENABLE(cygwin, [  --enable-cygwin         use the CygWin libraries [default=no]])
	if test x$enable_cygwin != xyes; then
	    # NOTE: We can't use ARCHFLAGS for this, since it does not work
	    #       with some of the function tests - Cygwin uses a
	    #       different C library...
	    CFLAGS="$CFLAGS -mno-cygwin"
	    CPPFLAGS="$CPPFLAGS -mno-cygwin"
	    CXXFLAGS="$CXXFLAGS -mno-cygwin"
	    LDFLAGS="$LDFLAGS -mno-cygwin"
	    DSOFLAGS="$DSOFLAGS -mno-cygwin"
	fi
	;;
    Darwin*)
        # Starting with 10.6 (Snow Leopard), OS X does not support
        # Carbon calls anymore. We patch this until we are completely Cocoa compliant
        # by limiting ourselves to 32 bit Intel compiles
        d_ver_rev=`sw_vers -productVersion | sed -e 's/\.[[0-9]][[0-9]]*//2'`
        d_ver=`echo $d_ver_rev | sed -e 's/\.[[0-9]][[0-9]]*//'`
        d_rev=`echo $d_ver_rev | sed -e 's/[[0-9]][[0-9]]*\.//'`
        if test $d_ver -gt 10 -o $d_ver -eq 10 -a $d_rev -ge 6; then
            CFLAGS="$CFLAGS -arch i386"
            CXXFLAGS="$CXXFLAGS -arch i386"
            LDFLAGS="$LDFLAGS -arch i386"
        fi
        ;;
esac

dnl Define the libraries and link options we'll need.
LINKFLTK="../lib/libfltk.a"
LINKFLTKFORMS="../lib/libfltk_forms.a"
LINKFLTKGL="../lib/libfltk_gl.a"
LINKFLTKIMG="../lib/libfltk_images.a"
GLDEMOS="gldemos"

LIBEXT=".a"
LIBNAME="../lib/libfltk.a"
FLLIBNAME="../lib/libfltk_forms.a"
GLLIBNAME="../lib/libfltk_gl.a"
IMGLIBNAME="../lib/libfltk_images.a"

LIBBASENAME="libfltk.a"
FLLIBBASENAME="libfltk_forms.a"
GLLIBBASENAME="libfltk_gl.a"
IMGLIBBASENAME="libfltk_images.a"

AC_SUBST(FLLIBNAME)
AC_SUBST(GLDEMOS)
AC_SUBST(GLLIBNAME)
AC_SUBST(IMGLIBNAME)
AC_SUBST(LIBEXT)
AC_SUBST(LIBNAME)
AC_SUBST(LINKFLTK)
AC_SUBST(LINKFLTKFORMS)
AC_SUBST(LINKFLTKGL)
AC_SUBST(LINKFLTKIMG)

AC_SUBST(LIBBASENAME)
AC_SUBST(FLLIBBASENAME)
AC_SUBST(GLLIBBASENAME)
AC_SUBST(IMGLIBBASENAME)

dnl Handle compile-time options...
AC_ARG_ENABLE(debug, [  --enable-debug          turn on debugging [default=no]])
if test x$enable_debug = xyes; then
    DEBUGFLAG="-g "
else
    DEBUGFLAG=""
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]])
if test x$enable_shared = xyes; then
    PICFLAG=1
    SHAREDSUFFIX=""
    FLUID="fluid-shared"

    case $uname in
	Darwin*)
            DSONAME="libfltk.$FL_API_VERSION.dylib"
            FLDSONAME="libfltk_forms.$FL_API_VERSION.dylib"
            GLDSONAME="libfltk_gl.$FL_API_VERSION.dylib"
            IMGDSONAME="libfltk_images.$FL_API_VERSION.dylib"
	    DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -dynamiclib -lc -o"
	    ;;

	SunOS* | UNIX_S*)
            DSONAME="libfltk.so.$FL_API_VERSION"
            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
	    DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -h \$@ \$(LDLIBS) -G $DEBUGFLAG -o"
	    if test "x$libdir" != "x/usr/lib"; then
		    DSOLINK="-R$libdir"
            fi
	    ;;
	HP-UX*)
            DSONAME="libfltk.sl.$FL_API_VERSION"
            FLDSONAME="libfltk_forms.sl.$FL_API_VERSION"
            GLDSONAME="libfltk_gl.sl.$FL_API_VERSION"
            IMGDSONAME="libfltk_images.sl.$FL_API_VERSION"
	    DSOCOMMAND="ld \$(DSOFLAGS) -b -z +h \$@ $DEBUGFLAG -o"
	    if test "x$libdir" != "x/usr/lib"; then
		    DSOLINK="-Wl,-rpath,$libdir"
            fi
	    ;;
	IRIX*)
            DSONAME="libfltk.so.$FL_API_VERSION"
            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
            DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@,-set_version,sgi1.1 \$(LDLIBS) -shared $DEBUGFLAG -o"
	    if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib32" -a "x$libdir" != "x/usr/lib64"; then
		    DSOLINK="-Wl,-rpath,$libdir"
            fi
	    ;;
	OSF1*)
            DSONAME="libfltk.so.$FL_API_VERSION"
            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
            DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared $DEBUGFLAG -o"
	    if test "x$libdir" != "x/usr/lib" -a "x$libdir" != "x/usr/lib32"; then
		    DSOLINK="-Wl,-rpath,$libdir"
            fi
	    ;;
	Linux* | *BSD*)
            DSONAME="libfltk.so.$FL_API_VERSION"
            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
            DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ -shared -fPIC $DEBUGFLAG -o"
#	    if test "x$libdir" != "x/usr/lib"; then
#		    DSOLINK="-Wl,-rpath,$libdir"
#           fi
	    ;;
	AIX*)
            DSONAME="libfltk_s.a"
            FLDSONAME="libfltk_forms_s.a"
            GLDSONAME="libfltk_gl_s.a"
            IMGDSONAME="libfltk_images_s.a"
            DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-bexpall,-bM:SRE,-bnoentry -o"
            SHAREDSUFFIX="_s"
            ;;
        CYGWIN* | MINGW*)
	    PICFLAG=0
	    if test x$enable_cygwin != xyes; then
		DSONAME="mgwfltknox-$FL_API_VERSION.dll"
		FLDSONAME="mgwfltknox_forms-$FL_API_VERSION.dll"
		GLDSONAME="mgwfltknox_gl-$FL_API_VERSION.dll"
		IMGDSONAME="mgwfltknox_images-$FL_API_VERSION.dll"
	    else
		DSONAME="cygfltknox-$FL_API_VERSION.dll"
		FLDSONAME="cygfltknox_forms-$FL_API_VERSION.dll"
		GLDSONAME="cygfltknox_gl-$FL_API_VERSION.dll"
		IMGDSONAME="cygfltknox_images-$FL_API_VERSION.dll"
	    fi
	    #-----------------------------------------------------------
	    # -Wl,--enable-runtime-pseudo-reloc: See str 1585
	    # appears to be necessary for older binutils versions < 2.16
	    #-----------------------------------------------------------
            LDFLAGS="$LDFLAGS -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
	    DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -shared \
	    	-Wl,--whole-archive -Wl,--export-all-symbols \
		-Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-import \
		-Wl,--enable-auto-image-base -o \$@"
	    ;;
	*)
            AC_MSG_WARN(Shared libraries may not be supported.  Trying -shared option with compiler.)
            DSONAME="libfltk.so.$FL_API_VERSION"
            FLDSONAME="libfltk_forms.so.$FL_API_VERSION"
            GLDSONAME="libfltk_gl.so.$FL_API_VERSION"
            IMGDSONAME="libfltk_images.so.$FL_API_VERSION"
            DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$@ \$(LDLIBS) -shared $DEBUGFLAG -o"
	    ;;
    esac

    LINKSHARED="-L../src -lfltk_images$SHAREDSUFFIX -lfltk_forms$SHAREDSUFFIX -lfltk$SHAREDSUFFIX"
else
    DSOCOMMAND="echo"
    DSOLINK=""
    DSONAME=""
    FLDSONAME=""
    GLDSONAME=""
    IMGDSONAME=""
    PICFLAG=0
    SHAREDSUFFIX=""
    FLUID="fluid"
    LINKSHARED="../lib/libfltk_images.a ../lib/libfltk_forms.a ../lib/libfltk.a"
fi

AC_SUBST(DSOCOMMAND)
AC_SUBST(DSOFLAGS)
AC_SUBST(DSOLINK)
AC_SUBST(DSONAME)
AC_SUBST(FLDSONAME)
AC_SUBST(GLDSONAME)
AC_SUBST(IMGDSONAME)
AC_SUBST(SHAREDSUFFIX)
AC_SUBST(LINKSHARED)
AC_SUBST(FLUID)

AC_ARG_ENABLE(threads, [  --enable-threads        enable multi-threading support])

AC_ARG_WITH(optim, [  --with-optim="flags"    use custom optimization flags])

AC_ARG_WITH(archflags, [  --with-archflags="flags"
                          use custom architecture flags],
    ARCHFLAGS="$withval")

case $uname in
    Darwin*)
        AC_ARG_ENABLE(quartz, [  --enable-quartz         use Quartz instead of Quickdraw (default=no)])
        if test "x$enable_quartz" = "xyes"; then
            AC_DEFINE(USE_QUARTZ, 1)
            AC_DEFINE(__APPLE_QUARTZ__)
        else
            AC_DEFINE(__APPLE_QD__)
        fi
        ;;
esac

dnl Find commands...
AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL
case $uname in
    OSF1*)
	INSTALL="`pwd`/install-sh -c"
	;;
esac
if test "$INSTALL" = "$ac_install_sh"; then
    # Use full path to install-sh script...
    INSTALL="`pwd`/install-sh -c"
fi
AC_PATH_PROG(NROFF,nroff)
if test "x$NROFF" = "x:"; then
    # Try groff instead of nroff...
    AC_PATH_PROG(GROFF,groff)
    if test "x$GROFF" = "x:"; then
        NROFF="echo"
    else
        NROFF="$GROFF -T ascii"
    fi
fi
AC_PATH_PROG(HTMLDOC,htmldoc)

dnl How do we make libraries?
AC_PROG_RANLIB
AC_PATH_PROG(AR, ar)

if test "x$AR" = "x:"; then
    AC_MSG_ERROR(Configure could not find the library archiver, aborting.)
fi

if test "x$RANLIB" != "x:"; then
    LIBCOMMAND="$AR cr"
else
    LIBCOMMAND="$AR crs"
fi

AC_SUBST(LIBCOMMAND)

dnl Architecture checks...
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

dnl Does the C++ compiler support the bool type?
AC_CACHE_CHECK(whether the compiler recognizes bool as a built-in type,
    ac_cv_cxx_bool,[
	AC_LANG_SAVE
	AC_LANG_CPLUSPLUS
	AC_TRY_COMPILE([
	    int f(int  x){return 1;}
	    int f(char x){return 1;}
	    int f(bool x){return 1;}
	],[
	    bool b = true;
	    return f(b);
	], ac_cv_cxx_bool=yes, ac_cv_cxx_bool=no)
	AC_LANG_RESTORE
    ])

if test "$ac_cv_cxx_bool" != yes; then
    CXXFLAGS="-Dbool=char -Dfalse=0 -Dtrue=1 $CXXFLAGS"
fi

dnl Standard headers and functions...
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 "x$uname" = xSunOS -o "x$uname" = xQNX; then
        AC_MSG_WARN(Not using $uname scandir emulation function.)
    else
        AC_DEFINE(HAVE_SCANDIR)
    fi)

dnl Do we have the POSIX compatible scandir() prototype?
AC_CACHE_CHECK([whether we have the POSIX compatible scandir() prototype],
    ac_cv_cxx_scandir_posix,[
	AC_LANG_SAVE
	AC_LANG_CPLUSPLUS
	AC_TRY_COMPILE([
	  #include <dirent.h>
	  int func (const char *d, dirent ***list, void *sort) {
	    int n = scandir(d, list, 0, (int(*)(const dirent **, const dirent **))sort);
	  }
	],[
	], ac_cv_cxx_scandir_posix=yes, ac_cv_cxx_scandir_posix=no)
	AC_LANG_RESTORE
    ])

if test "$ac_cv_cxx_scandir_posix" = yes; then
    AC_DEFINE(HAVE_SCANDIR_POSIX)
fi

AC_CHECK_FUNC(vsnprintf,[
    case "$uname" in
    	HP-UX*)
	    if test "$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
	    ;;

    	OSF1*)
	    if test "$uversion" = "40"; then
                AC_MSG_WARN(Not using built-in vsnprintf function because you are running Tru64 4.0.)
	    else
        	AC_DEFINE(HAVE_VSNPRINTF)
	    fi
	    ;;

        *)
            AC_DEFINE(HAVE_VSNPRINTF)
	    ;;
    esac])
AC_CHECK_FUNC(snprintf,[
    case "$uname" in
    	HP-UX*)
	    if test "$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
	    ;;

    	OSF1*)
	    if test "$uversion" = "40"; then
                AC_MSG_WARN(Not using built-in snprintf function because you are running Tru64 4.0.)
	    else
        	AC_DEFINE(HAVE_SNPRINTF)
	    fi
	    ;;

        *)
            AC_DEFINE(HAVE_SNPRINTF)
	    ;;
    esac])
AC_CHECK_HEADER(strings.h, AC_DEFINE(HAVE_STRINGS_H))
AC_CHECK_FUNCS(strcasecmp strlcat strlcpy)

AC_CHECK_HEADER(locale.h, AC_DEFINE(HAVE_LOCALE_H))
AC_CHECK_FUNCS(localeconv)

dnl FLTK library uses math library functions...
AC_SEARCH_LIBS(pow, m)

dnl Check for largefile support...
AC_SYS_LARGEFILE

dnl Define largefile options as needed...
LARGEFILE=""
if test x$enable_largefile = xyes; then
	LARGEFILE="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"

	if test x$ac_cv_sys_large_files = x1; then
		LARGEFILE="$LARGEFILE -D_LARGE_FILES"
	fi

	if test x$ac_cv_sys_file_offset_bits = x64; then
		LARGEFILE="$LARGEFILE -D_FILE_OFFSET_BITS=64"
	fi
fi
AC_SUBST(LARGEFILE)

dnl Check for "long long" support...
AC_CACHE_CHECK(for long long int, ac_cv_c_long_long,
	[if test "$GCC" = yes; then
		ac_cv_c_long_long=yes
	else
		AC_TRY_COMPILE(,[long long int i;],
			ac_cv_c_long_long=yes,
			ac_cv_c_long_long=no)
	fi])

if test $ac_cv_c_long_long = yes; then
	AC_DEFINE(HAVE_LONG_LONG)
fi

AC_CHECK_FUNC(strtoll, AC_DEFINE(HAVE_STRTOLL))

dnl Check for dlopen/dlsym...
SAVELIBS=$LIBS
AC_SEARCH_LIBS(dlsym, dl, AC_DEFINE(HAVE_DLSYM))
AC_CHECK_HEADER(dlfcn.h, AC_DEFINE(HAVE_DLFCN_H))
LIBS=$SAVELIBS

dnl Check for audio libraries...
AUDIOLIBS=""

case $uname in
    CYGWIN* | MINGW*)
	dnl Cygwin environment...
	AUDIOLIBS="-lwinmm"
	;;

    Darwin*)
	AUDIOLIBS="-framework CoreAudio"
	;;

    *)
	AC_CHECK_HEADER(alsa/asoundlib.h,
	    AC_DEFINE(HAVE_ALSA_ASOUNDLIB_H)
	    AUDIOLIBS="-lasound")
        ;;
esac

AC_SUBST(AUDIOLIBS)

dnl Check for image libraries...
SAVELIBS="$LIBS"
IMAGELIBS=""
STATICIMAGELIBS=""

AC_SUBST(IMAGELIBS)
AC_SUBST(STATICIMAGELIBS)

# Handle the JPEG lib linking mode (use fltk local or system lib)
# If --enable-(resp. --disable-)localjpeg parameter is not set by user
# Then we check the JPEG lib usability, with result in sysjpeglib_ok variable
AC_ARG_ENABLE(localjpeg, [  --enable-localjpeg      use local JPEG library, default=auto])
# Check for System lib use if automatic mode or --disable-localjpeg is requested
sysjpeglib_ok=no
sysjpeginc_ok=no
if test x$enable_localjpeg != xyes; then
    AC_CHECK_LIB(jpeg,jpeg_CreateCompress,
	[AC_CHECK_HEADER(jpeglib.h,
	    sysjpeginc_ok=yes)
	    if test x$sysjpeginc_ok = xyes; then
		sysjpeglib_ok=yes
		fi])
fi
# Now set the jpeg lib and include flags according to the requested mode and availability 
if test x$enable_localjpeg = xyes -o x$sysjpeglib_ok = xno; then
    JPEGINC="-I../jpeg"
    JPEG="jpeg"
    IMAGELIBS="-lfltk_jpeg $IMAGELIBS"
    STATICIMAGELIBS="\$libdir/libfltk_jpeg.a $STATICIMAGELIBS"
    AC_DEFINE(HAVE_LIBJPEG)
    #ac_cv_lib_jpeg_jpeg_CreateCompress=no # from ima: should not be necessary
    # Finally, warn user if system lib was requested but not found
    if test x$enable_localjpeg = xno; then
	AC_MSG_WARN(Cannot find system jpeg lib or header: choosing the local lib mode.)
    fi
else
    JPEGINC=""
    JPEG=""
    IMAGELIBS="-ljpeg $IMAGELIBS"
    STATICIMAGELIBS="-ljpeg $STATICIMAGELIBS"
    AC_DEFINE(HAVE_LIBJPEG)
fi

# Handle the ZLIB lib linking mode (use fltk local or system lib)
# If --enable-(resp. --disable-)localzlib parameter is not set by user
# Then we check the ZLIB lib usability, with result in syszlib_ok variable
AC_ARG_ENABLE(localzlib, [  --enable-localzlib      use local ZLIB library, default=auto])
# Check for System lib use if automatic mode or --disable-localzlib is requested
syszlib_ok=no
syszinc_ok=no
if test x$enable_localzlib != xyes; then
    AC_CHECK_LIB(z,gzgets,
	[AC_CHECK_HEADER(zlib.h, 
		syszinc_ok=yes)
	if test x$syszinc_ok = xyes; then
	    syszlib_ok=yes
	    fi])
fi
# Now set the Z lib and include flags according to the requested mode and availability 
if test x$enable_localzlib = xyes -o x$syszlib_ok = xno ; then
    ZLIBINC="-I../zlib"
    ZLIB="zlib"
    LIBS="-lfltk_z $LIBS"
    IMAGELIBS="-lfltk_z $IMAGELIBS"
    STATICIMAGELIBS="\$libdir/libfltk_z.a $STATICIMAGELIBS"
    AC_DEFINE(HAVE_LIBZ)
    ac_cv_lib_z_gzgets=no # fc: is still necessary ?
    # Finally, warn user if system lib was requested but not found
    if test x$enable_localzlib = xno; then
	AC_MSG_WARN(Cannot find system z lib or header: choosing the local lib mode.)
    fi
else
    ZLIBINC=""
    ZLIB=""
    # LIBS="-lz $LIBS"
    # IMAGELIBS="-lz $IMAGELIBS"
    STATICIMAGELIBS="-lz $STATICIMAGELIBS"
    AC_DEFINE(HAVE_LIBZ)
fi

# Handle the PNG lib linking mode (use fltk local or system lib)
# If --enable-(resp. --disable-)localpng parameter is not set by user
# Then we check the png lib usability with result in syspng_lib variable
AC_ARG_ENABLE(localpng, [  --enable-localpng       use local PNG library, default=auto])

# Now check if system lib is usable, we check Lib AND include availability with inc variant,
# but only, if the builtin lib is not requested
syspnglib_ok=no
syspnginc_ok=no
if test x$enable_localpng != xyes; then
  AC_CHECK_LIB(png, png_read_info, 
    [AC_CHECK_HEADER(png.h, 
	AC_DEFINE(HAVE_PNG_H)
	syspnginc_ok=yes)
    AC_CHECK_HEADER(libpng/png.h, 
	AC_DEFINE(HAVE_LIBPNG_PNG_H)
	syspnginc_ok=yes)
    if test x$syspnginc_ok = xyes; then
	syspnglib_ok=yes
    fi])
fi

# The following is executed if the lib was not found usable or if local lib is required explicitly
if test x$enable_localpng = xyes -o x$syspnglib_ok = xno ; then
    PNGINC="-I../png"
    PNG="png"
    IMAGELIBS="-lfltk_png $IMAGELIBS"
    STATICIMAGELIBS="\$libdir/libfltk_png.a $STATICIMAGELIBS"
    AC_DEFINE(HAVE_LIBPNG)
    AC_DEFINE(HAVE_PNG_H)
    AC_DEFINE(HAVE_PNG_GET_VALID)
    AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA)
    # Finally, warn user if system lib was requested but not found
    if test x$enable_localpng = xno; then
	AC_MSG_WARN(Cannot find system png lib or header: choosing the local lib mode.)
    fi
else
    PNGINC=""
    PNG=""
    IMAGELIBS="-lpng $IMAGELIBS"
    STATICIMAGELIBS="-lpng $STATICIMAGELIBS"
    AC_DEFINE(HAVE_LIBPNG)
    AC_CHECK_LIB(png,png_get_valid, AC_DEFINE(HAVE_PNG_GET_VALID))
    AC_CHECK_LIB(png,png_set_tRNS_to_alpha, AC_DEFINE(HAVE_PNG_SET_TRNS_TO_ALPHA))
fi

AC_SUBST(JPEG)
AC_SUBST(JPEGINC)
AC_SUBST(PNG)
AC_SUBST(PNGINC)
AC_SUBST(ZLIB)
AC_SUBST(ZLIBINC)

dnl Restore original LIBS settings...
LIBS="$SAVELIBS"

dnl See if we need a .exe extension on executables...
AC_EXEEXT

dnl Check for pthreads for multi-threaded apps...
have_pthread=no
PTHREAD_FLAGS=""

if test "x$enable_threads" = xyes; then
    AC_CHECK_HEADER(pthread.h, AC_DEFINE(HAVE_PTHREAD_H))

    if test x$ac_cv_header_pthread_h = xyes; then
	dnl Check various threading options for the platforms we support
	for flag in -lpthreads -lpthread -pthread; do
            AC_MSG_CHECKING([for pthread_create using $flag])
	    SAVELIBS="$LIBS"
	    LIBS="$flag $LIBS"
            AC_TRY_LINK([#include <pthread.h>],
		[pthread_create(0, 0, 0, 0);],
        	have_pthread=yes,
		LIBS="$SAVELIBS")
            AC_MSG_RESULT([$have_pthread])

	    if test $have_pthread = yes; then
	        AC_DEFINE(HAVE_PTHREAD)
		PTHREAD_FLAGS="-D_THREAD_SAFE -D_REENTRANT"

		# Solaris requires -D_POSIX_PTHREAD_SEMANTICS to
		# be POSIX-compliant... :(
		if test $uname = SunOS; then
		    PTHREAD_FLAGS="$PTHREAD_FLAGS -D_POSIX_PTHREAD_SEMANTICS"
		fi
		break
	    fi
	done
	LIBS=$SAVELIBS
    fi
fi

AC_SUBST(PTHREAD_FLAGS)

dnl Define OS-specific stuff...
HLINKS=
POSTBUILD=:
OSX_ONLY=:
THREADS=

AC_ARG_WITH(links, [  --with-links            make header links for common misspellings])

INSTALL_DESKTOP=""
UNINSTALL_DESKTOP=""

case $uname in
    CYGWIN* | MINGW*)
	dnl Cygwin environment...
	# Recent versions of Cygwin are seriously broken and the size
	# checks don't work because the shell puts out \r\n instead of
	# \n.  Here we just force U32 to be defined to "unsigned"...
        AC_DEFINE(U32,unsigned)
	CFLAGS="-mwindows -DWIN32 $CFLAGS"
	CXXFLAGS="-mwindows -DWIN32 $CXXFLAGS"
	LDFLAGS="-mwindows $LDFLAGS"
	DSOFLAGS="-mwindows $DSOFLAGS"
	LIBS="$LIBS -lole32 -luuid -lcomctl32 -lwsock32"
	if test "x$with_optim" = x; then
	    dnl Avoid -Os optimization on Cygwin/Mingw
	    with_optim="-O3"
	fi

	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

	if test "x$enable_threads" = xyes; then
	    if test x$have_pthread = xyes; then
		AC_DEFINE(HAVE_PTHREAD)
	    fi

	    THREADS="threads.exe"
        fi

	# Don't make symlinks since Windows is not case sensitive.
	if test "x$with_links" != xyes; then
		HLINKS="#"
	fi
	;;

    Darwin*)
        # MacOS X uses Carbon for graphics...
        LIBS="$LIBS -framework Carbon -framework ApplicationServices"

	if test x$have_pthread = xyes; then
	    AC_DEFINE(HAVE_PTHREAD)
	    THREADS="threads"
	fi

	if test x$enable_gl != xno; then
            AC_DEFINE(HAVE_GL)
            AC_DEFINE(HAVE_GL_GLU_H)
            GLLIB="-framework AGL -framework OpenGL"
        else
	    LINKFLTKGL=""
	    GLLIBNAME=""
	    GLDSONAME=""
	    GLDEMOS=""
        fi

	# Don't make symlinks because HFS+ is not case sensitive...
	if test "x$with_links" != xyes; then
		HLINKS="#"
	fi

	# Add a postbuild step after linking applications
	POSTBUILD="/Developer/Tools/Rez -t APPL -o"

	# Some steps are only done for OS X package management
	OSX_ONLY=

	# Install/Uninstall FLUID application
	INSTALL_DESKTOP="install-osx"
	UNINSTALL_DESKTOP="uninstall-osx"
	;;

    *)
	# All others are UNIX/X11...
	if test x$have_pthread = xyes; then
	    AC_DEFINE(HAVE_PTHREAD)
	    THREADS="threads"
	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 -lX11 $X_EXTRA_LIBS"
	CFLAGS="$CFLAGS $X_CFLAGS"
	CXXFLAGS="$CXXFLAGS $X_CFLAGS"
	LDFLAGS="$X_LIBS $LDFLAGS"
	DSOFLAGS="$X_LIBS $DSOFLAGS"

	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_SEARCH_LIBS(dlopen, dl)
	    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_LIB(GL, glXGetProcAddressARB,
		             AC_DEFINE(HAVE_GLXGETPROCADDRESSARB),, -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 != xyes -a x$ac_cv_lib_MesaGL_glXMakeCurrent != xyes; then
		    LINKFLTKGL=""
		    GLLIBNAME=""
		    GLDSONAME=""
		    GLDEMOS=""
	    fi
	else
	    LINKFLTKGL=""
	    GLLIBNAME=""
	    GLDSONAME=""
	    GLDEMOS=""
	fi

	dnl Check for Xinerama support unless disabled...
        AC_ARG_ENABLE(xinerama, [  --enable-xinerama       turn on Xinerama support [default=no]])

	if test x$enable_xinerama = xyes; then
	    AC_CHECK_LIB(Xinerama,XineramaIsActive,
		    AC_DEFINE(HAVE_XINERAMA)
		    LIBS="-lXinerama $LIBS")
	fi

	dnl Check for the Xft library unless disabled...
        AC_ARG_ENABLE(xft, [  --enable-xft            turn on Xft support [default=no]])

	if test x$enable_xft = xyes; then
            AC_PATH_PROG(FTCONFIG,freetype-config)

	    if test "x$FTCONFIG" != x; then
	        CPPFLAGS="`$FTCONFIG --cflags` $CPPFLAGS"
	        CXXFLAGS="`$FTCONFIG --cflags` $CXXFLAGS"

		AC_CHECK_HEADER(X11/Xft/Xft.h,
		    AC_CHECK_LIB(Xft, XftDrawCreate,
	        	AC_DEFINE(USE_XFT)
			LIBS="-lXft -lfontconfig $LIBS", [], -lfontconfig))
	    fi
	fi

	dnl Check for the Xdbe extension unless disabled...
        AC_ARG_ENABLE(xdbe, [  --enable-xdbe           turn on Xdbe support [default=no]])

	if test x$enable_xdbe = xyes; then
	    AC_CHECK_HEADER(X11/extensions/Xdbe.h, AC_DEFINE(HAVE_XDBE),,
	        [#include <X11/Xlib.h>])
	fi

	dnl Check for overlay visuals...
	AC_PATH_PROG(XPROP, xprop)
	AC_CACHE_CHECK(for X overlay visuals, ac_cv_have_overlay,
	    if test "x$XPROP" != x; then
		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
	    else
        	ac_cv_have_overlay=no
	    fi)

        if test x$ac_cv_have_overlay = xyes; then
	    AC_DEFINE(HAVE_OVERLAY)
	fi

	# Make symlinks since UNIX/Linux is case sensitive.
	if test "x$with_links" = xno; then
		HLINKS="#"
	fi

	# Install/Uninstall FLUID application support files
	INSTALL_DESKTOP="install-linux"
	UNINSTALL_DESKTOP="uninstall-linux"
	;;
esac

AC_SUBST(GLDEMOS)
AC_SUBST(GLLIB)
AC_SUBST(HLINKS)
AC_SUBST(POSTBUILD)
AC_SUBST(OSX_ONLY)
AC_SUBST(THREADS)

AC_SUBST(INSTALL_DESKTOP)
AC_SUBST(UNINSTALL_DESKTOP)

dnl Figure out the appropriate formatted man page extension...
case "$uname" in
    *BSD* | Darwin*)
	# *BSD
	CAT1EXT=0
	CAT3EXT=0
	CAT6EXT=0
	;;
    IRIX*)
	# SGI IRIX
	CAT1EXT=z
	CAT3EXT=z
	CAT6EXT=z
	;;
    *)
	# All others
	CAT1EXT=1
	CAT3EXT=3
	CAT6EXT=6
	;;
esac

AC_SUBST(CAT1EXT)
AC_SUBST(CAT3EXT)
AC_SUBST(CAT6EXT)

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" = "\${prefix}" -a "$prefix" = "/usr"; then
    libdir="/usr/lib32"
fi

dnl Define the command used to update the dependencies (this option
dnl mainly for FLTK core developers - not necessary for users)
MAKEDEPEND="\$(CXX) -M"
AC_SUBST(MAKEDEPEND)

dnl Add warnings to compiler switches:
dnl do this last so messing with switches does not break tests

if test -n "$GCC"; then
    # Show all standard warnings + unused variables, conversion errors,
    # and inlining problems when compiling...
    OPTIM="-Wall -Wunused -Wno-format-y2k $OPTIM"

    # The following additional warnings are useful for tracking down problems...
    #OPTIM="-Wshadow -Wconversion $OPTIM"

    # We know that Carbon is deprecated on OS X 10.4. To avoid hundreds of warnings
    # we will temporarily disable 'deprecated' warnings on OS X.
    if test "$uname" = "Darwin" -a $uversion -ge 800; then
        OPTIM="-Wno-deprecated-declarations $OPTIM"
    fi

    # Set the default compiler optimizations...
    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.
        #
	#       "-Os" seems to be the best compromise between speed and
	#       code size.  "-O3" and higher seem to make no effective
	#       difference in the speed of the code, but does bloat the
	#       library 10+%.
	#

        if test "x$with_optim" != x; then
	    OPTIM="$with_optim $OPTIM"
	else
            OPTIM="-Os $OPTIM"
	fi
    fi

    # Generate position-independent code when needed...
    if test $PICFLAG = 1; then
    	OPTIM="$OPTIM -fPIC"
    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 GCC supports -fno-strict-aliasing...
    AC_MSG_CHECKING(if GCC supports -fno-strict-aliasing)
    OLDCFLAGS="$CFLAGS"
    CFLAGS="$CFLAGS -fno-strict-aliasing"
    AC_TRY_COMPILE(,,
	OPTIM="$OPTIM -fno-strict-aliasing"
	AC_MSG_RESULT(yes),
	AC_MSG_RESULT(no))
    CFLAGS="$OLDCFLAGS"

    # See if we are running Solaris; if so, try the -fpermissive option...
    # This option is required on some versions of Solaris to work around
    # bugs in the X headers up through Solaris 7.
    #
    # Unlike the other compiler/optimization settings, this one is placed
    # in CFLAGS and CXXFLAGS so that fltk-config will provide the option
    # to clients - otherwise client apps will not compile properly...
    if test "$uname" = SunOS; then
	AC_MSG_CHECKING(if GCC supports -fpermissive)

	OLDCFLAGS="$CFLAGS"
	CFLAGS="$CFLAGS -fpermissive"
	AC_TRY_COMPILE(,,
	    CXXFLAGS="$CXXFLAGS -fpermissive"
	    AC_MSG_RESULT(yes),
	    CFLAGS="$OLDCFLAGS"
	    AC_MSG_RESULT(no))
    fi
else
    case "$uname" 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

        	OPTIM="-fullwarn $OPTIM"
	    fi
	    if test -z "$DEBUGFLAG"; then
        	if test "x$with_optim" != x; then
		    OPTIM="$with_optim $OPTIM"
		else
        	    OPTIM="-O2 $OPTIM"
		    if test $uversion -gt 62; then
        	        OPTIM="-OPT:Olimit=4000 $OPTIM"
	            fi
		fi
	    fi
	    ;;
	HP-UX*)
	    # Running HP-UX; these options should work for the HP compilers.
	    if test -z "$DEBUGFLAG"; then
        	if test "x$with_optim" != x; then
		    OPTIM="$with_optim $OPTIM"
		else
        	    OPTIM="+O2 $OPTIM"
		fi
	    fi

	    if test $PICFLAG = 1; then
		OPTIM="+z $OPTIM"
	    fi

	    CXXFLAGS="$CXXFLAGS +W336,501,736,740,749,829"
	    ;;
	OSF1*)
	    # Running Digital/Tru64 UNIX; these options should work for the
	    # Digital/Compaq/NewHP compilers.
	    if test -z "$DEBUGFLAG"; then
        	if test "x$with_optim" != x; then
		    OPTIM="$with_optim $OPTIM"
		else
        	    OPTIM="-O2 $OPTIM"
		fi
	    fi
	    ;;
	SunOS*)
	    # Solaris
	    if test -z "$DEBUGFLAG"; then
        	if test "x$with_optim" != x; then
		    OPTIM="$with_optim $OPTIM"
		else
        	    OPTIM="-xO3 $OPTIM"
		fi
	    fi

	    if test $PICFLAG = 1; then
		OPTIM="-KPIC $OPTIM"
	    fi
	    ;;
	AIX*)
	    if test -z "$DEBUGFLAG"; then
        	if test "x$with_optim" != x; then
		    OPTIM="$with_optim $OPTIM"
		else
        	    OPTIM="-O2 $OPTIM"
		fi
	    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

OPTIM="$DEBUGFLAG $OPTIM"

dnl Define the FLTK documentation directory...
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/fltk1.1-doc/HTML")
fi

dnl Define the FLTK data directory...
if test x$prefix = xNONE; then
    AC_DEFINE_UNQUOTED(FLTK_DATADIR, "/usr/local/share/fltk")
else
    AC_DEFINE_UNQUOTED(FLTK_DATADIR, "$prefix/share/fltk")
fi

dnl Summarize results of configure tests...
echo ""
echo "Configuration Summary"
echo "-------------------------------------------------------------------------"

case $uname in
    CYGWIN* | MINGW*)
        graphics="GDI"
	;;
    Darwin*)
        if test x$enable_quartz = xyes; then
            graphics="Quartz"
	else
            graphics="Quickdraw"
	fi
        ;;
    *)
        graphics="X11"
	if test x$enable_xft = xyes; then
	    graphics="$graphics+Xft"
	fi
	if test x$enable_xdbe = xyes; then
	    graphics="$graphics+Xdbe"
	fi
	if test x$enable_xinerama = xyes; then
	    graphics="$graphics+Xinerama"
	fi
        ;;
esac

echo "    Directories: prefix=$prefix"
echo "                 bindir=$bindir"
echo "                 datadir=$datadir"
echo "                 datarootdir=$datarootdir"
echo "                 exec_prefix=$exec_prefix"
echo "                 includedir=$includedir"
echo "                 libdir=$libdir"
echo "                 mandir=$mandir"
echo "       Graphics: $graphics"

if test x$JPEG = x; then
    echo "Image Libraries: JPEG=System"
else
    echo "Image Libraries: JPEG=Builtin"
fi
if test x$PNG = x; then
    echo "                 PNG=System"
else
    echo "                 PNG=Builtin"
fi
if test x$ZLIB = x; then
    echo "                 ZLIB=System"
else
    echo "                 ZLIB=Builtin"
fi

if test x$enable_largefile = xyes; then
    echo "    Large Files: YES"
else
    echo "    Large Files: NO"
fi

if test x$GLDEMOS = x; then
    echo "         OpenGL: NO"
else
    echo "         OpenGL: YES"
fi

if test x$THREADS = x; then
    echo "        Threads: NO"
else
    echo "        Threads: YES"
fi

dnl Write all of the files...
AC_CONFIG_HEADER(config.h:configh.in)
AC_OUTPUT(makeinclude fltk.list fltk-config fltk.spec FL/Makefile)

dnl Make sure the fltk-config script is executable...
chmod +x fltk-config

dnl
dnl End of "$Id: configure.in 6892 2009-09-20 17:25:25Z AlbrechtS $".
dnl