/[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.55 - (show annotations) (download)
Wed Oct 10 01:20:08 2001 UTC (17 years, 7 months ago) by ite
Branch: MAIN
CVS Tags: HEAD
Changes since 1.54: +1 -1 lines
FILE REMOVED
* Refactored the tree (especially src/modules.c) to use the libltdl
  wrapper. Modules are configured to be lt_dlopened or dl_preopened (if
  the system doesn't support shared libraries).
* Should compile modules on more SunOs environments and on Beos too.
* Libtoolized the package: modules and internal libraries build system
  more protable than ever.
* Wiped out old makefiles in favour of automake and Makefile.am's
  files.
* Misc cleanups.
* Updated bootstrap script
* Moved doc/AUTHORS to ./AUTHORS
* Updated config.guess and config.sub
* Changed misc/ to ./ temporairly
* Got rid of misc/modconfig, and more in general of the old module
  configuration stuff, in favor of an incoming ./configure parametrized
  choice.
* Moved configure macros from aclocal.m4 to acinclude.m4 since aclocal.m4
  is now generated by aclocal on bootstrap.
* Removed no more necessary macros like EGG_EXEEXT because of
  libltdl+automake power ;P
* Removed EGG_CHECK_LIBSAFE_SSCANF macro that wasn't necessary anymore
  after gettext support.
* Added preliminary EGG_DEBUG_OPTIONS macro.
* Heavily stripped EGG_CHECK_OS macro and got rid of some system
  specific defines that were dead because of libltdl.
* Updated .cvsignore files.
* Improved make dist target.
* make static is gone in favor of ./configure --disable-shared.
* make debug is gone in favor of future ./configure --with-debug
  options.
* Others targets are gone in favor of more GNU standard targets.
* Updated po/eggdrop.pot.
# Egglib is now compiled and linked in the core.
* Moved compress.mod's specific configure macros to the top configure script.
* Switched to gettext 0.10.40 and pre-gettextized the devel tree.

1 dnl aclocal.m4
2 dnl macros autoconf uses when building configure from configure.in
3 dnl
4 dnl $Id: aclocal.m4,v 1.54 2001/08/22 00:41:57 ite 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 AC_PROG_CC_WIN32
185 CC="$CC $WIN32FLAGS"
186 MOD_CC="$CC"
187 MOD_LD="$CC"
188 AC_MSG_CHECKING(for /usr/lib/binmode.o)
189 if test -r /usr/lib/binmode.o
190 then
191 AC_MSG_RESULT(yes)
192 LIBS="$LIBS /usr/lib/binmode.o"
193 else
194 AC_MSG_RESULT(no)
195 AC_MSG_WARN(Make sure the directory eggdrop is installed into is mounted in binary mode.)
196 fi
197 MOD_EXT=dll
198 AC_DEFINE(MODULES_OK)dnl
199 ;;
200 *)
201 NEED_DL=0
202 DEFAULT_MAKE=static
203 AC_MSG_WARN(Make sure the directory eggdrop is installed into is mounted in binary mode.)
204 ;;
205 esac
206 ;;
207 HP-UX)
208 HPUX=yes
209 MOD_LD="$CC -fPIC -shared"
210 SHLIB_CC="$CC -fPIC"
211 SHLIB_LD="ld -b"
212 NEED_DL=0
213 AC_DEFINE(MODULES_OK)dnl
214 AC_DEFINE(HPUX_HACKS)dnl
215 if test "`echo $egg_cv_var_system_release | cut -d . -f 2`" = "10"
216 then
217 AC_DEFINE(HPUX10_HACKS)dnl
218 fi
219 ;;
220 dell)
221 AC_MSG_RESULT(Dell SVR4)
222 SHLIB_STRIP=touch
223 NEED_DL=0
224 MOD_LD="$CC -lelf -lucb"
225 ;;
226 IRIX)
227 SHLIB_LD="ld -n32 -shared -rdata_shared"
228 IRIX=yes
229 SHLIB_STRIP=touch
230 NEED_DL=0
231 DEFAULT_MAKE=static
232 ;;
233 Ultrix)
234 NEED_DL=0
235 SHLIB_STRIP=touch
236 DEFAULT_MAKE=static
237 SHELL=/bin/sh5
238 ;;
239 SINIX*)
240 NEED_DL=0
241 SHLIB_STRIP=touch
242 DEFAULT_MAKE=static
243 SHLIB_CC="cc -G"
244 ;;
245 BeOS)
246 NEED_DL=0
247 SHLIB_STRIP=strip
248 DEFAULT_MAKE=static
249 ;;
250 Linux)
251 LINUX=yes
252 CFLAGS="$CFLAGS -Wall"
253 MOD_LD="$CC"
254 SHLIB_CC="$CC -fPIC"
255 SHLIB_LD="$CC -shared -nostartfiles"
256 AC_DEFINE(MODULES_OK)dnl
257 ;;
258 Lynx)
259 NEED_DL=0
260 DEFAULT_MAKE=static
261 SHLIB_STRIP=strip
262 ;;
263 QNX)
264 NEED_DL=0
265 DEFAULT_MAKE=static
266 SHLIB_LD="ld -shared"
267 SHLIB_STRIP=strip
268 ;;
269 OSF1)
270 case "`echo $egg_cv_var_system_release | cut -d . -f 1`" in
271 V*)
272 # FIXME: we should check this in a seperate test
273 # Digital OSF uses an ancient version of gawk
274 if test "$AWK" = "gawk"
275 then
276 AWK=awk
277 fi
278 MOD_CC=cc
279 MOD_LD=cc
280 SHLIB_CC=cc
281 SHLIB_LD="ld -shared -expect_unresolved \"'*'\""
282 SHLIB_STRIP=touch
283 AC_DEFINE(MODULES_OK)dnl
284 ;;
285 1.0|1.1|1.2)
286 SHLIB_LD="ld -R -export $@:"
287 AC_DEFINE(MODULES_OK)dnl
288 AC_DEFINE(OSF1_HACKS)dnl
289 ;;
290 1.*)
291 SHLIB_CC="$CC -fpic"
292 SHLIB_LD="ld -shared"
293 AC_DEFINE(MODULES_OK)dnl
294 AC_DEFINE(OSF1_HACKS)dnl
295 ;;
296 *)
297 NEED_DL=0
298 DEFAULT_MAKE=static
299 ;;
300 esac
301 AC_DEFINE(STOP_UAC)dnl
302 ;;
303 SunOS)
304 if test "`echo $egg_cv_var_system_release | cut -d . -f 1`" = "5"
305 then
306 # Solaris
307 if test -n "$GCC"
308 then
309 SHLIB_CC="$CC -fPIC"
310 SHLIB_LD="$CC"
311 else
312 SHLIB_CC="$CC -KPIC"
313 SHLIB_LD="$CC -G -z text"
314 fi
315 else
316 # SunOS 4
317 SUNOS=yes
318 SHLIB_LD=ld
319 SHLIB_CC="$CC -PIC"
320 AC_DEFINE(DLOPEN_1)dnl
321 fi
322 AC_DEFINE(MODULES_OK)dnl
323 ;;
324 *BSD)
325 # FreeBSD/OpenBSD/NetBSD
326 SHLIB_CC="$CC -fPIC"
327 SHLIB_LD="ld -Bshareable -x"
328 AC_DEFINE(MODULES_OK)dnl
329 ;;
330 *)
331 AC_MSG_CHECKING(if system is Mach based)
332 if test -r /mach
333 then
334 AC_MSG_RESULT(yes)
335 NEED_DL=0
336 DEFAULT_MAKE=static
337 AC_DEFINE(BORGCUBES)dnl
338 else
339 AC_MSG_RESULT(no)
340 AC_MSG_CHECKING(if system is QNX)
341 if test -r /cmds
342 then
343 AC_MSG_RESULT(yes)
344 SHLIB_STRIP=touch
345 NEED_DL=0
346 DEFAULT_MAKE=static
347 else
348 AC_MSG_RESULT(no)
349 AC_MSG_RESULT(Something unknown!)
350 AC_MSG_RESULT([If you get dynamic modules to work, be sure to let the devel team know HOW :)])
351 NEED_DL=0
352 DEFAULT_MAKE=static
353 fi
354 fi
355 ;;
356 esac
357 AC_SUBST(MOD_LD)dnl
358 AC_SUBST(MOD_CC)dnl
359 AC_SUBST(MOD_STRIP)dnl
360 AC_SUBST(SHLIB_LD)dnl
361 AC_SUBST(SHLIB_CC)dnl
362 AC_SUBST(SHLIB_STRIP)dnl
363 AC_SUBST(DEFAULT_MAKE)dnl
364 AC_SUBST(MOD_EXT)dnl
365 AC_DEFINE_UNQUOTED(EGG_MOD_EXT, "$MOD_EXT")dnl
366 ])dnl
367
368
369 dnl EGG_CHECK_LIBS()
370 dnl
371 AC_DEFUN(EGG_CHECK_LIBS, [dnl
372 # FIXME: this needs to be fixed so that it works on IRIX
373 if test "$IRIX" = "yes"
374 then
375 AC_MSG_WARN(Skipping library tests because they CONFUSE Irix.)
376 else
377 AC_CHECK_LIB(socket, socket)
378 AC_CHECK_LIB(nsl, connect)
379 AC_CHECK_LIB(dns, gethostbyname)
380 AC_CHECK_LIB(dl, dlopen)
381 AC_CHECK_LIB(m, tan, EGG_MATH_LIB="-lm")
382 # This is needed for Tcl libraries compiled with thread support
383 AC_CHECK_LIB(pthread, pthread_mutex_init, [dnl
384 ac_cv_lib_pthread_pthread_mutex_init=yes
385 ac_cv_lib_pthread="-lpthread"], [dnl
386 AC_CHECK_LIB(pthread, __pthread_mutex_init, [dnl
387 ac_cv_lib_pthread_pthread_mutex_init=yes
388 ac_cv_lib_pthread="-lpthread"], [dnl
389 AC_CHECK_LIB(pthreads, pthread_mutex_init, [dnl
390 ac_cv_lib_pthread_pthread_mutex_init=yes
391 ac_cv_lib_pthread="-lpthreads"], [dnl
392 AC_CHECK_FUNC(pthread_mutex_init, [dnl
393 ac_cv_lib_pthread_pthread_mutex_init=yes
394 ac_cv_lib_pthread=""],
395 ac_cv_lib_pthread_pthread_mutex_init=no)])])])
396 if test "$SUNOS" = "yes"
397 then
398 # For suns without yp or something like that
399 AC_CHECK_LIB(dl, main)
400 else
401 if test "$HPUX" = "yes"
402 then
403 AC_CHECK_LIB(dld, shl_load)
404 fi
405 fi
406 fi
407 ])dnl
408
409
410 dnl EGG_CHECK_FUNC_VSPRINTF()
411 dnl
412 AC_DEFUN(EGG_CHECK_FUNC_VSPRINTF, [dnl
413 AC_CHECK_FUNCS(vsprintf)
414 if test "$ac_cv_func_vsprintf" = "no"
415 then
416 cat << 'EOF' >&2
417 configure: error:
418
419 Your system does not have the sprintf/vsprintf libraries.
420 These are required to compile almost anything. Sorry.
421
422 EOF
423 exit 1
424 fi
425 ])dnl
426
427
428 dnl EGG_HEADER_STDC()
429 dnl
430 AC_DEFUN(EGG_HEADER_STDC, [dnl
431 if test "$ac_cv_header_stdc" = "no"
432 then
433 cat << 'EOF' >&2
434 configure: error:
435
436 Your system must support ANSI C Header files.
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 "$ac_cv_cygwin" = "yes"
1043 then
1044 TCL_REQS="$TCLLIB/lib$TCLLIBFN"
1045 TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB"
1046 else
1047 if test ! "$TCLLIBEXT" = ".a"
1048 then
1049 TCL_REQS="$TCLLIB/lib$TCLLIBFN"
1050 TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB"
1051 else
1052
1053 # Set default make as static for unshared Tcl library
1054 if test ! "$DEFAULT_MAKE" = "static"
1055 then
1056 cat << 'EOF' >&2
1057 configure: warning:
1058
1059 Your Tcl library is not a shared lib.
1060 configure will now set default make type to static...
1061
1062 EOF
1063 DEFAULT_MAKE=static
1064 AC_SUBST(DEFAULT_MAKE)dnl
1065 fi
1066
1067 # Are we using a pre 7.4 Tcl version ?
1068 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"}'`
1069 if test "$TCL_VER_PRE74" = "no"
1070 then
1071
1072 # Was the --with-tcllib option given ?
1073 if test ! "${tcllibname-x}" = "x"
1074 then
1075 TCL_REQS="$TCLLIB/lib$TCLLIBFN"
1076 TCL_LIBS="$TCLLIB/lib$TCLLIBFN $EGG_MATH_LIB"
1077 else
1078 TCL_REQS="$TCLLIB/lib$TCLLIBFN"
1079 TCL_LIBS="-L$TCLLIB -l$TCLLIBFNS $EGG_MATH_LIB"
1080 fi
1081 else
1082 cat << EOF >&2
1083 configure: warning:
1084
1085 Your Tcl version ($egg_cv_var_tcl_version) is older then 7.4.
1086 There are known problems, but we will attempt to work around them.
1087
1088 EOF
1089 TCL_REQS="libtcle.a"
1090 TCL_LIBS="-L`pwd` -ltcle $EGG_MATH_LIB"
1091 fi
1092 fi
1093 fi
1094 AC_SUBST(TCL_REQS)dnl
1095 AC_SUBST(TCL_LIBS)dnl
1096 ])dnl
1097
1098
1099 dnl EGG_FUNC_DLOPEN()
1100 dnl
1101 AC_DEFUN(EGG_FUNC_DLOPEN, [dnl
1102 if test "$NEED_DL" = 1 && test "$ac_cv_func_dlopen" = "no"
1103 then
1104 if test "$LINUX" = "yes"
1105 then
1106 cat << 'EOF' >&2
1107 configure: warning:
1108
1109 Since you are on a Linux system, this has a known problem...
1110 I know a kludge for it,
1111 EOF
1112
1113 if test -r "/lib/libdl.so.1"
1114 then
1115 cat << 'EOF' >&2
1116 and you seem to have it, so we'll do that...
1117
1118 EOF
1119 AC_DEFINE(HAVE_DLOPEN)dnl
1120 LIBS="/lib/libdl.so.1 $LIBS"
1121 else
1122 cat << 'EOF' >&2
1123 which you DON'T seem to have... doh!
1124 perhaps you may still have the stuff lying around somewhere
1125 if you work out where it is, add it to your XLIBS= lines
1126 and #define HAVE_DLOPEN in config.h
1127
1128 we'll proceed on anyway, but you probably won't be able
1129 to 'make eggdrop' but you might be able to make the
1130 static bot (I'll default your make to this version).
1131
1132 EOF
1133 DEFAULT_MAKE=static
1134 fi
1135 else
1136 cat << 'EOF' >&2
1137 configure: warning:
1138
1139 You don't seem to have libdl anywhere I can find it, this will
1140 prevent you from doing dynamic modules, I'll set your default
1141 make to static linking.
1142
1143 EOF
1144 DEFAULT_MAKE=static
1145 fi
1146 fi
1147 ])dnl
1148
1149
1150 dnl EGG_SUBST_MOD_UPDIR()
1151 dnl
1152 dnl Since module's Makefiles aren't generated by configure, some
1153 dnl paths in src/mod/Makefile.in take care of them. For correct
1154 dnl path "calculation", we need to keep absolute paths in mind
1155 dnl (which don't need a "../" pre-pended).
1156 AC_DEFUN(EGG_SUBST_MOD_UPDIR, [dnl
1157 case "$srcdir" in
1158 [[\\/]]* | ?:[[\\/]]*)
1159 MOD_UPDIR=""
1160 ;;
1161 *)
1162 MOD_UPDIR="../"
1163 ;;
1164 esac
1165 AC_SUBST(MOD_UPDIR)dnl
1166 ])dnl
1167
1168
1169 dnl EGG_REPLACE_IF_CHANGED(FILE-NAME, CONTENTS-CMDS, INIT-CMDS)
1170 dnl
1171 dnl Replace FILE-NAME if the newly created contents differs from the existing
1172 dnl file contents. Otherwise leave the file allone. This avoids needless
1173 dnl recompiles.
1174 dnl
1175 define(EGG_REPLACE_IF_CHANGED, [dnl
1176 AC_OUTPUT_COMMANDS([
1177 egg_replace_file="$1"
1178 echo "creating $1"
1179 $2
1180 if test -f "$egg_replace_file" && cmp -s conftest.out $egg_replace_file
1181 then
1182 echo "$1 is unchanged"
1183 else
1184 mv conftest.out $egg_replace_file
1185 fi
1186 rm -f conftest.out], [$3])dnl
1187 ])dnl
1188
1189
1190 dnl EGG_TCL_LUSH()
1191 dnl
1192 AC_DEFUN(EGG_TCL_LUSH, [dnl
1193 EGG_REPLACE_IF_CHANGED(lush.h, [
1194 cat > conftest.out << EGGEOF
1195 /* Ignore me but do not erase me. I am a kludge. */
1196
1197 #include "$egg_tclinc/$egg_tclincfn"
1198 EGGEOF], [
1199 egg_tclinc="$TCLINC"
1200 egg_tclincfn="$TCLINCFN"])dnl
1201 ])dnl
1202
1203
1204 dnl EGG_CATCH_MAKEFILE_REBUILD()
1205 dnl
1206 AC_DEFUN(EGG_CATCH_MAKEFILE_REBUILD, [dnl
1207 AC_OUTPUT_COMMANDS([
1208 if test -f .modules
1209 then
1210 $ac_given_srcdir/misc/modconfig --top_srcdir="$ac_given_srcdir" Makefile
1211 fi])
1212 ])dnl
1213
1214
1215 dnl EGG_SAVE_PARAMETERS()
1216 dnl
1217 AC_DEFUN(EGG_SAVE_PARAMETERS, [dnl
1218 dnl Normally, we shouldn't use this level as it's not intended for this
1219 dnl type of code, but there's no other way to run it before the main
1220 dnl parameter loop in configure.
1221 ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
1222 [AC_DIVERT_PUSH(NOTICE)])dnl
1223 egg_ac_parameters="[$]*"
1224 AC_DIVERT_POP()dnl to NORMAL
1225 AC_SUBST(egg_ac_parameters)dnl
1226 ])dnl
1227
1228 AC_DEFUN([AC_PROG_CC_WIN32], [
1229 AC_MSG_CHECKING([how to access the Win32 API])
1230 WIN32FLAGS=
1231 AC_TRY_COMPILE(,[
1232 #ifndef WIN32
1233 # ifndef _WIN32
1234 # error WIN32 or _WIN32 not defined
1235 # endif
1236 #endif], [
1237 dnl found windows.h with the current config.
1238 AC_MSG_RESULT([present by default])
1239 ], [
1240 dnl try -mwin32
1241 ac_compile_save="$ac_compile"
1242 dnl we change CC so config.log looks correct
1243 save_CC="$CC"
1244 ac_compile="$ac_compile -mwin32"
1245 CC="$CC -mwin32"
1246 AC_TRY_COMPILE(,[
1247 #ifndef WIN32
1248 # ifndef _WIN32
1249 # error WIN32 or _WIN32 not defined
1250 # endif
1251 #endif], [
1252 dnl found windows.h using -mwin32
1253 AC_MSG_RESULT([found via -mwin32])
1254 ac_compile="$ac_compile_save"
1255 CC="$save_CC"
1256 WIN32FLAGS="-mwin32"
1257 ], [
1258 ac_compile="$ac_compile_save"
1259 CC="$save_CC"
1260 AC_MSG_RESULT([not found])
1261 ])
1262 ])
1263
1264 ])
1265 dnl
1266
1267
1268 dnl EGG_ENABLE_IPV6()
1269 dnl
1270 AC_DEFUN(EGG_ENABLE_IPV6, [dnl
1271 AC_MSG_CHECKING(whether you enabled IPv6 support)
1272 AC_ARG_ENABLE(ipv6,
1273 [ --enable-ipv6 Enable IPV6 support.
1274 --disable-ipv6 Disable IPV6 support. ],
1275 [ ac_cv_ipv6=$enableval
1276 AC_MSG_RESULT($ac_cv_ipv6)
1277 ], [
1278 if test "x$egg_cv_ipv6_supported" = "xyes"; then
1279 ac_cv_ipv6='yes'
1280 else
1281 ac_cv_ipv6='no'
1282 fi
1283 AC_MSG_RESULT((default) $ac_cv_ipv6)
1284 ])
1285 if test "$ac_cv_ipv6" = "yes" ; then
1286 AC_DEFINE(IPV6)
1287 fi
1288 ])dnl
1289
1290
1291 dnl EGG_TYPE_SOCKLEN_T
1292 dnl
1293 AC_DEFUN(EGG_TYPE_SOCKLEN_T, [dnl
1294 AC_CACHE_CHECK(for socklen_t, egg_cv_var_socklen_t, [
1295 AC_TRY_COMPILE([#include <sys/param.h>
1296 #include <sys/socket.h>
1297 #include <sys/types.h>
1298 ], [
1299 socklen_t x;
1300 x = 0;
1301 ], egg_cv_var_socklen_t="yes", egg_cv_var_socklen_t="no")
1302 ])
1303 if test "$egg_cv_var_socklen_t" = "no"
1304 then
1305 AC_DEFINE(socklen_t, unsigned)dnl
1306 fi
1307 ])dnl
1308
1309
1310 dnl EGG_INADDR_LOOPBACK
1311 dnl
1312 AC_DEFUN(EGG_INADDR_LOOPBACK, [dnl
1313 AC_MSG_CHECKING(for INADDR_LOOPBACK)
1314 AC_CACHE_VAL(adns_cv_decl_inaddrloopback,[
1315 AC_TRY_COMPILE([
1316 #include <sys/socket.h>
1317 #include <netinet/in.h>
1318 #include <arpa/inet.h>
1319 ],[
1320 INADDR_LOOPBACK;
1321 ],
1322 adns_cv_decl_inaddrloopback=yes,
1323 adns_cv_decl_inaddrloopback=no)])
1324 if test "$adns_cv_decl_inaddrloopback" = yes; then
1325 AC_MSG_RESULT(found)
1326 else
1327 AC_MSG_RESULT([not in standard headers, urgh...])
1328 AC_CHECK_HEADER(rpc/types.h,[
1329 AC_DEFINE(HAVEUSE_RPCTYPES_H)
1330 ],[
1331 AC_MSG_ERROR([cannot find INADDR_LOOPBACK or rpc/types.h])
1332 ])
1333 fi
1334 ])dnl
1335
1336 dnl EGG_IPV6_SUPPORTED
1337 dnl
1338 AC_DEFUN(EGG_IPV6_SUPPORTED, [dnl
1339 AC_MSG_CHECKING(for kernel IPv6 support)
1340 AC_CACHE_VAL(egg_cv_ipv6_supported,[
1341 AC_TRY_RUN([
1342 #include <fcntl.h>
1343 #include <sys/socket.h>
1344 #include <sys/types.h>
1345 #include <netinet/in.h>
1346 #include <unistd.h>
1347 #include <errno.h>
1348 #include <stdio.h>
1349
1350 int main()
1351 {
1352 struct sockaddr_in6 sin6;
1353 int s = socket(AF_INET6, SOCK_STREAM, 0);
1354 if (s != -1)
1355 close(s);
1356 return s == -1;
1357 }
1358 ], egg_cv_ipv6_supported=yes, egg_cv_ipv6_supported=no,
1359 egg_cv_ipv6_supported=no)])
1360 if test "$egg_cv_ipv6_supported" = yes; then
1361 AC_MSG_RESULT(yes)
1362 else
1363 AC_MSG_RESULT(no)
1364 fi
1365 ])dnl
1366
1367 dnl EGG_DEFINE_VERSION_NUM
1368 dnl
1369 AC_DEFUN(EGG_DEFINE_VERSION_NUM, [dnl
1370 egg_version_num=`echo $VERSION | $AWK 'BEGIN {FS = "."} {printf("%d%02d%02d00", [$]1, [$]2, [$]3)}'`
1371 AC_DEFINE_UNQUOTED(VERSION_NUM, $egg_version_num)
1372 ])dnl
1373
1374 dnl EGG_GNU_GETTEXT
1375 dnl
1376 AC_DEFUN(EGG_GNU_GETTEXT, [dnl
1377 AC_MSG_CHECKING(for avaible translations)
1378 ALL_LINGUAS=""
1379 cd po
1380 for LOC in `ls *.po 2> /dev/null`; do
1381 ALL_LINGUAS="$ALL_LINGUAS `echo $LOC | awk 'BEGIN {FS = "."} {printf("%s", [$]1)}'`"
1382 done
1383 cd ..
1384 AC_MSG_RESULT($ALL_LINGUAS)
1385
1386 AM_GNU_GETTEXT
1387 ])dnl
1388
1389 #serial AM1
1390
1391 dnl From Bruno Haible.
1392
1393 AC_DEFUN([AM_LANGINFO_CODESET],
1394 [
1395 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
1396 [AC_TRY_LINK([#include <langinfo.h>],
1397 [char* cs = nl_langinfo(CODESET);],
1398 am_cv_langinfo_codeset=yes,
1399 am_cv_langinfo_codeset=no)
1400 ])
1401 if test $am_cv_langinfo_codeset = yes; then
1402 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
1403 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
1404 fi
1405 ])
1406 # Macro to add for using GNU gettext.
1407 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1408 #
1409 # This file can be copied and used freely without restrictions. It can
1410 # be used in projects which are not available under the GNU General Public
1411 # License but which still want to provide support for the GNU gettext
1412 # functionality.
1413 # Please note that the actual code of GNU gettext is covered by the GNU
1414 # General Public License and is *not* in the public domain.
1415
1416 # serial 10
1417
1418 dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
1419 dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
1420 dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
1421 dnl depending on --{enable,disable}-{shared,static} and on the presence of
1422 dnl AM-DISABLE-SHARED). Otherwise, a static library
1423 dnl $(top_builddir)/intl/libintl.a will be created.
1424 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
1425 dnl implementations (in libc or libintl) without the ngettext() function
1426 dnl will be ignored.
1427 dnl LIBDIR is used to find the intl libraries. If empty,
1428 dnl the value `$(top_builddir)/intl/' is used.
1429 dnl
1430 dnl The result of the configuration is one of three cases:
1431 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
1432 dnl and used.
1433 dnl Catalog format: GNU --> install in $(datadir)
1434 dnl Catalog extension: .mo after installation, .gmo in source tree
1435 dnl 2) GNU gettext has been found in the system's C library.
1436 dnl Catalog format: GNU --> install in $(datadir)
1437 dnl Catalog extension: .mo after installation, .gmo in source tree
1438 dnl 3) No internationalization, always use English msgid.
1439 dnl Catalog format: none
1440 dnl Catalog extension: none
1441 dnl The use of .gmo is historical (it was needed to avoid overwriting the
1442 dnl GNU format catalogs when building on a platform with an X/Open gettext),
1443 dnl but we keep it in order not to force irrelevant filename changes on the
1444 dnl maintainers.
1445 dnl
1446 AC_DEFUN([AM_WITH_NLS],
1447 [AC_MSG_CHECKING([whether NLS is requested])
1448 dnl Default is enabled NLS
1449 AC_ARG_ENABLE(nls,
1450 [ --disable-nls do not use Native Language Support],
1451 USE_NLS=$enableval, USE_NLS=yes)
1452 AC_MSG_RESULT($USE_NLS)
1453 AC_SUBST(USE_NLS)
1454
1455 BUILD_INCLUDED_LIBINTL=no
1456 USE_INCLUDED_LIBINTL=no
1457 INTLLIBS=
1458
1459 dnl If we use NLS figure out what method
1460 if test "$USE_NLS" = "yes"; then
1461 AC_DEFINE(ENABLE_NLS, 1,
1462 [Define to 1 if translation of program messages to the user's native language
1463 is requested.])
1464 AC_MSG_CHECKING([whether included gettext is requested])
1465 AC_ARG_WITH(included-gettext,
1466 [ --with-included-gettext use the GNU gettext library included here],
1467 nls_cv_force_use_gnu_gettext=$withval,
1468 nls_cv_force_use_gnu_gettext=no)
1469 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
1470
1471 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
1472 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
1473 dnl User does not insist on using GNU NLS library. Figure out what
1474 dnl to use. If GNU gettext is available we use this. Else we have
1475 dnl to fall back to GNU NLS library.
1476 CATOBJEXT=NONE
1477
1478 dnl Add a version number to the cache macros.
1479 define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
1480 define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
1481
1482 AC_CHECK_HEADER(libintl.h,
1483 [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
1484 [AC_TRY_LINK([#include <libintl.h>
1485 extern int _nl_msg_cat_cntr;],
1486 [bindtextdomain ("", "");
1487 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
1488 gt_cv_func_gnugettext_libc=yes,
1489 gt_cv_func_gnugettext_libc=no)])
1490
1491 if test "$gt_cv_func_gnugettext_libc" != "yes"; then
1492 AC_CACHE_CHECK([for GNU gettext in libintl],
1493 gt_cv_func_gnugettext_libintl,
1494 [gt_save_LIBS="$LIBS"
1495 LIBS="$LIBS -lintl $LIBICONV"
1496 AC_TRY_LINK([#include <libintl.h>
1497 extern int _nl_msg_cat_cntr;],
1498 [bindtextdomain ("", "");
1499 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
1500 gt_cv_func_gnugettext_libintl=yes,
1501 gt_cv_func_gnugettext_libintl=no)
1502 LIBS="$gt_save_LIBS"])
1503 fi
1504
1505 dnl If an already present or preinstalled GNU gettext() is found,
1506 dnl use it. But if this macro is used in GNU gettext, and GNU
1507 dnl gettext is already preinstalled in libintl, we update this
1508 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
1509 if test "$gt_cv_func_gnugettext_libc" = "yes" \
1510 || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
1511 && test "$PACKAGE" != gettext; }; then
1512 AC_DEFINE(HAVE_GETTEXT, 1,
1513 [Define if the GNU gettext() function is already present or preinstalled.])
1514
1515 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
1516 dnl If iconv() is in a separate libiconv library, then anyone
1517 dnl linking with libintl{.a,.so} also needs to link with
1518 dnl libiconv.
1519 INTLLIBS="-lintl $LIBICONV"
1520 fi
1521
1522 gt_save_LIBS="$LIBS"
1523 LIBS="$LIBS $INTLLIBS"
1524 AC_CHECK_FUNCS(dcgettext)
1525 LIBS="$gt_save_LIBS"
1526
1527 dnl Search for GNU msgfmt in the PATH.
1528 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1529 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
1530 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1531
1532 dnl Search for GNU xgettext in the PATH.
1533 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1534 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
1535
1536 CATOBJEXT=.gmo
1537 fi
1538 ])
1539
1540 if test "$CATOBJEXT" = "NONE"; then
1541 dnl GNU gettext is not found in the C library.
1542 dnl Fall back on GNU gettext library.
1543 nls_cv_use_gnu_gettext=yes
1544 fi
1545 fi
1546
1547 if test "$nls_cv_use_gnu_gettext" = "yes"; then
1548 dnl Mark actions used to generate GNU NLS library.
1549 INTLOBJS="\$(GETTOBJS)"
1550 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
1551 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1], :)
1552 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
1553 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
1554 [$ac_dir/$ac_word --omit-header /dev/null >/dev/null 2>&1], :)
1555 AC_SUBST(MSGFMT)
1556 BUILD_INCLUDED_LIBINTL=yes
1557 USE_INCLUDED_LIBINTL=yes
1558 CATOBJEXT=.gmo
1559 INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
1560 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
1561 fi
1562
1563 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1564 dnl Test whether we really found GNU msgfmt.
1565 if test "$GMSGFMT" != ":"; then
1566 dnl If it is no GNU msgfmt we define it as : so that the
1567 dnl Makefiles still can work.
1568 if $GMSGFMT --statistics /dev/null >/dev/null 2>&1; then
1569 : ;
1570 else
1571 AC_MSG_RESULT(
1572 [found msgfmt program is not GNU msgfmt; ignore it])
1573 GMSGFMT=":"
1574 fi
1575 fi
1576
1577 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
1578 dnl Test whether we really found GNU xgettext.
1579 if test "$XGETTEXT" != ":"; then
1580 dnl If it is no GNU xgettext we define it as : so that the
1581 dnl Makefiles still can work.
1582 if $XGETTEXT --omit-header /dev/null >/dev/null 2>&1; then
1583 : ;
1584 else
1585 AC_MSG_RESULT(
1586 [found xgettext program is not GNU xgettext; ignore it])
1587 XGETTEXT=":"
1588 fi
1589 fi
1590
1591 dnl We need to process the po/ directory.
1592 POSUB=po
1593 fi
1594 AC_OUTPUT_COMMANDS(
1595 [for ac_file in $CONFIG_FILES; do
1596 # Support "outfile[:infile[:infile...]]"
1597 case "$ac_file" in
1598 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
1599 esac
1600 # PO directories have a Makefile.in generated from Makefile.in.in.
1601 case "$ac_file" in */Makefile.in)
1602 # Adjust a relative srcdir.
1603 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
1604 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
1605 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
1606 # In autoconf-2.13 it is called $ac_given_srcdir.
1607 # In autoconf-2.50 it is called $srcdir.
1608 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
1609 case "$ac_given_srcdir" in
1610 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
1611 /*) top_srcdir="$ac_given_srcdir" ;;
1612 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
1613 esac
1614 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
1615 rm -f "$ac_dir/POTFILES"
1616 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
1617 sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
1618 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
1619 sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
1620 fi
1621 ;;
1622 esac
1623 done])
1624
1625
1626 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
1627 dnl to 'yes' because some of the testsuite requires it.
1628 if test "$PACKAGE" = gettext; then
1629 BUILD_INCLUDED_LIBINTL=yes
1630 fi
1631
1632 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
1633 dnl because plural.y uses bison specific features. It requires at least
1634 dnl bison-1.26 because earlier versions generate a plural.c that doesn't
1635 dnl compile.
1636 dnl bison is only needed for the maintainer (who touches plural.y). But in
1637 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
1638 dnl the rule in general Makefile. Now, some people carelessly touch the
1639 dnl files or have a broken "make" program, hence the plural.c rule will
1640 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
1641 dnl present or too old.
1642 AC_CHECK_PROGS([INTLBISON], [bison])
1643 if test -z "$INTLBISON"; then
1644 ac_verc_fail=yes
1645 else
1646 dnl Found it, now check the version.
1647 AC_MSG_CHECKING([version of bison])
1648 changequote(<<,>>)dnl
1649 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison .* \([0-9]*\.[0-9.]*\).*$/\1/p'`
1650 case $ac_prog_version in
1651 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
1652 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
1653 changequote([,])dnl
1654 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
1655 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
1656 esac
1657 AC_MSG_RESULT([$ac_prog_version])
1658 fi
1659 if test $ac_verc_fail = yes; then
1660 INTLBISON=:
1661 fi
1662
1663 dnl These rules are solely for the distribution goal. While doing this
1664 dnl we only have to keep exactly one list of the available catalogs
1665 dnl in configure.in.
1666 for lang in $ALL_LINGUAS; do
1667 GMOFILES="$GMOFILES $lang.gmo"
1668 POFILES="$POFILES $lang.po"
1669 done
1670
1671 dnl Make all variables we use known to autoconf.
1672 AC_SUBST(BUILD_INCLUDED_LIBINTL)
1673 AC_SUBST(USE_INCLUDED_LIBINTL)
1674 AC_SUBST(CATALOGS)
1675 AC_SUBST(CATOBJEXT)
1676 AC_SUBST(GMOFILES)
1677 AC_SUBST(INTLLIBS)
1678 AC_SUBST(INTLOBJS)
1679 AC_SUBST(POFILES)
1680 AC_SUBST(POSUB)
1681
1682 dnl For backward compatibility. Some configure.ins may be using this.
1683 nls_cv_header_intl=
1684 nls_cv_header_libgt=
1685
1686 dnl For backward compatibility. Some Makefiles may be using this.
1687 DATADIRNAME=share
1688 AC_SUBST(DATADIRNAME)
1689
1690 dnl For backward compatibility. Some Makefiles may be using this.
1691 INSTOBJEXT=.mo
1692 AC_SUBST(INSTOBJEXT)
1693
1694 dnl For backward compatibility. Some Makefiles may be using this.
1695 GENCAT=gencat
1696 AC_SUBST(GENCAT)
1697 ])
1698
1699 dnl Usage: Just like AM_WITH_NLS, which see.
1700 AC_DEFUN([AM_GNU_GETTEXT],
1701 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1702 AC_REQUIRE([AC_PROG_CC])dnl
1703 AC_REQUIRE([AC_CANONICAL_HOST])dnl
1704 AC_REQUIRE([AC_PROG_RANLIB])dnl
1705 AC_REQUIRE([AC_ISC_POSIX])dnl
1706 AC_REQUIRE([AC_HEADER_STDC])dnl
1707 AC_REQUIRE([AC_C_CONST])dnl
1708 AC_REQUIRE([AC_C_INLINE])dnl
1709 AC_REQUIRE([AC_TYPE_OFF_T])dnl
1710 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1711 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1712 AC_REQUIRE([AC_FUNC_MMAP])dnl
1713 AC_REQUIRE([jm_GLIBC21])dnl
1714
1715 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
1716 stdlib.h string.h unistd.h sys/param.h])
1717 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
1718 getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
1719 strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
1720
1721 AM_ICONV
1722 AM_LANGINFO_CODESET
1723 AM_LC_MESSAGES
1724 AM_WITH_NLS([$1],[$2],[$3])
1725
1726 if test "x$CATOBJEXT" != "x"; then
1727 if test "x$ALL_LINGUAS" = "x"; then
1728 LINGUAS=
1729 else
1730 AC_MSG_CHECKING(for catalogs to be installed)
1731 NEW_LINGUAS=
1732 for presentlang in $ALL_LINGUAS; do
1733 useit=no
1734 for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
1735 # Use the presentlang catalog if desiredlang is
1736 # a. equal to presentlang, or
1737 # b. a variant of presentlang (because in this case,
1738 # presentlang can be used as a fallback for messages
1739 # which are not translated in the desiredlang catalog).
1740 case "$desiredlang" in
1741 "$presentlang"*) useit=yes;;
1742 esac
1743 done
1744 if test $useit = yes; then
1745 NEW_LINGUAS="$NEW_LINGUAS $presentlang"
1746 fi
1747 done
1748 LINGUAS=$NEW_LINGUAS
1749 AC_MSG_RESULT($LINGUAS)
1750 fi
1751
1752 dnl Construct list of names of catalog files to be constructed.
1753 if test -n "$LINGUAS"; then
1754 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
1755 fi
1756 fi
1757
1758 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
1759 dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
1760 dnl Try to locate is.
1761 MKINSTALLDIRS=
1762 if test -n "$ac_aux_dir"; then
1763 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
1764 fi
1765 if test -z "$MKINSTALLDIRS"; then
1766 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
1767 fi
1768 AC_SUBST(MKINSTALLDIRS)
1769
1770 dnl Enable libtool support if the surrounding package wishes it.
1771 INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
1772 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
1773 ])
1774 #serial 2
1775
1776 # Test for the GNU C Library, version 2.1 or newer.
1777 # From Bruno Haible.
1778
1779 AC_DEFUN([jm_GLIBC21],
1780 [
1781 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
1782 ac_cv_gnu_library_2_1,
1783 [AC_EGREP_CPP([Lucky GNU user],
1784 [
1785 #include <features.h>
1786 #ifdef __GNU_LIBRARY__
1787 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
1788 Lucky GNU user
1789 #endif
1790 #endif
1791 ],
1792 ac_cv_gnu_library_2_1=yes,
1793 ac_cv_gnu_library_2_1=no)
1794 ]
1795 )
1796 AC_SUBST(GLIBC21)
1797 GLIBC21="$ac_cv_gnu_library_2_1"
1798 ]
1799 )
1800 #serial AM2
1801
1802 dnl From Bruno Haible.
1803
1804 AC_DEFUN([AM_ICONV],
1805 [
1806 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
1807 dnl those with the standalone portable GNU libiconv installed).
1808
1809 AC_ARG_WITH([libiconv-prefix],
1810 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
1811 for dir in `echo "$withval" | tr : ' '`; do
1812 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
1813 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
1814 done
1815 ])
1816
1817 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
1818 am_cv_func_iconv="no, consider installing GNU libiconv"
1819 am_cv_lib_iconv=no
1820 AC_TRY_LINK([#include <stdlib.h>
1821 #include <iconv.h>],
1822 [iconv_t cd = iconv_open("","");
1823 iconv(cd,NULL,NULL,NULL,NULL);
1824 iconv_close(cd);],
1825 am_cv_func_iconv=yes)
1826 if test "$am_cv_func_iconv" != yes; then
1827 am_save_LIBS="$LIBS"
1828 LIBS="$LIBS -liconv"
1829 AC_TRY_LINK([#include <stdlib.h>
1830 #include <iconv.h>],
1831 [iconv_t cd = iconv_open("","");
1832 iconv(cd,NULL,NULL,NULL,NULL);
1833 iconv_close(cd);],
1834 am_cv_lib_iconv=yes
1835 am_cv_func_iconv=yes)
1836 LIBS="$am_save_LIBS"
1837 fi
1838 ])
1839 if test "$am_cv_func_iconv" = yes; then
1840 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
1841 AC_MSG_CHECKING([for iconv declaration])
1842 AC_CACHE_VAL(am_cv_proto_iconv, [
1843 AC_TRY_COMPILE([
1844 #include <stdlib.h>
1845 #include <iconv.h>
1846 extern
1847 #ifdef __cplusplus
1848 "C"
1849 #endif
1850 #if defined(__STDC__) || defined(__cplusplus)
1851 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
1852 #else
1853 size_t iconv();
1854 #endif
1855 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
1856 am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
1857 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
1858 AC_MSG_RESULT([$]{ac_t:-
1859 }[$]am_cv_proto_iconv)
1860 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
1861 [Define as const if the declaration of iconv() needs const.])
1862 fi
1863 LIBICONV=
1864 if test "$am_cv_lib_iconv" = yes; then
1865 LIBICONV="-liconv"
1866 fi
1867 AC_SUBST(LIBICONV)
1868 ])
1869 #serial 1
1870 # This test replaces the one in autoconf.
1871 # Currently this macro should have the same name as the autoconf macro
1872 # because gettext's gettext.m4 (distributed in the automake package)
1873 # still uses it. Otherwise, the use in gettext.m4 makes autoheader
1874 # give these diagnostics:
1875 # configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
1876 # configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
1877
1878 undefine([AC_ISC_POSIX])
1879
1880 AC_DEFUN([AC_ISC_POSIX],
1881 [
1882 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
1883 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
1884 ]
1885 )
1886 # Check whether LC_MESSAGES is available in <locale.h>.
1887 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1888 #
1889 # This file can be copied and used freely without restrictions. It can
1890 # be used in projects which are not available under the GNU General Public
1891 # License but which still want to provide support for the GNU gettext
1892 # functionality.
1893 # Please note that the actual code of GNU gettext is covered by the GNU
1894 # General Public License and is *not* in the public domain.
1895
1896 # serial 2
1897
1898 AC_DEFUN([AM_LC_MESSAGES],
1899 [if test $ac_cv_header_locale_h = yes; then
1900 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
1901 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1902 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
1903 if test $am_cv_val_LC_MESSAGES = yes; then
1904 AC_DEFINE(HAVE_LC_MESSAGES, 1,
1905 [Define if your <locale.h> file defines LC_MESSAGES.])
1906 fi
1907 fi])
1908 # Search path for a program which passes the given test.
1909 # Ulrich Drepper <drepper@cygnus.com>, 1996.
1910 #
1911 # This file can be copied and used freely without restrictions. It can
1912 # be used in projects which are not available under the GNU General Public
1913 # License but which still want to provide support for the GNU gettext
1914 # functionality.
1915 # Please note that the actual code of GNU gettext is covered by the GNU
1916 # General Public License and is *not* in the public domain.
1917
1918 # serial 2
1919
1920 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
1921 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1922 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
1923 [# Extract the first word of "$2", so it can be a program name with args.
1924 set dummy $2; ac_word=[$]2
1925 AC_MSG_CHECKING([for $ac_word])
1926 AC_CACHE_VAL(ac_cv_path_$1,
1927 [case "[$]$1" in
1928 /*)
1929 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
1930 ;;
1931 *)
1932 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
1933 for ac_dir in ifelse([$5], , $PATH, [$5]); do
1934 test -z "$ac_dir" && ac_dir=.
1935 if test -f $ac_dir/$ac_word; then
1936 if [$3]; then
1937 ac_cv_path_$1="$ac_dir/$ac_word"
1938 break
1939 fi
1940 fi
1941 done
1942 IFS="$ac_save_ifs"
1943 dnl If no 4th arg is given, leave the cache variable unset,
1944 dnl so AC_PATH_PROGS will keep looking.
1945 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
1946 ])dnl
1947 ;;
1948 esac])dnl
1949 $1="$ac_cv_path_$1"
1950 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
1951 AC_MSG_RESULT([$]$1)
1952 else
1953 AC_MSG_RESULT(no)
1954 fi
1955 AC_SUBST($1)dnl
1956 ])

webmaster@eggheads.org
ViewVC Help
Powered by ViewVC 1.1.23