-
Notifications
You must be signed in to change notification settings - Fork 11
/
aclocal.m4
1992 lines (1732 loc) · 51.8 KB
/
aclocal.m4
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 aclocal.m4: macros autoconf uses when building configure from configure.ac
dnl
dnl Copyright (C) 1999 - 2010 Eggheads Development Team
dnl
dnl This program is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU General Public License
dnl as published by the Free Software Foundation; either version 2
dnl of the License, or (at your option) any later version.
dnl
dnl This program 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
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
dnl
dnl $Id: aclocal.m4,v 1.14 2011/07/20 10:31:37 thommey Exp $
dnl
dnl
dnl Message macros.
dnl
dnl EGG_MSG_CONFIGURE_START()
dnl
AC_DEFUN([EGG_MSG_CONFIGURE_START],
[
AC_MSG_RESULT
AC_MSG_RESULT([This is Eggdrop's GNU configure script.])
AC_MSG_RESULT([It's going to run a bunch of tests to hopefully make your compile])
AC_MSG_RESULT([work without much twiddling.])
AC_MSG_RESULT
])
dnl EGG_MSG_CONFIGURE_END()
dnl
AC_DEFUN([EGG_MSG_CONFIGURE_END],
[
AC_MSG_RESULT([Type 'make config' to configure the modules, or type 'make iconfig'])
AC_MSG_RESULT([to interactively choose which modules to compile.])
AC_MSG_RESULT
])
dnl EGG_MSG_WEIRDOS()
dnl
dnl Print some messages at the end of configure to give extra information to
dnl users of 'weird' operating systems.
dnl
AC_DEFUN([EGG_MSG_WEIRDOS],
[
AC_MSG_RESULT([Operating System: $egg_cv_var_system_type $egg_cv_var_system_release])
AC_MSG_RESULT
if test "$UNKNOWN_OS" = yes; then
AC_MSG_RESULT([WARNING:])
AC_MSG_RESULT
AC_MSG_RESULT([ Unknown Operating System: $egg_cv_var_system_type $egg_cv_var_system_release])
AC_MSG_RESULT
AC_MSG_RESULT([ Module support has been disabled for this build.])
AC_MSG_RESULT
AC_MSG_RESULT([ Please let us know what type of system this is by e-mailing])
AC_MSG_RESULT([ [email protected]. The output of uname -a, and some other basic])
AC_MSG_RESULT([ information about the OS should be included.])
AC_MSG_RESULT
else
if test "$WEIRD_OS" = yes; then
AC_MSG_RESULT([WARNING:])
AC_MSG_RESULT
AC_MSG_RESULT([ The operating system you are using has not yet had a great])
AC_MSG_RESULT([ deal of testing with Eggdrop. For this reason, this compile])
AC_MSG_RESULT([ will default to "make static".])
AC_MSG_RESULT
AC_MSG_RESULT([ To enable module support, type "make eggdrop" instead of just])
AC_MSG_RESULT([ "make" after you run "make config" (or "make iconfig").])
AC_MSG_RESULT
AC_MSG_RESULT([ As we have not done a sufficient amount of testing on this])
AC_MSG_RESULT([ OS, your feedback is greatly appreciated. Please let us know])
AC_MSG_RESULT([ at [email protected] if there are any problems compiling with])
AC_MSG_RESULT([ module support, or if you got it to work :)])
AC_MSG_RESULT
fi
AC_MSG_RESULT([If you experience any problems compiling Eggdrop, please read the])
AC_MSG_RESULT([compile guide, found in doc/COMPILE-GUIDE.])
AC_MSG_RESULT
fi
])
dnl EGG_APPEND_VAR()
dnl
dnl Append a non-empty string to a variable
dnl
dnl $1 = variable
dnl $2 = string
dnl
AC_DEFUN([EGG_APPEND_VAR],
[
if test "x$2" != x; then
if test "x$$1" = x; then
$1="$2"
else
$1="$$1 $2"
fi
fi
])
dnl
dnl Compiler checks.
dnl
dnl EGG_CHECK_CC()
dnl
dnl Check for a working C compiler.
dnl
AC_DEFUN([EGG_CHECK_CC],
[
if test "x$cross_compiling" = x; then
cat << 'EOF' >&2
configure: error:
This system does not appear to have a working C compiler.
A working C compiler is required to compile Eggdrop.
EOF
exit 1
fi
])
dnl EGG_HEADER_STDC()
dnl
AC_DEFUN([EGG_HEADER_STDC],
[
if test "$ac_cv_header_stdc" = no; then
cat << 'EOF' >&2
configure: error:
Your system must support ANSI C Header files.
These are required for the language support. Sorry.
EOF
exit 1
fi
])
dnl EGG_CHECK_ICC()
dnl
dnl Check for Intel's C compiler. It attempts to emulate gcc but doesn't
dnl accept all the standard gcc options.
dnl
dnl
AC_DEFUN([EGG_CHECK_ICC],[
AC_CACHE_CHECK([for icc], egg_cv_var_cc_icc, [
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#if !(defined(__ICC) || defined(__ECC) || defined(__INTEL_COMPILER))
"Toto, I've a feeling we're not in Kansas anymore."
#endif
]])], [
egg_cv_var_cc_icc="yes"
], [
egg_cv_var_cc_icc="no"
])
])
if test "$egg_cv_var_cc_icc" = yes; then
ICC="yes"
else
ICC="no"
fi
])
dnl EGG_CHECK_CCPIPE()
dnl
dnl This macro checks whether or not the compiler supports the `-pipe' flag,
dnl which speeds up the compilation.
dnl
AC_DEFUN([EGG_CHECK_CCPIPE],
[
if test "$GCC" = yes && test "$ICC" = no; then
AC_CACHE_CHECK([whether the compiler understands -pipe], egg_cv_var_ccpipe, [
ac_old_CC="$CC"
CC="$CC -pipe"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return(0); ]])], [
egg_cv_var_ccpipe="yes"
], [
egg_cv_var_ccpipe="no"
])
CC="$ac_old_CC"
])
if test "$egg_cv_var_ccpipe" = yes; then
EGG_APPEND_VAR(CFLAGS, -pipe)
fi
fi
])
dnl EGG_CHECK_CCWALL()
dnl
dnl See if the compiler supports -Wall.
dnl
AC_DEFUN([EGG_CHECK_CCWALL],
[
if test "$GCC" = yes && test "$ICC" = no; then
AC_CACHE_CHECK([whether the compiler understands -Wall], egg_cv_var_ccwall, [
ac_old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ return(0); ]])], [
egg_cv_var_ccwall="yes"
], [
egg_cv_var_ccwall="no"
])
CFLAGS="$ac_old_CFLAGS"
])
if test "$egg_cv_var_ccwall" = yes; then
EGG_APPEND_VAR(CFLAGS, -Wall)
fi
fi
])
dnl
dnl Checks for types and functions.
dnl
dnl EGG_CHECK_SOCKLEN_T()
dnl
dnl Check for the socklen_t type.
dnl
AC_DEFUN([EGG_CHECK_SOCKLEN_T],
[
AC_CACHE_CHECK([for socklen_t], egg_cv_socklen_t, [
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <unistd.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
]],[[
socklen_t test = 55;
if (test != 55)
return(1);
return(0);
]])], [
egg_cv_socklen_t="yes"
], [
egg_cv_socklen_t="no"
], [
egg_cv_socklen_t="cross"
])
])
if test "$egg_cv_socklen_t" = yes; then
AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define to 1 if you have the `socklen_t' type.])
fi
])
dnl EGG_FUNC_VPRINTF()
dnl
AC_DEFUN([EGG_FUNC_VPRINTF],
[
AC_FUNC_VPRINTF
if test "$ac_cv_func_vprintf" = no; then
cat << 'EOF' >&2
configure: error:
Your system does not have the vprintf/vsprintf/sprintf libraries.
These are required to compile almost anything. Sorry.
EOF
exit 1
fi
])
dnl
dnl Checks for programs.
dnl
dnl EGG_PROG_HEAD_1()
dnl
dnl This macro checks for the proper 'head -1' command variant to use.
dnl
AC_DEFUN([EGG_PROG_HEAD_1],
[
cat << 'EOF' > conftest.head
a
b
c
EOF
for ac_prog in 'head -n 1' 'head -1' 'sed 1q'; do
AC_MSG_CHECKING([whether $ac_prog works])
AC_CACHE_VAL([ac_cv_prog_HEAD_1], [
if test -n "$HEAD_1"; then
# Let the user override the test.
ac_cv_prog_HEAD_1="$HEAD_1"
else
if test `cat conftest.head | $ac_prog` = a; then
ac_cv_prog_HEAD_1="$ac_prog"
fi
fi
])
if test -n "$ac_cv_prog_HEAD_1"; then
AC_MSG_RESULT([yes])
break
else
AC_MSG_RESULT([no])
fi
done
if test "x$ac_cv_prog_HEAD_1" = x; then
cat << 'EOF' >&2
configure: error:
This system seems to lack a working 'head -1' or 'head -n 1' command.
A working 'head -1' (or equivalent) command is required to compile Eggdrop.
EOF
exit 1
fi
rm -f conftest.head
HEAD_1="$ac_cv_prog_HEAD_1"
AC_SUBST(HEAD_1)
])
dnl EGG_PROG_STRIP()
dnl
AC_DEFUN([EGG_PROG_STRIP],
[
AC_CHECK_PROG(STRIP, strip, strip)
if test "x$STRIP" = x; then
STRIP=touch
fi
])
dnl EGG_PROG_AWK()
dnl
AC_DEFUN([EGG_PROG_AWK],
[
AC_PROG_AWK
if test "x$AWK" = x; then
cat << 'EOF' >&2
configure: error:
This system seems to lack a working 'awk' command.
A working 'awk' command is required to compile Eggdrop.
EOF
exit 1
fi
])
dnl EGG_PROG_BASENAME()
dnl
AC_DEFUN([EGG_PROG_BASENAME],
[
AC_CHECK_PROG(BASENAME, basename, basename)
if test "x$BASENAME" = x; then
cat << 'EOF' >&2
configure: error:
This system seems to lack a working 'basename' command.
A working 'basename' command is required to compile Eggdrop.
EOF
exit 1
fi
])
dnl EGG_ENABLE_STRIP()
dnl
AC_DEFUN([EGG_ENABLE_STRIP],
[
AC_ARG_ENABLE([strip],
[ --enable-strip enable stripping of binaries],
[enable_strip="$enableval"],
[enable_strip="no"])
if test "$enable_strip" = yes; then
cat << 'EOF' >&2
configure: WARNING:
Stripping the executable, while saving some disk space, will make bug
reports nearly worthless. If Eggdrop crashes and you wish to report
a bug, you will need to recompile with stripping disabled.
EOF
else
STRIP="touch"
fi
])
dnl
dnl Checks for operating system and module support.
dnl
dnl EGG_OS_VERSION()
dnl
AC_DEFUN([EGG_OS_VERSION],
[
dnl FIXME: Eventually replace these with the results of AC_CANONICAL_* below
AC_CACHE_CHECK([system type], egg_cv_var_system_type, [egg_cv_var_system_type=`$UNAME -s`])
AC_CACHE_CHECK([system release], egg_cv_var_system_release, [egg_cv_var_system_release=`$UNAME -r`])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
])
dnl EGG_CYGWIN_BINMODE
dnl
dnl Check for binmode.o on Cygwin.
dnl
AC_DEFUN([EGG_CYGWIN_BINMODE],
[
if test "$EGG_CYGWIN" = yes; then
AC_MSG_CHECKING([for /usr/lib/binmode.o])
if test -r /usr/lib/binmode.o; then
AC_MSG_RESULT([yes])
EGG_APPEND_VAR(LIBS, /usr/lib/binmode.o)
else
AC_MSG_RESULT([no])
AC_MSG_WARN([Make sure the directory Eggdrop is installed into is mounted in binary mode.])
fi
fi
])
dnl EGG_DARWIN_BUNDLE
dnl
dnl Locate bundle1.o on Darwin. Test systems seem to have it in /usr/lib,
dnl however the official docs say /lib.
dnl
AC_DEFUN([EGG_DARWIN_BUNDLE],
[
BUNDLE=""
for bundlepath in "/lib" "/usr/lib" "/usr/local/lib"; do
AC_MSG_CHECKING([for bundle1.o in ${bundlepath}])
if test -r "${bundlepath}/bundle1.o"; then
AC_MSG_RESULT([yes])
BUNDLE="${bundlepath}/bundle1.o"
break
else
AC_MSG_RESULT([no])
fi
done
if test "x$BUNDLE" = x; then
cat << 'EOF' >&2
configure: WARNING:
bundle1.o cannot be located. A module build might not compile correctly.
EOF
fi
])
dnl EGG_CHECK_MODULE_SUPPORT()
dnl
dnl Checks for module support. This should be run after EGG_OS_VERSION.
dnl
AC_DEFUN([EGG_CHECK_MODULE_SUPPORT],
[
MODULES_OK="yes"
MOD_EXT="so"
DEFAULT_MAKE="debug"
LOAD_METHOD="dl"
WEIRD_OS="yes"
UNKNOWN_OS="no"
MODULE_XLIBS=""
AC_MSG_CHECKING([module loading capabilities])
AC_MSG_RESULT
AC_CHECK_HEADERS([dl.h dlfcn.h loader.h rld.h mach-o/dyld.h mach-o/rld.h])
AC_CHECK_FUNCS([dlopen load NSLinkModule shl_load rld_load])
# Note to other maintainers:
# Bourne shell has no concept of "fall through"
case "$egg_cv_var_system_type" in
BSD/OS)
if test `echo "$egg_cv_var_system_release" | cut -d . -f 1` = 2; then
MODULES_OK="no"
fi
;;
CYGWI*)
WEIRD_OS="no"
MOD_EXT="dll"
;;
HP-UX)
LOAD_METHOD="shl"
;;
dell)
# do nothing
;;
IRIX)
# do nothing
;;
Ultrix)
# No dlopen() or similar on Ultrix. We can't use modules.
MODULES_OK="no"
;;
BeOS)
# We don't yet support BeOS's dynamic linking interface.
MODULES_OK="no"
;;
Linux)
WEIRD_OS="no"
;;
Lynx)
# do nothing
;;
QNX)
# do nothing
# QNX (recent versions at least) support dlopen().
;;
OSF1)
case `echo "$egg_cv_var_system_release" | cut -d . -f 1` in
1.*) LOAD_METHOD="loader" ;;
esac
;;
SunOS)
if test `echo "$egg_cv_var_system_release" | cut -d . -f 1` = 5; then
# We've had quite a bit of testing on Solaris.
WEIRD_OS="no"
else
# SunOS 4
AC_DEFINE(DLOPEN_1, 1, [Define if running on SunOS 4.0.])
fi
;;
*BSD)
# FreeBSD/OpenBSD/NetBSD all support dlopen() and have had plenty of
# testing with Eggdrop.
WEIRD_OS="no"
;;
Darwin)
# We should support Mac OS X (at least 10.1 and later) now.
# Use rld on < 10.1.
if test "$ac_cv_func_NSLinkModule" = no; then
LOAD_METHOD="rld"
fi
LOAD_METHOD="dyld"
EGG_DARWIN_BUNDLE
EGG_APPEND_VAR(MODULE_XLIBS, $BUNDLE)
;;
*)
if test -r /mach; then
# At this point, we're guessing this is NeXT Step. We support rld, so
# modules will probably work on NeXT now, but we have absolutely no way
# to test this. I've never even seen a NeXT box, let alone do I know of
# one I can test this on.
LOAD_METHOD="rld"
else
# QNX apparently supports dlopen()... Fallthrough.
if test -r /cmds; then
UNKNOWN_OS="yes"
MODULES_OK="no"
fi
fi
;;
esac
if test "$MODULES_OK" = yes; then
AC_DEFINE(MODULES_OK, 1, [Define if modules will work on your system.])
case $LOAD_METHOD in
dl)
AC_DEFINE(MOD_USE_DL, 1, [Define if modules should be loaded using the dl*() functions.])
;;
shl)
AC_DEFINE(MOD_USE_SHL, 1, [Define if modules should be loaded using the shl_*() functions.])
;;
dyld)
AC_DEFINE(MOD_USE_DYLD, 1, [Define if modules should be loaded using the NS*() functions.])
;;
loader)
AC_DEFINE(MOD_USE_LOADER, 1, [Define if modules should be loaded using the ldr*() and *load() functions.])
;;
rld)
AC_DEFINE(MOD_USE_RLD, 1, [Define if modules should be loaded using the rld_*() functions.])
;;
esac
else
DEFAULT_MAKE="static"
fi
if test "$WEIRD_OS" = yes; then
# Default to "make static" for 'weird' operating systems. Will print a
# note at the end of configure explaining. This way, Eggdrop should compile
# "out of the box" on most every operating system we know of, and they can
# do a "make eggdrop" if they want to use(/try to use) module support. - Wcc
DEFAULT_MAKE="static"
fi
AC_SUBST(DEFAULT_MAKE)
AC_SUBST(MOD_EXT)
AC_SUBST(MODULE_XLIBS)
AC_DEFINE_UNQUOTED(EGG_MOD_EXT, "$MOD_EXT", [Defines the extension of Eggdrop modules.])
])
dnl EGG_CHECK_OS()
dnl
dnl Various operating system tests.
dnl
AC_DEFUN([EGG_CHECK_OS],
[
MOD_CC="$CC"
MOD_LD="$CC"
MOD_STRIP="$STRIP"
SHLIB_CC="$CC"
SHLIB_LD="$CC"
SHLIB_STRIP="$STRIP"
LINUX="no"
IRIX="no"
SUNOS="no"
HPUX="no"
EGG_CYGWIN="no"
case "$egg_cv_var_system_type" in
BSD/OS)
case `echo "$egg_cv_var_system_release" | cut -d . -f 1` in
2)
# do nothing
;;
3)
MOD_CC="shlicc"
MOD_LD="shlicc"
if test "$STRIP" != touch; then
MOD_STRIP="$STRIP -d"
fi
SHLIB_LD="shlicc -r"
SHLIB_STRIP="touch"
;;
*)
if test "$STRIP" != touch; then
MOD_STRIP="$STRIP -d"
fi
SHLIB_CC="$CC -export-dynamic -fPIC"
SHLIB_LD="$CC -shared -nostartfiles"
;;
esac
;;
CYGWI*)
SHLIB_LD="$CC -shared"
MOD_CC="$CC"
MOD_LD="$CC"
EGG_CYGWIN="yes"
EGG_CYGWIN_BINMODE
AC_DEFINE(CYGWIN_HACKS, 1, [Define if running under Cygwin.])
;;
HP-UX)
HPUX="yes"
if test "$CC" = cc; then
# HP-UX ANSI C Compiler.
MOD_LD="$CC +z"
SHLIB_CC="$CC +z"
else
# GCC
MOD_LD="$CC -fPIC -shared"
SHLIB_CC="$CC -fPIC"
fi
SHLIB_LD="ld -b"
;;
dell)
SHLIB_STRIP="touch"
MOD_LD="$CC -lelf -lucb"
;;
IRIX)
SHLIB_LD="ld -n32 -shared -rdata_shared"
IRIX="yes"
SHLIB_STRIP="touch"
;;
Ultrix)
SHLIB_STRIP="touch"
DEFAULT_MAKE="static"
SHELL="/bin/sh5"
;;
SINIX*)
SHLIB_STRIP="touch"
SHLIB_CC="cc -G"
;;
BeOS)
# do nothing
;;
Linux)
LINUX="yes"
MOD_LD="$CC"
SHLIB_CC="$CC -fPIC"
SHLIB_LD="$CC -shared -nostartfiles"
;;
Lynx)
# do nothing
;;
QNX)
SHLIB_LD="ld -shared"
AC_DEFINE(QNX_HACKS, 1, [Define if running under QNX.])
;;
OSF1)
case `echo "$egg_cv_var_system_release" | cut -d . -f 1` in
V*)
# Digital OSF uses an ancient version of gawk
if test "$AWK" = gawk; then
AWK="awk"
fi
SHLIB_LD="ld -shared -expect_unresolved \"'*'\""
SHLIB_STRIP="touch"
;;
1.0|1.1|1.2)
SHLIB_LD="ld -R -export $@:"
;;
1.*)
SHLIB_CC="$CC -fpic"
SHLIB_LD="ld -shared"
;;
esac
AC_DEFINE(BROKEN_SNPRINTF, 1, [Define to use Eggdrop's snprintf functions regardless of HAVE_SNPRINTF.])
AC_DEFINE(STOP_UAC, 1, [Define if running on OSF/1 platform.])
;;
SunOS)
if test `echo "$egg_cv_var_system_release" | cut -d . -f 1` = 5; then
# Solaris
if test -n "$GCC"; then
SHLIB_CC="$CC -fPIC"
SHLIB_LD="$CC -shared"
else
SHLIB_CC="$CC -KPIC"
SHLIB_LD="$CC -G -z text"
fi
else
# SunOS 4
SUNOS="yes"
SHLIB_LD="ld"
SHLIB_CC="$CC -PIC"
fi
;;
*BSD)
# FreeBSD/OpenBSD/NetBSD
SHLIB_CC="$CC -fPIC"
SHLIB_LD="ld -Bshareable -x"
;;
Darwin)
# Mac OS X
SHLIB_CC="$CC -fPIC"
SHLIB_LD="ld -bundle -undefined error"
AC_DEFINE(BIND_8_COMPAT, 1, [Define if running on Mac OS X with dns.mod.])
;;
*)
if test -r /mach; then
# At this point, we're guessing this is NeXT Step.
AC_DEFINE(BORGCUBES, 1, [Define if running on NeXT Step.])
else
if test -r /cmds; then
# Probably QNX.
SHLIB_LD="ld -shared"
SHLIB_STRIP="touch"
fi
fi
;;
esac
AC_SUBST(MOD_LD)
AC_SUBST(MOD_CC)
AC_SUBST(MOD_STRIP)
AC_SUBST(SHLIB_LD)
AC_SUBST(SHLIB_CC)
AC_SUBST(SHLIB_STRIP)
])
dnl
dnl Library tests.
dnl
dnl EGG_CHECK_LIBS()
dnl
AC_DEFUN([EGG_CHECK_LIBS],
[
# FIXME: this needs to be fixed so that it works on IRIX
if test "$IRIX" = yes; then
AC_MSG_WARN([Skipping library tests because they CONFUSE IRIX.])
else
AC_CHECK_LIB(socket, socket)
AC_CHECK_LIB(nsl, connect)
AC_CHECK_LIB(dns, gethostbyname)
AC_CHECK_LIB(dl, dlopen)
AC_CHECK_LIB(m, tan, EGG_MATH_LIB="-lm")
# This is needed for Tcl libraries compiled with thread support
AC_CHECK_LIB(pthread, pthread_mutex_init, [
ac_cv_lib_pthread_pthread_mutex_init="yes"
ac_cv_lib_pthread="-lpthread"
], [
AC_CHECK_LIB(pthread, __pthread_mutex_init, [
ac_cv_lib_pthread_pthread_mutex_init="yes"
ac_cv_lib_pthread="-lpthread"
], [
AC_CHECK_LIB(pthreads, pthread_mutex_init, [
ac_cv_lib_pthread_pthread_mutex_init="yes"
ac_cv_lib_pthread="-lpthreads"
], [
AC_CHECK_FUNC(pthread_mutex_init, [
ac_cv_lib_pthread_pthread_mutex_init="yes"
ac_cv_lib_pthread=""
], [
ac_cv_lib_pthread_pthread_mutex_init="no"
]
)]
)]
)])
if test "$SUNOS" = yes; then
# For suns without yp
AC_CHECK_LIB(dl, main)
else
if test "$HPUX" = yes; then
AC_CHECK_LIB(dld, shl_load)
fi
fi
fi
])
dnl EGG_ARG_HANDLEN()
dnl
AC_DEFUN([EGG_ARG_HANDLEN], [
AC_ARG_WITH(handlen, [ --with-handlen=VALUE set the maximum length a handle on the bot can be], [
if test -n $withval && test $withval -ge 9 && test $withval -le 32;
then
AC_DEFINE_UNQUOTED(EGG_HANDLEN, $withval, [
Define the maximum length of handles on the bot.
])
else
AC_MSG_WARN([Invalid handlen given (must be a number between 9 and 32), defaulting to 9.])
fi
])
])
dnl
dnl Misc checks.
dnl
dnl EGG_EXEEXT()
dnl
dnl Test for executable suffix and define Eggdrop's executable name accordingly.
dnl
AC_DEFUN([EGG_EXEEXT], [
EGGEXEC="eggdrop"
AC_EXEEXT
if test "x$EXEEXT" != x; then
EGGEXEC="eggdrop${EXEEXT}"
fi
AC_SUBST(EGGEXEC)
])
dnl
dnl Tcl checks.
dnl
dnl EGG_TCL_ARG_WITH()
dnl
AC_DEFUN([EGG_TCL_ARG_WITH],
[
AC_ARG_WITH(tcllib, [ --with-tcllib=PATH full path to Tcl library (e.g. /usr/lib/libtcl8.5.so)], [tcllibname="$withval"])
AC_ARG_WITH(tclinc, [ --with-tclinc=PATH full path to Tcl header (e.g. /usr/include/tcl.h)], [tclincname="$withval"])
WARN=0
# Make sure either both or neither $tcllibname and $tclincname are set
if test "x$tcllibname" != x; then
if test "x$tclincname" = x; then
WARN=1
tcllibname=""
TCLLIB=""
TCLINC=""
fi
else
if test "x$tclincname" != x; then
WARN=1
tclincname=""
TCLLIB=""
TCLINC=""
fi
fi
if test "$WARN" = 1; then
cat << 'EOF' >&2
configure: WARNING:
You must specify both --with-tcllib and --with-tclinc for either to work.
configure will now attempt to autodetect both the Tcl library and header.
EOF
fi
])
dnl EGG_TCL_ENV()
dnl
AC_DEFUN([EGG_TCL_ENV],
[
WARN=0
# Make sure either both or neither $TCLLIB and $TCLINC are set
if test "x$TCLLIB" != x; then
if test "x$TCLINC" = x; then
WARN=1
WVAR1=TCLLIB
WVAR2=TCLINC
TCLLIB=""
fi
else
if test "x$TCLINC" != x; then
WARN=1
WVAR1=TCLINC
WVAR2=TCLLIB
TCLINC=""
fi
fi
if test "$WARN" = 1; then
cat << EOF >&2
configure: WARNING:
Environment variable $WVAR1 was set, but I did not detect ${WVAR2}.
Please set both TCLLIB and TCLINC correctly if you wish to use them.
configure will now attempt to autodetect both the Tcl library and header.
EOF
fi
])
dnl EGG_TCL_WITH_TCLLIB()
dnl
AC_DEFUN([EGG_TCL_WITH_TCLLIB],
[
# Look for Tcl library: if $tcllibname is set, check there first
if test "x$tcllibname" != x; then
if test -f "$tcllibname" && test -r "$tcllibname"; then
TCLLIB=`echo $tcllibname | sed 's%/[[^/]][[^/]]*$%%'`
TCLLIBFN=`$BASENAME $tcllibname | cut -c4-`
TCLLIBEXT=".`echo $TCLLIBFN | $AWK '{j=split([$]1, i, "."); print i[[j]]}'`"
TCLLIBFNS=`$BASENAME $tcllibname $TCLLIBEXT | cut -c4-`
else
cat << EOF >&2
configure: WARNING:
The file '$tcllibname' given to option --with-tcllib is not valid.
Specify the full path including the file name (e.g. /usr/lib/libtcl8.5.so)
configure will now attempt to autodetect both the Tcl library and header.
EOF
tcllibname=""
tclincname=""
TCLLIB=""
TCLLIBFN=""
TCLINC=""
TCLINCFN=""
fi
fi
])
dnl EGG_TCL_WITH_TCLINC()
dnl
AC_DEFUN([EGG_TCL_WITH_TCLINC],
[
# Look for Tcl header: if $tclincname is set, check there first
if test "x$tclincname" != x; then