/[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.38 - (show annotations) (download)
Mon Jun 25 04:34:03 2001 UTC (18 years, 4 months ago) by guppy
Branch: MAIN
Changes since 1.37: +1 -23 lines
I knew I had commit'd aclocal.m4 properly ... having two copies of the libsafe fixes in aclocal.m4 was bad .. hehe here I thought it was my bad coding

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

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23