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

Annotation of /eggdrop1.8/aclocal.m4

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


Revision 1.14 - (hide annotations) (download)
Wed Jul 20 10:31:37 2011 UTC (7 years, 8 months ago) by thommey
Branch: MAIN
CVS Tags: HEAD
Changes since 1.13: +14 -29 lines
Work around Tcl8.5.10 bug 3371644. Use the autoconf macros AC_LANG_PROGRAM/AC_LANG_SOURCE.

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

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23