/[cvs]/eggdrop1.8/aclocal.m4
ViewVC logotype

Contents of /eggdrop1.8/aclocal.m4

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.7 - (show annotations) (download)
Thu Oct 14 09:49:47 2010 UTC (8 years, 9 months ago) by pseudo
Branch: MAIN
Changes since 1.6: +2 -1 lines
Fixed dns.mod on QNX6/Mac OS X/Solaris
Rewrote dns.mod's autoconf checks to detect the resolver library properly on Darwin/Solaris.
Added -lsocket to the list of libraries, searched for res_* functions, in order to support QNX6.

1 dnl aclocal.m4: macros autoconf uses when building configure from configure.ac
2 dnl
3 dnl Copyright (C) 1999 - 2010 Eggheads Development Team
4 dnl
5 dnl This program is free software; you can redistribute it and/or
6 dnl modify it under the terms of the GNU General Public License
7 dnl as published by the Free Software Foundation; either version 2
8 dnl of the License, or (at your option) any later version.
9 dnl
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 dnl GNU General Public License for more details.
14 dnl
15 dnl You should have received a copy of the GNU General Public License
16 dnl along with this program; if not, write to the Free Software
17 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 dnl
19 dnl $Id: aclocal.m4,v 1.6 2010/10/10 21:24:42 pseudo Exp $
20 dnl
21
22
23 dnl
24 dnl Message macros.
25 dnl
26
27
28 dnl EGG_MSG_CONFIGURE_START()
29 dnl
30 AC_DEFUN([EGG_MSG_CONFIGURE_START],
31 [
32 AC_MSG_RESULT
33 AC_MSG_RESULT([This is Eggdrop's GNU configure script.])
34 AC_MSG_RESULT([It's going to run a bunch of tests to hopefully make your compile])
35 AC_MSG_RESULT([work without much twiddling.])
36 AC_MSG_RESULT
37 ])
38
39
40 dnl EGG_MSG_CONFIGURE_END()
41 dnl
42 AC_DEFUN([EGG_MSG_CONFIGURE_END],
43 [
44 AC_MSG_RESULT([Type 'make config' to configure the modules, or type 'make iconfig'])
45 AC_MSG_RESULT([to interactively choose which modules to compile.])
46 AC_MSG_RESULT
47 ])
48
49
50 dnl EGG_MSG_WEIRDOS()
51 dnl
52 dnl Print some messages at the end of configure to give extra information to
53 dnl users of 'weird' operating systems.
54 dnl
55 AC_DEFUN([EGG_MSG_WEIRDOS],
56 [
57 AC_MSG_RESULT([Operating System: $egg_cv_var_system_type $egg_cv_var_system_release])
58 AC_MSG_RESULT
59 if test "$UNKNOWN_OS" = yes; then
60 AC_MSG_RESULT([WARNING:])
61 AC_MSG_RESULT
62 AC_MSG_RESULT([ Unknown Operating System: $egg_cv_var_system_type $egg_cv_var_system_release])
63 AC_MSG_RESULT
64 AC_MSG_RESULT([ Module support has been disabled for this build.])
65 AC_MSG_RESULT
66 AC_MSG_RESULT([ Please let us know what type of system this is by e-mailing])
67 AC_MSG_RESULT([ bugs@eggheads.org. The output of uname -a, and some other basic])
68 AC_MSG_RESULT([ information about the OS should be included.])
69 AC_MSG_RESULT
70 else
71 if test "$WEIRD_OS" = yes; then
72 AC_MSG_RESULT([WARNING:])
73 AC_MSG_RESULT
74 AC_MSG_RESULT([ The operating system you are using has not yet had a great])
75 AC_MSG_RESULT([ deal of testing with Eggdrop. For this reason, this compile])
76 AC_MSG_RESULT([ will default to "make static".])
77 AC_MSG_RESULT
78 AC_MSG_RESULT([ To enable module support, type "make eggdrop" instead of just])
79 AC_MSG_RESULT([ "make" after you run "make config" (or "make iconfig").])
80 AC_MSG_RESULT
81 AC_MSG_RESULT([ As we have not done a sufficient amount of testing on this])
82 AC_MSG_RESULT([ OS, your feedback is greatly appreciated. Please let us know])
83 AC_MSG_RESULT([ at bugs@eggheads.org if there are any problems compiling with])
84 AC_MSG_RESULT([ module support, or if you got it to work :)])
85 AC_MSG_RESULT
86 fi
87 AC_MSG_RESULT([If you experience any problems compiling Eggdrop, please read the])
88 AC_MSG_RESULT([compile guide, found in doc/COMPILE-GUIDE.])
89 AC_MSG_RESULT
90 fi
91 ])
92
93
94 dnl EGG_APPEND_VAR()
95 dnl
96 dnl Append a non-empty string to a variable
97 dnl
98 dnl $1 = variable
99 dnl $2 = string
100 dnl
101 AC_DEFUN([EGG_APPEND_VAR],
102 [
103 if test "x$2" != x; then
104 if test "x$$1" = x; then
105 $1="$2"
106 else
107 $1="$$1 $2"
108 fi
109 fi
110 ])
111
112
113 dnl
114 dnl Compiler checks.
115 dnl
116
117
118 dnl EGG_CHECK_CC()
119 dnl
120 dnl Check for a working C compiler.
121 dnl
122 AC_DEFUN([EGG_CHECK_CC],
123 [
124 if test "x$cross_compiling" = x; then
125 cat << 'EOF' >&2
126 configure: error:
127
128 This system does not appear to have a working C compiler.
129 A working C compiler is required to compile Eggdrop.
130
131 EOF
132 exit 1
133 fi
134 ])
135
136
137 dnl EGG_HEADER_STDC()
138 dnl
139 AC_DEFUN([EGG_HEADER_STDC],
140 [
141 if test "$ac_cv_header_stdc" = no; then
142 cat << 'EOF' >&2
143 configure: error:
144
145 Your system must support ANSI C Header files.
146 These are required for the language support. Sorry.
147
148 EOF
149 exit 1
150 fi
151 ])
152
153
154 dnl EGG_CHECK_ICC()
155 dnl
156 dnl Check for Intel's C compiler. It attempts to emulate gcc but doesn't
157 dnl accept all the standard gcc options.
158 dnl
159 dnl
160 AC_DEFUN([EGG_CHECK_ICC],[
161 AC_CACHE_CHECK([for icc], egg_cv_var_cc_icc, [
162 AC_COMPILE_IFELSE([[
163 #if !(defined(__ICC) || defined(__ECC) || defined(__INTEL_COMPILER))
164 "Toto, I've a feeling we're not in Kansas anymore."
165 #endif
166 ]], [
167 egg_cv_var_cc_icc="yes"
168 ], [
169 egg_cv_var_cc_icc="no"
170 ])
171 ])
172
173 if test "$egg_cv_var_cc_icc" = yes; then
174 ICC="yes"
175 else
176 ICC="no"
177 fi
178 ])
179
180
181 dnl EGG_CHECK_CCPIPE()
182 dnl
183 dnl This macro checks whether or not the compiler supports the `-pipe' flag,
184 dnl which speeds up the compilation.
185 dnl
186 AC_DEFUN([EGG_CHECK_CCPIPE],
187 [
188 if test "$GCC" = yes && test "$ICC" = no; then
189 AC_CACHE_CHECK([whether the compiler understands -pipe], egg_cv_var_ccpipe, [
190 ac_old_CC="$CC"
191 CC="$CC -pipe"
192 AC_COMPILE_IFELSE([[
193 int main ()
194 {
195 return(0);
196 }
197 ]], [
198 egg_cv_var_ccpipe="yes"
199 ], [
200 egg_cv_var_ccpipe="no"
201 ])
202 CC="$ac_old_CC"
203 ])
204
205 if test "$egg_cv_var_ccpipe" = yes; then
206 EGG_APPEND_VAR(CFLAGS, -pipe)
207 fi
208 fi
209 ])
210
211
212 dnl EGG_CHECK_CCWALL()
213 dnl
214 dnl See if the compiler supports -Wall.
215 dnl
216 AC_DEFUN([EGG_CHECK_CCWALL],
217 [
218 if test "$GCC" = yes && test "$ICC" = no; then
219 AC_CACHE_CHECK([whether the compiler understands -Wall], egg_cv_var_ccwall, [
220 ac_old_CFLAGS="$CFLAGS"
221 CFLAGS="$CFLAGS -Wall"
222 AC_COMPILE_IFELSE([[
223 int main ()
224 {
225 return(0);
226 }
227 ]], [
228 egg_cv_var_ccwall="yes"
229 ], [
230 egg_cv_var_ccwall="no"
231 ])
232 CFLAGS="$ac_old_CFLAGS"
233 ])
234
235 if test "$egg_cv_var_ccwall" = yes; then
236 EGG_APPEND_VAR(CFLAGS, -Wall)
237 fi
238 fi
239 ])
240
241
242 dnl
243 dnl Checks for types and functions.
244 dnl
245
246
247 dnl EGG_CHECK_SOCKLEN_T()
248 dnl
249 dnl Check for the socklen_t type.
250 dnl
251 AC_DEFUN([EGG_CHECK_SOCKLEN_T],
252 [
253 AC_CACHE_CHECK([for socklen_t], egg_cv_socklen_t, [
254 AC_RUN_IFELSE([[
255 #include <unistd.h>
256 #include <sys/param.h>
257 #include <sys/types.h>
258 #include <sys/socket.h>
259 #include <netinet/in.h>
260 #include <arpa/inet.h>
261
262 int main()
263 {
264 socklen_t test = 55;
265
266 if (test != 55)
267 exit(1);
268
269 return(0);
270 }
271 ]], [
272 egg_cv_socklen_t="yes"
273 ], [
274 egg_cv_socklen_t="no"
275 ], [
276 egg_cv_socklen_t="cross"
277 ])
278 ])
279
280 if test "$egg_cv_socklen_t" = yes; then
281 AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define to 1 if you have the `socklen_t' type.])
282 fi
283 ])
284
285
286 dnl EGG_FUNC_VPRINTF()
287 dnl
288 AC_DEFUN([EGG_FUNC_VPRINTF],
289 [
290 AC_FUNC_VPRINTF
291 if test "$ac_cv_func_vprintf" = no; then
292 cat << 'EOF' >&2
293 configure: error:
294
295 Your system does not have the vprintf/vsprintf/sprintf libraries.
296 These are required to compile almost anything. Sorry.
297
298 EOF
299 exit 1
300 fi
301 ])
302
303
304 dnl
305 dnl Checks for programs.
306 dnl
307
308
309 dnl EGG_PROG_HEAD_1()
310 dnl
311 dnl This macro checks for the proper 'head -1' command variant to use.
312 dnl
313 AC_DEFUN([EGG_PROG_HEAD_1],
314 [
315 cat << 'EOF' > conftest.head
316 a
317 b
318 c
319 EOF
320
321 for ac_prog in 'head -n 1' 'head -1' 'sed 1q'; do
322 AC_MSG_CHECKING([whether $ac_prog works])
323 AC_CACHE_VAL([ac_cv_prog_HEAD_1], [
324 if test -n "$HEAD_1"; then
325 # Let the user override the test.
326 ac_cv_prog_HEAD_1="$HEAD_1"
327 else
328 if test `cat conftest.head | $ac_prog` = a; then
329 ac_cv_prog_HEAD_1="$ac_prog"
330 fi
331 fi
332 ])
333 if test -n "$ac_cv_prog_HEAD_1"; then
334 AC_MSG_RESULT([yes])
335 break
336 else
337 AC_MSG_RESULT([no])
338 fi
339 done
340
341 if test "x$ac_cv_prog_HEAD_1" = x; then
342 cat << 'EOF' >&2
343 configure: error:
344
345 This system seems to lack a working 'head -1' or 'head -n 1' command.
346 A working 'head -1' (or equivalent) command is required to compile Eggdrop.
347
348 EOF
349 exit 1
350 fi
351
352 rm -f conftest.head
353 HEAD_1="$ac_cv_prog_HEAD_1"
354 AC_SUBST(HEAD_1)
355 ])
356
357
358 dnl EGG_PROG_STRIP()
359 dnl
360 AC_DEFUN([EGG_PROG_STRIP],
361 [
362 AC_CHECK_PROG(STRIP, strip, strip)
363 if test "x$STRIP" = x; then
364 STRIP=touch
365 fi
366 ])
367
368
369 dnl EGG_PROG_AWK()
370 dnl
371 AC_DEFUN([EGG_PROG_AWK],
372 [
373 AC_PROG_AWK
374 if test "x$AWK" = x; then
375 cat << 'EOF' >&2
376 configure: error:
377
378 This system seems to lack a working 'awk' command.
379 A working 'awk' command is required to compile Eggdrop.
380
381 EOF
382 exit 1
383 fi
384 ])
385
386
387 dnl EGG_PROG_BASENAME()
388 dnl
389 AC_DEFUN([EGG_PROG_BASENAME],
390 [
391 AC_CHECK_PROG(BASENAME, basename, basename)
392 if test "x$BASENAME" = x; then
393 cat << 'EOF' >&2
394 configure: error:
395
396 This system seems to lack a working 'basename' command.
397 A working 'basename' command is required to compile Eggdrop.
398
399 EOF
400 exit 1
401 fi
402 ])
403
404
405 dnl EGG_ENABLE_STRIP()
406 dnl
407 AC_DEFUN([EGG_ENABLE_STRIP],
408 [
409 AC_ARG_ENABLE([strip],
410 [ --enable-strip enable stripping of binaries],
411 [enable_strip="$enableval"],
412 [enable_strip="no"])
413
414 if test "$enable_strip" = yes; then
415 cat << 'EOF' >&2
416
417 configure: WARNING:
418
419 Stripping the executable, while saving some disk space, will make bug
420 reports nearly worthless. If Eggdrop crashes and you wish to report
421 a bug, you will need to recompile with stripping disabled.
422
423 EOF
424 else
425 STRIP="touch"
426 fi
427 ])
428
429
430 dnl
431 dnl Checks for operating system and module support.
432 dnl
433
434
435 dnl EGG_OS_VERSION()
436 dnl
437 AC_DEFUN([EGG_OS_VERSION],
438 [
439 dnl FIXME: Eventually replace these with the results of AC_CANONICAL_* below
440 AC_CACHE_CHECK([system type], egg_cv_var_system_type, [egg_cv_var_system_type=`$UNAME -s`])
441 AC_CACHE_CHECK([system release], egg_cv_var_system_release, [egg_cv_var_system_release=`$UNAME -r`])
442
443 AC_CANONICAL_BUILD
444 AC_CANONICAL_HOST
445 AC_CANONICAL_TARGET
446 ])
447
448
449 dnl EGG_CYGWIN_BINMODE
450 dnl
451 dnl Check for binmode.o on Cygwin.
452 dnl
453 AC_DEFUN([EGG_CYGWIN_BINMODE],
454 [
455 if test "$EGG_CYGWIN" = yes; then
456 AC_MSG_CHECKING([for /usr/lib/binmode.o])
457 if test -r /usr/lib/binmode.o; then
458 AC_MSG_RESULT([yes])
459 EGG_APPEND_VAR(LIBS, /usr/lib/binmode.o)
460 else
461 AC_MSG_RESULT([no])
462 AC_MSG_WARN([Make sure the directory Eggdrop is installed into is mounted in binary mode.])
463 fi
464 fi
465 ])
466
467
468 dnl EGG_DARWIN_BUNDLE
469 dnl
470 dnl Locate bundle1.o on Darwin. Test systems seem to have it in /usr/lib,
471 dnl however the official docs say /lib.
472 dnl
473 AC_DEFUN([EGG_DARWIN_BUNDLE],
474 [
475 BUNDLE=""
476 for bundlepath in "/lib" "/usr/lib" "/usr/local/lib"; do
477 AC_MSG_CHECKING([for bundle1.o in ${bundlepath}])
478 if test -r "${bundlepath}/bundle1.o"; then
479 AC_MSG_RESULT([yes])
480 BUNDLE="${bundlepath}/bundle1.o"
481 break
482 else
483 AC_MSG_RESULT([no])
484 fi
485 done
486
487 if test "x$BUNDLE" = x; then
488 cat << 'EOF' >&2
489 configure: WARNING:
490
491 bundle1.o cannot be located. A module build might not compile correctly.
492
493 EOF
494 fi
495 ])
496
497
498 dnl EGG_CHECK_MODULE_SUPPORT()
499 dnl
500 dnl Checks for module support. This should be run after EGG_OS_VERSION.
501 dnl
502 AC_DEFUN([EGG_CHECK_MODULE_SUPPORT],
503 [
504 MODULES_OK="yes"
505 MOD_EXT="so"
506 DEFAULT_MAKE="debug"
507 LOAD_METHOD="dl"
508 WEIRD_OS="yes"
509 UNKNOWN_OS="no"
510 MODULE_XLIBS=""
511
512 AC_MSG_CHECKING([module loading capabilities])
513 AC_MSG_RESULT
514 AC_CHECK_HEADERS([dl.h dlfcn.h loader.h rld.h mach-o/dyld.h mach-o/rld.h])
515 AC_CHECK_FUNCS([dlopen load NSLinkModule shl_load rld_load])
516
517 # Note to other maintainers:
518 # Bourne shell has no concept of "fall through"
519 case "$egg_cv_var_system_type" in
520 BSD/OS)
521 if test `echo "$egg_cv_var_system_release" | cut -d . -f 1` = 2; then
522 MODULES_OK="no"
523 fi
524 ;;
525 CYGWI*)
526 WEIRD_OS="no"
527 MOD_EXT="dll"
528 ;;
529 HP-UX)
530 LOAD_METHOD="shl"
531 ;;
532 dell)
533 # do nothing
534 ;;
535 IRIX)
536 # do nothing
537 ;;
538 Ultrix)
539 # No dlopen() or similar on Ultrix. We can't use modules.
540 MODULES_OK="no"
541 ;;
542 BeOS)
543 # We don't yet support BeOS's dynamic linking interface.
544 MODULES_OK="no"
545 ;;
546 Linux)
547 WEIRD_OS="no"
548 ;;
549 Lynx)
550 # do nothing
551 ;;
552 QNX)
553 # do nothing
554 # QNX (recent versions at least) support dlopen().
555 ;;
556 OSF1)
557 case `echo "$egg_cv_var_system_release" | cut -d . -f 1` in
558 1.*) LOAD_METHOD="loader" ;;
559 esac
560 ;;
561 SunOS)
562 if test `echo "$egg_cv_var_system_release" | cut -d . -f 1` = 5; then
563 # We've had quite a bit of testing on Solaris.
564 WEIRD_OS="no"
565 else
566 # SunOS 4
567 AC_DEFINE(DLOPEN_1, 1, [Define if running on SunOS 4.0.])
568 fi
569 ;;
570 *BSD)
571 # FreeBSD/OpenBSD/NetBSD all support dlopen() and have had plenty of
572 # testing with Eggdrop.
573 WEIRD_OS="no"
574 ;;
575 Darwin)
576 # We should support Mac OS X (at least 10.1 and later) now.
577 # Use rld on < 10.1.
578 if test "$ac_cv_func_NSLinkModule" = no; then
579 LOAD_METHOD="rld"
580 fi
581 LOAD_METHOD="dyld"
582 EGG_DARWIN_BUNDLE
583 EGG_APPEND_VAR(MODULE_XLIBS, $BUNDLE)
584 ;;
585 *)
586 if test -r /mach; then
587 # At this point, we're guessing this is NeXT Step. We support rld, so
588 # modules will probably work on NeXT now, but we have absolutely no way
589 # to test this. I've never even seen a NeXT box, let alone do I know of
590 # one I can test this on.
591 LOAD_METHOD="rld"
592 else
593 # QNX apparently supports dlopen()... Fallthrough.
594 if test -r /cmds; then
595 UNKNOWN_OS="yes"
596 MODULES_OK="no"
597 fi
598 fi
599 ;;
600 esac
601
602 if test "$MODULES_OK" = yes; then
603 AC_DEFINE(MODULES_OK, 1, [Define if modules will work on your system.])
604 case $LOAD_METHOD in
605 dl)
606 AC_DEFINE(MOD_USE_DL, 1, [Define if modules should be loaded using the dl*() functions.])
607 ;;
608 shl)
609 AC_DEFINE(MOD_USE_SHL, 1, [Define if modules should be loaded using the shl_*() functions.])
610 ;;
611 dyld)
612 AC_DEFINE(MOD_USE_DYLD, 1, [Define if modules should be loaded using the NS*() functions.])
613 ;;
614 loader)
615 AC_DEFINE(MOD_USE_LOADER, 1, [Define if modules should be loaded using the ldr*() and *load() functions.])
616 ;;
617 rld)
618 AC_DEFINE(MOD_USE_RLD, 1, [Define if modules should be loaded using the rld_*() functions.])
619 ;;
620 esac
621 else
622 DEFAULT_MAKE="static"
623 fi
624
625 if test "$WEIRD_OS" = yes; then
626 # Default to "make static" for 'weird' operating systems. Will print a
627 # note at the end of configure explaining. This way, Eggdrop should compile
628 # "out of the box" on most every operating system we know of, and they can
629 # do a "make eggdrop" if they want to use(/try to use) module support. - Wcc
630 DEFAULT_MAKE="static"
631 fi
632
633 AC_SUBST(DEFAULT_MAKE)
634 AC_SUBST(MOD_EXT)
635 AC_SUBST(MODULE_XLIBS)
636 AC_DEFINE_UNQUOTED(EGG_MOD_EXT, "$MOD_EXT", [Defines the extension of Eggdrop modules.])
637 ])
638
639
640 dnl EGG_CHECK_OS()
641 dnl
642 dnl Various operating system tests.
643 dnl
644 AC_DEFUN([EGG_CHECK_OS],
645 [
646 MOD_CC="$CC"
647 MOD_LD="$CC"
648 MOD_STRIP="$STRIP"
649 SHLIB_CC="$CC"
650 SHLIB_LD="$CC"
651 SHLIB_STRIP="$STRIP"
652 LINUX="no"
653 IRIX="no"
654 SUNOS="no"
655 HPUX="no"
656 EGG_CYGWIN="no"
657
658 case "$egg_cv_var_system_type" in
659 BSD/OS)
660 case `echo "$egg_cv_var_system_release" | cut -d . -f 1` in
661 2)
662 # do nothing
663 ;;
664 3)
665 MOD_CC="shlicc"
666 MOD_LD="shlicc"
667 if test "$STRIP" != touch; then
668 MOD_STRIP="$STRIP -d"
669 fi
670 SHLIB_LD="shlicc -r"
671 SHLIB_STRIP="touch"
672 ;;
673 *)
674 if test "$STRIP" != touch; then
675 MOD_STRIP="$STRIP -d"
676 fi
677 SHLIB_CC="$CC -export-dynamic -fPIC"
678 SHLIB_LD="$CC -shared -nostartfiles"
679 ;;
680 esac
681 ;;
682 CYGWI*)
683 AC_PROG_CC_WIN32
684 SHLIB_LD="$CC -shared"
685 CC="$CC $WIN32FLAGS"
686 MOD_CC="$CC"
687 MOD_LD="$CC"
688 EGG_CYGWIN="yes"
689 EGG_CYGWIN_BINMODE
690 AC_DEFINE(CYGWIN_HACKS, 1, [Define if running under Cygwin.])
691 ;;
692 HP-UX)
693 HPUX="yes"
694 if test "$CC" = cc; then
695 # HP-UX ANSI C Compiler.
696 MOD_LD="$CC +z"
697 SHLIB_CC="$CC +z"
698 else
699 # GCC
700 MOD_LD="$CC -fPIC -shared"
701 SHLIB_CC="$CC -fPIC"
702 fi
703 SHLIB_LD="ld -b"
704 ;;
705 dell)
706 SHLIB_STRIP="touch"
707 MOD_LD="$CC -lelf -lucb"
708 ;;
709 IRIX)
710 SHLIB_LD="ld -n32 -shared -rdata_shared"
711 IRIX="yes"
712 SHLIB_STRIP="touch"
713 ;;
714 Ultrix)
715 SHLIB_STRIP="touch"
716 DEFAULT_MAKE="static"
717 SHELL="/bin/sh5"
718 ;;
719 SINIX*)
720 SHLIB_STRIP="touch"
721 SHLIB_CC="cc -G"
722 ;;
723 BeOS)
724 # do nothing
725 ;;
726 Linux)
727 LINUX="yes"
728 MOD_LD="$CC"
729 SHLIB_CC="$CC -fPIC"
730 SHLIB_LD="$CC -shared -nostartfiles"
731 ;;
732 Lynx)
733 # do nothing
734 ;;
735 QNX)
736 SHLIB_LD="ld -shared"
737 AC_DEFINE(QNX_HACKS, 1, [Define if running under QNX.])
738 ;;
739 OSF1)
740 case `echo "$egg_cv_var_system_release" | cut -d . -f 1` in
741 V*)
742 # Digital OSF uses an ancient version of gawk
743 if test "$AWK" = gawk; then
744 AWK="awk"
745 fi
746 SHLIB_LD="ld -shared -expect_unresolved \"'*'\""
747 SHLIB_STRIP="touch"
748 ;;
749 1.0|1.1|1.2)
750 SHLIB_LD="ld -R -export $@:"
751 ;;
752 1.*)
753 SHLIB_CC="$CC -fpic"
754 SHLIB_LD="ld -shared"
755 ;;
756 esac
757 AC_DEFINE(BROKEN_SNPRINTF, 1, [Define to use Eggdrop's snprintf functions regardless of HAVE_SNPRINTF.])
758 AC_DEFINE(STOP_UAC, 1, [Define if running on OSF/1 platform.])
759 ;;
760 SunOS)
761 if test `echo "$egg_cv_var_system_release" | cut -d . -f 1` = 5; then
762 # Solaris
763 if test -n "$GCC"; then
764 SHLIB_CC="$CC -fPIC"
765 SHLIB_LD="$CC -shared"
766 else
767 SHLIB_CC="$CC -KPIC"
768 SHLIB_LD="$CC -G -z text"
769 fi
770 else
771 # SunOS 4
772 SUNOS="yes"
773 SHLIB_LD="ld"
774 SHLIB_CC="$CC -PIC"
775 fi
776 ;;
777 *BSD)
778 # FreeBSD/OpenBSD/NetBSD
779 SHLIB_CC="$CC -fPIC"
780 SHLIB_LD="ld -Bshareable -x"
781 ;;
782 Darwin)
783 # Mac OS X
784 SHLIB_CC="$CC -fPIC"
785 SHLIB_LD="ld -bundle -undefined error"
786 AC_DEFINE(BIND_8_COMPAT, 1, [Define if running on Mac OS X with dns.mod.])
787 ;;
788 *)
789 if test -r /mach; then
790 # At this point, we're guessing this is NeXT Step.
791 AC_DEFINE(BORGCUBES, 1, [Define if running on NeXT Step.])
792 else
793 if test -r /cmds; then
794 # Probably QNX.
795 SHLIB_LD="ld -shared"
796 SHLIB_STRIP="touch"
797 fi
798 fi
799 ;;
800 esac
801
802 AC_SUBST(MOD_LD)
803 AC_SUBST(MOD_CC)
804 AC_SUBST(MOD_STRIP)
805 AC_SUBST(SHLIB_LD)
806 AC_SUBST(SHLIB_CC)
807 AC_SUBST(SHLIB_STRIP)
808 ])
809
810
811 dnl
812 dnl Library tests.
813 dnl
814
815
816 dnl EGG_CHECK_LIBS()
817 dnl
818 AC_DEFUN([EGG_CHECK_LIBS],
819 [
820 # FIXME: this needs to be fixed so that it works on IRIX
821 if test "$IRIX" = yes; then
822 AC_MSG_WARN([Skipping library tests because they CONFUSE IRIX.])
823 else
824 AC_CHECK_LIB(socket, socket)
825 AC_CHECK_LIB(nsl, connect)
826 AC_CHECK_LIB(dns, gethostbyname)
827 AC_CHECK_LIB(dl, dlopen)
828 AC_CHECK_LIB(m, tan, EGG_MATH_LIB="-lm")
829
830 # This is needed for Tcl libraries compiled with thread support
831 AC_CHECK_LIB(pthread, pthread_mutex_init, [
832 ac_cv_lib_pthread_pthread_mutex_init="yes"
833 ac_cv_lib_pthread="-lpthread"
834 ], [
835 AC_CHECK_LIB(pthread, __pthread_mutex_init, [
836 ac_cv_lib_pthread_pthread_mutex_init="yes"
837 ac_cv_lib_pthread="-lpthread"
838 ], [
839 AC_CHECK_LIB(pthreads, pthread_mutex_init, [
840 ac_cv_lib_pthread_pthread_mutex_init="yes"
841 ac_cv_lib_pthread="-lpthreads"
842 ], [
843 AC_CHECK_FUNC(pthread_mutex_init, [
844 ac_cv_lib_pthread_pthread_mutex_init="yes"
845 ac_cv_lib_pthread=""
846 ], [
847 ac_cv_lib_pthread_pthread_mutex_init="no"
848 ]
849 )]
850 )]
851 )])
852
853 if test "$SUNOS" = yes; then
854 # For suns without yp
855 AC_CHECK_LIB(dl, main)
856 else
857 if test "$HPUX" = yes; then
858 AC_CHECK_LIB(dld, shl_load)
859 fi
860 fi
861 fi
862 ])
863
864
865 dnl EGG_ARG_HANDLEN()
866 dnl
867 AC_DEFUN([EGG_ARG_HANDLEN], [
868 AC_ARG_WITH(handlen, [ --with-handlen=VALUE set the maximum length a handle on the bot can be], [
869 if test -n $withval && test $withval -ge 9 && test $withval -le 32;
870 then
871 AC_DEFINE_UNQUOTED(EGG_HANDLEN, $withval, [
872 Define the maximum length of handles on the bot.
873 ])
874 else
875 AC_MSG_WARN([Invalid handlen given (must be a number between 9 and 32), defaulting to 9.])
876 fi
877 ])
878 ])
879
880 dnl
881 dnl Misc checks.
882 dnl
883
884
885 dnl EGG_EXEEXT()
886 dnl
887 dnl Test for executable suffix and define Eggdrop's executable name accordingly.
888 dnl
889 AC_DEFUN([EGG_EXEEXT], [
890 EGGEXEC="eggdrop"
891 AC_EXEEXT
892 if test "x$EXEEXT" != x; then
893 EGGEXEC="eggdrop${EXEEXT}"
894 fi
895 AC_SUBST(EGGEXEC)
896 ])
897
898
899 dnl
900 dnl Tcl checks.
901 dnl
902
903
904 dnl EGG_TCL_ARG_WITH()
905 dnl
906 AC_DEFUN([EGG_TCL_ARG_WITH],
907 [
908 AC_ARG_WITH(tcllib, [ --with-tcllib=PATH full path to Tcl library], [tcllibname="$withval"])
909 AC_ARG_WITH(tclinc, [ --with-tclinc=PATH full path to Tcl header], [tclincname="$withval"])
910
911 WARN=0
912 # Make sure either both or neither $tcllibname and $tclincname are set
913 if test "x$tcllibname" != x; then
914 if test "x$tclincname" = x; then
915 WARN=1
916 tcllibname=""
917 TCLLIB=""
918 TCLINC=""
919 fi
920 else
921 if test "x$tclincname" != x; then
922 WARN=1
923 tclincname=""
924 TCLLIB=""
925 TCLINC=""
926 fi
927 fi
928
929 if test "$WARN" = 1; then
930 cat << 'EOF' >&2
931 configure: WARNING:
932
933 You must specify both --with-tcllib and --with-tclinc for either to work.
934
935 configure will now attempt to autodetect both the Tcl library and header.
936
937 EOF
938 fi
939 ])
940
941
942 dnl EGG_TCL_ENV()
943 dnl
944 AC_DEFUN([EGG_TCL_ENV],
945 [
946 WARN=0
947 # Make sure either both or neither $TCLLIB and $TCLINC are set
948 if test "x$TCLLIB" != x; then
949 if test "x$TCLINC" = x; then
950 WARN=1
951 WVAR1=TCLLIB
952 WVAR2=TCLINC
953 TCLLIB=""
954 fi
955 else
956 if test "x$TCLINC" != x; then
957 WARN=1
958 WVAR1=TCLINC
959 WVAR2=TCLLIB
960 TCLINC=""
961 fi
962 fi
963
964 if test "$WARN" = 1; then
965 cat << EOF >&2
966 configure: WARNING:
967
968 Environment variable $WVAR1 was set, but I did not detect ${WVAR2}.
969 Please set both TCLLIB and TCLINC correctly if you wish to use them.
970
971 configure will now attempt to autodetect both the Tcl library and header.
972
973 EOF
974 fi
975 ])
976
977
978 dnl EGG_TCL_WITH_TCLLIB()
979 dnl
980 AC_DEFUN([EGG_TCL_WITH_TCLLIB],
981 [
982 # Look for Tcl library: if $tcllibname is set, check there first
983 if test "x$tcllibname" != x; then
984 if test -f "$tcllibname" && test -r "$tcllibname"; then
985 TCLLIB=`echo $tcllibname | sed 's%/[[^/]][[^/]]*$%%'`
986 TCLLIBFN=`$BASENAME $tcllibname | cut -c4-`
987 TCLLIBEXT=".`echo $TCLLIBFN | $AWK '{j=split([$]1, i, "."); print i[[j]]}'`"
988 TCLLIBFNS=`$BASENAME $tcllibname $TCLLIBEXT | cut -c4-`
989 else
990 cat << EOF >&2
991 configure: WARNING:
992
993 The file '$tcllibname' given to option --with-tcllib is not valid.
994
995 configure will now attempt to autodetect both the Tcl library and header.
996
997 EOF
998 tcllibname=""
999 tclincname=""
1000 TCLLIB=""
1001 TCLLIBFN=""
1002 TCLINC=""
1003 TCLINCFN=""
1004 fi
1005 fi
1006 ])
1007
1008
1009 dnl EGG_TCL_WITH_TCLINC()
1010 dnl
1011 AC_DEFUN([EGG_TCL_WITH_TCLINC],
1012 [
1013 # Look for Tcl header: if $tclincname is set, check there first
1014 if test "x$tclincname" != x; then
1015 if test -f "$tclincname" && test -r "$tclincname"; then
1016 TCLINC=`echo $tclincname | sed 's%/[[^/]][[^/]]*$%%'`
1017 TCLINCFN=`$BASENAME $tclincname`
1018 else
1019 cat << EOF >&2
1020 configure: WARNING:
1021
1022 The file '$tclincname' given to option --with-tclinc is not valid.
1023
1024 configure will now attempt to autodetect both the Tcl library and header.
1025
1026 EOF
1027 tcllibname=""
1028 tclincname=""
1029 TCLLIB=""
1030 TCLLIBFN=""
1031 TCLINC=""
1032 TCLINCFN=""
1033 fi
1034 fi
1035 ])
1036
1037
1038 dnl EGG_TCL_FIND_LIBRARY()
1039 dnl
1040 AC_DEFUN([EGG_TCL_FIND_LIBRARY],
1041 [
1042 # Look for Tcl library: if $TCLLIB is set, check there first
1043 if test "x$TCLLIBFN" = x && test "x$TCLLIB" != x; then
1044 if test -d "$TCLLIB"; then
1045 for tcllibfns in $tcllibnames; do
1046 for tcllibext in $tcllibextensions; do
1047 if test -r "${TCLLIB}/lib${tcllibfns}${tcllibext}"; then
1048 TCLLIBFN="${tcllibfns}${tcllibext}"
1049 TCLLIBEXT="$tcllibext"
1050 TCLLIBFNS="$tcllibfns"
1051 break 2
1052 fi
1053 done
1054 done
1055 fi
1056
1057 if test "x$TCLLIBFN" = x; then
1058 cat << 'EOF' >&2
1059 configure: WARNING:
1060
1061 Environment variable TCLLIB was set, but incorrectly.
1062 Please set both TCLLIB and TCLINC correctly if you wish to use them.
1063
1064 configure will now attempt to autodetect both the Tcl library and header.
1065
1066 EOF
1067 TCLLIB=""
1068 TCLLIBFN=""
1069 TCLINC=""
1070 TCLINCFN=""
1071 fi
1072 fi
1073 ])
1074
1075
1076 dnl EGG_TCL_FIND_HEADER()
1077 dnl
1078 AC_DEFUN([EGG_TCL_FIND_HEADER],
1079 [
1080 # Look for Tcl header: if $TCLINC is set, check there first
1081 if test "x$TCLINCFN" = x && test "x$TCLINC" != x; then
1082 if test -d "$TCLINC"; then
1083 for tclheaderfn in $tclheadernames; do
1084 if test -r "${TCLINC}/${tclheaderfn}"; then
1085 TCLINCFN="$tclheaderfn"
1086 break
1087 fi
1088 done
1089 fi
1090
1091 if test "x$TCLINCFN" = x; then
1092 cat << 'EOF' >&2
1093 configure: WARNING:
1094
1095 Environment variable TCLINC was set, but incorrectly.
1096 Please set both TCLLIB and TCLINC correctly if you wish to use them.
1097
1098 configure will now attempt to autodetect both the Tcl library and header.
1099
1100 EOF
1101 TCLLIB=""
1102 TCLLIBFN=""
1103 TCLINC=""
1104 TCLINCFN=""
1105 fi
1106 fi
1107 ])
1108
1109
1110 dnl EGG_TCL_CHECK_LIBRARY()
1111 dnl
1112 AC_DEFUN([EGG_TCL_CHECK_LIBRARY],
1113 [
1114 AC_MSG_CHECKING([for Tcl library])
1115
1116 # Attempt autodetect for $TCLLIBFN if it's not set
1117 if test "x$TCLLIBFN" != x; then
1118 AC_MSG_RESULT([using ${TCLLIB}/lib${TCLLIBFN}])
1119 else
1120 for tcllibfns in $tcllibnames; do
1121 for tcllibext in $tcllibextensions; do
1122 for tcllibpath in $tcllibpaths; do
1123 if test -r "${tcllibpath}/lib${tcllibfns}${tcllibext}"; then
1124 AC_MSG_RESULT([found ${tcllibpath}/lib${tcllibfns}${tcllibext}])
1125 TCLLIB="$tcllibpath"
1126 TCLLIBFN="${tcllibfns}${tcllibext}"
1127 TCLLIBEXT="$tcllibext"
1128 TCLLIBFNS="$tcllibfns"
1129 break 3
1130 fi
1131 done
1132 done
1133 done
1134 fi
1135
1136 # Show if $TCLLIBFN wasn't found
1137 if test "x$TCLLIBFN" = x; then
1138 AC_MSG_RESULT([not found])
1139 fi
1140
1141 AC_SUBST(TCLLIB)
1142 AC_SUBST(TCLLIBFN)
1143 ])
1144
1145
1146 dnl EGG_TCL_CHECK_HEADER()
1147 dnl
1148 AC_DEFUN([EGG_TCL_CHECK_HEADER],
1149 [
1150 AC_MSG_CHECKING([for Tcl header])
1151
1152 # Attempt autodetect for $TCLINCFN if it's not set
1153 if test "x$TCLINCFN" != x; then
1154 AC_MSG_RESULT([using ${TCLINC}/${TCLINCFN}])
1155 else
1156 for tclheaderpath in $tclheaderpaths; do
1157 for tclheaderfn in $tclheadernames; do
1158 if test -r "${tclheaderpath}/${tclheaderfn}"; then
1159 AC_MSG_RESULT([found ${tclheaderpath}/${tclheaderfn}])
1160 TCLINC="$tclheaderpath"
1161 TCLINCFN="$tclheaderfn"
1162 break 2
1163 fi
1164 done
1165 done
1166
1167 # FreeBSD hack ...
1168 if test "x$TCLINCFN" = x; then
1169 for tcllibfns in $tcllibnames; do
1170 for tclheaderpath in $tclheaderpaths; do
1171 for tclheaderfn in $tclheadernames; do
1172 if test -r "${tclheaderpath}/${tcllibfns}/${tclheaderfn}"; then
1173 AC_MSG_RESULT([found ${tclheaderpath}/${tcllibfns}/${tclheaderfn}])
1174 TCLINC="${tclheaderpath}/${tcllibfns}"
1175 TCLINCFN="$tclheaderfn"
1176 break 3
1177 fi
1178 done
1179 done
1180 done
1181 fi
1182 fi
1183
1184 if test "x$TCLINCFN" = x; then
1185 AC_MSG_RESULT([not found])
1186 fi
1187
1188 AC_SUBST(TCLINC)
1189 AC_SUBST(TCLINCFN)
1190 ])
1191
1192
1193 dnl EGG_CACHE_UNSET(CACHE-ID)
1194 dnl
1195 dnl Unsets a certain cache item. Typically called before using the AC_CACHE_*()
1196 dnl macros.
1197 dnl
1198 AC_DEFUN([EGG_CACHE_UNSET], [unset $1])
1199
1200
1201 dnl EGG_TCL_DETECT_CHANGE()
1202 dnl
1203 dnl Detect whether the Tcl system has changed since our last configure run.
1204 dnl Set egg_tcl_changed accordingly.
1205 dnl
1206 dnl Tcl related feature and version checks should re-run their checks as soon
1207 dnl as egg_tcl_changed is set to "yes".
1208 dnl
1209 AC_DEFUN([EGG_TCL_DETECT_CHANGE],
1210 [
1211 dnl NOTE: autoconf 2.50+ disables config.cache by default.
1212 dnl These checks don't do us much good if cache is disabled.
1213 AC_MSG_CHECKING([whether the Tcl system has changed])
1214 egg_tcl_changed="yes"
1215 egg_tcl_id="${TCLLIB}:${TCLLIBFN}:${TCLINC}:${TCLINCFN}"
1216 if test "$egg_tcl_id" != ":::"; then
1217 egg_tcl_cached="yes"
1218 AC_CACHE_VAL(egg_cv_var_tcl_id, [
1219 egg_cv_var_tcl_id="$egg_tcl_id"
1220 egg_tcl_cached="no"
1221 ])
1222 if test "$egg_tcl_cached" = yes; then
1223 if test "x$egg_cv_var_tcl_id" = "x$egg_tcl_id"; then
1224 egg_tcl_changed="no"
1225 else
1226 egg_cv_var_tcl_id="$egg_tcl_id"
1227 fi
1228 fi
1229 fi
1230
1231 if test "$egg_tcl_changed" = yes; then
1232 AC_MSG_RESULT([yes])
1233 else
1234 AC_MSG_RESULT([no])
1235 fi
1236 ])
1237
1238
1239 dnl EGG_TCL_CHECK_VERSION()
1240 dnl
1241 AC_DEFUN([EGG_TCL_CHECK_VERSION],
1242 [
1243 # Both TCLLIBFN & TCLINCFN must be set, or we bail
1244 TCL_FOUND=0
1245 if test "x$TCLLIBFN" != x && test "x$TCLINCFN" != x; then
1246 TCL_FOUND=1
1247
1248 # Check Tcl's version
1249 if test "$egg_tcl_changed" = yes; then
1250 EGG_CACHE_UNSET(egg_cv_var_tcl_version)
1251 fi
1252
1253 AC_MSG_CHECKING([for Tcl version])
1254 AC_CACHE_VAL(egg_cv_var_tcl_version, [
1255 egg_cv_var_tcl_version=`grep TCL_VERSION $TCLINC/$TCLINCFN | $HEAD_1 | $AWK '{gsub(/\"/, "", [$]3); print [$]3}'`
1256 ])
1257
1258 if test "x$egg_cv_var_tcl_version" != x; then
1259 AC_MSG_RESULT([$egg_cv_var_tcl_version])
1260 else
1261 AC_MSG_RESULT([not found])
1262 TCL_FOUND=0
1263 fi
1264
1265 # Check Tcl's patch level (if available)
1266 if test "$egg_tcl_changed" = yes; then
1267 EGG_CACHE_UNSET(egg_cv_var_tcl_patch_level)
1268 fi
1269 AC_MSG_CHECKING([for Tcl patch level])
1270 AC_CACHE_VAL(egg_cv_var_tcl_patch_level, [
1271 eval "egg_cv_var_tcl_patch_level=`grep TCL_PATCH_LEVEL $TCLINC/$TCLINCFN | $HEAD_1 | $AWK '{gsub(/\"/, "", [$]3); print [$]3}'`"
1272 ])
1273
1274 if test "x$egg_cv_var_tcl_patch_level" != x; then
1275 AC_MSG_RESULT([$egg_cv_var_tcl_patch_level])
1276 else
1277 egg_cv_var_tcl_patch_level="unknown"
1278 AC_MSG_RESULT([unknown])
1279 fi
1280 fi
1281
1282 # Check if we found Tcl's version
1283 if test "$TCL_FOUND" = 0; then
1284 cat << 'EOF' >&2
1285 configure: error:
1286
1287 Tcl cannot be found on this system.
1288
1289 Eggdrop requires Tcl to compile. If you already have Tcl installed on
1290 this system, and I just wasn't looking in the right place for it, re-run
1291 ./configure using the --with-tcllib='/path/to/libtcl.so' and
1292 --with-tclinc='/path/to/tcl.h' options.
1293
1294 See doc/COMPILE-GUIDE's 'Tcl Detection and Installation' section for more
1295 information.
1296
1297 EOF
1298 exit 1
1299 fi
1300 ])
1301
1302
1303 dnl EGG_TCL_CHECK_PRE70()
1304 dnl
1305 AC_DEFUN([EGG_TCL_CHECK_PRE70],
1306 [
1307 # Is this version of Tcl too old for us to use ?
1308 TCL_VER_PRE70=`echo $egg_cv_var_tcl_version | $AWK '{split([$]1, i, "."); if (i[[1]] < 7) print "yes"; else print "no"}'`
1309 if test "$TCL_VER_PRE70" = yes; then
1310 cat << EOF >&2
1311 configure: error:
1312
1313 Your Tcl version is much too old for Eggdrop to use. You should
1314 download and compile a more recent version. The most reliable
1315 current version is $tclrecommendver and can be downloaded from
1316 ${tclrecommendsite}.
1317
1318 See doc/COMPILE-GUIDE's 'Tcl Detection and Installation' section
1319 for more information.
1320
1321 EOF
1322 exit 1
1323 fi
1324 ])
1325
1326
1327 dnl EGG_TCL_TESTLIBS()
1328 dnl
1329 AC_DEFUN([EGG_TCL_TESTLIBS],
1330 [
1331 # Set variables for Tcl library tests
1332 TCL_TEST_LIB="$TCLLIBFNS"
1333 TCL_TEST_OTHERLIBS="-L$TCLLIB $EGG_MATH_LIB"
1334 if test "x$ac_cv_lib_pthread" != x; then
1335 TCL_TEST_OTHERLIBS="$TCL_TEST_OTHERLIBS $ac_cv_lib_pthread"
1336 fi
1337 ])
1338
1339
1340 dnl EGG_TCL_CHECK_FREE()
1341 dnl
1342 AC_DEFUN([EGG_TCL_CHECK_FREE],
1343 [
1344 if test "$egg_tcl_changed" = yes; then
1345 EGG_CACHE_UNSET(egg_cv_var_tcl_free)
1346 fi
1347
1348 # Check for Tcl_Free()
1349 AC_CHECK_LIB($TCL_TEST_LIB, Tcl_Free, [egg_cv_var_tcl_free="yes"], [egg_cv_var_tcl_free="no"], $TCL_TEST_OTHERLIBS)
1350
1351 if test "$egg_cv_var_tcl_free" = yes; then
1352 AC_DEFINE(HAVE_TCL_FREE, 1, [Define for Tcl that has Tcl_Free() (7.5p1 and later).])
1353 fi
1354 ])
1355
1356
1357 dnl EGG_TCL_CHECK_GETCURRENTTHREAD
1358 dnl
1359 AC_DEFUN([EGG_TCL_CHECK_GETCURRENTTHREAD],
1360 [
1361 if test "$egg_tcl_changed" = yes; then
1362 EGG_CACHE_UNSET(egg_cv_var_tcl_getcurrentthread)
1363 fi
1364
1365 # Check for Tcl_GetCurrentThread()
1366 AC_CHECK_LIB($TCL_TEST_LIB, Tcl_GetCurrentThread, [egg_cv_var_tcl_getcurrentthread="yes"], [egg_cv_var_tcl_getcurrentthread="no"], $TCL_TEST_OTHERLIBS)
1367 if test "$egg_cv_var_tcl_getcurrentthread" = yes; then
1368 AC_DEFINE(HAVE_TCL_GETCURRENTTHREAD, 1, [Define for Tcl that has Tcl_GetCurrentThread() (8.1a2 and later).])
1369
1370 # Add pthread library to $LIBS if we need it for threaded Tcl
1371 if test "x$ac_cv_lib_pthread" != x; then
1372 EGG_APPEND_VAR(LIBS, $ac_cv_lib_pthread)
1373 fi
1374 fi
1375 ])
1376
1377
1378 dnl EGG_TCL_CHECK_GETTHREADDATA
1379 dnl
1380 AC_DEFUN([EGG_TCL_CHECK_GETTHREADDATA],
1381 [
1382 if test "$egg_tcl_changed" = yes; then
1383 EGG_CACHE_UNSET(egg_cv_var_tcl_getthreaddata)
1384 fi
1385
1386 # Check for Tcl_GetThreadData()
1387 AC_CHECK_LIB($TCL_TEST_LIB, Tcl_GetThreadData, [egg_cv_var_tcl_getthreaddata="yes"], [egg_cv_var_tcl_getthreaddata="no"], $TCL_TEST_OTHERLIBS)
1388 if test "$egg_cv_var_tcl_getthreaddata" = yes; then
1389 AC_DEFINE(HAVE_TCL_GETTHREADDATA, 1, [Define for Tcl that has Tcl_GetThreadData() (8.1a2 and later).])
1390 fi
1391 ])
1392
1393
1394 dnl EGG_TCL_CHECK_SETNOTIFIER
1395 dnl
1396 AC_DEFUN([EGG_TCL_CHECK_SETNOTIFIER],
1397 [
1398 if test "$egg_tcl_changed" = yes; then
1399 EGG_CACHE_UNSET(egg_cv_var_tcl_setnotifier)
1400 fi
1401
1402 # Check for Tcl_SetNotifier()
1403 AC_CHECK_LIB($TCL_TEST_LIB, Tcl_SetNotifier, [egg_cv_var_tcl_setnotifier="yes"], [egg_cv_var_tcl_setnotifier="no"], $TCL_TEST_OTHERLIBS)
1404 if test "$egg_cv_var_tcl_setnotifier" = yes; then
1405 AC_DEFINE(HAVE_TCL_SETNOTIFIER, 1, [Define for Tcl that has Tcl_SetNotifier() (8.2b1 and later).])
1406 fi
1407 ])
1408
1409 dnl EGG_TCL_CHECK_NOTIFIER_INIT
1410 dnl
1411 AC_DEFUN([EGG_TCL_CHECK_NOTIFIER_INIT],
1412 [
1413 if test "$egg_tcl_changed" = yes; then
1414 EGG_CACHE_UNSET(egg_cv_var_tcl_notifier_init)
1415 fi
1416
1417 # Check for Tcl_NotifierProcs member initNotifierProc
1418 AC_CHECK_MEMBER([Tcl_NotifierProcs.initNotifierProc], [egg_cv_var_tcl_notifier_init="yes"], [egg_cv_var_tcl_notifier_init="no"], [[#include "$TCLINC/$TCLINCFN"]])
1419 if test "$egg_cv_var_tcl_notifier_init" = yes; then
1420 AC_DEFINE(HAVE_TCL_NOTIFIER_INIT, 1, [Define for Tcl that has the Tcl_NotiferProcs struct member initNotifierProc (8.4 and later).])
1421 fi
1422 ])
1423
1424
1425 dnl EGG_TCL_LIB_REQS()
1426 dnl
1427 AC_DEFUN([EGG_TCL_LIB_REQS],
1428 [
1429 if test "$EGG_CYGWIN" = yes; then
1430 TCL_REQS="${TCLLIB}/lib${TCLLIBFN}"
1431 TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB"
1432 else
1433 if test "$TCLLIBEXT" != ".a"; then
1434 TCL_REQS="${TCLLIB}/lib${TCLLIBFN}"
1435 TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB"
1436 else
1437 # Set default make as static for unshared Tcl library
1438 if test "$DEFAULT_MAKE" != static; then
1439 cat << 'EOF' >&2
1440 configure: WARNING:
1441
1442 Your Tcl library is not a shared lib.
1443 configure will now set default make type to static.
1444
1445 EOF
1446 DEFAULT_MAKE="static"
1447 AC_SUBST(DEFAULT_MAKE)
1448 fi
1449
1450 # Are we using a pre 7.4 Tcl version ?
1451 TCL_VER_PRE74=`echo $egg_cv_var_tcl_version | $AWK '{split([$]1, i, "."); if (((i[[1]] == 7) && (i[[2]] < 4)) || (i[[1]] < 7)) print "yes"; else print "no"}'`
1452 if test "$TCL_VER_PRE74" = no; then
1453
1454 # Was the --with-tcllib option given ?
1455 if test "x$tcllibname" != x; then
1456 TCL_REQS="${TCLLIB}/lib${TCLLIBFN}"
1457 TCL_LIBS="${TCLLIB}/lib${TCLLIBFN} $EGG_MATH_LIB"
1458 else
1459 TCL_REQS="${TCLLIB}/lib${TCLLIBFN}"
1460 TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB"
1461 fi
1462 else
1463 cat << EOF >&2
1464 configure: WARNING:
1465
1466 Your Tcl version ($egg_cv_var_tcl_version) is older than 7.4.
1467 There are known problems, but we will attempt to work around them.
1468
1469 EOF
1470 TCL_REQS="libtcle.a"
1471 TCL_LIBS="-L`pwd` -ltcle $EGG_MATH_LIB"
1472 fi
1473 fi
1474 fi
1475
1476 AC_SUBST(TCL_REQS)
1477 AC_SUBST(TCL_LIBS)
1478 ])
1479
1480
1481 dnl EGG_SUBST_EGGVERSION()
1482 dnl
1483 AC_DEFUN([EGG_SUBST_EGGVERSION],
1484 [
1485 EGGVERSION=`grep 'char.egg_version' $srcdir/src/main.c | $AWK '{gsub(/(\"|\;)/, "", [$]4); print [$]4}'`
1486 egg_version_num=`echo $EGGVERSION | $AWK 'BEGIN {FS = "."} {printf("%d%02d%02d", [$]1, [$]2, [$]3)}'`
1487 AC_SUBST(EGGVERSION)
1488 AC_DEFINE_UNQUOTED(EGG_VERSION, $egg_version_num, [Defines the current Eggdrop version.])
1489 ])
1490
1491
1492 dnl EGG_SUBST_DEST()
1493 AC_DEFUN([EGG_SUBST_DEST],
1494 [
1495 if test "x$DEST" = x; then
1496 DEST=\${prefix}
1497 fi
1498 AC_SUBST(DEST)
1499 ])
1500
1501
1502 dnl EGG_SUBST_MOD_UPDIR()
1503 dnl
1504 dnl Since module's Makefiles aren't generated by configure, some paths in
1505 dnl src/mod/Makefile.in take care of them. For correct path "calculation", we
1506 dnl need to keep absolute paths in mind (which don't need a "../" prepended).
1507 dnl
1508 AC_DEFUN([EGG_SUBST_MOD_UPDIR], [
1509 case "$srcdir" in
1510 [[\\/]]* | ?:[[\\/]]*)
1511 MOD_UPDIR=""
1512 ;;
1513 *)
1514 MOD_UPDIR="../"
1515 ;;
1516 esac
1517 AC_SUBST(MOD_UPDIR)
1518 ])
1519
1520
1521 dnl EGG_REPLACE_IF_CHANGED(FILE-NAME, CONTENTS-CMDS, INIT-CMDS)
1522 dnl
1523 dnl Replace FILE-NAME if the newly created contents differs from the existing
1524 dnl file contents. Otherwise, leave the file alone. This avoids needless
1525 dnl recompiles.
1526 dnl
1527 m4_define(EGG_REPLACE_IF_CHANGED,
1528 [
1529 AC_CONFIG_COMMANDS([replace-if-changed], [[
1530 egg_replace_file="$1"
1531 $2
1532 if test -f "$egg_replace_file" && cmp -s conftest.out $egg_replace_file; then
1533 echo "$1 is unchanged"
1534 else
1535 echo "creating $1"
1536 mv conftest.out $egg_replace_file
1537 fi
1538 rm -f conftest.out
1539 ]],
1540 [[$3]])
1541 ])
1542
1543
1544 dnl EGG_TCL_LUSH()
1545 dnl
1546 AC_DEFUN([EGG_TCL_LUSH],
1547 [
1548 EGG_REPLACE_IF_CHANGED(lush.h, [
1549 cat > conftest.out << EOF
1550
1551 /* Ignore me but do not erase me. I am a kludge. */
1552
1553 #include "${egg_tclinc}/${egg_tclincfn}"
1554
1555 EOF
1556 ], [
1557 egg_tclinc="$TCLINC"
1558 egg_tclincfn="$TCLINCFN"
1559 ])
1560 ])
1561
1562
1563 dnl EGG_DEBUG_ENABLE()
1564 dnl
1565 AC_DEFUN([EGG_DEBUG_ENABLE],
1566 [
1567 AC_ARG_ENABLE(debug, [ --enable-debug enable generic debug code (default for 'make debug')], [enable_debug="$enableval"], [enable_debug="auto"])
1568 AC_ARG_ENABLE(debug, [ --disable-debug disable generic debug code], [enable_debug="$enableval"], [enable_debug="auto"])
1569 AC_ARG_ENABLE(debug-assert, [ --enable-debug-assert enable assert debug code (default for 'make debug')], [enable_debug_assert="$enableval"], [enable_debug_assert="auto"])
1570 AC_ARG_ENABLE(debug-assert, [ --disable-debug-assert disable assert debug code], [enable_debug_assert="$enableval"], [enable_debug_assert="auto"])
1571 AC_ARG_ENABLE(debug-mem, [ --enable-debug-mem enable memory debug code (default for 'make debug')], [enable_debug_mem="$enableval"], [enable_debug_mem="auto"])
1572 AC_ARG_ENABLE(debug-mem, [ --disable-debug-mem disable memory debug code], [enable_debug_mem="$enableval"], [enable_debug_mem="auto"])
1573 AC_ARG_ENABLE(debug-dns, [ --enable-debug-dns enable dns.mod debug messages (default for 'make debug')], [enable_debug_dns="$enableval"], [enable_debug_dns="auto"])
1574 AC_ARG_ENABLE(debug-dns, [ --disable-debug-dns disable dns.mod debug messages], [enable_debug_dns="$enableval"], [enable_debug_dns="auto"])
1575 AC_ARG_ENABLE(debug-context, [ --enable-debug-context enable context debug code (default)], [enable_debug_context="$enableval"], [enable_debug_context="auto"])
1576 AC_ARG_ENABLE(debug-context, [ --disable-debug-context disable context debug code], [enable_debug_context="$enableval"], [enable_debug_context="auto"])
1577 ])
1578
1579
1580 dnl EGG_DEBUG_DEFAULTS()
1581 dnl
1582 AC_DEFUN([EGG_DEBUG_DEFAULTS],
1583 [
1584 # Defaults:
1585
1586 # make: 'eggdrop' or 'static'
1587 default_std_debug="no"
1588 default_std_debug_assert="no"
1589 default_std_debug_mem="no"
1590 default_std_debug_context="yes"
1591 default_std_debug_dns="no"
1592
1593 # make: 'debug' or 'sdebug'
1594 default_deb_debug="yes"
1595 default_deb_debug_assert="yes"
1596 default_deb_debug_mem="yes"
1597 default_deb_debug_context="yes"
1598 default_deb_debug_dns="yes"
1599
1600 if test "$DEFAULT_MAKE" = eggdrop || test "$DEFAULT_MAKE" = static; then
1601 default_debug="$default_std_debug"
1602 default_debug_assert="$default_std_debug_assert"
1603 default_debug_mem="$default_std_debug_mem"
1604 default_debug_context="$default_std_debug_context"
1605 default_debug_dns="$default_std_debug_dns"
1606 else
1607 default_debug="$default_deb_debug"
1608 default_debug_assert="$default_deb_debug_assert"
1609 default_debug_mem="$default_deb_debug_mem"
1610 default_debug_context="$default_deb_debug_context"
1611 default_debug_dns="$default_deb_debug_dns"
1612 fi
1613
1614 debug_options="debug debug_assert debug_mem debug_dns"
1615
1616 debug_cflags_debug="-g3 -DDEBUG"
1617 debug_cflags_debug_assert="-DDEBUG_ASSERT"
1618 debug_cflags_debug_mem="-DDEBUG_MEM"
1619 debug_cflags_debug_dns="-DDEBUG_DNS"
1620 debug_stdcflags_debug=""
1621 debug_stdcflags_debug_assert=""
1622 debug_stdcflags_debug_mem=""
1623 debug_stdcflags_debug_dns=""
1624 debug_debcflags_debug=""
1625 debug_debcflags_debug_assert=""
1626 debug_debcflags_debug_mem=""
1627 debug_debcflags_debug_dns=""
1628 ])
1629
1630
1631 dnl EGG_DEBUG_OPTIONS()
1632 dnl
1633 AC_DEFUN([EGG_DEBUG_OPTIONS],
1634 [
1635 for enable_option in $debug_options; do
1636
1637 eval enable_value=\$enable_$enable_option
1638
1639 # Check if either --enable-<opt> or --disable-<opt> was used
1640 if test "$enable_value" != auto; then
1641 # Make sure an invalid option wasn't passed as --enable-<opt>=foo
1642 if test "$enable_value" != yes && test "$enable_value" != no; then
1643 opt_name=`echo $enable_option | sed 's/_/-/g'`
1644 eval opt_default=\$default_$enable_option
1645 AC_MSG_WARN([Invalid option '$enable_value' passed to --enable-${opt_name}, defaulting to '$opt_default'])
1646 eval enable_$enable_option="auto"
1647 fi
1648 fi
1649
1650 if test "$enable_value" = auto; then
1651 # Note: options generally should not end up in both std and deb but
1652 # there may be options in the future where this behavior is desired.
1653 if test `eval echo '${'default_std_$enable_option'}'` = yes; then
1654 eval `echo debug_stdcflags_$enable_option`=\$debug_cflags_$enable_option
1655 fi
1656 if test `eval echo '${'default_deb_$enable_option'}'` = yes; then
1657 eval `echo debug_debcflags_$enable_option`=\$debug_cflags_$enable_option
1658 fi
1659 else
1660 if test "$enable_value" = yes; then
1661 # If option defaults to 'yes' for debug, always put it in stdcflags
1662 # when the option is forced on because someone may want it enabled
1663 # for a non-debug build.
1664 if test `eval echo '${'default_deb_$enable_option'}'` = yes; then
1665 eval `echo debug_stdcflags_$enable_option`=\$debug_cflags_$enable_option
1666 else
1667 # option defaulted to 'no' so put it in debcflags
1668 eval `echo debug_debcflags_$enable_option`=\$debug_cflags_$enable_option
1669 fi
1670 fi
1671 fi
1672 done
1673 ])
1674
1675
1676 dnl EGG_DEBUG_CFLAGS()
1677 dnl
1678 AC_DEFUN([EGG_DEBUG_CFLAGS],
1679 [
1680 for cflg_option in $debug_options; do
1681 eval stdcflg_value=\$debug_stdcflags_$cflg_option
1682 EGG_APPEND_VAR(CFLGS, $stdcflg_value)
1683
1684 eval debcflg_value=\$debug_debcflags_$cflg_option
1685 EGG_APPEND_VAR(DEBCFLGS, $debcflg_value)
1686 done
1687
1688 # Disable debug symbol stripping if compiled with --enable-debug
1689 # This will result in core dumps that are actually useful.
1690 if test "x$debug_stdcflags_debug" != x; then
1691 STRIP="touch"
1692 MOD_STRIP="touch"
1693 SHLIB_STRIP="touch"
1694 fi
1695
1696 AC_SUBST(CFLGS)
1697 AC_SUBST(DEBCFLGS)
1698 ])
1699
1700
1701 dnl EGG_ENABLE_DEBUG_CONTEXT()
1702 dnl
1703 AC_DEFUN([EGG_ENABLE_DEBUG_CONTEXT],
1704 [
1705 # Check if either --enable-debug-context or --disable-debug-context was used
1706 if test "$enable_debug_context" != auto; then
1707
1708 # Make sure an invalid option wasn't passed as --enable-debug-context=foo
1709 if test "$enable_debug_context" != yes && test "$enable_debug_context" != no; then
1710 AC_MSG_WARN([Invalid option '$enable_debug_context' passed to --enable-debug-context, defaulting to '$default_debug_context'])
1711 enable_debug_context="$default_debug_context"
1712 fi
1713 else
1714 enable_debug_context="$default_debug_context"
1715 fi
1716
1717 if test "$enable_debug_context" = yes; then
1718 AC_DEFINE(DEBUG_CONTEXT, 1, [Define for context debugging.])
1719 else
1720 cat << 'EOF' >&2
1721 configure: WARNING:
1722
1723 You have disabled context debugging.
1724
1725 Eggdrop will not be able to provide context information if it crashes.
1726 Bug reports without context are less helpful when tracking down bugs.
1727
1728 EOF
1729 fi
1730 ])
1731
1732
1733 dnl EGG_CATCH_MAKEFILE_REBUILD()
1734 dnl
1735 AC_DEFUN([EGG_CATCH_MAKEFILE_REBUILD],
1736 [
1737 AC_CONFIG_COMMANDS([catch-make-rebuild], [[
1738 if test -f .modules; then
1739 $srcdir/misc/modconfig --top_srcdir="$srcdir/src" Makefile
1740 fi
1741 ]])
1742 ])
1743
1744
1745 dnl EGG_SAVE_PARAMETERS()
1746 dnl
1747 dnl Remove --cache-file and --srcdir arguments so they do not pile up.
1748 dnl
1749 AC_DEFUN([EGG_SAVE_PARAMETERS],
1750 [
1751 egg_ac_parameters=
1752 ac_prev=
1753 for ac_arg in $ac_configure_args; do
1754 if test -n "$ac_prev"; then
1755 ac_prev=
1756 continue
1757 fi
1758 case $ac_arg in
1759 -cache-file | --cache-file | --cache-fil | --cache-fi | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
1760 ac_prev=cache_file ;;
1761 -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
1762 ;;
1763 --config-cache | -C)
1764 ;;
1765 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
1766 ac_prev=srcdir ;;
1767 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
1768 ;;
1769 *) egg_ac_parameters="$egg_ac_parameters $ac_arg" ;;
1770 esac
1771 done
1772
1773 AC_SUBST(egg_ac_parameters)
1774 AC_DEFINE_UNQUOTED(EGG_AC_ARGS, "$egg_ac_parameters", [Arguments passed to configure])
1775 ])
1776
1777
1778 dnl AC_PROG_CC_WIN32()
1779 dnl
1780 AC_DEFUN([AC_PROG_CC_WIN32],
1781 [
1782 AC_MSG_CHECKING([how to access the Win32 API])
1783 WIN32FLAGS=
1784 AC_COMPILE_IFELSE([[
1785 #ifndef WIN32
1786 # ifndef _WIN32
1787 # error WIN32 or _WIN32 not defined
1788 # endif
1789 #endif
1790 ]], [
1791 AC_MSG_RESULT([present by default])
1792 ], [
1793 ac_compile_save="$ac_compile"
1794 save_CC="$CC"
1795 ac_compile="$ac_compile -mwin32"
1796 CC="$CC -mwin32"
1797 AC_COMPILE_IFELSE([[
1798 #ifndef WIN32
1799 # ifndef _WIN32
1800 # error WIN32 or _WIN32 not defined
1801 # endif
1802 #endif
1803 ]], [
1804 AC_MSG_RESULT([found via -mwin32])
1805 ac_compile="$ac_compile_save"
1806 CC="$save_CC"
1807 WIN32FLAGS="-mwin32"
1808 ], [
1809 ac_compile="$ac_compile_save"
1810 CC="$save_CC"
1811 AC_MSG_RESULT([not found])
1812 ])
1813 ])
1814 ])
1815
1816
1817 dnl EGG_IPV6_COMPAT
1818 dnl
1819 AC_DEFUN([EGG_IPV6_COMPAT],
1820 [
1821 if test "$enable_ipv6" = "yes"; then
1822 AC_CHECK_FUNCS([inet_pton gethostbyname2])
1823 AC_CHECK_TYPES([struct in6_addr], egg_cv_var_have_in6_addr="yes", egg_cv_var_have_in6_addr="no", [
1824 #include <sys/types.h>
1825 #include <netinet/in.h>
1826 ])
1827 if test "$egg_cv_var_have_in6_addr" = "yes"; then
1828 # Check for in6addr_any
1829 AC_CACHE_CHECK([for the in6addr_any constant], [egg_cv_var_have_in6addr_any], [
1830 AC_TRY_COMPILE([
1831 #include <sys/types.h>
1832 #include <netinet/in.h>
1833 ], [struct in6_addr i6 = in6addr_any;],
1834 [egg_cv_var_have_in6addr_any="yes"], [egg_cv_var_have_in6addr_any="no"])
1835 ])
1836 if test "$egg_cv_var_have_in6addr_any" = "yes"; then
1837 AC_DEFINE(HAVE_IN6ADDR_ANY, 1, [Define to 1 if you have the in6addr_any constant.])
1838 fi
1839 # Check for in6addr_loopback
1840 AC_CACHE_CHECK([for the in6addr_loopback constant], [egg_cv_var_have_in6addr_loopback], [
1841 AC_TRY_COMPILE([
1842 #include <sys/types.h>
1843 #include <netinet/in.h>
1844 ], [struct in6_addr i6 = in6addr_loopback;],
1845 [egg_cv_var_have_in6addr_loopback="yes"], [egg_cv_var_have_in6addr_loopback="no"])
1846 ])
1847 if test "$egg_cv_var_have_in6addr_loopback" = "yes"; then
1848 AC_DEFINE(HAVE_IN6ADDR_LOOPBACK, 1, [Define to 1 if you have the in6addr_loopback constant.])
1849 fi
1850 AC_CHECK_TYPES([struct sockaddr_in6], , , [
1851 #include <sys/types.h>
1852 #include <netinet/in.h>
1853 ])
1854 else
1855 AC_MSG_NOTICE([no in6_addr found, skipping dependent checks. Custom definitions will be used.])
1856 fi
1857 fi
1858 ])
1859
1860
1861 dnl EGG_IPV6_ENABLE
1862 dnl
1863 AC_DEFUN([EGG_IPV6_ENABLE],
1864 [
1865 AC_ARG_ENABLE(ipv6,
1866 [ --enable-ipv6 enable IPv6 support (autodetect)],
1867 [enable_ipv6="$enableval"], [enable_ipv6="$egg_cv_var_ipv6_supported"])
1868 AC_ARG_ENABLE(ipv6,
1869 [ --disable-ipv6 disable IPv6 support ], [enable_ipv6="$enableval"])
1870
1871 if test "$enable_ipv6" = "yes"; then
1872 if test "$egg_cv_var_ipv6_supported" = "no"; then
1873 AC_MSG_WARN([You have enabled IPv6 but your system doesn't seem to support it.])
1874 AC_MSG_WARN([Eggdrop will compile but will be limited to IPv4 on this host.])
1875 fi
1876 AC_DEFINE(IPV6, 1, [Define to 1 if you want to enable IPv6 support.])
1877 fi
1878 ])
1879
1880
1881 dnl EGG_IPV6_STATUS
1882 dnl
1883 AC_DEFUN([EGG_IPV6_STATUS],
1884 [
1885 AC_CACHE_CHECK([for system IPv6 support], [egg_cv_var_ipv6_supported], [
1886 AC_RUN_IFELSE([[
1887 #include <unistd.h>
1888 #include <sys/socket.h>
1889 #include <netinet/in.h>
1890
1891 int main()
1892 {
1893 int s = socket(AF_INET6, SOCK_STREAM, 0);
1894
1895 if (s != -1)
1896 close(s);
1897
1898 return((s == -1));
1899 }
1900 ]], [
1901 egg_cv_var_ipv6_supported="yes"
1902 ], [
1903 egg_cv_var_ipv6_supported="no"
1904 ])
1905 ])
1906 ])

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23