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

Contents of /eggdrop1.9/aclocal.m4

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


Revision 1.43 - (show annotations) (download)
Tue Jul 24 14:43:34 2001 UTC (17 years, 10 months ago) by guppy
Branch: MAIN
Changes since 1.42: +7 -1 lines
QNX? don't banks use that

1 dnl aclocal.m4
2 dnl macros autoconf uses when building configure from configure.in
3 dnl
4 dnl $Id: aclocal.m4,v 1.42 2001/07/03 16:47:14 guppy Exp $
5 dnl
6
7
8 dnl EGG_MSG_CONFIGURE_START()
9 dnl
10 AC_DEFUN(EGG_MSG_CONFIGURE_START, [dnl
11 AC_MSG_RESULT()
12 AC_MSG_RESULT(This is eggdrop's GNU configure script.)
13 AC_MSG_RESULT(It's going to run a bunch of strange tests to hopefully)
14 AC_MSG_RESULT(make your compile work without much twiddling.)
15 AC_MSG_RESULT()
16 ])dnl
17
18
19 dnl EGG_MSG_CONFIGURE_END()
20 dnl
21 AC_DEFUN(EGG_MSG_CONFIGURE_END, [dnl
22 AC_MSG_RESULT()
23 AC_MSG_RESULT(Configure is done.)
24 AC_MSG_RESULT()
25 AC_MSG_RESULT(Type 'make config' to configure the modules. Or 'make iconfig' to)
26 AC_MSG_RESULT(interactively choose which modules to compile.)
27 AC_MSG_RESULT()
28 if test -f "./$EGGEXEC"
29 then
30 AC_MSG_RESULT([After that, type 'make clean' and then 'make' to create the bot.])
31 else
32 AC_MSG_RESULT([After that, type 'make' to create the bot.])
33 fi
34 AC_MSG_RESULT()
35 ])dnl
36
37
38 dnl EGG_CHECK_CC()
39 dnl
40 dnl FIXME: make a better test
41 dnl
42 AC_DEFUN(EGG_CHECK_CC, [dnl
43 if test "${cross_compiling-x}" = "x"
44 then
45 cat << 'EOF' >&2
46 configure: error:
47
48 This system does not appear to have a working C compiler.
49 A working C compiler is required to compile eggdrop.
50
51 EOF
52 exit 1
53 fi
54 ])dnl
55
56
57 dnl EGG_CHECK_CCPIPE()
58 dnl
59 dnl Checks whether the compiler supports the `-pipe' flag, which
60 dnl speeds up the compilation.
61 AC_DEFUN(EGG_CHECK_CCPIPE, [dnl
62 if test -z "$no_pipe"
63 then
64 if test -n "$GCC"
65 then
66 AC_CACHE_CHECK(whether the compiler understands -pipe, egg_cv_var_ccpipe, [dnl
67 ac_old_CC="$CC"
68 CC="$CC -pipe"
69 AC_TRY_COMPILE(,, egg_cv_var_ccpipe="yes", egg_cv_var_ccpipe="no")
70 CC="$ac_old_CC"
71 ])
72 if test "$egg_cv_var_ccpipe" = "yes"
73 then
74 CC="$CC -pipe"
75 fi
76 fi
77 fi
78 ])dnl
79
80
81 dnl EGG_PROG_STRIP()
82 dnl
83 AC_DEFUN(EGG_PROG_STRIP, [dnl
84 AC_CHECK_PROG(STRIP, strip, strip)
85 if test "${STRIP-x}" = "x"
86 then
87 STRIP=touch
88 fi
89 ])dnl
90
91
92 dnl EGG_PROG_AWK()
93 dnl
94 AC_DEFUN(EGG_PROG_AWK, [dnl
95 # awk is needed for Tcl library and header checks, and eggdrop version subst
96 AC_PROG_AWK
97 if test "${AWK-x}" = "x"
98 then
99 cat << 'EOF' >&2
100 configure: error:
101
102 This system seems to lack a working 'awk' command.
103 A working 'awk' command is required to compile eggdrop.
104
105 EOF
106 exit 1
107 fi
108 ])dnl
109
110
111 dnl EGG_PROG_BASENAME()
112 dnl
113 AC_DEFUN(EGG_PROG_BASENAME, [dnl
114 # basename is needed for Tcl library and header checks
115 AC_CHECK_PROG(BASENAME, basename, basename)
116 if test "${BASENAME-x}" = "x"
117 then
118 cat << 'EOF' >&2
119 configure: error:
120
121 This system seems to lack a working 'basename' command.
122 A working 'basename' command is required to compile eggdrop.
123
124 EOF
125 exit 1
126 fi
127 ])dnl
128
129
130 dnl EGG_CHECK_OS()
131 dnl
132 dnl FIXME/NOTICE:
133 dnl This function is obsolete. Any NEW code/checks should be written
134 dnl as individual tests that will be checked on ALL operating systems.
135 dnl
136 AC_DEFUN(EGG_CHECK_OS, [dnl
137 LINUX=no
138 IRIX=no
139 SUNOS=no
140 HPUX=no
141 MOD_CC="$CC"
142 MOD_LD="$CC"
143 MOD_STRIP="$STRIP"
144 SHLIB_CC="$CC"
145 SHLIB_LD="$CC"
146 SHLIB_STRIP="$STRIP"
147 NEED_DL=1
148 DEFAULT_MAKE=debug
149 MOD_EXT=so
150
151 AC_CACHE_CHECK(system type, egg_cv_var_system_type, egg_cv_var_system_type=`$UNAME -s`)
152 AC_CACHE_CHECK(system release, egg_cv_var_system_release, egg_cv_var_system_release=`$UNAME -r`)
153
154 case "$egg_cv_var_system_type" in
155 BSD/OS)
156 case "`echo $egg_cv_var_system_release | cut -d . -f 1`" in
157 2)
158 NEED_DL=0
159 DEFAULT_MAKE=static
160 ;;
161 3)
162 MOD_CC=shlicc
163 MOD_LD=shlicc
164 MOD_STRIP="$STRIP -d"
165 SHLIB_LD="shlicc -r"
166 SHLIB_STRIP=touch
167 AC_DEFINE(MODULES_OK)dnl
168 ;;
169 *)
170 CFLAGS="$CFLAGS -Wall"
171 MOD_LD="$CC"
172 MOD_STRIP="$STRIP -d"
173 SHLIB_CC="$CC -export-dynamic -fPIC"
174 SHLIB_LD="$CC -shared -nostartfiles"
175 AC_DEFINE(MODULES_OK)dnl
176 ;;
177 esac
178 ;;
179 CYGWIN*)
180 case "`echo $egg_cv_var_system_release | cut -c 1-3`" in
181 1.*)
182 NEED_DL=0
183 SHLIB_LD="$CC -shared"
184 CC="$CC -mwin32"
185 MOD_CC="$CC"
186 MOD_LD="$CC"
187 AC_MSG_CHECKING(for /usr/lib/binmode.o)
188 if test -r /usr/lib/binmode.o
189 then
190 AC_MSG_RESULT(yes)
191 LIBS="$LIBS /usr/lib/binmode.o"
192 else
193 AC_MSG_RESULT(no)
194 AC_MSG_WARN(Make sure the directory eggdrop is installed into is mounted in binary mode.)
195 fi
196 MOD_EXT=dll
197 AC_DEFINE(MODULES_OK)dnl
198 ;;
199 *)
200 NEED_DL=0
201 DEFAULT_MAKE=static
202 AC_MSG_WARN(Make sure the directory eggdrop is installed into is mounted in binary mode.)
203 ;;
204 esac
205 ;;
206 HP-UX)
207 HPUX=yes
208 MOD_LD="$CC -fPIC -shared"
209 SHLIB_CC="$CC -fPIC"
210 SHLIB_LD="ld -b"
211 NEED_DL=0
212 AC_DEFINE(MODULES_OK)dnl
213 AC_DEFINE(HPUX_HACKS)dnl
214 if test "`echo $egg_cv_var_system_release | cut -d . -f 2`" = "10"
215 then
216 AC_DEFINE(HPUX10_HACKS)dnl
217 fi
218 ;;
219 dell)
220 AC_MSG_RESULT(Dell SVR4)
221 SHLIB_STRIP=touch
222 NEED_DL=0
223 MOD_LD="$CC -lelf -lucb"
224 ;;
225 IRIX)
226 SHLIB_LD="ld -n32 -shared -rdata_shared"
227 IRIX=yes
228 SHLIB_STRIP=touch
229 NEED_DL=0
230 DEFAULT_MAKE=static
231 ;;
232 Ultrix)
233 NEED_DL=0
234 SHLIB_STRIP=touch
235 DEFAULT_MAKE=static
236 SHELL=/bin/sh5
237 ;;
238 SINIX*)
239 NEED_DL=0
240 SHLIB_STRIP=touch
241 DEFAULT_MAKE=static
242 SHLIB_CC="cc -G"
243 ;;
244 BeOS)
245 NEED_DL=0
246 SHLIB_STRIP=strip
247 DEFAULT_MAKE=static
248 ;;
249 Linux)
250 LINUX=yes
251 CFLAGS="$CFLAGS -Wall"
252 MOD_LD="$CC"
253 SHLIB_CC="$CC -fPIC"
254 SHLIB_LD="$CC -shared -nostartfiles"
255 AC_DEFINE(MODULES_OK)dnl
256 ;;
257 Lynx)
258 NEED_DL=0
259 DEFAULT_MAKE=static
260 SHLIB_STRIP=strip
261 ;;
262 QNX)
263 NEED_DL=0
264 DEFAULT_MAKE=static
265 SHLIB_LD="ld -shared"
266 SHLIB_STRIP=strip
267 ;;
268 OSF1)
269 case "`echo $egg_cv_var_system_release | cut -d . -f 1`" in
270 V*)
271 # FIXME: we should check this in a seperate test
272 # Digital OSF uses an ancient version of gawk
273 if test "$AWK" = "gawk"
274 then
275 AWK=awk
276 fi
277 MOD_CC=cc
278 MOD_LD=cc
279 SHLIB_CC=cc
280 SHLIB_LD="ld -shared -expect_unresolved \"'*'\""
281 SHLIB_STRIP=touch
282 AC_DEFINE(MODULES_OK)dnl
283 ;;
284 1.0|1.1|1.2)
285 SHLIB_LD="ld -R -export $@:"
286 AC_DEFINE(MODULES_OK)dnl
287 AC_DEFINE(OSF1_HACKS)dnl
288 ;;
289 1.*)
290 SHLIB_CC="$CC -fpic"
291 SHLIB_LD="ld -shared"
292 AC_DEFINE(MODULES_OK)dnl
293 AC_DEFINE(OSF1_HACKS)dnl
294 ;;
295 *)
296 NEED_DL=0
297 DEFAULT_MAKE=static
298 ;;
299 esac
300 AC_DEFINE(STOP_UAC)dnl
301 ;;
302 SunOS)
303 if test "`echo $egg_cv_var_system_release | cut -d . -f 1`" = "5"
304 then
305 # Solaris
306 if test -n "$GCC"
307 then
308 SHLIB_CC="$CC -fPIC"
309 SHLIB_LD="$CC"
310 else
311 SHLIB_CC="$CC -KPIC"
312 SHLIB_LD="$CC -G -z text"
313 fi
314 else
315 # SunOS 4
316 SUNOS=yes
317 SHLIB_LD=ld
318 SHLIB_CC="$CC -PIC"
319 AC_DEFINE(DLOPEN_1)dnl
320 fi
321 AC_DEFINE(MODULES_OK)dnl
322 ;;
323 *BSD)
324 # FreeBSD/OpenBSD/NetBSD
325 SHLIB_CC="$CC -fPIC"
326 SHLIB_LD="ld -Bshareable -x"
327 AC_DEFINE(MODULES_OK)dnl
328 ;;
329 *)
330 AC_MSG_CHECKING(if system is Mach based)
331 if test -r /mach
332 then
333 AC_MSG_RESULT(yes)
334 NEED_DL=0
335 DEFAULT_MAKE=static
336 AC_DEFINE(BORGCUBES)dnl
337 else
338 AC_MSG_RESULT(no)
339 AC_MSG_CHECKING(if system is QNX)
340 if test -r /cmds
341 then
342 AC_MSG_RESULT(yes)
343 SHLIB_STRIP=touch
344 NEED_DL=0
345 DEFAULT_MAKE=static
346 else
347 AC_MSG_RESULT(no)
348 AC_MSG_RESULT(Something unknown!)
349 AC_MSG_RESULT([If you get dynamic modules to work, be sure to let the devel team know HOW :)])
350 NEED_DL=0
351 DEFAULT_MAKE=static
352 fi
353 fi
354 ;;
355 esac
356 AC_SUBST(MOD_LD)dnl
357 AC_SUBST(MOD_CC)dnl
358 AC_SUBST(MOD_STRIP)dnl
359 AC_SUBST(SHLIB_LD)dnl
360 AC_SUBST(SHLIB_CC)dnl
361 AC_SUBST(SHLIB_STRIP)dnl
362 AC_SUBST(DEFAULT_MAKE)dnl
363 AC_SUBST(MOD_EXT)dnl
364 AC_DEFINE_UNQUOTED(EGG_MOD_EXT, "$MOD_EXT")dnl
365 ])dnl
366
367
368 dnl EGG_CHECK_LIBS()
369 dnl
370 AC_DEFUN(EGG_CHECK_LIBS, [dnl
371 # FIXME: this needs to be fixed so that it works on IRIX
372 if test "$IRIX" = "yes"
373 then
374 AC_MSG_WARN(Skipping library tests because they CONFUSE Irix.)
375 else
376 AC_CHECK_LIB(socket, socket)
377 AC_CHECK_LIB(nsl, connect)
378 AC_CHECK_LIB(dns, gethostbyname)
379 AC_CHECK_LIB(dl, dlopen)
380 AC_CHECK_LIB(m, tan, EGG_MATH_LIB="-lm")
381 # This is needed for Tcl libraries compiled with thread support
382 AC_CHECK_LIB(pthread, pthread_mutex_init, [dnl
383 ac_cv_lib_pthread_pthread_mutex_init=yes
384 ac_cv_lib_pthread="-lpthread"], [dnl
385 AC_CHECK_LIB(pthread, __pthread_mutex_init, [dnl
386 ac_cv_lib_pthread_pthread_mutex_init=yes
387 ac_cv_lib_pthread="-lpthread"], [dnl
388 AC_CHECK_LIB(pthreads, pthread_mutex_init, [dnl
389 ac_cv_lib_pthread_pthread_mutex_init=yes
390 ac_cv_lib_pthread="-lpthreads"], [dnl
391 AC_CHECK_FUNC(pthread_mutex_init, [dnl
392 ac_cv_lib_pthread_pthread_mutex_init=yes
393 ac_cv_lib_pthread=""],
394 ac_cv_lib_pthread_pthread_mutex_init=no)])])])
395 if test "$SUNOS" = "yes"
396 then
397 # For suns without yp or something like that
398 AC_CHECK_LIB(dl, main)
399 else
400 if test "$HPUX" = "yes"
401 then
402 AC_CHECK_LIB(dld, shl_load)
403 fi
404 fi
405 fi
406 ])dnl
407
408
409 dnl EGG_CHECK_FUNC_VSPRINTF()
410 dnl
411 AC_DEFUN(EGG_CHECK_FUNC_VSPRINTF, [dnl
412 AC_CHECK_FUNCS(vsprintf)
413 if test "$ac_cv_func_vsprintf" = "no"
414 then
415 cat << 'EOF' >&2
416 configure: error:
417
418 Your system does not have the sprintf/vsprintf libraries.
419 These are required to compile almost anything. Sorry.
420
421 EOF
422 exit 1
423 fi
424 ])dnl
425
426
427 dnl EGG_HEADER_STDC()
428 dnl
429 AC_DEFUN(EGG_HEADER_STDC, [dnl
430 if test "$ac_cv_header_stdc" = "no"
431 then
432 cat << 'EOF' >&2
433 configure: error:
434
435 Your system must support ANSI C Header files.
436 These are required for the language support. Sorry.
437
438 EOF
439 exit 1
440 fi
441 ])dnl
442
443
444 dnl EGG_CHECK_LIBSAFE_SSCANF()
445 dnl
446 AC_DEFUN(EGG_CHECK_LIBSAFE_SSCANF, [dnl
447 AC_CACHE_CHECK(for broken libsafe sscanf, egg_cv_var_libsafe_sscanf, [dnl
448 AC_TRY_RUN([
449 #include <stdio.h>
450
451 int main()
452 {
453 char *src = "0x001,guppyism\n";
454 char dst[10];
455 int idx;
456 if (sscanf(src, "0x%x,%10c", &idx, dst) == 1)
457 exit(1);
458 return 0;
459 }
460 ], egg_cv_var_libsafe_sscanf="no", egg_cv_var_libsafe_sscanf="yes",
461 egg_cv_var_libsafe_sscanf="no")
462 ])
463 if test "$egg_cv_var_libsafe_sscanf" = "yes"
464 then
465 AC_DEFINE(LIBSAFE_HACKS)dnl
466 fi
467 ])dnl
468
469
470 dnl EGG_CYGWIN()
471 dnl
472 dnl Check for Cygwin support.
473 AC_DEFUN(EGG_CYGWIN, [dnl
474 AC_CYGWIN
475 if test "$ac_cv_cygwin" = "yes"
476 then
477 AC_DEFINE(CYGWIN_HACKS)dnl
478 fi
479 ])dnl
480
481
482 dnl EGG_EXEEXT()
483 dnl
484 dnl Test for executable suffix and define eggdrop's executable name
485 dnl accordingly.
486 AC_DEFUN(EGG_EXEEXT, [dnl
487 EGGEXEC=eggdrop
488 AC_EXEEXT
489 if test ! "${EXEEXT-x}" = "x"
490 then
491 EGGEXEC="eggdrop$EXEEXT"
492 fi
493 AC_SUBST(EGGEXEC)dnl
494 ])dnl
495
496
497 dnl EGG_TCL_ARG_WITH()
498 dnl
499 AC_DEFUN(EGG_TCL_ARG_WITH, [dnl
500 # oohh new configure --variables for those with multiple tcl libs
501 AC_ARG_WITH(tcllib, [ --with-tcllib=PATH full path to tcl library], tcllibname="$withval")
502 AC_ARG_WITH(tclinc, [ --with-tclinc=PATH full path to tcl header], tclincname="$withval")
503
504 WARN=0
505 # Make sure either both or neither $tcllibname and $tclincname are set
506 if test ! "${tcllibname-x}" = "x"
507 then
508 if test "${tclincname-x}" = "x"
509 then
510 WARN=1
511 tcllibname=""
512 TCLLIB=""
513 TCLINC=""
514 fi
515 else
516 if test ! "${tclincname-x}" = "x"
517 then
518 WARN=1
519 tclincname=""
520 TCLLIB=""
521 TCLINC=""
522 fi
523 fi
524 if test "$WARN" = 1
525 then
526 cat << 'EOF' >&2
527 configure: warning:
528
529 You must specify both --with-tcllib and --with-tclinc for them to work.
530 configure will now attempt to autodetect both the Tcl library and header...
531
532 EOF
533 fi
534 ])dnl
535
536
537 dnl EGG_TCL_ENV()
538 dnl
539 AC_DEFUN(EGG_TCL_ENV, [dnl
540 WARN=0
541 # Make sure either both or neither $TCLLIB and $TCLINC are set
542 if test ! "${TCLLIB-x}" = "x"
543 then
544 if test "${TCLINC-x}" = "x"
545 then
546 WARN=1
547 WVAR1=TCLLIB
548 WVAR2=TCLINC
549 TCLLIB=""
550 fi
551 else
552 if test ! "${TCLINC-x}" = "x"
553 then
554 WARN=1
555 WVAR1=TCLINC
556 WVAR2=TCLLIB
557 TCLINC=""
558 fi
559 fi
560 if test "$WARN" = 1
561 then
562 cat << EOF >&2
563 configure: warning:
564
565 Environment variable $WVAR1 was set, but I did not detect ${WVAR2}.
566 Please set both TCLLIB and TCLINC correctly if you wish to use them.
567 configure will now attempt to autodetect both the Tcl library and header...
568
569 EOF
570 fi
571 ])dnl
572
573
574 dnl EGG_TCL_WITH_TCLLIB()
575 dnl
576 AC_DEFUN(EGG_TCL_WITH_TCLLIB, [dnl
577 # Look for Tcl library: if $tcllibname is set, check there first
578 if test ! "${tcllibname-x}" = "x"
579 then
580 if test -f "$tcllibname" && test -r "$tcllibname"
581 then
582 TCLLIB=`echo $tcllibname | sed 's%/[[^/]][[^/]]*$%%'`
583 TCLLIBFN=`$BASENAME $tcllibname | cut -c4-`
584 TCLLIBEXT=".`echo $TCLLIBFN | $AWK '{j=split([$]1, i, "."); print i[[j]]}'`"
585 TCLLIBFNS=`$BASENAME $tcllibname $TCLLIBEXT | cut -c4-`
586 else
587 cat << EOF >&2
588 configure: warning:
589
590 The file '$tcllibname' given to option --with-tcllib is not valid.
591 configure will now attempt to autodetect both the Tcl library and header...
592
593 EOF
594 tcllibname=""
595 tclincname=""
596 TCLLIB=""
597 TCLLIBFN=""
598 TCLINC=""
599 TCLINCFN=""
600 fi
601 fi
602 ])dnl
603
604
605 dnl EGG_TCL_WITH_TCLINC()
606 dnl
607 AC_DEFUN(EGG_TCL_WITH_TCLINC, [dnl
608 # Look for Tcl header: if $tclincname is set, check there first
609 if test ! "${tclincname-x}" = "x"
610 then
611 if test -f "$tclincname" && test -r "$tclincname"
612 then
613 TCLINC=`echo $tclincname | sed 's%/[[^/]][[^/]]*$%%'`
614 TCLINCFN=`$BASENAME $tclincname`
615 else
616 cat << EOF >&2
617 configure: warning:
618
619 The file '$tclincname' given to option --with-tclinc is not valid.
620 configure will now attempt to autodetect both the Tcl library and header...
621
622 EOF
623 tcllibname=""
624 tclincname=""
625 TCLLIB=""
626 TCLLIBFN=""
627 TCLINC=""
628 TCLINCFN=""
629 fi
630 fi
631 ])dnl
632
633
634 dnl EGG_TCL_FIND_LIBRARY()
635 dnl
636 AC_DEFUN(EGG_TCL_FIND_LIBRARY, [dnl
637 # Look for Tcl library: if $TCLLIB is set, check there first
638 if test "${TCLLIBFN-x}" = "x"
639 then
640 if test ! "${TCLLIB-x}" = "x"
641 then
642 if test -d "$TCLLIB"
643 then
644 for tcllibfns in $tcllibnames
645 do
646 for tcllibext in $tcllibextensions
647 do
648 if test -r "$TCLLIB/lib$tcllibfns$tcllibext"
649 then
650 TCLLIBFN="$tcllibfns$tcllibext"
651 TCLLIBEXT="$tcllibext"
652 TCLLIBFNS="$tcllibfns"
653 break 2
654 fi
655 done
656 done
657 fi
658 if test "${TCLLIBFN-x}" = "x"
659 then
660 cat << 'EOF' >&2
661 configure: warning:
662
663 Environment variable TCLLIB was set, but incorrect.
664 Please set both TCLLIB and TCLINC correctly if you wish to use them.
665 configure will now attempt to autodetect both the Tcl library and header...
666
667 EOF
668 TCLLIB=""
669 TCLLIBFN=""
670 TCLINC=""
671 TCLINCFN=""
672 fi
673 fi
674 fi
675 ])dnl
676
677
678 dnl EGG_TCL_FIND_HEADER()
679 dnl
680 AC_DEFUN(EGG_TCL_FIND_HEADER, [dnl
681 # Look for Tcl header: if $TCLINC is set, check there first
682 if test "${TCLINCFN-x}" = "x"
683 then
684 if test ! "${TCLINC-x}" = "x"
685 then
686 if test -d "$TCLINC"
687 then
688 for tclheaderfn in $tclheadernames
689 do
690 if test -r "$TCLINC/$tclheaderfn"
691 then
692 TCLINCFN="$tclheaderfn"
693 break
694 fi
695 done
696 fi
697 if test "${TCLINCFN-x}" = "x"
698 then
699 cat << 'EOF' >&2
700 configure: warning:
701
702 Environment variable TCLINC was set, but incorrect.
703 Please set both TCLLIB and TCLINC correctly if you wish to use them.
704 configure will now attempt to autodetect both the Tcl library and header...
705
706 EOF
707 TCLLIB=""
708 TCLLIBFN=""
709 TCLINC=""
710 TCLINCFN=""
711 fi
712 fi
713 fi
714 ])dnl
715
716
717 dnl EGG_TCL_CHECK_LIBRARY()
718 dnl
719 AC_DEFUN(EGG_TCL_CHECK_LIBRARY, [dnl
720 AC_MSG_CHECKING(for Tcl library)
721
722 # Attempt autodetect for $TCLLIBFN if it's not set
723 if test ! "${TCLLIBFN-x}" = "x"
724 then
725 AC_MSG_RESULT(using $TCLLIB/lib$TCLLIBFN)
726 else
727 for tcllibfns in $tcllibnames
728 do
729 for tcllibext in $tcllibextensions
730 do
731 for tcllibpath in $tcllibpaths
732 do
733 if test -r "$tcllibpath/lib$tcllibfns$tcllibext"
734 then
735 AC_MSG_RESULT(found $tcllibpath/lib$tcllibfns$tcllibext)
736 TCLLIB="$tcllibpath"
737 TCLLIBFN="$tcllibfns$tcllibext"
738 TCLLIBEXT="$tcllibext"
739 TCLLIBFNS="$tcllibfns"
740 break 3
741 fi
742 done
743 done
744 done
745 fi
746
747 # Show if $TCLLIBFN wasn't found
748 if test "${TCLLIBFN-x}" = "x"
749 then
750 AC_MSG_RESULT(not found)
751 fi
752 AC_SUBST(TCLLIB)dnl
753 AC_SUBST(TCLLIBFN)dnl
754 ])dnl
755
756
757 dnl EGG_TCL_CHECK_HEADER()
758 dnl
759 AC_DEFUN(EGG_TCL_CHECK_HEADER, [dnl
760 AC_MSG_CHECKING(for Tcl header)
761
762 # Attempt autodetect for $TCLINCFN if it's not set
763 if test ! "${TCLINCFN-x}" = "x"
764 then
765 AC_MSG_RESULT(using $TCLINC/$TCLINCFN)
766 else
767 for tclheaderpath in $tclheaderpaths
768 do
769 for tclheaderfn in $tclheadernames
770 do
771 if test -r "$tclheaderpath/$tclheaderfn"
772 then
773 AC_MSG_RESULT(found $tclheaderpath/$tclheaderfn)
774 TCLINC="$tclheaderpath"
775 TCLINCFN="$tclheaderfn"
776 break 2
777 fi
778 done
779 done
780 # FreeBSD hack ...
781 if test "${TCLINCFN-x}" = "x"
782 then
783 for tcllibfns in $tcllibnames
784 do
785 for tclheaderpath in $tclheaderpaths
786 do
787 for tclheaderfn in $tclheadernames
788 do
789 if test -r "$tclheaderpath/$tcllibfns/$tclheaderfn"
790 then
791 AC_MSG_RESULT(found $tclheaderpath/$tcllibfns/$tclheaderfn)
792 TCLINC="$tclheaderpath/$tcllibfns"
793 TCLINCFN="$tclheaderfn"
794 break 3
795 fi
796 done
797 done
798 done
799 fi
800 fi
801
802 # Show if $TCLINCFN wasn't found
803 if test "${TCLINCFN-x}" = "x"
804 then
805 AC_MSG_RESULT(not found)
806 fi
807 AC_SUBST(TCLINC)dnl
808 AC_SUBST(TCLINCFN)dnl
809 ])dnl
810
811
812 dnl EGG_CACHE_UNSET(CACHE-ID)
813 dnl
814 dnl Unsets a certain cache item. Typically called before using
815 dnl the AC_CACHE_*() macros.
816 AC_DEFUN(EGG_CACHE_UNSET, [dnl
817 unset $1
818 ])
819
820
821 dnl EGG_TCL_DETECT_CHANGE()
822 dnl
823 dnl Detect whether the tcl system has changed since our last
824 dnl configure run. Set egg_tcl_changed accordingly.
825 dnl
826 dnl Tcl related feature and version checks should re-run their
827 dnl checks as soon as egg_tcl_changed is set to "yes".
828 AC_DEFUN(EGG_TCL_DETECT_CHANGE, [dnl
829 AC_MSG_CHECKING(whether the tcl system has changed)
830 egg_tcl_changed=yes
831 egg_tcl_id="$TCLLIB:$TCLLIBFN:$TCLINC:$TCLINCFN"
832 if test ! "$egg_tcl_id" = ":::"
833 then
834 egg_tcl_cached=yes
835 AC_CACHE_VAL(egg_cv_var_tcl_id, [dnl
836 egg_cv_var_tcl_id="$egg_tcl_id"
837 egg_tcl_cached=no
838 ])
839 if test "$egg_tcl_cached" = "yes"
840 then
841 if test "${egg_cv_var_tcl_id-x}" = "${egg_tcl_id-x}"
842 then
843 egg_tcl_changed=no
844 else
845 egg_cv_var_tcl_id="$egg_tcl_id"
846 fi
847 fi
848 fi
849 if test "$egg_tcl_changed" = "yes"
850 then
851 AC_MSG_RESULT(yes)
852 else
853 AC_MSG_RESULT(no)
854 fi
855 ])
856
857
858 dnl EGG_TCL_CHECK_VERSION()
859 dnl
860 AC_DEFUN(EGG_TCL_CHECK_VERSION, [dnl
861 # Both TCLLIBFN & TCLINCFN must be set, or we bail
862 TCL_FOUND=0
863 if test ! "${TCLLIBFN-x}" = "x" && test ! "${TCLINCFN-x}" = "x"
864 then
865 TCL_FOUND=1
866
867 # Check Tcl's version
868 if test "$egg_tcl_changed" = "yes"
869 then
870 EGG_CACHE_UNSET(egg_cv_var_tcl_version)
871 fi
872 AC_MSG_CHECKING(for Tcl version)
873 AC_CACHE_VAL(egg_cv_var_tcl_version, [dnl
874 egg_cv_var_tcl_version=`grep TCL_VERSION $TCLINC/$TCLINCFN | head -1 | $AWK '{gsub(/\"/, "", [$]3); print [$]3}'`
875 ])
876
877 if test ! "${egg_cv_var_tcl_version-x}" = "x"
878 then
879 AC_MSG_RESULT($egg_cv_var_tcl_version)
880 else
881 AC_MSG_RESULT(not found)
882 TCL_FOUND=0
883 fi
884
885 # Check Tcl's patch level (if avaliable)
886 if test "$egg_tcl_changed" = "yes"
887 then
888 EGG_CACHE_UNSET(egg_cv_var_tcl_patch_level)
889 fi
890 AC_MSG_CHECKING(for Tcl patch level)
891 AC_CACHE_VAL(egg_cv_var_tcl_patch_level, [dnl
892 eval "egg_cv_var_tcl_patch_level=`grep TCL_PATCH_LEVEL $TCLINC/$TCLINCFN | head -1 | $AWK '{gsub(/\"/, "", [$]3); print [$]3}'`"
893 ])
894
895 if test ! "${egg_cv_var_tcl_patch_level-x}" = "x"
896 then
897 AC_MSG_RESULT($egg_cv_var_tcl_patch_level)
898 else
899 egg_cv_var_tcl_patch_level="unknown"
900 AC_MSG_RESULT(unknown)
901 fi
902 fi
903
904 # Check if we found Tcl's version
905 if test "$TCL_FOUND" = 0
906 then
907 cat << 'EOF' >&2
908 configure: error:
909
910 I can't find Tcl on this system.
911
912 Eggdrop requires Tcl to compile. If you already have Tcl installed
913 on this system, and I just wasn't looking in the right place for it,
914 set the environment variables TCLLIB and TCLINC so I will know where
915 to find 'libtcl.a' (or 'libtcl.so') and 'tcl.h' (respectively). Then
916 run 'configure' again.
917
918 Read the README file if you don't know what Tcl is or how to get it
919 and install it.
920
921 EOF
922 exit 1
923 fi
924 ])dnl
925
926
927 dnl EGG_TCL_CHECK_PRE70()
928 dnl
929 AC_DEFUN(EGG_TCL_CHECK_PRE70, [dnl
930 # Is this version of Tcl too old for us to use ?
931 TCL_VER_PRE70=`echo $egg_cv_var_tcl_version | $AWK '{split([$]1, i, "."); if (i[[1]] < 7) print "yes"; else print "no"}'`
932 if test "$TCL_VER_PRE70" = "yes"
933 then
934 cat << EOF >&2
935 configure: error:
936
937 Your Tcl version is much too old for eggdrop to use.
938 I suggest you download and complie a more recent version.
939 The most reliable current version is $tclrecommendver and
940 can be downloaded from $tclrecommendsite
941
942 EOF
943 exit 1
944 fi
945 ])dnl
946
947
948 dnl EGG_TCL_CHECK_PRE75()
949 dnl
950 AC_DEFUN(EGG_TCL_CHECK_PRE75, [dnl
951 # Are we using a pre 7.5 Tcl version ?
952 TCL_VER_PRE75=`echo $egg_cv_var_tcl_version | $AWK '{split([$]1, i, "."); if (((i[[1]] == 7) && (i[[2]] < 5)) || (i[[1]] < 7)) print "yes"; else print "no"}'`
953 if test "$TCL_VER_PRE75" = "yes"
954 then
955 AC_DEFINE(HAVE_PRE7_5_TCL)dnl
956 fi
957 ])dnl
958
959
960 dnl EGG_TCL_TESTLIBS()
961 dnl
962 AC_DEFUN(EGG_TCL_TESTLIBS, [dnl
963 # Set variables for Tcl library tests
964 TCL_TEST_LIB="$TCLLIBFNS"
965 TCL_TEST_OTHERLIBS="-L$TCLLIB $EGG_MATH_LIB"
966
967 if test ! "${ac_cv_lib_pthread-x}" = "x"
968 then
969 TCL_TEST_OTHERLIBS="$TCL_TEST_OTHERLIBS $ac_cv_lib_pthread"
970 fi
971 ])dnl
972
973
974 dnl EGG_TCL_CHECK_FREE()
975 dnl
976 AC_DEFUN(EGG_TCL_CHECK_FREE, [dnl
977 if test "$egg_tcl_changed" = "yes"
978 then
979 EGG_CACHE_UNSET(egg_cv_var_tcl_free)
980 fi
981
982 # Check for Tcl_Free()
983 AC_CHECK_LIB($TCL_TEST_LIB, Tcl_Free, egg_cv_var_tcl_free="yes", egg_cv_var_tcl_free="no", $TCL_TEST_OTHERLIBS)
984
985 if test "$egg_cv_var_tcl_free" = "yes"
986 then
987 AC_DEFINE(HAVE_TCL_FREE)dnl
988 fi
989 ])dnl
990
991
992 dnl EGG_TCL_ENABLE_THREADS()
993 dnl
994 AC_DEFUN(EGG_TCL_ENABLE_THREADS, [dnl
995 AC_ARG_ENABLE(tcl-threads,
996 [ --disable-tcl-threads Disable threaded tcl support if detected. (Ignore this
997 option unless you know what you are doing)],
998 enable_tcl_threads="$enableval",
999 enable_tcl_threads=yes)
1000 ])dnl
1001
1002
1003 dnl EGG_TCL_CHECK_THREADS()
1004 dnl
1005 AC_DEFUN(EGG_TCL_CHECK_THREADS, [dnl
1006 if test "$egg_tcl_changed" = "yes"
1007 then
1008 EGG_CACHE_UNSET(egg_cv_var_tcl_threaded)
1009 fi
1010
1011 # Check for TclpFinalizeThreadData()
1012 AC_CHECK_LIB($TCL_TEST_LIB, TclpFinalizeThreadData, egg_cv_var_tcl_threaded="yes", egg_cv_var_tcl_threaded="no", $TCL_TEST_OTHERLIBS)
1013
1014 if test "$egg_cv_var_tcl_threaded" = "yes"
1015 then
1016 if test "$enable_tcl_threads" = "no"
1017 then
1018
1019 cat << 'EOF' >&2
1020 configure: warning:
1021
1022 You have disabled threads support on a system with a threaded Tcl library.
1023 Tcl features that rely on scheduled events may not function properly.
1024
1025 EOF
1026 else
1027 AC_DEFINE(HAVE_TCL_THREADS)dnl
1028 fi
1029
1030 # Add pthread library to $LIBS if we need it
1031 if test ! "${ac_cv_lib_pthread-x}" = "x"
1032 then
1033 LIBS="$ac_cv_lib_pthread $LIBS"
1034 fi
1035 fi
1036 ])dnl
1037
1038
1039 dnl EGG_TCL_LIB_REQS()
1040 dnl
1041 AC_DEFUN(EGG_TCL_LIB_REQS, [dnl
1042 if test ! "$TCLLIBEXT" = ".a"
1043 then
1044 TCL_REQS="$TCLLIB/lib$TCLLIBFN"
1045 TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB"
1046 else
1047
1048 # Set default make as static for unshared Tcl library
1049 if test ! "$DEFAULT_MAKE" = "static"
1050 then
1051 cat << 'EOF' >&2
1052 configure: warning:
1053
1054 Your Tcl library is not a shared lib.
1055 configure will now set default make type to static...
1056
1057 EOF
1058 DEFAULT_MAKE=static
1059 AC_SUBST(DEFAULT_MAKE)dnl
1060 fi
1061
1062 # Are we using a pre 7.4 Tcl version ?
1063 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"}'`
1064 if test "$TCL_VER_PRE74" = "no"
1065 then
1066
1067 # Was the --with-tcllib option given ?
1068 if test ! "${tcllibname-x}" = "x"
1069 then
1070 TCL_REQS="$TCLLIB/lib$TCLLIBFN"
1071 TCL_LIBS="$TCLLIB/lib$TCLLIBFN $EGG_MATH_LIB"
1072 else
1073 TCL_REQS="$TCLLIB/lib$TCLLIBFN"
1074 TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB"
1075 fi
1076 else
1077 cat << EOF >&2
1078 configure: warning:
1079
1080 Your Tcl version ($egg_cv_var_tcl_version) is older then 7.4.
1081 There are known problems, but we will attempt to work around them.
1082
1083 EOF
1084 TCL_REQS="libtcle.a"
1085 TCL_LIBS="-L`pwd` -ltcle $EGG_MATH_LIB"
1086 fi
1087 fi
1088 AC_SUBST(TCL_REQS)dnl
1089 AC_SUBST(TCL_LIBS)dnl
1090 ])dnl
1091
1092
1093 dnl EGG_FUNC_DLOPEN()
1094 dnl
1095 AC_DEFUN(EGG_FUNC_DLOPEN, [dnl
1096 if test "$NEED_DL" = 1 && test "$ac_cv_func_dlopen" = "no"
1097 then
1098 if test "$LINUX" = "yes"
1099 then
1100 cat << 'EOF' >&2
1101 configure: warning:
1102
1103 Since you are on a Linux system, this has a known problem...
1104 I know a kludge for it,
1105 EOF
1106
1107 if test -r "/lib/libdl.so.1"
1108 then
1109 cat << 'EOF' >&2
1110 and you seem to have it, so we'll do that...
1111
1112 EOF
1113 AC_DEFINE(HAVE_DLOPEN)dnl
1114 LIBS="/lib/libdl.so.1 $LIBS"
1115 else
1116 cat << 'EOF' >&2
1117 which you DON'T seem to have... doh!
1118 perhaps you may still have the stuff lying around somewhere
1119 if you work out where it is, add it to your XLIBS= lines
1120 and #define HAVE_DLOPEN in config.h
1121
1122 we'll proceed on anyway, but you probably won't be able
1123 to 'make eggdrop' but you might be able to make the
1124 static bot (I'll default your make to this version).
1125
1126 EOF
1127 DEFAULT_MAKE=static
1128 fi
1129 else
1130 cat << 'EOF' >&2
1131 configure: warning:
1132
1133 You don't seem to have libdl anywhere I can find it, this will
1134 prevent you from doing dynamic modules, I'll set your default
1135 make to static linking.
1136
1137 EOF
1138 DEFAULT_MAKE=static
1139 fi
1140 fi
1141 ])dnl
1142
1143
1144 dnl EGG_SUBST_EGGVERSION()
1145 dnl
1146 AC_DEFUN(EGG_SUBST_EGGVERSION, [dnl
1147 EGGVERSION=`grep 'char.egg_version' $srcdir/src/main.c | $AWK '{gsub(/(\"|\;)/, "", [$]4); print [$]4}'`
1148 egg_version_num=`echo $EGGVERSION | $AWK 'BEGIN {FS = "."} {printf("%d%02d%02d", [$]1, [$]2, [$]3)}'`
1149 AC_SUBST(EGGVERSION)dnl
1150 AC_DEFINE_UNQUOTED(EGG_VERSION, $egg_version_num)dnl
1151 ])dnl
1152
1153
1154 dnl EGG_SUBST_DEST()
1155 dnl
1156 AC_DEFUN(EGG_SUBST_DEST, [dnl
1157 if test "${DEST-x}" = "x"
1158 then
1159 DEST=\${prefix}
1160 fi
1161 AC_SUBST(DEST)dnl
1162 ])dnl
1163
1164
1165 dnl EGG_SUBST_MOD_UPDIR()
1166 dnl
1167 dnl Since module's Makefiles aren't generated by configure, some
1168 dnl paths in src/mod/Makefile.in take care of them. For correct
1169 dnl path "calculation", we need to keep absolute paths in mind
1170 dnl (which don't need a "../" pre-pended).
1171 AC_DEFUN(EGG_SUBST_MOD_UPDIR, [dnl
1172 case "$srcdir" in
1173 [[\\/]]* | ?:[[\\/]]*)
1174 MOD_UPDIR=""
1175 ;;
1176 *)
1177 MOD_UPDIR="../"
1178 ;;
1179 esac
1180 AC_SUBST(MOD_UPDIR)dnl
1181 ])dnl
1182
1183
1184 dnl EGG_REPLACE_IF_CHANGED(FILE-NAME, CONTENTS-CMDS, INIT-CMDS)
1185 dnl
1186 dnl Replace FILE-NAME if the newly created contents differs from the existing
1187 dnl file contents. Otherwise leave the file allone. This avoids needless
1188 dnl recompiles.
1189 dnl
1190 define(EGG_REPLACE_IF_CHANGED, [dnl
1191 AC_OUTPUT_COMMANDS([
1192 egg_replace_file="$1"
1193 echo "creating $1"
1194 $2
1195 if test -f "$egg_replace_file" && cmp -s conftest.out $egg_replace_file
1196 then
1197 echo "$1 is unchanged"
1198 else
1199 mv conftest.out $egg_replace_file
1200 fi
1201 rm -f conftest.out], [$3])dnl
1202 ])dnl
1203
1204
1205 dnl EGG_TCL_LUSH()
1206 dnl
1207 AC_DEFUN(EGG_TCL_LUSH, [dnl
1208 EGG_REPLACE_IF_CHANGED(lush.h, [
1209 cat > conftest.out << EGGEOF
1210 /* Ignore me but do not erase me. I am a kludge. */
1211
1212 #include "$egg_tclinc/$egg_tclincfn"
1213 EGGEOF], [
1214 egg_tclinc="$TCLINC"
1215 egg_tclincfn="$TCLINCFN"])dnl
1216 ])dnl
1217
1218
1219 dnl EGG_CATCH_MAKEFILE_REBUILD()
1220 dnl
1221 AC_DEFUN(EGG_CATCH_MAKEFILE_REBUILD, [dnl
1222 AC_OUTPUT_COMMANDS([
1223 if test -f .modules
1224 then
1225 $ac_given_srcdir/misc/modconfig --top_srcdir="$ac_given_srcdir" Makefile
1226 fi])
1227 ])dnl
1228
1229
1230 dnl EGG_SAVE_PARAMETERS()
1231 dnl
1232 AC_DEFUN(EGG_SAVE_PARAMETERS, [dnl
1233 dnl Normally, we shouldn't use this level as it's not intended for this
1234 dnl type of code, but there's no other way to run it before the main
1235 dnl parameter loop in configure.
1236 AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
1237 egg_ac_parameters="[$]*"
1238 AC_DIVERT_POP()dnl to NORMAL
1239 AC_SUBST(egg_ac_parameters)dnl
1240 ])dnl

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23