HP2500C driver writes devmode with private data that ends
[samba.git] / source3 / aclocal.m4
1 dnl AC_VALIDATE_CACHE_SYSTEM_TYPE[(cmd)]
2 dnl if the cache file is inconsistent with the current host,
3 dnl target and build system types, execute CMD or print a default
4 dnl error message.
5 AC_DEFUN(AC_VALIDATE_CACHE_SYSTEM_TYPE, [
6     AC_REQUIRE([AC_CANONICAL_SYSTEM])
7     AC_MSG_CHECKING([config.cache system type])
8     if { test x"${ac_cv_host_system_type+set}" = x"set" &&
9          test x"$ac_cv_host_system_type" != x"$host"; } ||
10        { test x"${ac_cv_build_system_type+set}" = x"set" &&
11          test x"$ac_cv_build_system_type" != x"$build"; } ||
12        { test x"${ac_cv_target_system_type+set}" = x"set" &&
13          test x"$ac_cv_target_system_type" != x"$target"; }; then
14         AC_MSG_RESULT([different])
15         ifelse($#, 1, [$1],
16                 [AC_MSG_ERROR(["you must remove config.cache and restart configure"])])
17     else
18         AC_MSG_RESULT([same])
19     fi
20     ac_cv_host_system_type="$host"
21     ac_cv_build_system_type="$build"
22     ac_cv_target_system_type="$target"
23 ])
24
25
26 dnl test whether dirent has a d_off member
27 AC_DEFUN(AC_DIRENT_D_OFF,
28 [AC_CACHE_CHECK([for d_off in dirent], ac_cv_dirent_d_off,
29 [AC_TRY_COMPILE([
30 #include <unistd.h>
31 #include <sys/types.h>
32 #include <dirent.h>], [struct dirent d; d.d_off;],
33 ac_cv_dirent_d_off=yes, ac_cv_dirent_d_off=no)])
34 if test $ac_cv_dirent_d_off = yes; then
35   AC_DEFINE(HAVE_DIRENT_D_OFF)
36 fi
37 ])
38
39
40 dnl AC_PROG_CC_FLAG(flag)
41 AC_DEFUN(AC_PROG_CC_FLAG,
42 [AC_CACHE_CHECK(whether ${CC-cc} accepts -$1, ac_cv_prog_cc_$1,
43 [echo 'void f(){}' > conftest.c
44 if test -z "`${CC-cc} -$1 -c conftest.c 2>&1`"; then
45   ac_cv_prog_cc_$1=yes
46 else
47   ac_cv_prog_cc_$1=no
48 fi
49 rm -f conftest*
50 ])])
51
52 dnl see if a declaration exists for a function or variable
53 dnl defines HAVE_function_DECL if it exists
54 dnl AC_HAVE_DECL(var, includes)
55 AC_DEFUN(AC_HAVE_DECL,
56 [
57  AC_CACHE_CHECK([for $1 declaration],ac_cv_have_$1_decl,[
58     AC_TRY_COMPILE([$2],[int i = (int)$1],
59         ac_cv_have_$1_decl=yes,ac_cv_have_$1_decl=no)])
60  if test x"$ac_cv_have_$1_decl" = x"yes"; then
61     AC_DEFINE([HAVE_]translit([$1], [a-z], [A-Z])[_DECL])
62  fi
63 ])
64
65
66 dnl check for a function in a library, but don't
67 dnl keep adding the same library to the LIBS variable.
68 dnl AC_LIBTESTFUNC(lib,func)
69 AC_DEFUN(AC_LIBTESTFUNC,
70 [case "$LIBS" in
71   *-l$1*) AC_CHECK_FUNCS($2) ;;
72   *) AC_CHECK_LIB($1, $2) 
73      AC_CHECK_FUNCS($2)
74   ;;
75   esac
76 ])
77
78 dnl Define an AC_DEFINE with ifndef guard.
79 dnl AC_N_DEFINE(VARIABLE [, VALUE])
80 define(AC_N_DEFINE,
81 [cat >> confdefs.h <<\EOF
82 [#ifndef] $1
83 [#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1)
84 [#endif]
85 EOF
86 ])
87
88 dnl Add an #include
89 dnl AC_ADD_INCLUDE(VARIABLE)
90 define(AC_ADD_INCLUDE,
91 [cat >> confdefs.h <<\EOF
92 [#include] $1
93 EOF
94 ])
95
96 ## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
97 ## Copyright (C) 1996-1999 Free Software Foundation, Inc.
98 ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
99 ##
100 ## This program is free software; you can redistribute it and/or modify
101 ## it under the terms of the GNU General Public License as published by
102 ## the Free Software Foundation; either version 2 of the License, or
103 ## (at your option) any later version.
104 ##
105 ## This program is distributed in the hope that it will be useful, but
106 ## WITHOUT ANY WARRANTY; without even the implied warranty of
107 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
108 ## General Public License for more details.
109 ##
110 ## You should have received a copy of the GNU General Public License
111 ## along with this program; if not, write to the Free Software
112 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
113 ##
114 ## As a special exception to the GNU General Public License, if you
115 ## distribute this file as part of a program that contains a
116 ## configuration script generated by Autoconf, you may include it under
117 ## the same distribution terms that you use for the rest of that program.
118
119 # serial 40 AC_PROG_LIBTOOL
120 AC_DEFUN(AC_PROG_LIBTOOL,
121 [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
122
123 # Save cache, so that ltconfig can load it
124 AC_CACHE_SAVE
125
126 # Actually configure libtool.  ac_aux_dir is where install-sh is found.
127 CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
128 LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
129 LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
130 DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
131 ${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
132 $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
133 || AC_MSG_ERROR([libtool configure failed])
134
135 # Reload cache, that may have been modified by ltconfig
136 AC_CACHE_LOAD
137
138 # This can be used to rebuild libtool when needed
139 LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
140
141 # Always use our own libtool.
142 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
143 AC_SUBST(LIBTOOL)dnl
144
145 # Redirect the config.log output again, so that the ltconfig log is not
146 # clobbered by the next message.
147 exec 5>>./config.log
148 ])
149
150 # Macro to add for using GNU gettext.
151 # Ulrich Drepper <drepper@cygnus.com>, 1995.
152 #
153 # This file can be copied and used freely without restrictions.  It can
154 # be used in projects which are not available under the GNU Public License
155 # but which still want to provide support for the GNU gettext functionality.
156 # Please note that the actual code is *not* freely available.
157
158 # serial 5
159
160 AC_DEFUN(AM_WITH_NLS,
161   [AC_MSG_CHECKING([whether NLS is requested])
162     dnl Default is enabled NLS
163     AC_ARG_ENABLE(nls,
164       [  --disable-nls           do not use Native Language Support],
165       USE_NLS=$enableval, USE_NLS=yes)
166     AC_MSG_RESULT($USE_NLS)
167     AC_SUBST(USE_NLS)
168
169     USE_INCLUDED_LIBINTL=no
170
171     dnl If we use NLS figure out what method
172     if test "$USE_NLS" = "yes"; then
173       AC_DEFINE(ENABLE_NLS)
174 #      AC_MSG_CHECKING([whether included gettext is requested])
175 #      AC_ARG_WITH(included-gettext,
176 #        [  --with-included-gettext use the GNU gettext library included here],
177 #        nls_cv_force_use_gnu_gettext=$withval,
178 #        nls_cv_force_use_gnu_gettext=no)
179 #      AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
180
181         dnl ad-hoc fix to prevent configure from detecting
182         dnl gettext on the system. use included-gettext as default.(rkawa)
183         nls_cv_force_use_gnu_gettext="yes"
184
185       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
186       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
187         dnl User does not insist on using GNU NLS library.  Figure out what
188         dnl to use.  If gettext or catgets are available (in this order) we
189         dnl use this.  Else we have to fall back to GNU NLS library.
190         dnl catgets is only used if permitted by option --with-catgets.
191         nls_cv_header_intl=
192         nls_cv_header_libgt=
193         CATOBJEXT=NONE
194
195         AC_CHECK_HEADER(libintl.h,
196           [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
197             [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
198                gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
199
200            if test "$gt_cv_func_gettext_libc" != "yes"; then
201              AC_CHECK_LIB(intl, bindtextdomain,
202                [AC_CACHE_CHECK([for gettext in libintl],
203                  gt_cv_func_gettext_libintl,
204                  [AC_CHECK_LIB(intl, gettext,
205                   gt_cv_func_gettext_libintl=yes,
206                   gt_cv_func_gettext_libintl=no)],
207                  gt_cv_func_gettext_libintl=no)])
208            fi
209
210            if test "$gt_cv_func_gettext_libc" = "yes" \
211               || test "$gt_cv_func_gettext_libintl" = "yes"; then
212               AC_DEFINE(HAVE_GETTEXT)
213               AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
214                 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
215               if test "$MSGFMT" != "no"; then
216                 AC_CHECK_FUNCS(dcgettext)
217                 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
218                 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
219                   [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
220                 AC_TRY_LINK(, [extern int _nl_msg_cat_cntr;
221                                return _nl_msg_cat_cntr],
222                   [CATOBJEXT=.gmo
223                    DATADIRNAME=share],
224                   [CATOBJEXT=.mo
225                    DATADIRNAME=lib])
226                 INSTOBJEXT=.mo
227               fi
228             fi
229         ])
230
231         if test "$CATOBJEXT" = "NONE"; then
232 #         AC_MSG_CHECKING([whether catgets can be used])
233 #         AC_ARG_WITH(catgets,
234 #           [  --with-catgets          use catgets functions if available],
235 #           nls_cv_use_catgets=$withval, nls_cv_use_catgets=no)
236 #         AC_MSG_RESULT($nls_cv_use_catgets)
237
238         dnl ad-hoc fix to prevent configure to detect catgets library.
239         dnl (rkawa)
240         nls_cv_use_catgets="no"
241
242           if test "$nls_cv_use_catgets" = "yes"; then
243             dnl No gettext in C library.  Try catgets next.
244             AC_CHECK_LIB(i, main)
245             AC_CHECK_FUNC(catgets,
246               [AC_DEFINE(HAVE_CATGETS)
247                INTLOBJS="\$(CATOBJS)"
248                AC_PATH_PROG(GENCAT, gencat, no)dnl
249                if test "$GENCAT" != "no"; then
250                  AC_PATH_PROG(GMSGFMT, gmsgfmt, no)
251                  if test "$GMSGFMT" = "no"; then
252                    AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt,
253                     [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)
254                  fi
255                  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
256                    [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
257                  USE_INCLUDED_LIBINTL=yes
258                  CATOBJEXT=.cat
259                  INSTOBJEXT=.cat
260                  DATADIRNAME=lib
261                  INTLDEPS='$(top_builddir)/intl/libintl.a'
262                  INTLLIBS=$INTLDEPS
263                  LIBS=`echo $LIBS | sed -e 's/-lintl//'`
264                  nls_cv_header_intl=intl/libintl.h
265                  nls_cv_header_libgt=intl/libgettext.h
266                fi])
267           fi
268         fi
269
270         if test "$CATOBJEXT" = "NONE"; then
271           dnl Neither gettext nor catgets in included in the C library.
272           dnl Fall back on GNU gettext library.
273           nls_cv_use_gnu_gettext=yes
274         fi
275       fi
276
277       if test "$nls_cv_use_gnu_gettext" = "yes"; then
278         dnl Mark actions used to generate GNU NLS library.
279         INTLOBJS="\$(GETTOBJS)"
280         AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
281           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
282         AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
283         AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
284           [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
285         AC_SUBST(MSGFMT)
286         USE_INCLUDED_LIBINTL=yes
287         CATOBJEXT=.gmo
288         INSTOBJEXT=.mo
289         DATADIRNAME=share
290         INTLDEPS='$(top_builddir)/intl/libintl.a'
291         INTLLIBS=$INTLDEPS
292         LIBS=`echo $LIBS | sed -e 's/-lintl//'`
293         nls_cv_header_intl=intl/libintl.h
294         nls_cv_header_libgt=intl/libgettext.h
295       fi
296
297       dnl Test whether we really found GNU xgettext.
298       if test "$XGETTEXT" != ":"; then
299         dnl If it is no GNU xgettext we define it as : so that the
300         dnl Makefiles still can work.
301         if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
302           : ;
303         else
304           AC_MSG_RESULT(
305             [found xgettext program is not GNU xgettext; ignore it])
306           XGETTEXT=":"
307         fi
308       fi
309
310       # We need to process the po/ directory.
311       POSUB=po
312     else
313       DATADIRNAME=share
314       nls_cv_header_intl=intl/libintl.h
315       nls_cv_header_libgt=intl/libgettext.h
316     fi
317
318     dnl the next line has been modified by rkawa to avoid
319     dnl misconfiguration of intl/libintl.h symlink.
320     rm -f intl/libintl.h
321
322     AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)
323     AC_OUTPUT_COMMANDS(
324      [case "$CONFIG_FILES" in *po/Makefile.in*)
325         sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
326       esac])
327
328
329     # If this is used in GNU gettext we have to set USE_NLS to `yes'
330     # because some of the sources are only built for this goal.
331     if test "$PACKAGE" = gettext; then
332       USE_NLS=yes
333       USE_INCLUDED_LIBINTL=yes
334     fi
335
336     dnl These rules are solely for the distribution goal.  While doing this
337     dnl we only have to keep exactly one list of the available catalogs
338     dnl in configure.in.
339     for lang in $ALL_LINGUAS; do
340       GMOFILES="$GMOFILES $lang.gmo"
341       POFILES="$POFILES $lang.po"
342     done
343
344     dnl Make all variables we use known to autoconf.
345     AC_SUBST(USE_INCLUDED_LIBINTL)
346     AC_SUBST(CATALOGS)
347     AC_SUBST(CATOBJEXT)
348     AC_SUBST(DATADIRNAME)
349     AC_SUBST(GMOFILES)
350     AC_SUBST(INSTOBJEXT)
351     AC_SUBST(INTLDEPS)
352     AC_SUBST(INTLLIBS)
353     AC_SUBST(INTLOBJS)
354     AC_SUBST(POFILES)
355     AC_SUBST(POSUB)
356   ])
357
358 AC_DEFUN(AM_GNU_GETTEXT,
359   [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
360    AC_REQUIRE([AC_PROG_CC])dnl
361    AC_REQUIRE([AC_PROG_RANLIB])dnl
362    AC_REQUIRE([AC_ISC_POSIX])dnl
363    AC_REQUIRE([AC_HEADER_STDC])dnl
364    AC_REQUIRE([AC_C_CONST])dnl
365    AC_REQUIRE([AC_C_INLINE])dnl
366    AC_REQUIRE([AC_TYPE_OFF_T])dnl
367    AC_REQUIRE([AC_TYPE_SIZE_T])dnl
368    AC_REQUIRE([AC_FUNC_ALLOCA])dnl
369    AC_REQUIRE([AC_FUNC_MMAP])dnl
370
371    AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
372 unistd.h sys/param.h])
373    AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \
374 strdup __argz_count __argz_stringify __argz_next])
375
376    if test "${ac_cv_func_stpcpy+set}" != "set"; then
377      AC_CHECK_FUNCS(stpcpy)
378    fi
379    if test "${ac_cv_func_stpcpy}" = "yes"; then
380      AC_DEFINE(HAVE_STPCPY)
381    fi
382
383    AM_LC_MESSAGES
384    AM_WITH_NLS
385
386
387    if test "x$CATOBJEXT" != "x"; then
388      if test "x$ALL_LINGUAS" = "x"; then
389        LINGUAS=
390      else
391        AC_MSG_CHECKING(for catalogs to be installed)
392        NEW_LINGUAS=
393        for lang in ${LINGUAS=$ALL_LINGUAS}; do
394          case "$ALL_LINGUAS" in
395           *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
396          esac
397        done
398        LINGUAS=$NEW_LINGUAS
399        AC_MSG_RESULT($LINGUAS)
400      fi
401
402      dnl Construct list of names of catalog files to be constructed.
403      if test -n "$LINGUAS"; then
404        for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
405      fi
406    fi
407
408    dnl The reference to <locale.h> in the installed <libintl.h> file
409    dnl must be resolved because we cannot expect the users of this
410    dnl to define HAVE_LOCALE_H.
411    if test $ac_cv_header_locale_h = yes; then
412      INCLUDE_LOCALE_H="#include <locale.h>"
413    else
414      INCLUDE_LOCALE_H="\
415 /* The system does not provide the header <locale.h>.  Take care yourself.  */"
416    fi
417    AC_SUBST(INCLUDE_LOCALE_H)
418    dnl Determine which catalog format we have (if any is needed)
419    dnl For now we know about two different formats:
420    dnl   Linux libc-5 and the normal X/Open format
421    test -d intl || mkdir intl
422    if test "$CATOBJEXT" = ".cat"; then
423      AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen)
424
425      dnl Transform the SED scripts while copying because some dumb SEDs
426      dnl cannot handle comments.
427      sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed
428
429      dnl To avoid XPG incompatible SED to be used, .msg files of
430      dnl x/open format are included to the archive, rather than
431      dnl compiled in the installation. If the system uses linux libc5
432      dnl format, then x/open files are removed and the sed script
433      dnl creates the files of the correct format. (rkawa)
434      if test "$msgformat" = "linux"; then
435        rm -f $srcdir/po/*.msg
436      fi
437    fi
438    dnl po2tbl.sed is always needed.
439    sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \
440      $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed
441
442    dnl In the intl/Makefile.in we have a special dependency which makes
443    dnl only sense for gettext.  We comment this out for non-gettext
444    dnl packages.
445    if test "$PACKAGE" = "gettext"; then
446      GT_NO="#NO#"
447      GT_YES=
448    else
449      GT_NO=
450      GT_YES="#YES#"
451    fi
452    AC_SUBST(GT_NO)
453    AC_SUBST(GT_YES)
454
455    dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
456    dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
457    dnl Try to locate is.
458    MKINSTALLDIRS=
459    if test -n "$ac_aux_dir"; then
460      MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
461    fi
462    if test -z "$MKINSTALLDIRS"; then
463      MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
464    fi
465    AC_SUBST(MKINSTALLDIRS)
466
467    dnl *** For now the libtool support in intl/Makefile is not for real.
468    l=
469    AC_SUBST(l)
470
471    dnl Generate list of files to be processed by xgettext which will
472    dnl be included in po/Makefile.
473    test -d po || mkdir po
474    if test "x$srcdir" != "x."; then
475      if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
476        posrcprefix="$srcdir/"
477      else
478        posrcprefix="../$srcdir/"
479      fi
480    else
481      posrcprefix="../"
482    fi
483    rm -f po/POTFILES
484    sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
485         < $srcdir/po/POTFILES.in > po/POTFILES
486   ])
487
488 # Check whether LC_MESSAGES is available in <locale.h>.
489 # Ulrich Drepper <drepper@cygnus.com>, 1995.
490 #
491 # This file can be copied and used freely without restrictions.  It can
492 # be used in projects which are not available under the GNU Public License
493 # but which still want to provide support for the GNU gettext functionality.
494 # Please note that the actual code is *not* freely available.
495
496 # serial 1
497
498 AC_DEFUN(AM_LC_MESSAGES,
499   [if test $ac_cv_header_locale_h = yes; then
500     AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
501       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
502        am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
503     if test $am_cv_val_LC_MESSAGES = yes; then
504       AC_DEFINE(HAVE_LC_MESSAGES)
505     fi
506   fi])
507
508 # Search path for a program which passes the given test.
509 # Ulrich Drepper <drepper@cygnus.com>, 1996.
510 #
511 # This file can be copied and used freely without restrictions.  It can
512 # be used in projects which are not available under the GNU Public License
513 # but which still want to provide support for the GNU gettext functionality.
514 # Please note that the actual code is *not* freely available.
515
516 # serial 1
517
518 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
519 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
520 AC_DEFUN(AM_PATH_PROG_WITH_TEST,
521 [# Extract the first word of "$2", so it can be a program name with args.
522 set dummy $2; ac_word=[$]2
523 AC_MSG_CHECKING([for $ac_word])
524 AC_CACHE_VAL(ac_cv_path_$1,
525 [case "[$]$1" in
526   /*)
527   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
528   ;;
529   *)
530   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
531   for ac_dir in ifelse([$5], , $PATH, [$5]); do
532     test -z "$ac_dir" && ac_dir=.
533     if test -f $ac_dir/$ac_word; then
534       if [$3]; then
535         ac_cv_path_$1="$ac_dir/$ac_word"
536         break
537       fi
538     fi
539   done
540   IFS="$ac_save_ifs"
541 dnl If no 4th arg is given, leave the cache variable unset,
542 dnl so AC_PATH_PROGS will keep looking.
543 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
544 ])dnl
545   ;;
546 esac])dnl
547 $1="$ac_cv_path_$1"
548 if test -n "[$]$1"; then
549   AC_MSG_RESULT([$]$1)
550 else
551   AC_MSG_RESULT(no)
552 fi
553 AC_SUBST($1)dnl
554 ])
555
556
557 AC_DEFUN(AC_LIBTOOL_SETUP,
558 [AC_PREREQ(2.13)dnl
559 AC_REQUIRE([AC_ENABLE_SHARED])dnl
560 AC_REQUIRE([AC_ENABLE_STATIC])dnl
561 AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
562 AC_REQUIRE([AC_CANONICAL_HOST])dnl
563 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
564 AC_REQUIRE([AC_PROG_RANLIB])dnl
565 AC_REQUIRE([AC_PROG_CC])dnl
566 AC_REQUIRE([AC_PROG_LD])dnl
567 AC_REQUIRE([AC_PROG_NM])dnl
568 AC_REQUIRE([AC_PROG_LN_S])dnl
569 dnl
570
571 case "$target" in
572 NONE) lt_target="$host" ;;
573 *) lt_target="$target" ;;
574 esac
575
576 # Check for any special flags to pass to ltconfig.
577 libtool_flags="--cache-file=$cache_file"
578 test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
579 test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
580 test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
581 test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
582 test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
583 ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
584 [libtool_flags="$libtool_flags --enable-dlopen"])
585 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
586 [libtool_flags="$libtool_flags --enable-win32-dll"])
587 AC_ARG_ENABLE(libtool-lock,
588   [  --disable-libtool-lock  avoid locking (might break parallel builds)])
589 test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
590 test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
591
592 # Some flags need to be propagated to the compiler or linker for good
593 # libtool support.
594 case "$lt_target" in
595 *-*-irix6*)
596   # Find out which ABI we are using.
597   echo '[#]line __oline__ "configure"' > conftest.$ac_ext
598   if AC_TRY_EVAL(ac_compile); then
599     case "`/usr/bin/file conftest.o`" in
600     *32-bit*)
601       LD="${LD-ld} -32"
602       ;;
603     *N32*)
604       LD="${LD-ld} -n32"
605       ;;
606     *64-bit*)
607       LD="${LD-ld} -64"
608       ;;
609     esac
610   fi
611   rm -rf conftest*
612   ;;
613
614 *-*-sco3.2v5*)
615   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
616   SAVE_CFLAGS="$CFLAGS"
617   CFLAGS="$CFLAGS -belf"
618   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
619     [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
620   if test x"$lt_cv_cc_needs_belf" != x"yes"; then
621     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
622     CFLAGS="$SAVE_CFLAGS"
623   fi
624   ;;
625
626 ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
627 [*-*-cygwin* | *-*-mingw*)
628   AC_CHECK_TOOL(DLLTOOL, dlltool, false)
629   AC_CHECK_TOOL(AS, as, false)
630   AC_CHECK_TOOL(OBJDUMP, objdump, false)
631   ;;
632 ])
633 esac
634 ])
635
636 # AC_LIBTOOL_DLOPEN - enable checks for dlopen support
637 AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
638
639 # AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
640 AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
641
642 # AC_ENABLE_SHARED - implement the --enable-shared flag
643 # Usage: AC_ENABLE_SHARED[(DEFAULT)]
644 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
645 #   `yes'.
646 AC_DEFUN(AC_ENABLE_SHARED, [dnl
647 define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
648 AC_ARG_ENABLE(shared,
649 changequote(<<, >>)dnl
650 <<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
651 changequote([, ])dnl
652 [p=${PACKAGE-default}
653 case "$enableval" in
654 yes) enable_shared=yes ;;
655 no) enable_shared=no ;;
656 *)
657   enable_shared=no
658   # Look at the argument we got.  We use all the common list separators.
659   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
660   for pkg in $enableval; do
661     if test "X$pkg" = "X$p"; then
662       enable_shared=yes
663     fi
664   done
665   IFS="$ac_save_ifs"
666   ;;
667 esac],
668 enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
669 ])
670
671 # AC_DISABLE_SHARED - set the default shared flag to --disable-shared
672 AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
673 AC_ENABLE_SHARED(no)])
674
675 # AC_ENABLE_STATIC - implement the --enable-static flag
676 # Usage: AC_ENABLE_STATIC[(DEFAULT)]
677 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
678 #   `yes'.
679 AC_DEFUN(AC_ENABLE_STATIC, [dnl
680 define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
681 AC_ARG_ENABLE(static,
682 changequote(<<, >>)dnl
683 <<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
684 changequote([, ])dnl
685 [p=${PACKAGE-default}
686 case "$enableval" in
687 yes) enable_static=yes ;;
688 no) enable_static=no ;;
689 *)
690   enable_static=no
691   # Look at the argument we got.  We use all the common list separators.
692   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
693   for pkg in $enableval; do
694     if test "X$pkg" = "X$p"; then
695       enable_static=yes
696     fi
697   done
698   IFS="$ac_save_ifs"
699   ;;
700 esac],
701 enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
702 ])
703
704 # AC_DISABLE_STATIC - set the default static flag to --disable-static
705 AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
706 AC_ENABLE_STATIC(no)])
707
708
709 # AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
710 # Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
711 #   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
712 #   `yes'.
713 AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
714 define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
715 AC_ARG_ENABLE(fast-install,
716 changequote(<<, >>)dnl
717 <<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
718 changequote([, ])dnl
719 [p=${PACKAGE-default}
720 case "$enableval" in
721 yes) enable_fast_install=yes ;;
722 no) enable_fast_install=no ;;
723 *)
724   enable_fast_install=no
725   # Look at the argument we got.  We use all the common list separators.
726   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
727   for pkg in $enableval; do
728     if test "X$pkg" = "X$p"; then
729       enable_fast_install=yes
730     fi
731   done
732   IFS="$ac_save_ifs"
733   ;;
734 esac],
735 enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
736 ])
737
738 # AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
739 AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
740 AC_ENABLE_FAST_INSTALL(no)])
741
742 # AC_PROG_LD - find the path to the GNU or non-GNU linker
743 AC_DEFUN(AC_PROG_LD,
744 [AC_ARG_WITH(gnu-ld,
745 [  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
746 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
747 AC_REQUIRE([AC_PROG_CC])dnl
748 AC_REQUIRE([AC_CANONICAL_HOST])dnl
749 AC_REQUIRE([AC_CANONICAL_BUILD])dnl
750 ac_prog=ld
751 if test "$ac_cv_prog_gcc" = yes; then
752   # Check if gcc -print-prog-name=ld gives a path.
753   AC_MSG_CHECKING([for ld used by GCC])
754   ac_prog=`($CC -print-prog-name=ld) 2>&5`
755   case "$ac_prog" in
756     # Accept absolute paths.
757 changequote(,)dnl
758     [\\/]* | [A-Za-z]:[\\/]*)
759       re_direlt='/[^/][^/]*/\.\./'
760 changequote([,])dnl
761       # Canonicalize the path of ld
762       ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
763       while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
764         ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
765       done
766       test -z "$LD" && LD="$ac_prog"
767       ;;
768   "")
769     # If it fails, then pretend we aren't using GCC.
770     ac_prog=ld
771     ;;
772   *)
773     # If it is relative, then search for the first ld in PATH.
774     with_gnu_ld=unknown
775     ;;
776   esac
777 elif test "$with_gnu_ld" = yes; then
778   AC_MSG_CHECKING([for GNU ld])
779 else
780   AC_MSG_CHECKING([for non-GNU ld])
781 fi
782 AC_CACHE_VAL(ac_cv_path_LD,
783 [if test -z "$LD"; then
784   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
785   for ac_dir in $PATH; do
786     test -z "$ac_dir" && ac_dir=.
787     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
788       ac_cv_path_LD="$ac_dir/$ac_prog"
789       # Check to see if the program is GNU ld.  I'd rather use --version,
790       # but apparently some GNU ld's only accept -v.
791       # Break only if it was the GNU/non-GNU ld that we prefer.
792       if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
793         test "$with_gnu_ld" != no && break
794       else
795         test "$with_gnu_ld" != yes && break
796       fi
797     fi
798   done
799   IFS="$ac_save_ifs"
800 else
801   ac_cv_path_LD="$LD" # Let the user override the test with a path.
802 fi])
803 LD="$ac_cv_path_LD"
804 if test -n "$LD"; then
805   AC_MSG_RESULT($LD)
806 else
807   AC_MSG_RESULT(no)
808 fi
809 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
810 AC_PROG_LD_GNU
811 ])
812
813 AC_DEFUN(AC_PROG_LD_GNU,
814 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
815 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
816 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
817   ac_cv_prog_gnu_ld=yes
818 else
819   ac_cv_prog_gnu_ld=no
820 fi])
821 ])
822
823 # AC_PROG_NM - find the path to a BSD-compatible name lister
824 AC_DEFUN(AC_PROG_NM,
825 [AC_MSG_CHECKING([for BSD-compatible nm])
826 AC_CACHE_VAL(ac_cv_path_NM,
827 [if test -n "$NM"; then
828   # Let the user override the test.
829   ac_cv_path_NM="$NM"
830 else
831   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
832   for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
833     test -z "$ac_dir" && ac_dir=.
834     if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
835       # Check to see if the nm accepts a BSD-compat flag.
836       # Adding the `sed 1q' prevents false positives on HP-UX, which says:
837       #   nm: unknown option "B" ignored
838       if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
839         ac_cv_path_NM="$ac_dir/nm -B"
840         break
841       elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
842         ac_cv_path_NM="$ac_dir/nm -p"
843         break
844       else
845         ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
846         continue # so that we can try to find one that supports BSD flags
847       fi
848     fi
849   done
850   IFS="$ac_save_ifs"
851   test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
852 fi])
853 NM="$ac_cv_path_NM"
854 AC_MSG_RESULT([$NM])
855 ])
856
857 # AC_CHECK_LIBM - check for math library
858 AC_DEFUN(AC_CHECK_LIBM,
859 [AC_REQUIRE([AC_CANONICAL_HOST])dnl
860 LIBM=
861 case "$lt_target" in
862 *-*-beos* | *-*-cygwin*)
863   # These system don't have libm
864   ;;
865 *-ncr-sysv4.3*)
866   AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
867   AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
868   ;;
869 *)
870   AC_CHECK_LIB(m, main, LIBM="-lm")
871   ;;
872 esac
873 ])
874
875 # AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
876 # the libltdl convenience library, adds --enable-ltdl-convenience to
877 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
878 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
879 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
880 # '${top_builddir}/' (note the single quotes!) if your package is not
881 # flat, and, if you're not using automake, define top_builddir as
882 # appropriate in the Makefiles.
883 AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
884   case "$enable_ltdl_convenience" in
885   no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
886   "") enable_ltdl_convenience=yes
887       ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
888   esac
889   LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
890   INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
891 ])
892
893 # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
894 # the libltdl installable library, and adds --enable-ltdl-install to
895 # the configure arguments.  Note that LIBLTDL is not AC_SUBSTed, nor
896 # is AC_CONFIG_SUBDIRS called.  If DIR is not provided, it is assumed
897 # to be `${top_builddir}/libltdl'.  Make sure you start DIR with
898 # '${top_builddir}/' (note the single quotes!) if your package is not
899 # flat, and, if you're not using automake, define top_builddir as
900 # appropriate in the Makefiles.
901 # In the future, this macro may have to be called after AC_PROG_LIBTOOL.
902 AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
903   AC_CHECK_LIB(ltdl, main,
904   [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
905   [if test x"$enable_ltdl_install" = xno; then
906      AC_MSG_WARN([libltdl not installed, but installation disabled])
907    else
908      enable_ltdl_install=yes
909    fi
910   ])
911   if test x"$enable_ltdl_install" = x"yes"; then
912     ac_configure_args="$ac_configure_args --enable-ltdl-install"
913     LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
914     INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
915   else
916     ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
917     LIBLTDL="-lltdl"
918     INCLTDL=
919   fi
920 ])
921
922 dnl old names
923 AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
924 AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
925 AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
926 AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
927 AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
928 AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
929 AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
930
931 dnl This is just to silence aclocal about the macro not being used
932 ifelse([AC_DISABLE_FAST_INSTALL])dnl