/[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.3 - (hide annotations) (download)
Wed Jul 20 10:45:36 2011 UTC (7 years, 9 months ago) by thommey
Branch: gettext
Changes since 1.12.2.2: +12 -27 lines
Work around Tcl8.5.10 bug 3371644. Use the autoconf macros AC_LANG_PROGRAM/AC_LANG_SOURCE.

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

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23