]> git.sur5r.net Git - openldap/blob - aclocal.m4
10a30e02e7f946f8e073ff076dda2a2ee7bb27e2
[openldap] / aclocal.m4
1 dnl aclocal.m4 generated automatically by aclocal 1.4a
2
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
7
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
12
13 dnl $OpenLDAP$
14 dnl Copyright 1998-1999 The OpenLDAP Foundation,  All Rights Reserved.
15 dnl COPYING RESTRICTIONS APPLY, See COPYRIGHT file
16 dnl
17 dnl OpenLDAP Autoconf Macros
18 dnl
19 builtin(include, build/openldap.m4)dnl
20
21 # Do all the work for Automake.  This macro actually does too much --
22 # some checks are only needed if your package does certain things.
23 # But this isn't really a big deal.
24
25 # serial 1
26
27 dnl Usage:
28 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
29
30 AC_DEFUN(AM_INIT_AUTOMAKE,
31 [AC_REQUIRE([AC_PROG_INSTALL])
32 dnl We require 2.13 because we rely on SHELL being computed by configure.
33 AC_PREREQ([2.13])
34 PACKAGE=[$1]
35 AC_SUBST(PACKAGE)
36 VERSION=[$2]
37 AC_SUBST(VERSION)
38 dnl test to see if srcdir already configured
39 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
40   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
41 fi
42 ifelse([$3],,
43 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
44 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
45 AC_REQUIRE([AM_SANITY_CHECK])
46 AC_REQUIRE([AC_ARG_PROGRAM])
47 dnl FIXME This is truly gross.
48 missing_dir=`cd $ac_aux_dir && pwd`
49 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
50 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
51 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
52 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
53 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
54 dnl Set install_sh for make dist
55 install_sh="$missing_dir/install-sh"
56 test -f "$install_sh" || install_sh="$missing_dir/install.sh"
57 AC_SUBST(install_sh)
58 dnl We check for tar when the user configures the end package.
59 dnl This is sad, since we only need this for "dist".  However,
60 dnl there's no other good way to do it.  We prefer GNU tar if
61 dnl we can find it.  If we can't find a tar, it doesn't really matter.
62 AC_CHECK_PROGS(AMTAR, gnutar gtar tar)
63 dnl We need awk for the "check" target.  The system "awk" is bad on
64 dnl some platforms.
65 AC_REQUIRE([AC_PROG_AWK])
66 AMTARFLAGS=
67 if test -n "$AMTAR"; then
68   if $SHELL -c "$AMTAR --version" > /dev/null 2>&1; then
69     dnl We have GNU tar.
70     AMTARFLAGS=o
71   fi
72 fi
73 AC_SUBST(AMTARFLAGS)
74 AC_REQUIRE([AC_PROG_MAKE_SET])])
75
76 #
77 # Check to make sure that the build environment is sane.
78 #
79
80 AC_DEFUN(AM_SANITY_CHECK,
81 [AC_MSG_CHECKING([whether build environment is sane])
82 # Just in case
83 sleep 1
84 echo timestamp > conftestfile
85 # Do `set' in a subshell so we don't clobber the current shell's
86 # arguments.  Must try -L first in case configure is actually a
87 # symlink; some systems play weird games with the mod time of symlinks
88 # (eg FreeBSD returns the mod time of the symlink's containing
89 # directory).
90 if (
91    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
92    if test "[$]*" = "X"; then
93       # -L didn't work.
94       set X `ls -t $srcdir/configure conftestfile`
95    fi
96    if test "[$]*" != "X $srcdir/configure conftestfile" \
97       && test "[$]*" != "X conftestfile $srcdir/configure"; then
98
99       # If neither matched, then we have a broken ls.  This can happen
100       # if, for instance, CONFIG_SHELL is bash and it inherits a
101       # broken ls alias from the environment.  This has actually
102       # happened.  Such a system could not be considered "sane".
103       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
104 alias in your environment])
105    fi
106
107    test "[$]2" = conftestfile
108    )
109 then
110    # Ok.
111    :
112 else
113    AC_MSG_ERROR([newly created file is older than distributed files!
114 Check your system clock])
115 fi
116 rm -f conftest*
117 AC_MSG_RESULT(yes)])
118
119 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
120 dnl The program must properly implement --version.
121 AC_DEFUN(AM_MISSING_PROG,
122 [AC_MSG_CHECKING(for working $2)
123 # Run test in a subshell; some versions of sh will print an error if
124 # an executable is not found, even if stderr is redirected.
125 # Redirect stdin to placate older versions of autoconf.  Sigh.
126 if ($2 --version) < /dev/null > /dev/null 2>&1; then
127    $1=$2
128    AC_MSG_RESULT(found)
129 else
130    $1="$3/missing $2"
131    AC_MSG_RESULT(missing)
132 fi
133 AC_SUBST($1)])
134
135
136 # serial 40 AC_PROG_LIBTOOL
137 AC_DEFUN(AC_PROG_LIBTOOL,
138 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
139
140 # Save cache, so that ltconfig can load it
141 AC_CACHE_SAVE
142
143 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
144 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
145 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
146 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
147 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
148 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
149 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
150 || AC_MSG_ERROR([libtool configure failed])
151
152 # Reload cache, that may have been modified by ltconfig
153 AC_CACHE_LOAD
154
155 # This can be used to rebuild libtool when needed
156 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
157
158 # Always use our own libtool.
159 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
160 AC_SUBST(LIBTOOL)dnl
161
162 # Redirect the config.log output again, so that the ltconfig log is not
163 # clobbered by the next message.
164 exec 5>>./config.log
165 ])
166
167 AC_DEFUN(AC_LIBTOOL_SETUP,
168 [AC_PREREQ(2.13)dnl
169 AC_REQUIRE([AC_ENABLE_SHARED])dnl
170 AC_REQUIRE([AC_ENABLE_STATIC])dnl
171 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
172 AC_REQUIRE([AC_CANONICAL_HOST])dnl
173 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
174 AC_REQUIRE([AC_PROG_RANLIB])dnl
175 AC_REQUIRE([AC_PROG_CC])dnl
176 AC_REQUIRE([AC_PROG_LD])dnl
177 AC_REQUIRE([AC_PROG_NM])dnl
178 AC_REQUIRE([AC_PROG_LN_S])dnl
179 dnl
180
181 # Check for any special flags to pass to ltconfig.
182 libtool_flags="--cache-file=$cache_file"
183 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
184 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
185 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
186 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
187 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
188 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
189 [libtool_flags="$libtool_flags --enable-dlopen"])
190 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
191 [libtool_flags="$libtool_flags --enable-win32-dll"])
192 AC_ARG_ENABLE(libtool-lock,
193   [  --disable-libtool-lock  avoid locking (might break parallel builds)])
194 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
195 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
196
197 # Some flags need to be propagated to the compiler or linker for good
198 # libtool support.
199 case "$host" in
200 *-*-irix6*)
201   # Find out which ABI we are using.
202   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
203   if AC_TRY_EVAL(ac_compile); then
204     case "`/usr/bin/file conftest.o`" in
205     *32-bit*)
206       LD="${LD-ld} -32"
207       ;;
208     *N32*)
209       LD="${LD-ld} -n32"
210       ;;
211     *64-bit*)
212       LD="${LD-ld} -64"
213       ;;
214     esac
215   fi
216   rm -rf conftest*
217   ;;
218
219 *-*-sco3.2v5*)
220   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
221   SAVE_CFLAGS="$CFLAGS"
222   CFLAGS="$CFLAGS -belf"
223   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
224     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
225   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
226     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
227     CFLAGS="$SAVE_CFLAGS"
228   fi
229   ;;
230
231 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
232 [*-*-cygwin* | *-*-mingw*)
233   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
234   AC_CHECK_TOOL(AS, as, false)
235   AC_CHECK_TOOL(OBJDUMP, objdump, false)
236   ;;
237 ])
238 esac
239 ])
240
241 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
242 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
243
244 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
245 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
246
247 # AC_ENABLE_SHARED - implement the --enable-shared flag
248 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
249 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
250 #   `yes'.
251 AC_DEFUN(AC_ENABLE_SHARED, [dnl
252 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
253 AC_ARG_ENABLE(shared,
254 changequote(<<, >>)dnl
255 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
256 changequote([, ])dnl
257 [p=${PACKAGE-default}
258 case "$enableval" in
259 yes) enable_shared=yes ;;
260 no) enable_shared=no ;;
261 *)
262   enable_shared=no
263   # Look at the argument we got.  We use all the common list separators.
264   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
265   for pkg in $enableval; do
266     if test "X$pkg" = "X$p"; then
267       enable_shared=yes
268     fi
269   done
270   IFS="$ac_save_ifs"
271   ;;
272 esac],
273 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
274 ])
275
276 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
277 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
278 AC_ENABLE_SHARED(no)])
279
280 # AC_ENABLE_STATIC - implement the --enable-static flag
281 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
282 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
283 #   `yes'.
284 AC_DEFUN(AC_ENABLE_STATIC, [dnl
285 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
286 AC_ARG_ENABLE(static,
287 changequote(<<, >>)dnl
288 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
289 changequote([, ])dnl
290 [p=${PACKAGE-default}
291 case "$enableval" in
292 yes) enable_static=yes ;;
293 no) enable_static=no ;;
294 *)
295   enable_static=no
296   # Look at the argument we got.  We use all the common list separators.
297   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
298   for pkg in $enableval; do
299     if test "X$pkg" = "X$p"; then
300       enable_static=yes
301     fi
302   done
303   IFS="$ac_save_ifs"
304   ;;
305 esac],
306 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
307 ])
308
309 # AC_DISABLE_STATIC - set the default static flag to --disable-static
310 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
311 AC_ENABLE_STATIC(no)])
312
313
314 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
315 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
316 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
317 #   `yes'.
318 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
319 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
320 AC_ARG_ENABLE(fast-install,
321 changequote(<<, >>)dnl
322 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
323 changequote([, ])dnl
324 [p=${PACKAGE-default}
325 case "$enableval" in
326 yes) enable_fast_install=yes ;;
327 no) enable_fast_install=no ;;
328 *)
329   enable_fast_install=no
330   # Look at the argument we got.  We use all the common list separators.
331   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
332   for pkg in $enableval; do
333     if test "X$pkg" = "X$p"; then
334       enable_fast_install=yes
335     fi
336   done
337   IFS="$ac_save_ifs"
338   ;;
339 esac],
340 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
341 ])
342
343 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
344 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
345 AC_ENABLE_FAST_INSTALL(no)])
346
347 # AC_PROG_LD - find the path to the GNU or non-GNU linker
348 AC_DEFUN(AC_PROG_LD,
349 [AC_ARG_WITH(gnu-ld,
350 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
351 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
352 AC_REQUIRE([AC_PROG_CC])dnl
353 AC_REQUIRE([AC_CANONICAL_HOST])dnl
354 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
355 ac_prog=ld
356 if test "$ac_cv_prog_gcc" = yes; then
357   # Check if gcc -print-prog-name=ld gives a path.
358   AC_MSG_CHECKING([for ld used by GCC])
359   ac_prog=`($CC -print-prog-name=ld) 2>&5`
360   case "$ac_prog" in
361     # Accept absolute paths.
362 changequote(,)dnl
363     [\\/]* | [A-Za-z]:[\\/]*)
364       re_direlt='/[^/][^/]*/\.\./'
365 changequote([,])dnl
366       # Canonicalize the path of ld
367       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
368       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
369         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
370       done
371       test -z "$LD" && LD="$ac_prog"
372       ;;
373   "")
374     # If it fails, then pretend we aren't using GCC.
375     ac_prog=ld
376     ;;
377   *)
378     # If it is relative, then search for the first ld in PATH.
379     with_gnu_ld=unknown
380     ;;
381   esac
382 elif test "$with_gnu_ld" = yes; then
383   AC_MSG_CHECKING([for GNU ld])
384 else
385   AC_MSG_CHECKING([for non-GNU ld])
386 fi
387 AC_CACHE_VAL(ac_cv_path_LD,
388 [if test -z "$LD"; then
389   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
390   for ac_dir in $PATH; do
391     test -z "$ac_dir" && ac_dir=.
392     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
393       ac_cv_path_LD="$ac_dir/$ac_prog"
394       # Check to see if the program is GNU ld.  I'd rather use --version,
395       # but apparently some GNU ld's only accept -v.
396       # Break only if it was the GNU/non-GNU ld that we prefer.
397       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
398         test "$with_gnu_ld" != no && break
399       else
400         test "$with_gnu_ld" != yes && break
401       fi
402     fi
403   done
404   IFS="$ac_save_ifs"
405 else
406   ac_cv_path_LD="$LD" # Let the user override the test with a path.
407 fi])
408 LD="$ac_cv_path_LD"
409 if test -n "$LD"; then
410   AC_MSG_RESULT($LD)
411 else
412   AC_MSG_RESULT(no)
413 fi
414 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
415 AC_SUBST(LD)
416 AC_PROG_LD_GNU
417 ])
418
419 AC_DEFUN(AC_PROG_LD_GNU,
420 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
421 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
422 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
423   ac_cv_prog_gnu_ld=yes
424 else
425   ac_cv_prog_gnu_ld=no
426 fi])
427 ])
428
429 # AC_PROG_NM - find the path to a BSD-compatible name lister
430 AC_DEFUN(AC_PROG_NM,
431 [AC_MSG_CHECKING([for BSD-compatible nm])
432 AC_CACHE_VAL(ac_cv_path_NM,
433 [if test -n "$NM"; then
434   # Let the user override the test.
435   ac_cv_path_NM="$NM"
436 else
437   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
438   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
439     test -z "$ac_dir" && ac_dir=.
440     if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
441       # Check to see if the nm accepts a BSD-compat flag.
442       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
443       #   nm: unknown option "B" ignored
444       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
445         ac_cv_path_NM="$ac_dir/nm -B"
446         break
447       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
448         ac_cv_path_NM="$ac_dir/nm -p"
449         break
450       else
451         ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
452         continue # so that we can try to find one that supports BSD flags
453       fi
454     fi
455   done
456   IFS="$ac_save_ifs"
457   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
458 fi])
459 NM="$ac_cv_path_NM"
460 AC_MSG_RESULT([$NM])
461 AC_SUBST(NM)
462 ])
463
464 # AC_CHECK_LIBM - check for math library
465 AC_DEFUN(AC_CHECK_LIBM,
466 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
467 LIBM=
468 case "$host" in
469 *-*-beos* | *-*-cygwin*)
470   # These system don't have libm
471   ;;
472 *-ncr-sysv4.3*)
473   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
474   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
475   ;;
476 *)
477   AC_CHECK_LIB(m, main, LIBM="-lm")
478   ;;
479 esac
480 ])
481
482 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
483 # the libltdl convenience library, adds --enable-ltdl-convenience to
484 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
485 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
486 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
487 # '${top_builddir}/' (note the single quotes!) if your package is not
488 # flat, and, if you're not using automake, define top_builddir as
489 # appropriate in the Makefiles.
490 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
491   case "$enable_ltdl_convenience" in
492   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
493   "") enable_ltdl_convenience=yes
494       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
495   esac
496   LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
497   INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
498 ])
499
500 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
501 # the libltdl installable library, and adds --enable-ltdl-install to
502 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
503 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
504 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
505 # '${top_builddir}/' (note the single quotes!) if your package is not
506 # flat, and, if you're not using automake, define top_builddir as
507 # appropriate in the Makefiles.
508 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
509 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
510   AC_CHECK_LIB(ltdl, main,
511   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
512   [if test x"$enable_ltdl_install" = xno; then
513      AC_MSG_WARN([libltdl not installed, but installation disabled])
514    else
515      enable_ltdl_install=yes
516    fi
517   ])
518   if test x"$enable_ltdl_install" = x"yes"; then
519     ac_configure_args="$ac_configure_args --enable-ltdl-install"
520     LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
521     INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
522   else
523     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
524     LIBLTDL="-lltdl"
525     INCLTDL=
526   fi
527 ])
528
529 dnl old names
530 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
531 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
532 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
533 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
534 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
535 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
536 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
537
538 dnl This is just to silence aclocal about the macro not being used
539 ifelse([AC_DISABLE_FAST_INSTALL])dnl
540
541
542 # serial 1
543
544 # @defmac AC_PROG_CC_STDC
545 # @maindex PROG_CC_STDC
546 # @ovindex CC
547 # If the C compiler in not in ANSI C mode by default, try to add an option
548 # to output variable @code{CC} to make it so.  This macro tries various
549 # options that select ANSI C on some system or another.  It considers the
550 # compiler to be in ANSI C mode if it handles function prototypes correctly.
551 #
552 # If you use this macro, you should check after calling it whether the C
553 # compiler has been set to accept ANSI C; if not, the shell variable
554 # @code{am_cv_prog_cc_stdc} is set to @samp{no}.  If you wrote your source
555 # code in ANSI C, you can make an un-ANSIfied copy of it by using the
556 # program @code{ansi2knr}, which comes with Ghostscript.
557 # @end defmac
558
559 AC_DEFUN(AM_PROG_CC_STDC,
560 [AC_REQUIRE([AC_PROG_CC])
561 AC_BEFORE([$0], [AC_C_INLINE])
562 AC_BEFORE([$0], [AC_C_CONST])
563 dnl Force this before AC_PROG_CPP.  Some cpp's, eg on HPUX, require
564 dnl a magic option to avoid problems with ANSI preprocessor commands
565 dnl like #elif.
566 dnl FIXME: can't do this because then AC_AIX won't work due to a
567 dnl circular dependency.
568 dnl AC_BEFORE([$0], [AC_PROG_CPP])
569 AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
570 AC_CACHE_VAL(am_cv_prog_cc_stdc,
571 [am_cv_prog_cc_stdc=no
572 ac_save_CC="$CC"
573 # Don't try gcc -ansi; that turns off useful extensions and
574 # breaks some systems' header files.
575 # AIX                   -qlanglvl=ansi
576 # Ultrix and OSF/1      -std1
577 # HP-UX 10.20 and later -Ae
578 # HP-UX older versions  -Aa -D_HPUX_SOURCE
579 # SVR4                  -Xc -D__EXTENSIONS__
580 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
581 do
582   CC="$ac_save_CC $ac_arg"
583   AC_TRY_COMPILE(
584 [#include <stdarg.h>
585 #include <stdio.h>
586 #include <sys/types.h>
587 #include <sys/stat.h>
588 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
589 struct buf { int x; };
590 FILE * (*rcsopen) (struct buf *, struct stat *, int);
591 static char *e (p, i)
592      char **p;
593      int i;
594 {
595   return p[i];
596 }
597 static char *f (char * (*g) (char **, int), char **p, ...)
598 {
599   char *s;
600   va_list v;
601   va_start (v,p);
602   s = g (p, va_arg (v,int));
603   va_end (v);
604   return s;
605 }
606 int test (int i, double x);
607 struct s1 {int (*f) (int a);};
608 struct s2 {int (*f) (double a);};
609 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
610 int argc;
611 char **argv;
612 ], [
613 return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
614 ],
615 [am_cv_prog_cc_stdc="$ac_arg"; break])
616 done
617 CC="$ac_save_CC"
618 ])
619 if test -z "$am_cv_prog_cc_stdc"; then
620   AC_MSG_RESULT([none needed])
621 else
622   AC_MSG_RESULT($am_cv_prog_cc_stdc)
623 fi
624 case "x$am_cv_prog_cc_stdc" in
625   x|xno) ;;
626   *) CC="$CC $am_cv_prog_cc_stdc" ;;
627 esac
628 ])
629
630 dnl From Jim Meyering.
631
632 # serial 1
633
634 AC_DEFUN(AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL,
635 [AC_REQUIRE([AM_SYS_POSIX_TERMIOS])
636  AC_CACHE_CHECK([whether use of TIOCGWINSZ requires sys/ioctl.h],
637                 am_cv_sys_tiocgwinsz_needs_sys_ioctl_h,
638   [am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=no
639
640   gwinsz_in_termios_h=no
641   if test $am_cv_sys_posix_termios = yes; then
642     AC_EGREP_CPP([yes],
643     [#include <sys/types.h>
644 #     include <termios.h>
645 #     ifdef TIOCGWINSZ
646         yes
647 #     endif
648     ], gwinsz_in_termios_h=yes)
649   fi
650
651   if test $gwinsz_in_termios_h = no; then
652     AC_EGREP_CPP([yes],
653     [#include <sys/types.h>
654 #     include <sys/ioctl.h>
655 #     ifdef TIOCGWINSZ
656         yes
657 #     endif
658     ], am_cv_sys_tiocgwinsz_needs_sys_ioctl_h=yes)
659   fi
660   ])
661   if test $am_cv_sys_tiocgwinsz_needs_sys_ioctl_h = yes; then
662     AC_DEFINE(GWINSZ_IN_SYS_IOCTL,1,
663               [Define if TIOCGWINSZ requires sys/ioctl.h])
664   fi
665 ])
666
667 dnl From Jim Meyering.
668
669 # serial 1
670
671 AC_DEFUN(AM_SYS_POSIX_TERMIOS,
672 [AC_CACHE_CHECK([POSIX termios], am_cv_sys_posix_termios,
673   [AC_TRY_LINK([#include <sys/types.h>
674 #include <unistd.h>
675 #include <termios.h>],
676   [/* SunOS 4.0.3 has termios.h but not the library calls.  */
677    tcgetattr(0, 0);],
678   am_cv_sys_posix_termios=yes,
679   am_cv_sys_posix_termios=no)])
680 ])
681
682 # From Ulrich Drepper.
683
684 # serial 1
685
686 AC_DEFUN(AM_TYPE_PTRDIFF_T,
687   [AC_CACHE_CHECK([for ptrdiff_t], am_cv_type_ptrdiff_t,
688      [AC_TRY_COMPILE([#include <stddef.h>], [ptrdiff_t p],
689                      am_cv_type_ptrdiff_t=yes, am_cv_type_ptrdiff_t=no)])
690    if test $am_cv_type_ptrdiff_t = yes; then
691      AC_DEFINE(HAVE_PTRDIFF_T,1,[Define if system has ptrdiff_t type])
692    fi
693 ])
694