/[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.13 - (hide annotations) (download)
Fri Jan 21 02:33:41 2011 UTC (8 years, 8 months ago) by thommey
Branch: MAIN
Changes since 1.12: +11 -6 lines
Clarified --with-tcl* usage in configure and mentioned tcl-dev packages. Fixed some section numbering in doc/COMPILE-GUIDE.

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.13 dnl $Id: aclocal.m4,v 1.12 2010/10/25 22:11:23 pseudo 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     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 pseudo 1.2 DEFAULT_MAKE="debug"
507 simple 1.1 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     SHLIB_LD="$CC -shared"
684     MOD_CC="$CC"
685     MOD_LD="$CC"
686     EGG_CYGWIN="yes"
687     EGG_CYGWIN_BINMODE
688     AC_DEFINE(CYGWIN_HACKS, 1, [Define if running under Cygwin.])
689     ;;
690     HP-UX)
691     HPUX="yes"
692     if test "$CC" = cc; then
693     # HP-UX ANSI C Compiler.
694     MOD_LD="$CC +z"
695     SHLIB_CC="$CC +z"
696     else
697     # GCC
698     MOD_LD="$CC -fPIC -shared"
699     SHLIB_CC="$CC -fPIC"
700     fi
701     SHLIB_LD="ld -b"
702     ;;
703     dell)
704     SHLIB_STRIP="touch"
705     MOD_LD="$CC -lelf -lucb"
706     ;;
707     IRIX)
708     SHLIB_LD="ld -n32 -shared -rdata_shared"
709     IRIX="yes"
710     SHLIB_STRIP="touch"
711     ;;
712     Ultrix)
713     SHLIB_STRIP="touch"
714     DEFAULT_MAKE="static"
715     SHELL="/bin/sh5"
716     ;;
717     SINIX*)
718     SHLIB_STRIP="touch"
719     SHLIB_CC="cc -G"
720     ;;
721     BeOS)
722     # do nothing
723     ;;
724     Linux)
725     LINUX="yes"
726     MOD_LD="$CC"
727     SHLIB_CC="$CC -fPIC"
728     SHLIB_LD="$CC -shared -nostartfiles"
729     ;;
730     Lynx)
731     # do nothing
732     ;;
733     QNX)
734     SHLIB_LD="ld -shared"
735 pseudo 1.7 AC_DEFINE(QNX_HACKS, 1, [Define if running under QNX.])
736 simple 1.1 ;;
737     OSF1)
738     case `echo "$egg_cv_var_system_release" | cut -d . -f 1` in
739     V*)
740     # Digital OSF uses an ancient version of gawk
741     if test "$AWK" = gawk; then
742     AWK="awk"
743     fi
744     SHLIB_LD="ld -shared -expect_unresolved \"'*'\""
745     SHLIB_STRIP="touch"
746     ;;
747     1.0|1.1|1.2)
748     SHLIB_LD="ld -R -export $@:"
749     ;;
750     1.*)
751     SHLIB_CC="$CC -fpic"
752     SHLIB_LD="ld -shared"
753     ;;
754     esac
755     AC_DEFINE(BROKEN_SNPRINTF, 1, [Define to use Eggdrop's snprintf functions regardless of HAVE_SNPRINTF.])
756     AC_DEFINE(STOP_UAC, 1, [Define if running on OSF/1 platform.])
757     ;;
758     SunOS)
759     if test `echo "$egg_cv_var_system_release" | cut -d . -f 1` = 5; then
760     # Solaris
761     if test -n "$GCC"; then
762     SHLIB_CC="$CC -fPIC"
763     SHLIB_LD="$CC -shared"
764     else
765     SHLIB_CC="$CC -KPIC"
766     SHLIB_LD="$CC -G -z text"
767     fi
768     else
769     # SunOS 4
770     SUNOS="yes"
771     SHLIB_LD="ld"
772     SHLIB_CC="$CC -PIC"
773     fi
774     ;;
775     *BSD)
776     # FreeBSD/OpenBSD/NetBSD
777     SHLIB_CC="$CC -fPIC"
778     SHLIB_LD="ld -Bshareable -x"
779     ;;
780     Darwin)
781     # Mac OS X
782     SHLIB_CC="$CC -fPIC"
783     SHLIB_LD="ld -bundle -undefined error"
784     AC_DEFINE(BIND_8_COMPAT, 1, [Define if running on Mac OS X with dns.mod.])
785     ;;
786     *)
787     if test -r /mach; then
788     # At this point, we're guessing this is NeXT Step.
789     AC_DEFINE(BORGCUBES, 1, [Define if running on NeXT Step.])
790     else
791     if test -r /cmds; then
792     # Probably QNX.
793     SHLIB_LD="ld -shared"
794     SHLIB_STRIP="touch"
795     fi
796     fi
797     ;;
798     esac
799    
800     AC_SUBST(MOD_LD)
801     AC_SUBST(MOD_CC)
802     AC_SUBST(MOD_STRIP)
803     AC_SUBST(SHLIB_LD)
804     AC_SUBST(SHLIB_CC)
805     AC_SUBST(SHLIB_STRIP)
806     ])
807    
808    
809     dnl
810     dnl Library tests.
811     dnl
812    
813    
814     dnl EGG_CHECK_LIBS()
815     dnl
816     AC_DEFUN([EGG_CHECK_LIBS],
817     [
818     # FIXME: this needs to be fixed so that it works on IRIX
819     if test "$IRIX" = yes; then
820     AC_MSG_WARN([Skipping library tests because they CONFUSE IRIX.])
821     else
822     AC_CHECK_LIB(socket, socket)
823     AC_CHECK_LIB(nsl, connect)
824     AC_CHECK_LIB(dns, gethostbyname)
825     AC_CHECK_LIB(dl, dlopen)
826     AC_CHECK_LIB(m, tan, EGG_MATH_LIB="-lm")
827    
828     # This is needed for Tcl libraries compiled with thread support
829     AC_CHECK_LIB(pthread, pthread_mutex_init, [
830     ac_cv_lib_pthread_pthread_mutex_init="yes"
831     ac_cv_lib_pthread="-lpthread"
832     ], [
833     AC_CHECK_LIB(pthread, __pthread_mutex_init, [
834     ac_cv_lib_pthread_pthread_mutex_init="yes"
835     ac_cv_lib_pthread="-lpthread"
836     ], [
837     AC_CHECK_LIB(pthreads, pthread_mutex_init, [
838     ac_cv_lib_pthread_pthread_mutex_init="yes"
839     ac_cv_lib_pthread="-lpthreads"
840     ], [
841     AC_CHECK_FUNC(pthread_mutex_init, [
842     ac_cv_lib_pthread_pthread_mutex_init="yes"
843     ac_cv_lib_pthread=""
844     ], [
845     ac_cv_lib_pthread_pthread_mutex_init="no"
846     ]
847     )]
848     )]
849     )])
850    
851     if test "$SUNOS" = yes; then
852     # For suns without yp
853     AC_CHECK_LIB(dl, main)
854     else
855     if test "$HPUX" = yes; then
856     AC_CHECK_LIB(dld, shl_load)
857     fi
858     fi
859     fi
860     ])
861    
862    
863     dnl EGG_ARG_HANDLEN()
864     dnl
865     AC_DEFUN([EGG_ARG_HANDLEN], [
866     AC_ARG_WITH(handlen, [ --with-handlen=VALUE set the maximum length a handle on the bot can be], [
867     if test -n $withval && test $withval -ge 9 && test $withval -le 32;
868     then
869     AC_DEFINE_UNQUOTED(EGG_HANDLEN, $withval, [
870     Define the maximum length of handles on the bot.
871     ])
872     else
873     AC_MSG_WARN([Invalid handlen given (must be a number between 9 and 32), defaulting to 9.])
874     fi
875     ])
876     ])
877    
878     dnl
879     dnl Misc checks.
880     dnl
881    
882    
883     dnl EGG_EXEEXT()
884     dnl
885     dnl Test for executable suffix and define Eggdrop's executable name accordingly.
886     dnl
887     AC_DEFUN([EGG_EXEEXT], [
888     EGGEXEC="eggdrop"
889     AC_EXEEXT
890     if test "x$EXEEXT" != x; then
891     EGGEXEC="eggdrop${EXEEXT}"
892     fi
893     AC_SUBST(EGGEXEC)
894     ])
895    
896    
897     dnl
898     dnl Tcl checks.
899     dnl
900    
901    
902     dnl EGG_TCL_ARG_WITH()
903     dnl
904     AC_DEFUN([EGG_TCL_ARG_WITH],
905     [
906 thommey 1.13 AC_ARG_WITH(tcllib, [ --with-tcllib=PATH full path to Tcl library (e.g. /usr/lib/libtcl8.5.so)], [tcllibname="$withval"])
907     AC_ARG_WITH(tclinc, [ --with-tclinc=PATH full path to Tcl header (e.g. /usr/include/tcl.h)], [tclincname="$withval"])
908 simple 1.1
909     WARN=0
910     # Make sure either both or neither $tcllibname and $tclincname are set
911     if test "x$tcllibname" != x; then
912     if test "x$tclincname" = x; then
913     WARN=1
914     tcllibname=""
915     TCLLIB=""
916     TCLINC=""
917     fi
918     else
919     if test "x$tclincname" != x; then
920     WARN=1
921     tclincname=""
922     TCLLIB=""
923     TCLINC=""
924     fi
925     fi
926    
927     if test "$WARN" = 1; then
928     cat << 'EOF' >&2
929     configure: WARNING:
930    
931     You must specify both --with-tcllib and --with-tclinc for either to work.
932    
933     configure will now attempt to autodetect both the Tcl library and header.
934    
935     EOF
936     fi
937     ])
938    
939    
940     dnl EGG_TCL_ENV()
941     dnl
942     AC_DEFUN([EGG_TCL_ENV],
943     [
944     WARN=0
945     # Make sure either both or neither $TCLLIB and $TCLINC are set
946     if test "x$TCLLIB" != x; then
947     if test "x$TCLINC" = x; then
948     WARN=1
949     WVAR1=TCLLIB
950     WVAR2=TCLINC
951     TCLLIB=""
952     fi
953     else
954     if test "x$TCLINC" != x; then
955     WARN=1
956     WVAR1=TCLINC
957     WVAR2=TCLLIB
958     TCLINC=""
959     fi
960     fi
961    
962     if test "$WARN" = 1; then
963     cat << EOF >&2
964     configure: WARNING:
965    
966     Environment variable $WVAR1 was set, but I did not detect ${WVAR2}.
967     Please set both TCLLIB and TCLINC correctly if you wish to use them.
968    
969     configure will now attempt to autodetect both the Tcl library and header.
970    
971     EOF
972     fi
973     ])
974    
975    
976     dnl EGG_TCL_WITH_TCLLIB()
977     dnl
978     AC_DEFUN([EGG_TCL_WITH_TCLLIB],
979     [
980     # Look for Tcl library: if $tcllibname is set, check there first
981     if test "x$tcllibname" != x; then
982     if test -f "$tcllibname" && test -r "$tcllibname"; then
983     TCLLIB=`echo $tcllibname | sed 's%/[[^/]][[^/]]*$%%'`
984     TCLLIBFN=`$BASENAME $tcllibname | cut -c4-`
985     TCLLIBEXT=".`echo $TCLLIBFN | $AWK '{j=split([$]1, i, "."); print i[[j]]}'`"
986     TCLLIBFNS=`$BASENAME $tcllibname $TCLLIBEXT | cut -c4-`
987     else
988     cat << EOF >&2
989     configure: WARNING:
990    
991     The file '$tcllibname' given to option --with-tcllib is not valid.
992 thommey 1.13 Specify the full path including the file name (e.g. /usr/lib/libtcl8.5.so)
993 simple 1.1
994     configure will now attempt to autodetect both the Tcl library and header.
995    
996     EOF
997     tcllibname=""
998     tclincname=""
999     TCLLIB=""
1000     TCLLIBFN=""
1001     TCLINC=""
1002     TCLINCFN=""
1003     fi
1004     fi
1005     ])
1006    
1007    
1008     dnl EGG_TCL_WITH_TCLINC()
1009     dnl
1010     AC_DEFUN([EGG_TCL_WITH_TCLINC],
1011     [
1012     # Look for Tcl header: if $tclincname is set, check there first
1013     if test "x$tclincname" != x; then
1014     if test -f "$tclincname" && test -r "$tclincname"; then
1015     TCLINC=`echo $tclincname | sed 's%/[[^/]][[^/]]*$%%'`
1016     TCLINCFN=`$BASENAME $tclincname`
1017     else
1018     cat << EOF >&2
1019     configure: WARNING:
1020    
1021     The file '$tclincname' given to option --with-tclinc is not valid.
1022 thommey 1.13 Specify the full path including the file name (e.g. /usr/include/tcl.h)
1023 simple 1.1
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 thommey 1.13 Eggdrop requires Tcl and the Tcl development files to compile.
1290     If you already have Tcl installed on this system, make sure you
1291     also have the development files (common package names include
1292     'tcl-dev' and 'tcl-devel'). If I just wasn't looking
1293     in the right place for it, re-run ./configure using the
1294     --with-tcllib='/path/to/libtcl.so' and
1295 simple 1.1 --with-tclinc='/path/to/tcl.h' options.
1296    
1297     See doc/COMPILE-GUIDE's 'Tcl Detection and Installation' section for more
1298     information.
1299    
1300     EOF
1301     exit 1
1302     fi
1303     ])
1304    
1305    
1306     dnl EGG_TCL_CHECK_PRE70()
1307     dnl
1308     AC_DEFUN([EGG_TCL_CHECK_PRE70],
1309     [
1310     # Is this version of Tcl too old for us to use ?
1311     TCL_VER_PRE70=`echo $egg_cv_var_tcl_version | $AWK '{split([$]1, i, "."); if (i[[1]] < 7) print "yes"; else print "no"}'`
1312     if test "$TCL_VER_PRE70" = yes; then
1313     cat << EOF >&2
1314     configure: error:
1315    
1316     Your Tcl version is much too old for Eggdrop to use. You should
1317     download and compile a more recent version. The most reliable
1318     current version is $tclrecommendver and can be downloaded from
1319     ${tclrecommendsite}.
1320    
1321     See doc/COMPILE-GUIDE's 'Tcl Detection and Installation' section
1322     for more information.
1323    
1324     EOF
1325     exit 1
1326     fi
1327     ])
1328    
1329    
1330     dnl EGG_TCL_TESTLIBS()
1331     dnl
1332     AC_DEFUN([EGG_TCL_TESTLIBS],
1333     [
1334     # Set variables for Tcl library tests
1335     TCL_TEST_LIB="$TCLLIBFNS"
1336     TCL_TEST_OTHERLIBS="-L$TCLLIB $EGG_MATH_LIB"
1337     if test "x$ac_cv_lib_pthread" != x; then
1338     TCL_TEST_OTHERLIBS="$TCL_TEST_OTHERLIBS $ac_cv_lib_pthread"
1339     fi
1340     ])
1341    
1342    
1343     dnl EGG_TCL_CHECK_FREE()
1344     dnl
1345     AC_DEFUN([EGG_TCL_CHECK_FREE],
1346     [
1347     if test "$egg_tcl_changed" = yes; then
1348     EGG_CACHE_UNSET(egg_cv_var_tcl_free)
1349     fi
1350    
1351     # Check for Tcl_Free()
1352     AC_CHECK_LIB($TCL_TEST_LIB, Tcl_Free, [egg_cv_var_tcl_free="yes"], [egg_cv_var_tcl_free="no"], $TCL_TEST_OTHERLIBS)
1353    
1354     if test "$egg_cv_var_tcl_free" = yes; then
1355     AC_DEFINE(HAVE_TCL_FREE, 1, [Define for Tcl that has Tcl_Free() (7.5p1 and later).])
1356     fi
1357     ])
1358    
1359    
1360     dnl EGG_TCL_CHECK_GETCURRENTTHREAD
1361     dnl
1362     AC_DEFUN([EGG_TCL_CHECK_GETCURRENTTHREAD],
1363     [
1364     if test "$egg_tcl_changed" = yes; then
1365     EGG_CACHE_UNSET(egg_cv_var_tcl_getcurrentthread)
1366     fi
1367    
1368     # Check for Tcl_GetCurrentThread()
1369     AC_CHECK_LIB($TCL_TEST_LIB, Tcl_GetCurrentThread, [egg_cv_var_tcl_getcurrentthread="yes"], [egg_cv_var_tcl_getcurrentthread="no"], $TCL_TEST_OTHERLIBS)
1370     if test "$egg_cv_var_tcl_getcurrentthread" = yes; then
1371     AC_DEFINE(HAVE_TCL_GETCURRENTTHREAD, 1, [Define for Tcl that has Tcl_GetCurrentThread() (8.1a2 and later).])
1372    
1373     # Add pthread library to $LIBS if we need it for threaded Tcl
1374     if test "x$ac_cv_lib_pthread" != x; then
1375     EGG_APPEND_VAR(LIBS, $ac_cv_lib_pthread)
1376     fi
1377     fi
1378     ])
1379    
1380    
1381     dnl EGG_TCL_CHECK_GETTHREADDATA
1382     dnl
1383     AC_DEFUN([EGG_TCL_CHECK_GETTHREADDATA],
1384     [
1385     if test "$egg_tcl_changed" = yes; then
1386     EGG_CACHE_UNSET(egg_cv_var_tcl_getthreaddata)
1387     fi
1388    
1389     # Check for Tcl_GetThreadData()
1390     AC_CHECK_LIB($TCL_TEST_LIB, Tcl_GetThreadData, [egg_cv_var_tcl_getthreaddata="yes"], [egg_cv_var_tcl_getthreaddata="no"], $TCL_TEST_OTHERLIBS)
1391     if test "$egg_cv_var_tcl_getthreaddata" = yes; then
1392     AC_DEFINE(HAVE_TCL_GETTHREADDATA, 1, [Define for Tcl that has Tcl_GetThreadData() (8.1a2 and later).])
1393     fi
1394     ])
1395    
1396    
1397     dnl EGG_TCL_CHECK_SETNOTIFIER
1398     dnl
1399     AC_DEFUN([EGG_TCL_CHECK_SETNOTIFIER],
1400     [
1401     if test "$egg_tcl_changed" = yes; then
1402     EGG_CACHE_UNSET(egg_cv_var_tcl_setnotifier)
1403     fi
1404    
1405     # Check for Tcl_SetNotifier()
1406     AC_CHECK_LIB($TCL_TEST_LIB, Tcl_SetNotifier, [egg_cv_var_tcl_setnotifier="yes"], [egg_cv_var_tcl_setnotifier="no"], $TCL_TEST_OTHERLIBS)
1407     if test "$egg_cv_var_tcl_setnotifier" = yes; then
1408     AC_DEFINE(HAVE_TCL_SETNOTIFIER, 1, [Define for Tcl that has Tcl_SetNotifier() (8.2b1 and later).])
1409     fi
1410     ])
1411    
1412 thommey 1.4 dnl EGG_TCL_CHECK_NOTIFIER_INIT
1413     dnl
1414     AC_DEFUN([EGG_TCL_CHECK_NOTIFIER_INIT],
1415     [
1416     if test "$egg_tcl_changed" = yes; then
1417     EGG_CACHE_UNSET(egg_cv_var_tcl_notifier_init)
1418     fi
1419    
1420     # Check for Tcl_NotifierProcs member initNotifierProc
1421     AC_CHECK_MEMBER([Tcl_NotifierProcs.initNotifierProc], [egg_cv_var_tcl_notifier_init="yes"], [egg_cv_var_tcl_notifier_init="no"], [[#include "$TCLINC/$TCLINCFN"]])
1422     if test "$egg_cv_var_tcl_notifier_init" = yes; then
1423     AC_DEFINE(HAVE_TCL_NOTIFIER_INIT, 1, [Define for Tcl that has the Tcl_NotiferProcs struct member initNotifierProc (8.4 and later).])
1424     fi
1425     ])
1426    
1427 simple 1.1
1428     dnl EGG_TCL_LIB_REQS()
1429     dnl
1430     AC_DEFUN([EGG_TCL_LIB_REQS],
1431     [
1432     if test "$EGG_CYGWIN" = yes; then
1433     TCL_REQS="${TCLLIB}/lib${TCLLIBFN}"
1434     TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB"
1435     else
1436     if test "$TCLLIBEXT" != ".a"; then
1437     TCL_REQS="${TCLLIB}/lib${TCLLIBFN}"
1438     TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB"
1439     else
1440     # Set default make as static for unshared Tcl library
1441     if test "$DEFAULT_MAKE" != static; then
1442     cat << 'EOF' >&2
1443     configure: WARNING:
1444    
1445     Your Tcl library is not a shared lib.
1446     configure will now set default make type to static.
1447    
1448     EOF
1449     DEFAULT_MAKE="static"
1450     AC_SUBST(DEFAULT_MAKE)
1451     fi
1452    
1453     # Are we using a pre 7.4 Tcl version ?
1454     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"}'`
1455     if test "$TCL_VER_PRE74" = no; then
1456    
1457     # Was the --with-tcllib option given ?
1458     if test "x$tcllibname" != x; then
1459     TCL_REQS="${TCLLIB}/lib${TCLLIBFN}"
1460     TCL_LIBS="${TCLLIB}/lib${TCLLIBFN} $EGG_MATH_LIB"
1461     else
1462     TCL_REQS="${TCLLIB}/lib${TCLLIBFN}"
1463     TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB"
1464     fi
1465     else
1466     cat << EOF >&2
1467     configure: WARNING:
1468    
1469     Your Tcl version ($egg_cv_var_tcl_version) is older than 7.4.
1470     There are known problems, but we will attempt to work around them.
1471    
1472     EOF
1473     TCL_REQS="libtcle.a"
1474     TCL_LIBS="-L`pwd` -ltcle $EGG_MATH_LIB"
1475     fi
1476     fi
1477     fi
1478    
1479     AC_SUBST(TCL_REQS)
1480     AC_SUBST(TCL_LIBS)
1481     ])
1482    
1483    
1484     dnl EGG_SUBST_EGGVERSION()
1485     dnl
1486     AC_DEFUN([EGG_SUBST_EGGVERSION],
1487     [
1488     EGGVERSION=`grep 'char.egg_version' $srcdir/src/main.c | $AWK '{gsub(/(\"|\;)/, "", [$]4); print [$]4}'`
1489     egg_version_num=`echo $EGGVERSION | $AWK 'BEGIN {FS = "."} {printf("%d%02d%02d", [$]1, [$]2, [$]3)}'`
1490     AC_SUBST(EGGVERSION)
1491     AC_DEFINE_UNQUOTED(EGG_VERSION, $egg_version_num, [Defines the current Eggdrop version.])
1492     ])
1493    
1494    
1495     dnl EGG_SUBST_DEST()
1496     AC_DEFUN([EGG_SUBST_DEST],
1497     [
1498     if test "x$DEST" = x; then
1499     DEST=\${prefix}
1500     fi
1501     AC_SUBST(DEST)
1502     ])
1503    
1504    
1505     dnl EGG_SUBST_MOD_UPDIR()
1506     dnl
1507     dnl Since module's Makefiles aren't generated by configure, some paths in
1508     dnl src/mod/Makefile.in take care of them. For correct path "calculation", we
1509     dnl need to keep absolute paths in mind (which don't need a "../" prepended).
1510     dnl
1511     AC_DEFUN([EGG_SUBST_MOD_UPDIR], [
1512     case "$srcdir" in
1513     [[\\/]]* | ?:[[\\/]]*)
1514     MOD_UPDIR=""
1515     ;;
1516     *)
1517     MOD_UPDIR="../"
1518     ;;
1519     esac
1520     AC_SUBST(MOD_UPDIR)
1521     ])
1522    
1523    
1524     dnl EGG_REPLACE_IF_CHANGED(FILE-NAME, CONTENTS-CMDS, INIT-CMDS)
1525     dnl
1526     dnl Replace FILE-NAME if the newly created contents differs from the existing
1527     dnl file contents. Otherwise, leave the file alone. This avoids needless
1528     dnl recompiles.
1529     dnl
1530     m4_define(EGG_REPLACE_IF_CHANGED,
1531     [
1532     AC_CONFIG_COMMANDS([replace-if-changed], [[
1533     egg_replace_file="$1"
1534     $2
1535     if test -f "$egg_replace_file" && cmp -s conftest.out $egg_replace_file; then
1536     echo "$1 is unchanged"
1537     else
1538     echo "creating $1"
1539     mv conftest.out $egg_replace_file
1540     fi
1541     rm -f conftest.out
1542     ]],
1543     [[$3]])
1544     ])
1545    
1546    
1547     dnl EGG_TCL_LUSH()
1548     dnl
1549     AC_DEFUN([EGG_TCL_LUSH],
1550     [
1551     EGG_REPLACE_IF_CHANGED(lush.h, [
1552     cat > conftest.out << EOF
1553    
1554     /* Ignore me but do not erase me. I am a kludge. */
1555    
1556     #include "${egg_tclinc}/${egg_tclincfn}"
1557    
1558     EOF
1559     ], [
1560     egg_tclinc="$TCLINC"
1561     egg_tclincfn="$TCLINCFN"
1562     ])
1563     ])
1564    
1565    
1566     dnl EGG_DEBUG_ENABLE()
1567     dnl
1568     AC_DEFUN([EGG_DEBUG_ENABLE],
1569     [
1570     AC_ARG_ENABLE(debug, [ --enable-debug enable generic debug code (default for 'make debug')], [enable_debug="$enableval"], [enable_debug="auto"])
1571     AC_ARG_ENABLE(debug, [ --disable-debug disable generic debug code], [enable_debug="$enableval"], [enable_debug="auto"])
1572     AC_ARG_ENABLE(debug-assert, [ --enable-debug-assert enable assert debug code (default for 'make debug')], [enable_debug_assert="$enableval"], [enable_debug_assert="auto"])
1573     AC_ARG_ENABLE(debug-assert, [ --disable-debug-assert disable assert debug code], [enable_debug_assert="$enableval"], [enable_debug_assert="auto"])
1574     AC_ARG_ENABLE(debug-mem, [ --enable-debug-mem enable memory debug code (default for 'make debug')], [enable_debug_mem="$enableval"], [enable_debug_mem="auto"])
1575     AC_ARG_ENABLE(debug-mem, [ --disable-debug-mem disable memory debug code], [enable_debug_mem="$enableval"], [enable_debug_mem="auto"])
1576     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"])
1577     AC_ARG_ENABLE(debug-dns, [ --disable-debug-dns disable dns.mod debug messages], [enable_debug_dns="$enableval"], [enable_debug_dns="auto"])
1578     AC_ARG_ENABLE(debug-context, [ --enable-debug-context enable context debug code (default)], [enable_debug_context="$enableval"], [enable_debug_context="auto"])
1579     AC_ARG_ENABLE(debug-context, [ --disable-debug-context disable context debug code], [enable_debug_context="$enableval"], [enable_debug_context="auto"])
1580     ])
1581    
1582    
1583     dnl EGG_DEBUG_DEFAULTS()
1584     dnl
1585     AC_DEFUN([EGG_DEBUG_DEFAULTS],
1586     [
1587     # Defaults:
1588    
1589     # make: 'eggdrop' or 'static'
1590     default_std_debug="no"
1591     default_std_debug_assert="no"
1592     default_std_debug_mem="no"
1593     default_std_debug_context="yes"
1594     default_std_debug_dns="no"
1595    
1596     # make: 'debug' or 'sdebug'
1597     default_deb_debug="yes"
1598     default_deb_debug_assert="yes"
1599     default_deb_debug_mem="yes"
1600     default_deb_debug_context="yes"
1601     default_deb_debug_dns="yes"
1602    
1603     if test "$DEFAULT_MAKE" = eggdrop || test "$DEFAULT_MAKE" = static; then
1604     default_debug="$default_std_debug"
1605     default_debug_assert="$default_std_debug_assert"
1606     default_debug_mem="$default_std_debug_mem"
1607     default_debug_context="$default_std_debug_context"
1608     default_debug_dns="$default_std_debug_dns"
1609     else
1610     default_debug="$default_deb_debug"
1611     default_debug_assert="$default_deb_debug_assert"
1612     default_debug_mem="$default_deb_debug_mem"
1613     default_debug_context="$default_deb_debug_context"
1614     default_debug_dns="$default_deb_debug_dns"
1615     fi
1616    
1617     debug_options="debug debug_assert debug_mem debug_dns"
1618    
1619     debug_cflags_debug="-g3 -DDEBUG"
1620     debug_cflags_debug_assert="-DDEBUG_ASSERT"
1621     debug_cflags_debug_mem="-DDEBUG_MEM"
1622     debug_cflags_debug_dns="-DDEBUG_DNS"
1623     debug_stdcflags_debug=""
1624     debug_stdcflags_debug_assert=""
1625     debug_stdcflags_debug_mem=""
1626     debug_stdcflags_debug_dns=""
1627     debug_debcflags_debug=""
1628     debug_debcflags_debug_assert=""
1629     debug_debcflags_debug_mem=""
1630     debug_debcflags_debug_dns=""
1631     ])
1632    
1633    
1634     dnl EGG_DEBUG_OPTIONS()
1635     dnl
1636     AC_DEFUN([EGG_DEBUG_OPTIONS],
1637     [
1638     for enable_option in $debug_options; do
1639    
1640     eval enable_value=\$enable_$enable_option
1641    
1642     # Check if either --enable-<opt> or --disable-<opt> was used
1643     if test "$enable_value" != auto; then
1644     # Make sure an invalid option wasn't passed as --enable-<opt>=foo
1645     if test "$enable_value" != yes && test "$enable_value" != no; then
1646     opt_name=`echo $enable_option | sed 's/_/-/g'`
1647     eval opt_default=\$default_$enable_option
1648     AC_MSG_WARN([Invalid option '$enable_value' passed to --enable-${opt_name}, defaulting to '$opt_default'])
1649     eval enable_$enable_option="auto"
1650     fi
1651     fi
1652    
1653     if test "$enable_value" = auto; then
1654     # Note: options generally should not end up in both std and deb but
1655     # there may be options in the future where this behavior is desired.
1656     if test `eval echo '${'default_std_$enable_option'}'` = yes; then
1657     eval `echo debug_stdcflags_$enable_option`=\$debug_cflags_$enable_option
1658     fi
1659     if test `eval echo '${'default_deb_$enable_option'}'` = yes; then
1660     eval `echo debug_debcflags_$enable_option`=\$debug_cflags_$enable_option
1661     fi
1662     else
1663     if test "$enable_value" = yes; then
1664     # If option defaults to 'yes' for debug, always put it in stdcflags
1665     # when the option is forced on because someone may want it enabled
1666     # for a non-debug build.
1667     if test `eval echo '${'default_deb_$enable_option'}'` = yes; then
1668     eval `echo debug_stdcflags_$enable_option`=\$debug_cflags_$enable_option
1669     else
1670     # option defaulted to 'no' so put it in debcflags
1671     eval `echo debug_debcflags_$enable_option`=\$debug_cflags_$enable_option
1672     fi
1673     fi
1674     fi
1675     done
1676     ])
1677    
1678    
1679     dnl EGG_DEBUG_CFLAGS()
1680     dnl
1681     AC_DEFUN([EGG_DEBUG_CFLAGS],
1682     [
1683     for cflg_option in $debug_options; do
1684     eval stdcflg_value=\$debug_stdcflags_$cflg_option
1685     EGG_APPEND_VAR(CFLGS, $stdcflg_value)
1686    
1687     eval debcflg_value=\$debug_debcflags_$cflg_option
1688     EGG_APPEND_VAR(DEBCFLGS, $debcflg_value)
1689     done
1690    
1691     # Disable debug symbol stripping if compiled with --enable-debug
1692     # This will result in core dumps that are actually useful.
1693     if test "x$debug_stdcflags_debug" != x; then
1694     STRIP="touch"
1695     MOD_STRIP="touch"
1696     SHLIB_STRIP="touch"
1697     fi
1698    
1699     AC_SUBST(CFLGS)
1700     AC_SUBST(DEBCFLGS)
1701     ])
1702    
1703    
1704     dnl EGG_ENABLE_DEBUG_CONTEXT()
1705     dnl
1706     AC_DEFUN([EGG_ENABLE_DEBUG_CONTEXT],
1707     [
1708     # Check if either --enable-debug-context or --disable-debug-context was used
1709     if test "$enable_debug_context" != auto; then
1710    
1711     # Make sure an invalid option wasn't passed as --enable-debug-context=foo
1712     if test "$enable_debug_context" != yes && test "$enable_debug_context" != no; then
1713     AC_MSG_WARN([Invalid option '$enable_debug_context' passed to --enable-debug-context, defaulting to '$default_debug_context'])
1714     enable_debug_context="$default_debug_context"
1715     fi
1716     else
1717     enable_debug_context="$default_debug_context"
1718     fi
1719    
1720     if test "$enable_debug_context" = yes; then
1721     AC_DEFINE(DEBUG_CONTEXT, 1, [Define for context debugging.])
1722     else
1723     cat << 'EOF' >&2
1724     configure: WARNING:
1725    
1726     You have disabled context debugging.
1727    
1728     Eggdrop will not be able to provide context information if it crashes.
1729     Bug reports without context are less helpful when tracking down bugs.
1730    
1731     EOF
1732     fi
1733     ])
1734    
1735    
1736     dnl EGG_CATCH_MAKEFILE_REBUILD()
1737     dnl
1738     AC_DEFUN([EGG_CATCH_MAKEFILE_REBUILD],
1739     [
1740     AC_CONFIG_COMMANDS([catch-make-rebuild], [[
1741     if test -f .modules; then
1742     $srcdir/misc/modconfig --top_srcdir="$srcdir/src" Makefile
1743     fi
1744     ]])
1745     ])
1746    
1747    
1748     dnl EGG_SAVE_PARAMETERS()
1749     dnl
1750     dnl Remove --cache-file and --srcdir arguments so they do not pile up.
1751     dnl
1752     AC_DEFUN([EGG_SAVE_PARAMETERS],
1753     [
1754     egg_ac_parameters=
1755     ac_prev=
1756     for ac_arg in $ac_configure_args; do
1757     if test -n "$ac_prev"; then
1758     ac_prev=
1759     continue
1760     fi
1761     case $ac_arg in
1762     -cache-file | --cache-file | --cache-fil | --cache-fi | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
1763     ac_prev=cache_file ;;
1764     -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
1765     ;;
1766     --config-cache | -C)
1767     ;;
1768     -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
1769     ac_prev=srcdir ;;
1770     -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
1771     ;;
1772     *) egg_ac_parameters="$egg_ac_parameters $ac_arg" ;;
1773     esac
1774     done
1775    
1776     AC_SUBST(egg_ac_parameters)
1777 pseudo 1.6 AC_DEFINE_UNQUOTED(EGG_AC_ARGS, "$egg_ac_parameters", [Arguments passed to configure])
1778 simple 1.1 ])
1779    
1780    
1781 pseudo 1.3 dnl EGG_IPV6_COMPAT
1782     dnl
1783     AC_DEFUN([EGG_IPV6_COMPAT],
1784     [
1785     if test "$enable_ipv6" = "yes"; then
1786     AC_CHECK_FUNCS([inet_pton gethostbyname2])
1787 pseudo 1.5 AC_CHECK_TYPES([struct in6_addr], egg_cv_var_have_in6_addr="yes", egg_cv_var_have_in6_addr="no", [
1788     #include <sys/types.h>
1789     #include <netinet/in.h>
1790     ])
1791 pseudo 1.3 if test "$egg_cv_var_have_in6_addr" = "yes"; then
1792     # Check for in6addr_any
1793     AC_CACHE_CHECK([for the in6addr_any constant], [egg_cv_var_have_in6addr_any], [
1794 pseudo 1.5 AC_TRY_COMPILE([
1795     #include <sys/types.h>
1796     #include <netinet/in.h>
1797     ], [struct in6_addr i6 = in6addr_any;],
1798     [egg_cv_var_have_in6addr_any="yes"], [egg_cv_var_have_in6addr_any="no"])
1799 pseudo 1.3 ])
1800     if test "$egg_cv_var_have_in6addr_any" = "yes"; then
1801     AC_DEFINE(HAVE_IN6ADDR_ANY, 1, [Define to 1 if you have the in6addr_any constant.])
1802     fi
1803     # Check for in6addr_loopback
1804     AC_CACHE_CHECK([for the in6addr_loopback constant], [egg_cv_var_have_in6addr_loopback], [
1805 pseudo 1.5 AC_TRY_COMPILE([
1806     #include <sys/types.h>
1807     #include <netinet/in.h>
1808     ], [struct in6_addr i6 = in6addr_loopback;],
1809     [egg_cv_var_have_in6addr_loopback="yes"], [egg_cv_var_have_in6addr_loopback="no"])
1810 pseudo 1.3 ])
1811     if test "$egg_cv_var_have_in6addr_loopback" = "yes"; then
1812     AC_DEFINE(HAVE_IN6ADDR_LOOPBACK, 1, [Define to 1 if you have the in6addr_loopback constant.])
1813     fi
1814 pseudo 1.5 AC_CHECK_TYPES([struct sockaddr_in6], , , [
1815     #include <sys/types.h>
1816     #include <netinet/in.h>
1817     ])
1818 pseudo 1.3 else
1819     AC_MSG_NOTICE([no in6_addr found, skipping dependent checks. Custom definitions will be used.])
1820     fi
1821     fi
1822     ])
1823    
1824    
1825     dnl EGG_IPV6_ENABLE
1826     dnl
1827     AC_DEFUN([EGG_IPV6_ENABLE],
1828     [
1829     AC_ARG_ENABLE(ipv6,
1830     [ --enable-ipv6 enable IPv6 support (autodetect)],
1831     [enable_ipv6="$enableval"], [enable_ipv6="$egg_cv_var_ipv6_supported"])
1832     AC_ARG_ENABLE(ipv6,
1833     [ --disable-ipv6 disable IPv6 support ], [enable_ipv6="$enableval"])
1834    
1835     if test "$enable_ipv6" = "yes"; then
1836     if test "$egg_cv_var_ipv6_supported" = "no"; then
1837     AC_MSG_WARN([You have enabled IPv6 but your system doesn't seem to support it.])
1838     AC_MSG_WARN([Eggdrop will compile but will be limited to IPv4 on this host.])
1839     fi
1840     AC_DEFINE(IPV6, 1, [Define to 1 if you want to enable IPv6 support.])
1841     fi
1842     ])
1843    
1844    
1845     dnl EGG_IPV6_STATUS
1846     dnl
1847     AC_DEFUN([EGG_IPV6_STATUS],
1848     [
1849     AC_CACHE_CHECK([for system IPv6 support], [egg_cv_var_ipv6_supported], [
1850     AC_RUN_IFELSE([[
1851     #include <unistd.h>
1852     #include <sys/socket.h>
1853     #include <netinet/in.h>
1854    
1855     int main()
1856     {
1857     int s = socket(AF_INET6, SOCK_STREAM, 0);
1858    
1859     if (s != -1)
1860     close(s);
1861    
1862     return((s == -1));
1863     }
1864     ]], [
1865     egg_cv_var_ipv6_supported="yes"
1866     ], [
1867     egg_cv_var_ipv6_supported="no"
1868     ])
1869     ])
1870     ])
1871 pseudo 1.8
1872    
1873     dnl EGG_TLS_ENABLE
1874     dnl
1875     AC_DEFUN([EGG_TLS_ENABLE],
1876     [
1877     AC_MSG_CHECKING([whether to enable TLS support])
1878     AC_ARG_ENABLE(tls,
1879     [ --enable-tls enable TLS support (autodetect)],
1880     [enable_tls="$enableval"])
1881     AC_ARG_ENABLE(tls,
1882     [ --disable-tls disable TLS support ], [enable_tls="$enableval"],
1883     [enable_tls="autodetect"])
1884    
1885     AC_MSG_RESULT([$enable_tls])
1886     ])
1887    
1888    
1889     dnl EGG_TLS_WITHSSL
1890     dnl
1891     AC_DEFUN(EGG_TLS_WITHSSL,
1892     [
1893     save_LIBS="$LIBS"
1894     AC_ARG_WITH(sslinc, [ --with-sslinc=PATH Path to OpenSSL headers], [
1895     if test "$enable_tls" != "no"; then
1896     if test -d "$withval"; then
1897     save_CC="$CC"
1898     save_CPP="$CPP"
1899     CC="$CC -I$withval"
1900     CPP="$CPP -I$withval"
1901     AC_CHECK_HEADERS([openssl/ssl.h openssl/x509v3.h], [sslinc="-I$withval"], [
1902     AC_MSG_WARN([Invalid path to OpenSSL headers. $withval/openssl/ doesn't contain the required files.])
1903     sslinc=""
1904     break
1905     ], [[
1906     #ifdef CYGWIN_HACKS
1907     # ifndef __int64
1908     # define __int64 long long
1909     # endif
1910     #endif
1911     ]])
1912     AC_SUBST(SSL_INCLUDES, [$sslinc])
1913     CC="$save_CC"
1914     CPP="$save_CPP"
1915     else
1916     AC_MSG_WARN([Invalid path to OpenSSL headers. $withval is not a directory.])
1917     fi
1918     fi
1919     ])
1920    
1921     AC_ARG_WITH(ssllib, [ --with-ssllib=PATH Path to OpenSSL libraries],
1922     [
1923     if test "$enable_tls" != "no"; then
1924     if test -d "$withval"; then
1925 pseudo 1.11 AC_CHECK_LIB(ssl, SSL_accept, , [havessllib="no"], [-L$withval -lcrypto])
1926     AC_CHECK_LIB(crypto, X509_digest, , [havessllib="no"], [-L$withval -lssl])
1927 pseudo 1.8 if test "$havessllib" = "no"; then
1928     AC_MSG_WARN([Invalid path to OpenSSL libs. $withval doesn't contain the required files.])
1929     else
1930     AC_SUBST(SSL_LIBS, [-L$withval])
1931     fi
1932     else
1933     AC_MSG_WARN([You have specified an invalid path to OpenSSL libs. $withval is not a directory.])
1934     fi
1935     fi
1936     ])
1937     ])
1938    
1939    
1940     dnl EGG_TLS_DETECT
1941     dnl
1942     AC_DEFUN([EGG_TLS_DETECT],
1943     [
1944     if test "$enable_tls" != "no"; then
1945     if test -z "$SSL_INCLUDES"; then
1946     AC_CHECK_HEADERS([openssl/ssl.h openssl/x509v3.h], , [havesslinc="no"], [
1947     #ifdef CYGWIN_HACKS
1948     # ifndef __int64
1949     # define __int64 long long
1950     # endif
1951     #endif
1952     ])
1953     fi
1954     if test -z "$SSL_LIBS"; then
1955     AC_CHECK_LIB(ssl, SSL_accept, , [havessllib="no"], [-lcrypto])
1956     AC_CHECK_LIB(crypto, X509_digest, , [havessllib="no"], [-lssl])
1957 pseudo 1.9 AC_CHECK_FUNCS([EVP_md5 EVP_sha1 a2i_IPADDRESS hex_to_string string_to_hex], , [[
1958 pseudo 1.8 havessllib="no"
1959     break
1960     ]])
1961     fi
1962     if test "$enable_tls" = "yes"; then
1963     if test "$havesslinc" = "no"; then
1964     AC_MSG_WARN([Cannot find OpenSSL headers.])
1965     AC_MSG_WARN([Please specify the path to the openssl include dir using --with-sslinc=path])
1966     fi
1967     if test "$havessllib" = "no"; then
1968     AC_MSG_WARN([Cannot find OpenSSL libraries.])
1969     AC_MSG_WARN([Please specify the path to libssl and libcrypto using --with-ssllib=path])
1970     fi
1971     fi
1972     AC_MSG_CHECKING([for OpenSSL])
1973     if test "$havesslinc" = "no" || test "$havessllib" = "no"; then
1974 pseudo 1.10 AC_MSG_RESULT([no (make sure you have version 0.9.8 or higher installed)])
1975 pseudo 1.8 LIBS="$save_LIBS"
1976     else
1977     AC_MSG_RESULT([yes])
1978     if test "$EGG_CYGWIN" = "yes"; then
1979     AC_CHECK_TYPE([__int64], , [
1980     AC_DEFINE([__int64], [long long], [Define this to a 64-bit type on Cygwin to satisfy OpenSSL dependencies.])
1981     ])
1982     fi
1983 pseudo 1.9 AC_CHECK_FUNCS([RAND_status])
1984 pseudo 1.8 AC_DEFINE(TLS, 1, [Define this to enable SSL support.])
1985     EGG_MD5_COMPAT
1986     fi
1987     fi
1988     ])
1989    
1990    
1991     dnl EGG_MD5_COMPAT
1992     dnl
1993     AC_DEFUN([EGG_MD5_COMPAT],
1994     [
1995     save_CC="$CC"
1996     save_CPP="$CPP"
1997     CC="$CC $sslinc"
1998     CPP="$CPP $sslinc"
1999     AC_CHECK_HEADERS([openssl/md5.h], [
2000     AC_CHECK_FUNCS([MD5_Init MD5_Update MD5_Final], , [havesslmd5="no"])
2001     ])
2002     if test "$havesslmd5" != "no"; then
2003     AC_DEFINE(HAVE_OPENSSL_MD5, 1, [Define this if your OpenSSL library has MD5 cipher support.])
2004     fi
2005     CC="$save_CC"
2006     CPP="$save_CPP"
2007     ])

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23