/[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.12.2.1 - (hide annotations) (download)
Sun Feb 6 19:19:15 2011 UTC (8 years, 1 month ago) by pseudo
Branch: gettext
Changes since 1.12: +65 -158 lines
configure.ac cleanup, part 1. Removed some tests which are no longer needed
or are obsolete nowadays. Updated/canonicalized some macros.

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

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23