-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
1115 lines (954 loc) · 30.2 KB
/
configure.in
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
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Autoconf setup for {tk|tty|dtk}eden
dnl
dnl Ashley Ward ([email protected]) June 1999
dnl
dnl $Id: configure.in,v 1.22 2002/02/19 14:27:53 cssbz Exp $
dnl
dnl #####################################################################
dnl Initial setup
dnl #####################################################################
dnl Write this revision information to the created configure script
AC_REVISION($Revision: 1.22 $)
# Check this file exists to make sure we are in the correct directory
AC_INIT(Eden/main.c)
dnl C preprocessor symbols get written to this file
AC_CONFIG_HEADER(config.h)
dnl #####################################################################
dnl Functions for use later on
dnl #####################################################################
AC_DEFUN([CF_CHECK_CACHE],
[
#
# Check if we're accidentally using a cache from a different machine.
# Derive the system name, as a check for reusing the autoconf cache.
#
# If we've packaged config.guess and config.sub, run that (since it does a
# better job than uname).
#
if test -f $srcdir/config.guess ; then
AC_CANONICAL_HOST
system_name="$host_os"
else
system_name="`(uname -s -r) 2>/dev/null`"
if test -z "$system_name" ; then
system_name="`(hostname) 2>/dev/null`"
fi
fi
test -n "$system_name" && AC_DEFINE_UNQUOTED(SYSTEM_NAME,"$system_name")
AC_CACHE_VAL(cf_cv_system_name,[cf_cv_system_name="$system_name"])
test -z "$system_name" && system_name="$cf_cv_system_name"
test -n "$cf_cv_system_name" && AC_MSG_RESULT("Configuring for $cf_cv_system_name")
if test ".$system_name" != ".$cf_cv_system_name" ; then
AC_MSG_RESULT("Cached system name does not agree with actual")
AC_ERROR("Please remove config.cache and try again.")
fi
])dnl
AC_DEFUN([CF_ANSI_CC_CHECK],
[
AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
AC_CACHE_VAL(cf_cv_ansi_cc,[
cf_cv_ansi_cc=no
cf_save_CFLAGS="$CFLAGS"
# Don't try gcc -ansi; that turns off useful extensions and
# breaks some systems' header files.
# AIX -qlanglvl=ansi
# Ultrix and OSF/1 -std1
# HP-UX -Aa -D_HPUX_SOURCE
# SVR4 -Xc
# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes)
for cf_arg in "-DCC_HAS_PROTOS" "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" -Xc
do
CFLAGS="$cf_save_CFLAGS $cf_arg"
AC_TRY_COMPILE(
[
#ifndef CC_HAS_PROTOS
#if !defined(__STDC__) || __STDC__ != 1
choke me
#endif
#endif
],[
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};],
[cf_cv_ansi_cc="$cf_arg"; break])
done
CFLAGS="$cf_save_CFLAGS"
])
AC_MSG_RESULT($cf_cv_ansi_cc)
if test "$cf_cv_ansi_cc" != "no"; then
if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then
CFLAGS="$CFLAGS $cf_cv_ansi_cc"
else
AC_DEFINE(CC_HAS_PROTOS)
fi
fi
])dnl
dnl #####################################################################
dnl End functions - carry on with the work
dnl #####################################################################
# Sanity check
CF_CHECK_CACHE
# Solaris-sparc at DCS has gcc 2.95.2 in /gnu/bin/gcc and gcc 3.4.2
# in /usr/local/bin/gcc. At the moment we need to use the earlier version
# (there are problems with Misc/customlib.h), so provide an option for this.
AC_ARG_WITH(cc,
[ --with-cc=path-to-c-compiler ],
[
CC=$withval
])
# bison-1.27 and -1.28 were fine for the Eden/Donald/Scout/LSD parsers,
# but various things have changed at some point between that and
# bison 1.875, which does not seem capable of doing the same job without
# us putting some serious thought into our parsers. As a workaround,
# provide the possibility of choosing which bison to use, so people can
# download, compile, install bison-1.28 from http://ftp.gnu.org/gnu/bison/
# if need be.
AC_ARG_WITH(bison,
[ --with-bison=path-to-bison-utility ],
[
BISON=$withval
],
[
BISON=bison
])
# !@!@ Not sure if all of these are required
# AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
dnl Sets LEX and LEXLIB, to, eg flex and -lfl
AC_PROG_LEX
dnl Does make set ${MAKE}? Defines @SET_MAKE@
AC_PROG_MAKE_SET
dnl Sets RANLIB output variable to 'ranlib' or ':' if it is not found
AC_PROG_RANLIB
# Find options to use ANSI C
CF_ANSI_CC_CHECK
# Is the math library OK?
AC_CHECK_LIB(m, tan,, AC_MSG_ERROR(can't find math functions))
# Tcl on Linux on PC seems to require -ldl
AC_CHECK_LIB(dl, dlerror)
#########################################################################
# Compile time switches
#########################################################################
AC_ARG_ENABLE(debug,
[ --enable-debug enable debugging],
[
AC_DEFINE(DEBUG)
AC_DEFINE(YYDEBUG) # parser debugging wrapped into general debug now
])
AC_ARG_ENABLE(weden,
[ --enable-weden enable features required to run web eden],
[
AC_DEFINE(WEDEN_ENABLED)
])
AC_ARG_ENABLE(tcl-const84,
[ --enable-tcl-const84 Use the TCL Const84 when declaring commands for Tcl_CreateCommand],
[
AC_DEFINE(USE_TCL_CONST84_OPTION)
])
AC_ARG_ENABLE(dcc,
[ --enable-dcc enable dcc function for disabling circular checking],
[
AC_DEFINE(NO_CHECK_CIRCULAR)
])
AC_ARG_ENABLE(depend,
[ --enable-depend enable Makefile source dependency checking],
[
DEPEND_MAKEDEFS="include ../depend.mk"
],
[
DEPEND_MAKEDEFS="#include ../depend.mk"
])
AC_ARG_ENABLE(disable-sasami,
[ --enable-disable-sasami don't try to build the Sasami OpenGL notation],
[
AC_MSG_WARN(Disabling Sasami)
aw_want_sasami="no"
],
[
aw_want_sasami="yes"
AC_DEFINE(WANT_SASAMI)
])
AC_ARG_ENABLE(ipc,
[ --enable-ipc enable support for Eden IPC functions (send_msg...)],
[
AC_DEFINE(ipc)
])
#########################################################################
# X / GUI libraries
#########################################################################
dnl Sets $X_CFLAGS, $X_LIBS, $X_EXTRA_LIBS, $X_PRE_LIBS
AC_PATH_XTRA
AC_MSG_CHECKING(system type to determine GUI libraries)
dnl The following isn't a great way to do this -- it is borrowed from
dnl the run time linker config test below. Hopefully it'll do for
dnl our common cases though.
case "`(uname -s) 2>/dev/null`" in
CYGWIN*)
# Probably Windows
AW_X_LIBS="-lGDI32 -lUSER32 -lCOMDLG32 -lKERNEL32 -Wl,--subsystem,windows"
ICON_OBJS="eden-res.o"
;;
Darwin*)
# Probably Mac
AW_X_LIBS="-framework CoreFoundation -framework Carbon"
ICON_OBJS=""
;;
*)
# Probably some flavour of X11
AW_X_LIBS="-lXt -lX11"
if test "$aw_want_sasami" = "yes"; then
AW_X_LIBS="$AW_X_LIBS -lXmu -lXext"
fi
ICON_OBJS=""
;;
esac
AC_MSG_RESULT(think we need $AW_X_LIBS)
#########################################################################
# Run time linker
#########################################################################
# The Solaris implementation of dynamic linking means that the run-time
# linker needs to know where to locate the (dynamically linked) libraries.
# This means when we are linking, for each -L option, we need to pass a
# similar -R option.
# Apparently some versions of Sun CC require a space after the -R, and
# some no space, which seems incredibly dumb. I haven't bothered to check
# for this yet though.
dnl See the stuff in the AC_PATH_XTRA macro for how to implement a test
dnl for this. I can't be bothered at the moment because in order to do it
dnl properly it looks like I need to choose a functioning library to test.
dnl (And possibly even *run* the test, not just link it to test completely
dnl that -R works: note that -R on linux is for something else! Duh!).
dnl See /gnu/share/autoconf/acspecific.m4 for AC_PATH_XTRA.
AC_MSG_CHECKING(whether we need -R)
case "`(uname -sr) 2>/dev/null`" in
"SunOS 5"*)
aw_need_r=yes
AC_MSG_RESULT(yes)
;;
*)
aw_need_r=no
AC_MSG_RESULT(no)
;;
esac
#########################################################################
# curses
#########################################################################
#
# Prefer "new" curses: ncurses.
#
# Examples:
# bax and holst: /usr/include/ncurses/curses.h:
# -I/usr/include/ncurses -L/usr/lib -L/usr/lib/ncurses -lncurses
# gem: /gnu/include/ncurses.h:
# -I/gnu/include -L/gnu/lib -lncurses
# gem: /usr/include/curses.h:
# -lcurses
#
# Possible include directories: /usr/include /gnu/include /usr/local/include
#
# One of these directories might include
# ncurses/curses.h: -Iinc_dir/ncurses -Llib_dir -Llib_dir/ncurses -lncurses
# ncurses.h: -Iinc_dir -Llib_dir -lcurses
# curses.h: -Iinc_dir -Llib_dir -lcurses
#
# Everything set up already (eg in LIBS) is not an option as we want
# this to apply only to ttyeden.
#
# Sets Example
# CURSES_TYPE curses
# CURSES_INCLUDE -I/usr/local/include
# CURSES_LIB -lcurses
# CURSES_LIB_PATH -L/usr/local/lib
# HAVE_CURSES ""
#
dnl AW_LIB_CURSES2
dnl Don't call this directly - use AW_LIB_CURSES
dnl Parameters:
dnl $1 include directory to try
dnl $2 header filename to look for
dnl $3 CURSES_TYPE: curses or ncurses, used for the header file to include
dnl $4 CURSES_INCLUDE if it works
dnl $5 CURSES_LIB_PATH if it works
AC_DEFUN([AW_LIB_CURSES2],
[
aw_curses_include_dir=$1
aw_curses_header_look=$2
aw_curses_type=$3
aw_curses_include=$4
aw_curses_lib_path=$5
if test -z "$aw_finished_curses"; then
AC_MSG_CHECKING(for ${aw_curses_include_dir}/${aw_curses_header_look})
if test -f ${aw_curses_include_dir}/${aw_curses_header_look}; then
AC_MSG_RESULT(yes)
# Temporarily add blurb to LIBS
aw_save_libs=$LIBS
LIBS="$aw_curses_include $aw_curses_lib_path -l${aw_curses_type} $LIBS"
AC_MSG_CHECKING(whether we can link curses using $LIBS)
AC_TRY_LINK(
[#include <curses.h>],
[initscr()],
[
# Link succeeded
LIBS=$aw_save_libs
AC_MSG_RESULT(yes)
aw_finished_curses="yes"
CURSES_TYPE=$aw_curses_type
CURSES_INCLUDE=$aw_curses_include
CURSES_LIB_PATH=$aw_curses_lib_path
CURSES_LIB=-l$aw_curses_type
],
[
# Link failed. Do nothing (the search process will
# just continue to another possible location).
LIBS=$aw_save_libs
AC_MSG_RESULT(no)
]
)
else
AC_MSG_RESULT(no)
fi
fi
])
dnl AW_LIB_CURSES
dnl $1 include directory to try
dnl $2 corresponding lib directory
AC_DEFUN([AW_LIB_CURSES],
[
# Three possible cases
# ncurses/curses.h: -Iinc_dir/ncurses -Llib_dir -Llib_dir/ncurses -lncurses
# ncurses.h: -Iinc_dir -Llib_dir -lcurses
# curses.h: -Iinc_dir -Llib_dir -lcurses
if test "$aw_need_r" = "yes"; then
# We need the -R for runtime linking
# Note this code is repeated below with -R taken away
AW_LIB_CURSES2($1, ncurses/curses.h, ncurses,
-I$1/ncurses, "-L$2 -L$2/ncurses -R$2 -R$2/ncurses")
AW_LIB_CURSES2($1, ncurses/curses.h, ncurses,
-I$1, "-L$2 -L$2/ncurses -R$2 -R$2/ncurses")
AW_LIB_CURSES2($1, ncurses.h, ncurses,
-I$1, "-L$2 -R$2")
AW_LIB_CURSES2($1, curses.h, curses,
-I$1, "-L$2 -R$2")
else
# We don't need the -R option
# Note this code is repeated above with -R added
AW_LIB_CURSES2($1, ncurses/curses.h, ncurses,
-I$1/ncurses, "-L$2 -L$2/ncurses")
AW_LIB_CURSES2($1, ncurses/curses.h, ncurses,
-I$1, "-L$2 -L$2/ncurses")
AW_LIB_CURSES2($1, ncurses.h, ncurses,
-I$1, -L$2)
AW_LIB_CURSES2($1, curses.h, curses,
-I$1, -L$2)
fi
])
# See if the user supplied some arguments
AC_ARG_WITH(curses-include,
[ --with-curses-include=DIR
(n)curses include files are in DIR],
[
aw_user_supplied_curses_include=$withval
# Try and find this with the lib variable unset - the user
# should really provide --with-curses-lib as well.
AW_LIB_CURSES($aw_user_supplied_curses_include,)
]
)
AC_ARG_WITH(curses-lib,
[ --with-curses-lib=DIR (n)curses library files are in DIR],
[
aw_user_supplied_curses_lib_dir=$withval
AW_LIB_CURSES($aw_user_supplied_curses_include,
$aw_user_supplied_curses_lib_dir)
]
)
# Attempt to guess where it might be
AW_LIB_CURSES(/usr/local/include, /usr/local/lib)
AW_LIB_CURSES(/gnu/include, /gnu/lib)
## !@!@ commented out for Darwin 31/3/2003
##AW_LIB_CURSES(/usr/include, /usr/lib)
# Declare the type of curses found so that we can include the
# appropriate header file, and include the curses object in the list
# of objects to be built in the appropriate Makefiles
if test "$CURSES_TYPE" = "ncurses"; then
AC_DEFINE(HAVE_NCURSES)
HAVE_CURSES="ncurses"
elif test "$CURSES_TYPE" = "curses"; then
AC_DEFINE(HAVE_CURSES)
HAVE_CURSES="curses"
else
HAVE_CURSES=""
fi
# Print results
AC_MSG_CHECKING(for curses)
AC_MSG_RESULT([$CURSES_TYPE $CURSES_INCLUDE $CURSES_LIB $CURSES_LIB_PATH $CURSES_IF_ENABLED])
#########################################################################
# tcl
#########################################################################
#
# Sets Example
# TCL_INCLUDE -I/usr/local/include
# TCL_LIB -L/usr/local/lib -ltcl
#
AC_DEFUN([AW_CHECK_TCL],
[
aw_tcl_include=$1
aw_tcl_lib=$2
if test "$aw_need_r" = "yes"; then
# !@!@ This bit should really be an AC function
# Note I need m4 [] quotes around this so that the brackets in the
# sed expression do not get eaten
aw_tcl_lib=[`echo $aw_tcl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'`]
fi
# If we haven't already found an answer...
if test -z "$aw_finished_tcl"; then
aw_save_libs=$LIBS
LIBS="$aw_tcl_include $aw_tcl_lib $LIBS"
AC_MSG_CHECKING(whether we can link tcl using $LIBS)
AC_TRY_LINK(
[#include <tcl.h>],
[Tcl_AsyncReady()],
[
# Link succeeded
AC_MSG_RESULT(yes)
# Don't do any more tests - we have the answer
aw_finished_tcl="yes"
TCL_INCLUDE=$aw_tcl_include
TCL_LIB=$aw_tcl_lib
AC_MSG_CHECKING(whether tcl has Tcl_EvalEx)
AC_TRY_LINK(
[#include <tcl.h>],
[
Tcl_Interp *interp;
Tcl_EvalEx(interp, "", -1, 0)
],
[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_TCL_EVALEX)
],
[
AC_MSG_RESULT(no)
]
)
LIBS=$aw_save_libs
],
[
# Link failed - do nothing.
LIBS=$aw_save_libs
AC_MSG_RESULT(no)
]
)
fi
])
AC_ARG_WITH(tcl-include,
[ --with-tcl-include=compiler options to enable location of tcl.h
eg \"-I/usr/local/include\"],
[aw_user_tcl_include=$withval]
)
AC_ARG_WITH(tcl-lib,
[ --with-tcl-lib=linker options to enable location of the tcl library
eg \"-L/usr/local/lib -R/usr/local/lib -ltcl\"],
[aw_user_tcl_lib=$withval]
)
# If the user provided both or either option, then try it first
if test -n "$aw_user_tcl_include" -o -n "$aw_user_tcl_lib"; then
AW_CHECK_TCL($aw_user_tcl_include, $aw_user_tcl_lib)
fi
# Else can we use tcl with just -ltcl?
AW_CHECK_TCL(, "-ltcl")
# Now we're guessing... :)
# Good guess for ubuntu 10.10
AW_CHECK_TCL("-I/usr/include/tcl8.4", "-ltcl")
# This works at DCS, University of Warwick
AW_CHECK_TCL("-I/usr/local/include", "-L/usr/local/lib -ltcl")
# This works at ITS, University of Warwick
AW_CHECK_TCL(, "-L/usr/local/lib -ltcl8.0")
# This works on ride, a Sparc Solaris 7 machine with packages
# from sunfreeware.com
AW_CHECK_TCL(, "-L/usr/local/lib -ltcl")
# I give a warning if tcl is not found at the end of the script
#########################################################################
# tk
#########################################################################
#
# Sets Example
# TK_INCLUDE -I/usr/local/include
# TK_LIB -L/usr/local/lib -ltk
#
AC_DEFUN([AW_CHECK_TK],
[
aw_tk_include=$1
aw_tk_lib=$2
if test "$aw_need_r" = "yes"; then
# Note I need m4 [] quotes around this so that the brackets in the
# sed expression do not get eaten
aw_tk_lib=[`echo $aw_tk_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'`]
fi
# If we haven't already found an answer...
if test -z "$aw_finished_tk"; then
aw_save_libs=$LIBS
# Also add X stuff and tcl stuff. Existing LIBS must go at the
# end: -lm must come after -ltk for example.
# NB don't seem to need $AW_X_LIBS and -lglPNG may cause an error
LIBS="$aw_tk_include $aw_tk_lib $X_CFLAGS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS $TCL_INCLUDE $TCL_LIB $LIBS"
AC_MSG_CHECKING(whether we can link tk using $LIBS)
AC_TRY_LINK(
[#include <tk.h>],
[Tk_GetNumMainWindows();],
[
# Link succeeded
LIBS=$aw_save_libs
AC_MSG_RESULT(yes)
# Don't do any more tests - we have the answer
aw_finished_tk="yes"
TK_INCLUDE=$aw_tk_include
TK_LIB=$aw_tk_lib
],
[
# Link failed - do nothing.
LIBS=$aw_save_libs
AC_MSG_RESULT(no)
]
)
fi
])
AC_ARG_WITH(tk-include,
[ --with-tk-include=compiler options to enable location of tk.h
eg \"-I/usr/local/include\"],
[aw_user_tk_include=$withval]
)
AC_ARG_WITH(tk-lib,
[ --with-tk-lib=linker options to enable location of the tk library
eg \"-L/usr/local/lib -R/usr/local/lib -ltk\"],
[aw_user_tk_lib=$withval]
)
# If the user provided both or either option, then try it first
if test -n "$aw_user_tk_include" -o -n "$aw_user_tk_lib"; then
AW_CHECK_TK($aw_user_tk_include, $aw_user_tk_lib)
fi
# Else can we use tk with just -ltk?
AW_CHECK_TK(, "-ltk")
# Now we're guessing... :)
# This works at DCS, University of Warwick
AW_CHECK_TK("-I/usr/local/include", "-L/usr/local/lib -ltk")
# This works at ITS, University of Warwick
AW_CHECK_TK(, "-L/usr/local/lib -ltk8.0")
# This works on ride, a Sparc Solaris 7 machine with packages from
# sunfreeware.com
AW_CHECK_TK(, "-L/usr/local/lib -ltk8.2")
# I give a warning if tk is not found at the end of the script
#########################################################################
# Readline
#########################################################################
#
# Sets Example
# READLINE_INCLUDE -I/gnu/include/readline
# READLINE_LIB -L/gnu/lib -R/gnu/lib -lreadline
#
AC_DEFUN([AW_CHECK_READLINE],
[
aw_readline_include=$1
aw_readline_lib=$2
if test "$aw_need_r" = "yes"; then
# Note I need m4 [] quotes around this so that the brackets in the
# sed expression do not get eaten
aw_readline_lib=[`echo $aw_readline_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'`]
fi
# If we haven't already found an answer...
if test -z "$aw_finished_readline"; then
aw_save_libs=$LIBS
# Need curses as well as the supplied settings
LIBS="$aw_readline_include $aw_readline_lib $CURSES_INCLUDE $CURSES_LIB_PATH $CURSES_LIB $LIBS"
AC_MSG_CHECKING(whether we can link readline using $LIBS)
AC_TRY_LINK(
[
#include <stdio.h>
#include <stdlib.h>
#include <readline.h>
],
[readline("test");],
[
# Link succeeded
LIBS=$aw_save_libs
AC_MSG_RESULT(yes)
# Don't do any more tests - we have the answer
aw_finished_readline="yes"
READLINE_INCLUDE=$aw_readline_include
READLINE_LIB=$aw_readline_lib
],
[
# Link failed - do nothing.
LIBS=$aw_save_libs
AC_MSG_RESULT(no)
]
)
fi
]
)
AC_ARG_WITH(readline-include,
[ --with-readline-include=compiler options to enable location of GNU readline
header files eg \"-I/gnu/include/readline\"],
[aw_user_readline_include=$withval]
)
AC_ARG_WITH(readline-lib,
[ --with-readline-lib=linker options to enable location of the GNU
readline library
eg \"-L/gnu/lib -R/gnu/lib -lreadline\"],
[aw_user_readline_lib=$withval]
)
# If the user provided both or either option, then try it first
if test -n "$aw_user_readline_include" -o -n "$aw_user_readline_lib"; then
AW_CHECK_READLINE($aw_user_readline_include, $aw_user_readline_lib)
fi
# Else can we use readline with just -lreadline?
AW_CHECK_READLINE(, "-lreadline")
# Now we're guessing... :)
# This works on cygwin
AW_CHECK_READLINE("-I/usr/include/readline", "-L/usr/lib -lreadline")
# This works at DCS, University of Warwick
AW_CHECK_READLINE("-I/gnu/include/readline -I/gnu/include", "-L/gnu/lib -R/gnu/lib -lreadline")
# This works on a newly installed Solaris 7 machine with standard GNU install
AW_CHECK_READLINE("-I/usr/local/include/readline", "-L/usr/local/lib -R/usr/local/lib -lreadline")
# If we found an answer, then we HAVE_READLINE
if test -n "$aw_finished_readline"; then
AC_DEFINE(HAVE_READLINE)
fi
#########################################################################
# OpenGL
#########################################################################
#
# Sets Example
# OPENGL_INCLUDE -I/usr/openwin/include
# OPENGL_LIB -L/usr/openwin/lib -R/usr/openwin/lib -lGL
AC_DEFUN([AW_CHECK_GL],
[
aw_gl_include=$1
aw_gl_lib=$2
if test "$aw_need_r" = "yes"; then
# Note I need m4 [] quotes around this so that the brackets in the
# sed expression do not get eaten
aw_gl_lib=[`echo $aw_gl_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'`]
fi
# If we haven't already found an answer...
if test -z "$aw_finished_gl"; then
aw_save_libs=$LIBS
# Debian seems to require -lm...
LIBS="$aw_gl_include $aw_gl_lib -lm"
AC_MSG_CHECKING(whether we can link GL using $LIBS)
# !@!@ should put a test for the Solaris GL implementation in here,
# because I can't get it to use the correct colormap on 8-bit GFX
# hardware: the workaround is to use Mesa instead
AC_TRY_LINK(
[
#include <gl.h>
],
[glLoadIdentity();],
[
# Link succeeded
LIBS=$aw_save_libs
AC_MSG_RESULT(yes)
# Don't do any more tests - we have the answer
aw_finished_gl="yes"
OPENGL_INCLUDE=$aw_gl_include
OPENGL_LIB=$aw_gl_lib
],
[
# Link failed - do nothing.
LIBS=$aw_save_libs
AC_MSG_RESULT(no)
]
)
fi
]
)
AC_ARG_WITH(gl-include,
[ --with-gl-include=compiler options to enable location of GL header files
eg \"-I/usr/openwin/include\"],
[aw_user_gl_include=$withval]
)
AC_ARG_WITH(gl-lib,
[ --with-gl-lib=linker options to enable location of the GL library
eg \"-L/usr/openwin/lib -R/usr/openwin/lib -lGL\"],
[aw_user_gl_lib=$withval]
)
if test "$aw_want_sasami" = "yes"; then
# We want to build Sasami - so figure out OpenGL
# If the user provided both or either option, then try it first
if test -n "$aw_user_gl_include" -o -n "$aw_user_gl_lib"; then
AW_CHECK_GL($aw_user_gl_include, $aw_user_gl_lib)
fi
# Good guess for ubuntu 10.10
AW_CHECK_GL("-I/usr/include/GL", "-lGL")
# Else can we use GL with just -lGL?
AW_CHECK_GL(, "-lGL")
# This works on the Mac...
AW_CHECK_GL("-I/System/Library/Frameworks/OpenGL.framework/Headers/",
"-framework AGL -framework OpenGL")
else
OPENGL_INCLUDE=""
OPENGL_LIB=""
fi
#########################################################################
# PNG library
#########################################################################
#
# Sets Example
# PNG_INCLUDE -I/usr/local/include
# PNG_LIB -L/usr/local/lib -R/usr/local/lib -lpng
AC_DEFUN([AW_CHECK_PNG],
[
aw_png_include=$1
aw_png_lib=$2
if test "$aw_need_r" = "yes"; then
# Note I need m4 [] quotes around this so that the brackets in the
# sed expression do not get eaten
aw_png_lib=[`echo $aw_png_lib | sed 's/-L\([^ ]*\)/-L\1 -R\1/'`]
fi
# If we haven't already found an answer...
if test -z "$aw_finished_png"; then
aw_save_libs=$LIBS
# -lpng needs -lm
LIBS="$aw_png_include $aw_png_lib -lm"
AC_MSG_CHECKING(whether we can link png using $LIBS)
AC_TRY_LINK(
[
#include <png.h>
],
[
png_structp png;
png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
],
[
# Link succeeded
LIBS=$aw_save_libs
AC_MSG_RESULT(yes)
# Don't do any more tests - we have the answer
aw_finished_png="yes"
PNG_INCLUDE=$aw_png_include
PNG_LIB=$aw_png_lib
],
[
# Link failed - do nothing.
LIBS=$aw_save_libs
AC_MSG_RESULT(no)
]
)
fi
]
)
AC_ARG_WITH(png-include,
[ --with-png-include=compiler options to enable location of PNG header files
eg \"-I/usr/local/include\"],
[aw_user_png_include=$withval]
)
AC_ARG_WITH(png-lib,
[ --with-png-lib=linker options to enable location of the PNG library
eg \"-L/usr/local/lib -R/usr/local/lib -lpng\"],
[aw_user_png_lib=$withval]
)
# If the user provided both or either option, then try it first
if test -n "$aw_user_png_include" -o -n "$aw_user_png_lib"; then
AW_CHECK_PNG($aw_user_png_include, $aw_user_png_lib)
fi
# Else can we use PNG with just -lpng?
AW_CHECK_PNG(, "-lpng")
# Try this...
AW_CHECK_PNG("-I/usr/local/include", "-L/usr/local/lib -lpng")
#########################################################################
# Memory alignment
#########################################################################
# I could use the gcc __alignof__ function, but then this would
# restrict us to using gcc only. So we attempt to detect the alignment
# required instead.
AC_MSG_CHECKING(how doubles should be aligned)
AC_TRY_RUN(
[
#include <stdio.h>
struct foo {
union align {
double d;
long l;
void *p;
} u;
char c;
};
int main() {
struct foo f[2];
FILE *fp;
int n;
if ((fp = fopen("conftestalignoutput", "w")) == NULL) exit(1);
if( 2*sizeof(union align) != sizeof(f) ) {
n = fprintf(fp, "%ld\n", (long)(sizeof(struct foo) - sizeof(union align)));
}
else {
n = fprintf(fp, "%ld\n", (long)sizeof(union align));
}
/* If fprintf didn't complete successfully, exit code 1 */
if (n < 0) exit(1);
if (fclose(fp) != 0) exit(1);
/* All OK - exit code 0 */
exit(0);
}
],
[
# The code compiled, linked, executed and had exit code 0,
# so we can read the alignment value written to the temporary
# file.
aw_alignment=`cat conftestalignoutput`
AC_DEFINE_UNQUOTED(DOUBLE_ALIGNMENT, $aw_alignment)
AC_MSG_RESULT($aw_alignment byte boundaries)
],
[
# The test failed in some way, so assume the worst.
AC_DEFINE(DOUBLE_ALIGNMENT, sizeof(double))
AC_MSG_RESULT([sizeof(double) byte boundaries])
],
[
# We are cross compiling so can't run the test, so we
# assume the worst.
AC_DEFINE(DOUBLE_ALIGNMENT, sizeof(double))
AC_MSG_RESULT([sizeof(double) byte boundaries])
]
)
#########################################################################
# dmalloc (tool for checking for memory leaks etc)
#########################################################################
# I'm trusting the user to get this right, so no checks are done to see
# if the arguments provided are correct. If they want to run it with a
# memory debugger, they should know what they are doing... I hope.
DMALLOC_INCLUDE=
DMALLOC_LIB=
AC_ARG_WITH(dmalloc-include,
[ --with-dmalloc-include=DIR
dmalloc include file is in DIR],
[
AC_DEFINE(HAVE_DMALLOC)
DMALLOC_INCLUDE=-I$withval
]
)
AC_ARG_WITH(dmalloc-lib,
[ --with-dmalloc-lib=DIR dmalloc lib file is in DIR],
[
AC_DEFINE(HAVE_DMALLOC)
DMALLOC_LIB="-L$withval -ldmalloc"
]
)
#########################################################################
# Pascal strings
#########################################################################
# Need to try with -fpascal-strings first as \p only results in a
# warning if the option is not given
aw_save_cflags=$CFLAGS
CFLAGS="$CFLAGS -fpascal-strings"
AC_TRY_COMPILE(
[],
[
char *pascal = "\pHello world";
],
[],
[
# Had a problem: all we can do is to omit the option again
CFLAGS="$aw_save_cflags"
]
)
#########################################################################
# Locations of "embedded" Tcl/Tk Frameworks required for "make macdist"
#########################################################################