]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blob - libares/aclocal.m4
need automake as a build-dep, even though we don't use most of it
[1ts-debian.git] / libares / aclocal.m4
1 dnl $Id$
2
3 dnl Copyright 1996 by the Massachusetts Institute of Technology.
4 dnl
5 dnl Permission to use, copy, modify, and distribute this
6 dnl software and its documentation for any purpose and without
7 dnl fee is hereby granted, provided that the above copyright
8 dnl notice appear in all copies and that both that copyright
9 dnl notice and this permission notice appear in supporting
10 dnl documentation, and that the name of M.I.T. not be used in
11 dnl advertising or publicity pertaining to distribution of the
12 dnl software without specific, written prior permission.
13 dnl M.I.T. makes no representations about the suitability of
14 dnl this software for any purpose.  It is provided "as is"
15 dnl without express or implied warranty.
16
17 dnl This file provides local macros for packages which use specific
18 dnl external libraries.  The public macros are:
19 dnl
20 dnl     ATHENA_UTIL_COM_ERR
21 dnl             Generates error if com_err not found.
22 dnl     ATHENA_UTIL_SS
23 dnl             Generates error if ss not found.
24 dnl     ATHENA_REGEXP
25 dnl             Sets REGEX_LIBS if rx library used; ensures POSIX
26 dnl             regexp support.
27 dnl     ATHENA_MOTIF
28 dnl             Sets MOTIF_LIBS and defines HAVE_MOTIF if Motif used.
29 dnl     ATHENA_MOTIF_REQUIRED
30 dnl             Generates error if Motif not found.
31 dnl     ATHENA_AFS
32 dnl             Sets AFS_LIBS and defines HAVE_AFS if AFS used.  Pass
33 dnl             in an argument giving the desired AFS libraries;
34 dnl             AFS_LIBS will be set to that value if AFS is found.
35 dnl             AFS_DIR will be set to the prefix given.
36 dnl     ATHENA_AFS_REQUIRED
37 dnl             Generates error if AFS libraries not found.  AFS_DIR
38 dnl             will be set to the prefix given.
39 dnl     ATHENA_KRB4
40 dnl             Sets KRB4_LIBS and defines HAVE_KRB4 if krb4 used.
41 dnl     ATHENA_KRB4_REQUIRED
42 dnl             Generates error if krb4 not found.  Sets KRB4_LIBS
43 dnl             otherwise.  (Special behavior because krb4 libraries
44 dnl             may be different if using krb4 compatibility libraries
45 dnl             from krb5.)
46 dnl     ATHENA_KRB5
47 dnl             Sets KRB5_LIBS and defines HAVE_KRB5 if krb5 used.
48 dnl     ATHENA_KRB5_REQUIRED
49 dnl             Generates error if krb5 not found.
50 dnl     ATHENA_HESIOD
51 dnl             Sets HESIOD_LIBS and defines HAVE_HESIOD if Hesiod
52 dnl             used.
53 dnl     ATHENA_HESIOD_REQUIRED
54 dnl             Generates error if Hesiod not found.
55 dnl     ATHENA_ARES
56 dnl             Sets ARES_LIBS and defines HAVE_ARES if libares
57 dnl             used.
58 dnl     ATHENA_ARES_REQUIRED
59 dnl             Generates error if libares not found.
60 dnl     ATHENA_ZEPHYR
61 dnl             Sets ZEPHYR_LIBS and defines HAVE_ZEPHYR if zephyr
62 dnl             used.
63 dnl     ATHENA_ZEPHYR_REQUIRED
64 dnl             Generates error if zephyr not found.
65 dnl
66 dnl All of the macros may extend CPPFLAGS and LDFLAGS to let the
67 dnl compiler find the requested libraries.  Put ATHENA_UTIL_COM_ERR
68 dnl and ATHENA_UTIL_SS before ATHENA_AFS or ATHENA_AFS_REQUIRED; there
69 dnl is a com_err library in the AFS libraries which requires -lutil.
70
71 dnl ----- com_err -----
72
73 AC_DEFUN(ATHENA_UTIL_COM_ERR,
74 [AC_ARG_WITH(com_err,
75         [  --with-com_err=PREFIX   Specify location of com_err],
76         [com_err="$withval"], [com_err=yes])
77 if test "$com_err" != no; then
78         if test "$com_err" != yes; then
79                 CPPFLAGS="$CPPFLAGS -I$com_err/include"
80                 LDFLAGS="$LDFLAGS -L$com_err/lib"
81         fi
82         AC_CHECK_LIB(com_err, com_err, :,
83                      [AC_MSG_ERROR(com_err library not found)])
84 else
85         AC_MSG_ERROR(This package requires com_err.)
86 fi])
87
88 dnl ----- ss -----
89
90 AC_DEFUN(ATHENA_UTIL_SS,
91 [AC_ARG_WITH(ss,
92         [  --with-ss=PREFIX        Specify location of ss (requires com_err)],
93         [ss="$withval"], [ss=yes])
94 if test "$ss" != no; then
95         if test "$ss" != yes; then
96                 CPPFLAGS="$CPPFLAGS -I$ss/include"
97                 LDFLAGS="$LDFLAGS -L$ss/lib"
98         fi
99         AC_CHECK_LIB(ss, ss_perror, :,
100                      [AC_MSG_ERROR(ss library not found)], -lcom_err)
101 else
102         AC_MSG_ERROR(This package requires ss.)
103 fi])
104
105 dnl ----- Regular expressions -----
106
107 AC_DEFUN(ATHENA_REGEXP,
108 [AC_ARG_WITH(regex,
109         [  --with-regex=PREFIX     Use installed regex library],
110         [regex="$withval"], [regex=no])
111 if test "$regex" != no; then
112         if test "$regex" != yes; then
113                 CPPFLAGS="$CPPFLAGS -I$regex/include"
114                 LDFLAGS="$LDFLAGS -L$regex/lib"
115         fi
116         AC_CHECK_LIB(regex, regcomp, REGEX_LIBS=-lregex,
117                      [AC_MSG_ERROR(regex library not found)])
118 else
119         AC_CHECK_FUNC(regcomp, :,
120                       [AC_MSG_ERROR(can't find POSIX regexp support)])
121 fi
122 AC_SUBST(REGEX_LIBS)])
123
124 dnl ----- Motif -----
125
126 AC_DEFUN(ATHENA_MOTIF_CHECK,
127 [if test "$motif" != yes; then
128         CPPFLAGS="$CPPFLAGS -I$motif/include"
129         LDFLAGS="$LDFLAGS -L$motif/lib"
130 fi
131 AC_CHECK_LIB(Xm, XmStringFree, :, [AC_MSG_ERROR(Motif library not found)])])
132
133 AC_DEFUN(ATHENA_MOTIF,
134 [AC_ARG_WITH(motif,
135         [  --with-motif=PREFIX     Use Motif],
136         [motif="$withval"], [motif=no])
137 if test "$motif" != no; then
138         ATHENA_MOTIF_CHECK
139         MOTIF_LIBS=-lXm
140         AC_DEFINE(HAVE_MOTIF)
141 fi
142 AC_SUBST(MOTIF_LIBS)])
143
144 AC_DEFUN(ATHENA_MOTIF_REQUIRED,
145 [AC_ARG_WITH(motif,
146         [  --with-motif=PREFIX     Specify location of Motif],
147         [motif="$withval"], [motif=yes])
148 if test "$motif" != no; then
149         ATHENA_MOTIF_CHECK
150 else
151         AC_MSG_ERROR(This package requires Motif.)
152 fi])
153
154 dnl ----- AFS -----
155
156 AC_DEFUN(ATHENA_AFS_CHECK,
157 [AC_CHECK_FUNC(insque, :, AC_CHECK_LIB(compat, insque))
158 AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
159 AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
160 if test "$afs" != yes; then
161         CPPFLAGS="$CPPFLAGS -I$afs/include"
162         LDFLAGS="$LDFLAGS -L$afs/lib -L$afs/lib/afs"
163 fi
164 AC_CHECK_LIB(sys, pioctl, :, [AC_MSG_ERROR(AFS libraries not found)],
165              -lrx -llwp -lsys)
166 AFS_DIR=$afs
167 AC_SUBST(AFS_DIR)])
168
169 dnl Specify desired AFS libraries as a parameter.
170 AC_DEFUN(ATHENA_AFS,
171 [AC_ARG_WITH(afs,
172         [  --with-afs=PREFIX       Use AFS libraries],
173         [afs="$withval"], [afs=no])
174 if test "$afs" != no; then
175         ATHENA_AFS_CHECK
176         AFS_LIBS=$1
177         AC_DEFINE(HAVE_AFS)
178 fi
179 AC_SUBST(AFS_LIBS)])
180
181 AC_DEFUN(ATHENA_AFS_REQUIRED,
182 [AC_ARG_WITH(afs,
183         [  --with-afs=PREFIX       Specify location of AFS libraries],
184         [afs="$withval"], [afs=/usr/afsws])
185 if test "$afs" != no; then
186         ATHENA_AFS_CHECK
187 else
188         AC_MSG_ERROR(This package requires AFS libraries.)
189 fi])
190
191 dnl ----- Kerberos 4 -----
192
193 AC_DEFUN(ATHENA_KRB4_CHECK,
194 [AC_CHECK_FUNC(gethostbyname, :, AC_CHECK_LIB(nsl, gethostbyname))
195 AC_CHECK_FUNC(socket, :, AC_CHECK_LIB(socket, socket))
196 AC_CHECK_LIB(gen, compile)
197 if test "$krb4" != yes; then
198         CPPFLAGS="$CPPFLAGS -I$krb4/include"
199         if test -d "$krb4/include/kerberosIV"; then
200                 CPPFLAGS="$CPPFLAGS -I$krb4/include/kerberosIV"
201         fi
202         LDFLAGS="$LDFLAGS -L$krb4/lib"
203 fi
204 AC_CHECK_LIB(krb4, krb_rd_req,
205              [KRB4_LIBS="-lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"],
206              [AC_CHECK_LIB(krb, krb_rd_req,
207                            [KRB4_LIBS="-lkrb -ldes"],
208                            [AC_MSG_ERROR(Kerberos 4 libraries not found)],
209                            -ldes)],
210              -ldes425 -lkrb5 -lk5crypto -lcom_err)])
211
212 AC_DEFUN(ATHENA_KRB4,
213 [AC_ARG_WITH(krb4,
214         [  --with-krb4=PREFIX      Use Kerberos 4],
215         [krb4="$withval"], [krb4=no])
216 if test "$krb4" != no; then
217         ATHENA_KRB4_CHECK
218         AC_DEFINE(HAVE_KRB4)
219 fi
220 AC_SUBST(KRB4_LIBS)])
221
222 AC_DEFUN(ATHENA_KRB4_REQUIRED,
223 [AC_ARG_WITH(krb4,
224         [  --with-krb4=PREFIX      Specify location of Kerberos 4],
225         [krb4="$withval"], [krb4=yes])
226 if test "$krb4" != no; then
227         ATHENA_KRB4_CHECK
228         AC_SUBST(KRB4_LIBS)
229 else
230         AC_MSG_ERROR(This package requires Kerberos 4.)
231 fi])
232
233 dnl ----- Kerberos 5 -----
234
235 AC_DEFUN(ATHENA_KRB5_CHECK,
236 [AC_SEARCH_LIBS(gethostbyname, nsl)
237 AC_SEARCH_LIBS(socket, socket)
238 AC_CHECK_LIB(gen, compile)
239 if test "$krb5" != yes; then
240         CPPFLAGS="$CPPFLAGS -I$krb5/include"
241         LDFLAGS="$LDFLAGS -L$krb5/lib"
242 fi
243 AC_CHECK_LIB(krb5, krb5_init_context, :,
244              [AC_MSG_ERROR(Kerberos 5 libraries not found)],
245              -lk5crypto -lcom_err)])
246
247 AC_DEFUN(ATHENA_KRB5,
248 [AC_ARG_WITH(krb5,
249         [  --with-krb5=PREFIX      Use Kerberos 5],
250         [krb5="$withval"], [krb5=no])
251 if test "$krb5" != no; then
252         ATHENA_KRB5_CHECK
253         KRB5_LIBS="-lkrb5 -lk5crypto -lcom_err"
254         AC_DEFINE(HAVE_KRB5)
255 fi
256 AC_SUBST(KRB5_LIBS)])
257
258 AC_DEFUN(ATHENA_KRB5_REQUIRED,
259 [AC_ARG_WITH(krb5,
260         [  --with-krb5=PREFIX      Specify location of Kerberos 5],
261         [krb5="$withval"], [krb5=yes])
262 if test "$krb5" != no; then
263         ATHENA_KRB5_CHECK
264 else
265         AC_MSG_ERROR(This package requires Kerberos 5.)
266 fi])
267
268 dnl ----- Hesiod -----
269
270 AC_DEFUN(ATHENA_HESIOD_CHECK,
271 [AC_CHECK_FUNC(res_send, :, AC_CHECK_LIB(resolv, res_send))
272 if test "$hesiod" != yes; then
273         CPPFLAGS="$CPPFLAGS -I$hesiod/include"
274         LDFLAGS="$LDFLAGS -L$hesiod/lib"
275 fi
276 AC_CHECK_LIB(hesiod, hes_resolve, :,
277              [AC_MSG_ERROR(Hesiod library not found)])])
278
279 AC_DEFUN(ATHENA_HESIOD,
280 [AC_ARG_WITH(hesiod,
281         [  --with-hesiod=PREFIX    Use Hesiod],
282         [hesiod="$withval"], [hesiod=no])
283 if test "$hesiod" != no; then
284         ATHENA_HESIOD_CHECK
285         HESIOD_LIBS="-lhesiod"
286         AC_DEFINE(HAVE_HESIOD)
287 fi
288 AC_SUBST(HESIOD_LIBS)])
289
290 AC_DEFUN(ATHENA_HESIOD_REQUIRED,
291 [AC_ARG_WITH(hesiod,
292         [  --with-hesiod=PREFIX    Specify location of Hesiod],
293         [hesiod="$withval"], [hesiod=yes])
294 if test "$hesiod" != no; then
295         ATHENA_HESIOD_CHECK
296 else
297         AC_MSG_ERROR(This package requires Hesiod.)
298 fi])
299
300 dnl ----- libares -----
301
302 AC_DEFUN(ATHENA_ARES_CHECK,
303 [AC_CHECK_FUNC(res_send, :, AC_CHECK_LIB(resolv, res_send))
304 if test "$ares" != yes; then
305         CPPFLAGS="$CPPFLAGS -I$ares/include"
306         LDFLAGS="$LDFLAGS -L$ares/lib"
307 fi
308 AC_CHECK_LIB(ares, ares_init, :, [AC_MSG_ERROR(libares not found)])])
309
310 AC_DEFUN(ATHENA_ARES,
311 [AC_ARG_WITH(ares,
312         [  --with-ares=PREFIX      Use libares],
313         [ares="$withval"], [ares=no])
314 if test "$ares" != no; then
315         ATHENA_ARES_CHECK
316         ARES_LIBS="-lares"
317         AC_DEFINE(HAVE_ARES)
318 fi
319 AC_SUBST(ARES_LIBS)])
320
321 AC_DEFUN(ATHENA_ARES_REQUIRED,
322 [AC_ARG_WITH(ares,
323         [  --with-ares=PREFIX      Specify location of libares],
324         [ares="$withval"], [ares=yes])
325 if test "$ares" != no; then
326         ATHENA_ARES_CHECK
327 else
328         AC_MSG_ERROR(This package requires libares.)
329 fi])
330 dnl ----- zephyr -----
331
332 AC_DEFUN(ATHENA_ZEPHYR_CHECK,
333 [if test "$zephyr" != yes; then
334         CPPFLAGS="$CPPFLAGS -I$zephyr/include"
335         LDFLAGS="$LDFLAGS -L$zephyr/lib"
336 fi
337 AC_CHECK_LIB(zephyr, ZFreeNotice, :, [AC_MSG_ERROR(zephyr not found)])])
338
339 AC_DEFUN(ATHENA_ZEPHYR,
340 [AC_ARG_WITH(zephyr,
341         [  --with-zephyr=PREFIX      Use zephyr],
342         [zephyr="$withval"], [zephyr=no])
343 if test "$zephyr" != no; then
344         ATHENA_ZEPHYR_CHECK
345         ZEPHYR_LIBS="-lzephyr"
346         AC_DEFINE(HAVE_ZEPHYR)
347 fi
348 AC_SUBST(ZEPHYR_LIBS)])
349
350 AC_DEFUN(ATHENA_ZEPHYR_REQUIRED,
351 [AC_ARG_WITH(zephyr,
352         [  --with-zephyr=PREFIX      Specify location of zephyr],
353         [zephyr="$withval"], [zephyr=yes])
354 if test "$zephyr" != no; then
355         ATHENA_ZEPHYR_CHECK
356 else
357         AC_MSG_ERROR(This package requires zephyr.)
358 fi])
359 ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
360 ## Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc.
361 ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
362 ##
363 ## This program is free software; you can redistribute it and/or modify
364 ## it under the terms of the GNU General Public License as published by
365 ## the Free Software Foundation; either version 2 of the License, or
366 ## (at your option) any later version.
367 ##
368 ## This program is distributed in the hope that it will be useful, but
369 ## WITHOUT ANY WARRANTY; without even the implied warranty of
370 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
371 ## General Public License for more details.
372 ##
373 ## You should have received a copy of the GNU General Public License
374 ## along with this program; if not, write to the Free Software
375 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
376 ##
377 ## As a special exception to the GNU General Public License, if you
378 ## distribute this file as part of a program that contains a
379 ## configuration script generated by Autoconf, you may include it under
380 ## the same distribution terms that you use for the rest of that program.
381
382 # serial 40 AC_PROG_LIBTOOL
383 AC_DEFUN(AC_PROG_LIBTOOL,
384 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
385
386 # Save cache, so that ltconfig can load it
387 AC_CACHE_SAVE
388
389 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
390 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
391 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
392 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
393 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
394 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
395 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
396 || AC_MSG_ERROR([libtool configure failed])
397
398 # Reload cache, that may have been modified by ltconfig
399 AC_CACHE_LOAD
400
401 # This can be used to rebuild libtool when needed
402 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
403
404 # Always use our own libtool.
405 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
406 AC_SUBST(LIBTOOL)dnl
407
408 # Redirect the config.log output again, so that the ltconfig log is not
409 # clobbered by the next message.
410 exec 5>>./config.log
411 ])
412
413 AC_DEFUN(AC_LIBTOOL_SETUP,
414 [AC_PREREQ(2.13)dnl
415 AC_REQUIRE([AC_ENABLE_SHARED])dnl
416 AC_REQUIRE([AC_ENABLE_STATIC])dnl
417 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
418 AC_REQUIRE([AC_CANONICAL_HOST])dnl
419 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
420 AC_REQUIRE([AC_PROG_RANLIB])dnl
421 AC_REQUIRE([AC_PROG_CC])dnl
422 AC_REQUIRE([AC_PROG_LD])dnl
423 AC_REQUIRE([AC_PROG_NM])dnl
424 AC_REQUIRE([AC_PROG_LN_S])dnl
425 dnl
426
427 case "$target" in
428 NONE) lt_target="$host" ;;
429 *) lt_target="$target" ;;
430 esac
431
432 # Check for any special flags to pass to ltconfig.
433 libtool_flags="--cache-file=$cache_file"
434 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
435 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
436 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
437 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
438 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
439 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
440 [libtool_flags="$libtool_flags --enable-dlopen"])
441 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
442 [libtool_flags="$libtool_flags --enable-win32-dll"])
443 AC_ARG_ENABLE(libtool-lock,
444   [  --disable-libtool-lock  avoid locking (might break parallel builds)])
445 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
446 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
447
448 # Some flags need to be propagated to the compiler or linker for good
449 # libtool support.
450 case "$lt_target" in
451 *-*-irix6*)
452   # Find out which ABI we are using.
453   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
454   if AC_TRY_EVAL(ac_compile); then
455     case "`/usr/bin/file conftest.o`" in
456     *32-bit*)
457       LD="${LD-ld} -32"
458       ;;
459     *N32*)
460       LD="${LD-ld} -n32"
461       ;;
462     *64-bit*)
463       LD="${LD-ld} -64"
464       ;;
465     esac
466   fi
467   rm -rf conftest*
468   ;;
469
470 *-*-sco3.2v5*)
471   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
472   SAVE_CFLAGS="$CFLAGS"
473   CFLAGS="$CFLAGS -belf"
474   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
475     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
476   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
477     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
478     CFLAGS="$SAVE_CFLAGS"
479   fi
480   ;;
481
482 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
483 [*-*-cygwin* | *-*-mingw*)
484   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
485   AC_CHECK_TOOL(AS, as, false)
486   AC_CHECK_TOOL(OBJDUMP, objdump, false)
487   ;;
488 ])
489 esac
490 ])
491
492 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
493 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
494
495 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
496 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
497
498 # AC_ENABLE_SHARED - implement the --enable-shared flag
499 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
500 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
501 #   `yes'.
502 AC_DEFUN(AC_ENABLE_SHARED, [dnl
503 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
504 AC_ARG_ENABLE(shared,
505 changequote(<<, >>)dnl
506 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
507 changequote([, ])dnl
508 [p=${PACKAGE-default}
509 case "$enableval" in
510 yes) enable_shared=yes ;;
511 no) enable_shared=no ;;
512 *)
513   enable_shared=no
514   # Look at the argument we got.  We use all the common list separators.
515   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
516   for pkg in $enableval; do
517     if test "X$pkg" = "X$p"; then
518       enable_shared=yes
519     fi
520   done
521   IFS="$ac_save_ifs"
522   ;;
523 esac],
524 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
525 ])
526
527 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
528 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
529 AC_ENABLE_SHARED(no)])
530
531 # AC_ENABLE_STATIC - implement the --enable-static flag
532 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
533 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
534 #   `yes'.
535 AC_DEFUN(AC_ENABLE_STATIC, [dnl
536 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
537 AC_ARG_ENABLE(static,
538 changequote(<<, >>)dnl
539 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
540 changequote([, ])dnl
541 [p=${PACKAGE-default}
542 case "$enableval" in
543 yes) enable_static=yes ;;
544 no) enable_static=no ;;
545 *)
546   enable_static=no
547   # Look at the argument we got.  We use all the common list separators.
548   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
549   for pkg in $enableval; do
550     if test "X$pkg" = "X$p"; then
551       enable_static=yes
552     fi
553   done
554   IFS="$ac_save_ifs"
555   ;;
556 esac],
557 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
558 ])
559
560 # AC_DISABLE_STATIC - set the default static flag to --disable-static
561 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
562 AC_ENABLE_STATIC(no)])
563
564
565 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
566 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
567 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
568 #   `yes'.
569 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
570 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
571 AC_ARG_ENABLE(fast-install,
572 changequote(<<, >>)dnl
573 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
574 changequote([, ])dnl
575 [p=${PACKAGE-default}
576 case "$enableval" in
577 yes) enable_fast_install=yes ;;
578 no) enable_fast_install=no ;;
579 *)
580   enable_fast_install=no
581   # Look at the argument we got.  We use all the common list separators.
582   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
583   for pkg in $enableval; do
584     if test "X$pkg" = "X$p"; then
585       enable_fast_install=yes
586     fi
587   done
588   IFS="$ac_save_ifs"
589   ;;
590 esac],
591 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
592 ])
593
594 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
595 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
596 AC_ENABLE_FAST_INSTALL(no)])
597
598 # AC_PROG_LD - find the path to the GNU or non-GNU linker
599 AC_DEFUN(AC_PROG_LD,
600 [AC_ARG_WITH(gnu-ld,
601 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
602 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
603 AC_REQUIRE([AC_PROG_CC])dnl
604 AC_REQUIRE([AC_CANONICAL_HOST])dnl
605 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
606 ac_prog=ld
607 if test "$ac_cv_prog_gcc" = yes; then
608   # Check if gcc -print-prog-name=ld gives a path.
609   AC_MSG_CHECKING([for ld used by GCC])
610   ac_prog=`($CC -print-prog-name=ld) 2>&5`
611   case "$ac_prog" in
612     # Accept absolute paths.
613 changequote(,)dnl
614     [\\/]* | [A-Za-z]:[\\/]*)
615       re_direlt='/[^/][^/]*/\.\./'
616 changequote([,])dnl
617       # Canonicalize the path of ld
618       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
619       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
620         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
621       done
622       test -z "$LD" && LD="$ac_prog"
623       ;;
624   "")
625     # If it fails, then pretend we aren't using GCC.
626     ac_prog=ld
627     ;;
628   *)
629     # If it is relative, then search for the first ld in PATH.
630     with_gnu_ld=unknown
631     ;;
632   esac
633 elif test "$with_gnu_ld" = yes; then
634   AC_MSG_CHECKING([for GNU ld])
635 else
636   AC_MSG_CHECKING([for non-GNU ld])
637 fi
638 AC_CACHE_VAL(ac_cv_path_LD,
639 [if test -z "$LD"; then
640   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
641   for ac_dir in $PATH; do
642     test -z "$ac_dir" && ac_dir=.
643     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
644       ac_cv_path_LD="$ac_dir/$ac_prog"
645       # Check to see if the program is GNU ld.  I'd rather use --version,
646       # but apparently some GNU ld's only accept -v.
647       # Break only if it was the GNU/non-GNU ld that we prefer.
648       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
649         test "$with_gnu_ld" != no && break
650       else
651         test "$with_gnu_ld" != yes && break
652       fi
653     fi
654   done
655   IFS="$ac_save_ifs"
656 else
657   ac_cv_path_LD="$LD" # Let the user override the test with a path.
658 fi])
659 LD="$ac_cv_path_LD"
660 if test -n "$LD"; then
661   AC_MSG_RESULT($LD)
662 else
663   AC_MSG_RESULT(no)
664 fi
665 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
666 AC_PROG_LD_GNU
667 ])
668
669 AC_DEFUN(AC_PROG_LD_GNU,
670 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
671 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
672 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
673   ac_cv_prog_gnu_ld=yes
674 else
675   ac_cv_prog_gnu_ld=no
676 fi])
677 ])
678
679 # AC_PROG_NM - find the path to a BSD-compatible name lister
680 AC_DEFUN(AC_PROG_NM,
681 [AC_MSG_CHECKING([for BSD-compatible nm])
682 AC_CACHE_VAL(ac_cv_path_NM,
683 [if test -n "$NM"; then
684   # Let the user override the test.
685   ac_cv_path_NM="$NM"
686 else
687   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
688   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
689     test -z "$ac_dir" && ac_dir=.
690     if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
691       # Check to see if the nm accepts a BSD-compat flag.
692       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
693       #   nm: unknown option "B" ignored
694       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
695         ac_cv_path_NM="$ac_dir/nm -B"
696         break
697       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
698         ac_cv_path_NM="$ac_dir/nm -p"
699         break
700       else
701         ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
702         continue # so that we can try to find one that supports BSD flags
703       fi
704     fi
705   done
706   IFS="$ac_save_ifs"
707   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
708 fi])
709 NM="$ac_cv_path_NM"
710 AC_MSG_RESULT([$NM])
711 ])
712
713 # AC_CHECK_LIBM - check for math library
714 AC_DEFUN(AC_CHECK_LIBM,
715 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
716 LIBM=
717 case "$lt_target" in
718 *-*-beos* | *-*-cygwin*)
719   # These system don't have libm
720   ;;
721 *-ncr-sysv4.3*)
722   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
723   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
724   ;;
725 *)
726   AC_CHECK_LIB(m, main, LIBM="-lm")
727   ;;
728 esac
729 ])
730
731 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
732 # the libltdl convenience library and INCLTDL to the include flags for
733 # the libltdl header and adds --enable-ltdl-convenience to the
734 # configure arguments.  Note that LIBLTDL and INCLTDL are not
735 # AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
736 # provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
737 # with '${top_builddir}/' and INCLTDL will be prefixed with
738 # '${top_srcdir}/' (note the single quotes!).  If your package is not
739 # flat and you're not using automake, define top_builddir and
740 # top_srcdir appropriately in the Makefiles.
741 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
742   case "$enable_ltdl_convenience" in
743   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
744   "") enable_ltdl_convenience=yes
745       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
746   esac
747   LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
748   INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
749 ])
750
751 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
752 # the libltdl installable library and INCLTDL to the include flags for
753 # the libltdl header and adds --enable-ltdl-install to the configure
754 # arguments.  Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
755 # AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
756 # libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
757 # be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
758 # with '${top_srcdir}/' (note the single quotes!).  If your package is
759 # not flat and you're not using automake, define top_builddir and
760 # top_srcdir appropriately in the Makefiles.
761 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
762 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
763   AC_CHECK_LIB(ltdl, main,
764   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
765   [if test x"$enable_ltdl_install" = xno; then
766      AC_MSG_WARN([libltdl not installed, but installation disabled])
767    else
768      enable_ltdl_install=yes
769    fi
770   ])
771   if test x"$enable_ltdl_install" = x"yes"; then
772     ac_configure_args="$ac_configure_args --enable-ltdl-install"
773     LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
774     INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
775   else
776     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
777     LIBLTDL="-lltdl"
778     INCLTDL=
779   fi
780 ])
781
782 dnl old names
783 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
784 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
785 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
786 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
787 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
788 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
789 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
790
791 dnl This is just to silence aclocal about the macro not being used
792 ifelse([AC_DISABLE_FAST_INSTALL])dnl