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

Contents of /eggdrop1.8/aclocal.m4

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


Revision 1.12 - (show annotations) (download)
Mon Oct 25 22:11:23 2010 UTC (8 years, 5 months ago) by pseudo
Branch: MAIN
Branch point for: gettext
Changes since 1.11: +1 -42 lines
Removed -mwin32 on Windows. It's no longer necessary and causes problems with Cygwin 1.7.

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

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23