aclocal.m4 revision 102644
1# aclocal.m4t generated automatically by aclocal 1.6.3 -*- Autoconf -*-
2
3# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
4# Free Software Foundation, Inc.
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
13
14dnl $Id: acinclude.m4,v 1.15 1998/05/23 14:54:53 joda Exp $
15dnl
16dnl Only put things that for some reason can't live in the `cf'
17dnl directory in this file.
18dnl
19
20dnl $xId: misc.m4,v 1.1 1997/12/14 15:59:04 joda Exp $
21dnl
22define(upcase,`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`)dnl
23
24
25dnl $Id: misc.m4,v 1.5 2002/05/24 15:35:32 joda Exp $
26dnl
27AC_DEFUN([upcase],[`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`])dnl
28AC_DEFUN([rk_LIBOBJ],[AC_LIBOBJ([$1])])dnl
29AC_DEFUN([rk_CONFIG_HEADER],[AH_TOP([#ifndef RCSID
30#define RCSID(msg) \
31static /**/const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg }
32#endif
33
34/* Maximum values on all known systems */
35#define MaxHostNameLen (64+4)
36#define MaxPathLen (1024+4)
37
38])])
39# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*-
40
41# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
42
43# This program is free software; you can redistribute it and/or modify
44# it under the terms of the GNU General Public License as published by
45# the Free Software Foundation; either version 2, or (at your option)
46# any later version.
47
48# This program is distributed in the hope that it will be useful,
49# but WITHOUT ANY WARRANTY; without even the implied warranty of
50# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
51# GNU General Public License for more details.
52
53# You should have received a copy of the GNU General Public License
54# along with this program; if not, write to the Free Software
55# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
56# 02111-1307, USA.
57
58AC_PREREQ([2.52])
59
60# serial 6
61
62# When config.status generates a header, we must update the stamp-h file.
63# This file resides in the same directory as the config header
64# that is generated.  We must strip everything past the first ":",
65# and everything past the last "/".
66
67# _AM_DIRNAME(PATH)
68# -----------------
69# Like AS_DIRNAME, only do it during macro expansion
70AC_DEFUN([_AM_DIRNAME],
71       [m4_if(regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1,
72	      m4_if(regexp([$1], [^//\([^/]\|$\)]), -1,
73		    m4_if(regexp([$1], [^/.*]), -1,
74			  [.],
75			  patsubst([$1], [^\(/\).*], [\1])),
76		    patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])),
77	      patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl
78])# _AM_DIRNAME
79
80
81# The stamp files are numbered to have different names.
82# We could number them on a directory basis, but that's additional
83# complications, let's have a unique counter.
84m4_define([_AM_STAMP_Count], [0])
85
86
87# _AM_STAMP(HEADER)
88# -----------------
89# The name of the stamp file for HEADER.
90AC_DEFUN([_AM_STAMP],
91[m4_define([_AM_STAMP_Count], m4_incr(_AM_STAMP_Count))dnl
92AS_ESCAPE(_AM_DIRNAME(patsubst([$1],
93                               [:.*])))/stamp-h[]_AM_STAMP_Count])
94
95
96# _AM_CONFIG_HEADER(HEADER[:SOURCES], COMMANDS, INIT-COMMANDS)
97# ------------------------------------------------------------
98# We used to try to get a real timestamp in stamp-h.  But the fear is that
99# that will cause unnecessary cvs conflicts.
100AC_DEFUN([_AM_CONFIG_HEADER],
101[# Add the stamp file to the list of files AC keeps track of,
102# along with our hook.
103AC_CONFIG_HEADERS([$1],
104                  [# update the timestamp
105echo 'timestamp for $1' >"_AM_STAMP([$1])"
106$2],
107                  [$3])
108])# _AM_CONFIG_HEADER
109
110
111# AM_CONFIG_HEADER(HEADER[:SOURCES]..., COMMANDS, INIT-COMMANDS)
112# --------------------------------------------------------------
113AC_DEFUN([AM_CONFIG_HEADER],
114[AC_FOREACH([_AM_File], [$1], [_AM_CONFIG_HEADER(_AM_File, [$2], [$3])])
115])# AM_CONFIG_HEADER
116
117# Do all the work for Automake.                            -*- Autoconf -*-
118
119# This macro actually does too much some checks are only needed if
120# your package does certain things.  But this isn't really a big deal.
121
122# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
123# Free Software Foundation, Inc.
124
125# This program is free software; you can redistribute it and/or modify
126# it under the terms of the GNU General Public License as published by
127# the Free Software Foundation; either version 2, or (at your option)
128# any later version.
129
130# This program is distributed in the hope that it will be useful,
131# but WITHOUT ANY WARRANTY; without even the implied warranty of
132# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
133# GNU General Public License for more details.
134
135# You should have received a copy of the GNU General Public License
136# along with this program; if not, write to the Free Software
137# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
138# 02111-1307, USA.
139
140# serial 8
141
142# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
143# written in clear, in which case automake, when reading aclocal.m4,
144# will think it sees a *use*, and therefore will trigger all it's
145# C support machinery.  Also note that it means that autoscan, seeing
146# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
147
148
149AC_PREREQ([2.52])
150
151# Autoconf 2.50 wants to disallow AM_ names.  We explicitly allow
152# the ones we care about.
153m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
154
155# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
156# AM_INIT_AUTOMAKE([OPTIONS])
157# -----------------------------------------------
158# The call with PACKAGE and VERSION arguments is the old style
159# call (pre autoconf-2.50), which is being phased out.  PACKAGE
160# and VERSION should now be passed to AC_INIT and removed from
161# the call to AM_INIT_AUTOMAKE.
162# We support both call styles for the transition.  After
163# the next Automake release, Autoconf can make the AC_INIT
164# arguments mandatory, and then we can depend on a new Autoconf
165# release and drop the old call support.
166AC_DEFUN([AM_INIT_AUTOMAKE],
167[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
168 AC_REQUIRE([AC_PROG_INSTALL])dnl
169# test to see if srcdir already configured
170if test "`cd $srcdir && pwd`" != "`pwd`" &&
171   test -f $srcdir/config.status; then
172  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
173fi
174
175# Define the identity of the package.
176dnl Distinguish between old-style and new-style calls.
177m4_ifval([$2],
178[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
179 AC_SUBST([PACKAGE], [$1])dnl
180 AC_SUBST([VERSION], [$2])],
181[_AM_SET_OPTIONS([$1])dnl
182 AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])dnl
183 AC_SUBST([VERSION], [AC_PACKAGE_VERSION])])dnl
184
185_AM_IF_OPTION([no-define],,
186[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
187 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
188
189# Some tools Automake needs.
190AC_REQUIRE([AM_SANITY_CHECK])dnl
191AC_REQUIRE([AC_ARG_PROGRAM])dnl
192AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
193AM_MISSING_PROG(AUTOCONF, autoconf)
194AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
195AM_MISSING_PROG(AUTOHEADER, autoheader)
196AM_MISSING_PROG(MAKEINFO, makeinfo)
197AM_MISSING_PROG(AMTAR, tar)
198AM_PROG_INSTALL_SH
199AM_PROG_INSTALL_STRIP
200# We need awk for the "check" target.  The system "awk" is bad on
201# some platforms.
202AC_REQUIRE([AC_PROG_AWK])dnl
203AC_REQUIRE([AC_PROG_MAKE_SET])dnl
204
205_AM_IF_OPTION([no-dependencies],,
206[AC_PROVIDE_IFELSE([AC_PROG_][CC],
207                  [_AM_DEPENDENCIES(CC)],
208                  [define([AC_PROG_][CC],
209                          defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl
210AC_PROVIDE_IFELSE([AC_PROG_][CXX],
211                  [_AM_DEPENDENCIES(CXX)],
212                  [define([AC_PROG_][CXX],
213                          defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl
214])
215])
216
217# Copyright 2002  Free Software Foundation, Inc.
218
219# This program is free software; you can redistribute it and/or modify
220# it under the terms of the GNU General Public License as published by
221# the Free Software Foundation; either version 2, or (at your option)
222# any later version.
223
224# This program is distributed in the hope that it will be useful,
225# but WITHOUT ANY WARRANTY; without even the implied warranty of
226# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
227# GNU General Public License for more details.
228
229# You should have received a copy of the GNU General Public License
230# along with this program; if not, write to the Free Software
231# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
232
233# AM_AUTOMAKE_VERSION(VERSION)
234# ----------------------------
235# Automake X.Y traces this macro to ensure aclocal.m4 has been
236# generated from the m4 files accompanying Automake X.Y.
237AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.6"])
238
239# AM_SET_CURRENT_AUTOMAKE_VERSION
240# -------------------------------
241# Call AM_AUTOMAKE_VERSION so it can be traced.
242# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
243AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
244	 [AM_AUTOMAKE_VERSION([1.6.3])])
245
246# Helper functions for option handling.                    -*- Autoconf -*-
247
248# Copyright 2001, 2002  Free Software Foundation, Inc.
249
250# This program is free software; you can redistribute it and/or modify
251# it under the terms of the GNU General Public License as published by
252# the Free Software Foundation; either version 2, or (at your option)
253# any later version.
254
255# This program is distributed in the hope that it will be useful,
256# but WITHOUT ANY WARRANTY; without even the implied warranty of
257# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
258# GNU General Public License for more details.
259
260# You should have received a copy of the GNU General Public License
261# along with this program; if not, write to the Free Software
262# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
263# 02111-1307, USA.
264
265# serial 2
266
267# _AM_MANGLE_OPTION(NAME)
268# -----------------------
269AC_DEFUN([_AM_MANGLE_OPTION],
270[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
271
272# _AM_SET_OPTION(NAME)
273# ------------------------------
274# Set option NAME.  Presently that only means defining a flag for this option.
275AC_DEFUN([_AM_SET_OPTION],
276[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
277
278# _AM_SET_OPTIONS(OPTIONS)
279# ----------------------------------
280# OPTIONS is a space-separated list of Automake options.
281AC_DEFUN([_AM_SET_OPTIONS],
282[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
283
284# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
285# -------------------------------------------
286# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
287AC_DEFUN([_AM_IF_OPTION],
288[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
289
290#
291# Check to make sure that the build environment is sane.
292#
293
294# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
295
296# This program is free software; you can redistribute it and/or modify
297# it under the terms of the GNU General Public License as published by
298# the Free Software Foundation; either version 2, or (at your option)
299# any later version.
300
301# This program is distributed in the hope that it will be useful,
302# but WITHOUT ANY WARRANTY; without even the implied warranty of
303# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
304# GNU General Public License for more details.
305
306# You should have received a copy of the GNU General Public License
307# along with this program; if not, write to the Free Software
308# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
309# 02111-1307, USA.
310
311# serial 3
312
313# AM_SANITY_CHECK
314# ---------------
315AC_DEFUN([AM_SANITY_CHECK],
316[AC_MSG_CHECKING([whether build environment is sane])
317# Just in case
318sleep 1
319echo timestamp > conftest.file
320# Do `set' in a subshell so we don't clobber the current shell's
321# arguments.  Must try -L first in case configure is actually a
322# symlink; some systems play weird games with the mod time of symlinks
323# (eg FreeBSD returns the mod time of the symlink's containing
324# directory).
325if (
326   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
327   if test "$[*]" = "X"; then
328      # -L didn't work.
329      set X `ls -t $srcdir/configure conftest.file`
330   fi
331   rm -f conftest.file
332   if test "$[*]" != "X $srcdir/configure conftest.file" \
333      && test "$[*]" != "X conftest.file $srcdir/configure"; then
334
335      # If neither matched, then we have a broken ls.  This can happen
336      # if, for instance, CONFIG_SHELL is bash and it inherits a
337      # broken ls alias from the environment.  This has actually
338      # happened.  Such a system could not be considered "sane".
339      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
340alias in your environment])
341   fi
342
343   test "$[2]" = conftest.file
344   )
345then
346   # Ok.
347   :
348else
349   AC_MSG_ERROR([newly created file is older than distributed files!
350Check your system clock])
351fi
352AC_MSG_RESULT(yes)])
353
354#  -*- Autoconf -*-
355
356
357# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
358
359# This program is free software; you can redistribute it and/or modify
360# it under the terms of the GNU General Public License as published by
361# the Free Software Foundation; either version 2, or (at your option)
362# any later version.
363
364# This program is distributed in the hope that it will be useful,
365# but WITHOUT ANY WARRANTY; without even the implied warranty of
366# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
367# GNU General Public License for more details.
368
369# You should have received a copy of the GNU General Public License
370# along with this program; if not, write to the Free Software
371# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
372# 02111-1307, USA.
373
374# serial 3
375
376# AM_MISSING_PROG(NAME, PROGRAM)
377# ------------------------------
378AC_DEFUN([AM_MISSING_PROG],
379[AC_REQUIRE([AM_MISSING_HAS_RUN])
380$1=${$1-"${am_missing_run}$2"}
381AC_SUBST($1)])
382
383
384# AM_MISSING_HAS_RUN
385# ------------------
386# Define MISSING if not defined so far and test if it supports --run.
387# If it does, set am_missing_run to use it, otherwise, to nothing.
388AC_DEFUN([AM_MISSING_HAS_RUN],
389[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
390test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
391# Use eval to expand $SHELL
392if eval "$MISSING --run true"; then
393  am_missing_run="$MISSING --run "
394else
395  am_missing_run=
396  AC_MSG_WARN([`missing' script is too old or missing])
397fi
398])
399
400# AM_AUX_DIR_EXPAND
401
402# Copyright 2001 Free Software Foundation, Inc.
403
404# This program is free software; you can redistribute it and/or modify
405# it under the terms of the GNU General Public License as published by
406# the Free Software Foundation; either version 2, or (at your option)
407# any later version.
408
409# This program is distributed in the hope that it will be useful,
410# but WITHOUT ANY WARRANTY; without even the implied warranty of
411# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
412# GNU General Public License for more details.
413
414# You should have received a copy of the GNU General Public License
415# along with this program; if not, write to the Free Software
416# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
417# 02111-1307, USA.
418
419# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
420# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
421# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
422#
423# Of course, Automake must honor this variable whenever it calls a
424# tool from the auxiliary directory.  The problem is that $srcdir (and
425# therefore $ac_aux_dir as well) can be either absolute or relative,
426# depending on how configure is run.  This is pretty annoying, since
427# it makes $ac_aux_dir quite unusable in subdirectories: in the top
428# source directory, any form will work fine, but in subdirectories a
429# relative path needs to be adjusted first.
430#
431# $ac_aux_dir/missing
432#    fails when called from a subdirectory if $ac_aux_dir is relative
433# $top_srcdir/$ac_aux_dir/missing
434#    fails if $ac_aux_dir is absolute,
435#    fails when called from a subdirectory in a VPATH build with
436#          a relative $ac_aux_dir
437#
438# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
439# are both prefixed by $srcdir.  In an in-source build this is usually
440# harmless because $srcdir is `.', but things will broke when you
441# start a VPATH build or use an absolute $srcdir.
442#
443# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
444# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
445#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
446# and then we would define $MISSING as
447#   MISSING="\${SHELL} $am_aux_dir/missing"
448# This will work as long as MISSING is not called from configure, because
449# unfortunately $(top_srcdir) has no meaning in configure.
450# However there are other variables, like CC, which are often used in
451# configure, and could therefore not use this "fixed" $ac_aux_dir.
452#
453# Another solution, used here, is to always expand $ac_aux_dir to an
454# absolute PATH.  The drawback is that using absolute paths prevent a
455# configured tree to be moved without reconfiguration.
456
457# Rely on autoconf to set up CDPATH properly.
458AC_PREREQ([2.50])
459
460AC_DEFUN([AM_AUX_DIR_EXPAND], [
461# expand $ac_aux_dir to an absolute path
462am_aux_dir=`cd $ac_aux_dir && pwd`
463])
464
465# AM_PROG_INSTALL_SH
466# ------------------
467# Define $install_sh.
468
469# Copyright 2001 Free Software Foundation, Inc.
470
471# This program is free software; you can redistribute it and/or modify
472# it under the terms of the GNU General Public License as published by
473# the Free Software Foundation; either version 2, or (at your option)
474# any later version.
475
476# This program is distributed in the hope that it will be useful,
477# but WITHOUT ANY WARRANTY; without even the implied warranty of
478# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
479# GNU General Public License for more details.
480
481# You should have received a copy of the GNU General Public License
482# along with this program; if not, write to the Free Software
483# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
484# 02111-1307, USA.
485
486AC_DEFUN([AM_PROG_INSTALL_SH],
487[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
488install_sh=${install_sh-"$am_aux_dir/install-sh"}
489AC_SUBST(install_sh)])
490
491# AM_PROG_INSTALL_STRIP
492
493# Copyright 2001 Free Software Foundation, Inc.
494
495# This program is free software; you can redistribute it and/or modify
496# it under the terms of the GNU General Public License as published by
497# the Free Software Foundation; either version 2, or (at your option)
498# any later version.
499
500# This program is distributed in the hope that it will be useful,
501# but WITHOUT ANY WARRANTY; without even the implied warranty of
502# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
503# GNU General Public License for more details.
504
505# You should have received a copy of the GNU General Public License
506# along with this program; if not, write to the Free Software
507# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
508# 02111-1307, USA.
509
510# One issue with vendor `install' (even GNU) is that you can't
511# specify the program used to strip binaries.  This is especially
512# annoying in cross-compiling environments, where the build's strip
513# is unlikely to handle the host's binaries.
514# Fortunately install-sh will honor a STRIPPROG variable, so we
515# always use install-sh in `make install-strip', and initialize
516# STRIPPROG with the value of the STRIP variable (set by the user).
517AC_DEFUN([AM_PROG_INSTALL_STRIP],
518[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
519# Installed binaries are usually stripped using `strip' when the user
520# run `make install-strip'.  However `strip' might not be the right
521# tool to use in cross-compilation environments, therefore Automake
522# will honor the `STRIP' environment variable to overrule this program.
523dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
524if test "$cross_compiling" != no; then
525  AC_CHECK_TOOL([STRIP], [strip], :)
526fi
527INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
528AC_SUBST([INSTALL_STRIP_PROGRAM])])
529
530# serial 4						-*- Autoconf -*-
531
532# Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
533
534# This program is free software; you can redistribute it and/or modify
535# it under the terms of the GNU General Public License as published by
536# the Free Software Foundation; either version 2, or (at your option)
537# any later version.
538
539# This program is distributed in the hope that it will be useful,
540# but WITHOUT ANY WARRANTY; without even the implied warranty of
541# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
542# GNU General Public License for more details.
543
544# You should have received a copy of the GNU General Public License
545# along with this program; if not, write to the Free Software
546# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
547# 02111-1307, USA.
548
549
550# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
551# written in clear, in which case automake, when reading aclocal.m4,
552# will think it sees a *use*, and therefore will trigger all it's
553# C support machinery.  Also note that it means that autoscan, seeing
554# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
555
556
557
558# _AM_DEPENDENCIES(NAME)
559# ----------------------
560# See how the compiler implements dependency checking.
561# NAME is "CC", "CXX", "GCJ", or "OBJC".
562# We try a few techniques and use that to set a single cache variable.
563#
564# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
565# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
566# dependency, and given that the user is not expected to run this macro,
567# just rely on AC_PROG_CC.
568AC_DEFUN([_AM_DEPENDENCIES],
569[AC_REQUIRE([AM_SET_DEPDIR])dnl
570AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
571AC_REQUIRE([AM_MAKE_INCLUDE])dnl
572AC_REQUIRE([AM_DEP_TRACK])dnl
573
574ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
575       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
576       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
577       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
578                   [depcc="$$1"   am_compiler_list=])
579
580AC_CACHE_CHECK([dependency style of $depcc],
581               [am_cv_$1_dependencies_compiler_type],
582[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
583  # We make a subdir and do the tests there.  Otherwise we can end up
584  # making bogus files that we don't know about and never remove.  For
585  # instance it was reported that on HP-UX the gcc test will end up
586  # making a dummy file named `D' -- because `-MD' means `put the output
587  # in D'.
588  mkdir conftest.dir
589  # Copy depcomp to subdir because otherwise we won't find it if we're
590  # using a relative directory.
591  cp "$am_depcomp" conftest.dir
592  cd conftest.dir
593
594  am_cv_$1_dependencies_compiler_type=none
595  if test "$am_compiler_list" = ""; then
596     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
597  fi
598  for depmode in $am_compiler_list; do
599    # We need to recreate these files for each test, as the compiler may
600    # overwrite some of them when testing with obscure command lines.
601    # This happens at least with the AIX C compiler.
602    echo '#include "conftest.h"' > conftest.c
603    echo 'int i;' > conftest.h
604    echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
605
606    case $depmode in
607    nosideeffect)
608      # after this tag, mechanisms are not by side-effect, so they'll
609      # only be used when explicitly requested
610      if test "x$enable_dependency_tracking" = xyes; then
611	continue
612      else
613	break
614      fi
615      ;;
616    none) break ;;
617    esac
618    # We check with `-c' and `-o' for the sake of the "dashmstdout"
619    # mode.  It turns out that the SunPro C++ compiler does not properly
620    # handle `-M -o', and we need to detect this.
621    if depmode=$depmode \
622       source=conftest.c object=conftest.o \
623       depfile=conftest.Po tmpdepfile=conftest.TPo \
624       $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
625       grep conftest.h conftest.Po > /dev/null 2>&1 &&
626       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
627      am_cv_$1_dependencies_compiler_type=$depmode
628      break
629    fi
630  done
631
632  cd ..
633  rm -rf conftest.dir
634else
635  am_cv_$1_dependencies_compiler_type=none
636fi
637])
638AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
639])
640
641
642# AM_SET_DEPDIR
643# -------------
644# Choose a directory name for dependency files.
645# This macro is AC_REQUIREd in _AM_DEPENDENCIES
646AC_DEFUN([AM_SET_DEPDIR],
647[rm -f .deps 2>/dev/null
648mkdir .deps 2>/dev/null
649if test -d .deps; then
650  DEPDIR=.deps
651else
652  # MS-DOS does not allow filenames that begin with a dot.
653  DEPDIR=_deps
654fi
655rmdir .deps 2>/dev/null
656AC_SUBST([DEPDIR])
657])
658
659
660# AM_DEP_TRACK
661# ------------
662AC_DEFUN([AM_DEP_TRACK],
663[AC_ARG_ENABLE(dependency-tracking,
664[  --disable-dependency-tracking Speeds up one-time builds
665  --enable-dependency-tracking  Do not reject slow dependency extractors])
666if test "x$enable_dependency_tracking" != xno; then
667  am_depcomp="$ac_aux_dir/depcomp"
668  AMDEPBACKSLASH='\'
669fi
670AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
671AC_SUBST([AMDEPBACKSLASH])
672])
673
674# Generate code to set up dependency tracking.   -*- Autoconf -*-
675
676# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
677
678# This program is free software; you can redistribute it and/or modify
679# it under the terms of the GNU General Public License as published by
680# the Free Software Foundation; either version 2, or (at your option)
681# any later version.
682
683# This program is distributed in the hope that it will be useful,
684# but WITHOUT ANY WARRANTY; without even the implied warranty of
685# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
686# GNU General Public License for more details.
687
688# You should have received a copy of the GNU General Public License
689# along with this program; if not, write to the Free Software
690# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
691# 02111-1307, USA.
692
693#serial 2
694
695# _AM_OUTPUT_DEPENDENCY_COMMANDS
696# ------------------------------
697AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
698[for mf in $CONFIG_FILES; do
699  # Strip MF so we end up with the name of the file.
700  mf=`echo "$mf" | sed -e 's/:.*$//'`
701  # Check whether this is an Automake generated Makefile or not.
702  # We used to match only the files named `Makefile.in', but
703  # some people rename them; so instead we look at the file content.
704  # Grep'ing the first line is not enough: some people post-process
705  # each Makefile.in and add a new line on top of each file to say so.
706  # So let's grep whole file.
707  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
708    dirpart=`AS_DIRNAME("$mf")`
709  else
710    continue
711  fi
712  grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
713  # Extract the definition of DEP_FILES from the Makefile without
714  # running `make'.
715  DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
716  test -z "$DEPDIR" && continue
717  # When using ansi2knr, U may be empty or an underscore; expand it
718  U=`sed -n -e '/^U = / s///p' < "$mf"`
719  test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
720  # We invoke sed twice because it is the simplest approach to
721  # changing $(DEPDIR) to its actual value in the expansion.
722  for file in `sed -n -e '
723    /^DEP_FILES = .*\\\\$/ {
724      s/^DEP_FILES = //
725      :loop
726	s/\\\\$//
727	p
728	n
729	/\\\\$/ b loop
730      p
731    }
732    /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
733       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
734    # Make sure the directory exists.
735    test -f "$dirpart/$file" && continue
736    fdir=`AS_DIRNAME(["$file"])`
737    AS_MKDIR_P([$dirpart/$fdir])
738    # echo "creating $dirpart/$file"
739    echo '# dummy' > "$dirpart/$file"
740  done
741done
742])# _AM_OUTPUT_DEPENDENCY_COMMANDS
743
744
745# AM_OUTPUT_DEPENDENCY_COMMANDS
746# -----------------------------
747# This macro should only be invoked once -- use via AC_REQUIRE.
748#
749# This code is only required when automatic dependency tracking
750# is enabled.  FIXME.  This creates each `.P' file that we will
751# need in order to bootstrap the dependency handling code.
752AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
753[AC_CONFIG_COMMANDS([depfiles],
754     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
755     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
756])
757
758# Copyright 2001 Free Software Foundation, Inc.             -*- Autoconf -*-
759
760# This program is free software; you can redistribute it and/or modify
761# it under the terms of the GNU General Public License as published by
762# the Free Software Foundation; either version 2, or (at your option)
763# any later version.
764
765# This program is distributed in the hope that it will be useful,
766# but WITHOUT ANY WARRANTY; without even the implied warranty of
767# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
768# GNU General Public License for more details.
769
770# You should have received a copy of the GNU General Public License
771# along with this program; if not, write to the Free Software
772# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
773# 02111-1307, USA.
774
775# serial 2
776
777# AM_MAKE_INCLUDE()
778# -----------------
779# Check to see how make treats includes.
780AC_DEFUN([AM_MAKE_INCLUDE],
781[am_make=${MAKE-make}
782cat > confinc << 'END'
783doit:
784	@echo done
785END
786# If we don't find an include directive, just comment out the code.
787AC_MSG_CHECKING([for style of include used by $am_make])
788am__include="#"
789am__quote=
790_am_result=none
791# First try GNU make style include.
792echo "include confinc" > confmf
793# We grep out `Entering directory' and `Leaving directory'
794# messages which can occur if `w' ends up in MAKEFLAGS.
795# In particular we don't look at `^make:' because GNU make might
796# be invoked under some other name (usually "gmake"), in which
797# case it prints its new name instead of `make'.
798if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then
799   am__include=include
800   am__quote=
801   _am_result=GNU
802fi
803# Now try BSD make style include.
804if test "$am__include" = "#"; then
805   echo '.include "confinc"' > confmf
806   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
807      am__include=.include
808      am__quote="\""
809      _am_result=BSD
810   fi
811fi
812AC_SUBST(am__include)
813AC_SUBST(am__quote)
814AC_MSG_RESULT($_am_result)
815rm -f confinc confmf
816])
817
818# AM_CONDITIONAL                                              -*- Autoconf -*-
819
820# Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
821
822# This program is free software; you can redistribute it and/or modify
823# it under the terms of the GNU General Public License as published by
824# the Free Software Foundation; either version 2, or (at your option)
825# any later version.
826
827# This program is distributed in the hope that it will be useful,
828# but WITHOUT ANY WARRANTY; without even the implied warranty of
829# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
830# GNU General Public License for more details.
831
832# You should have received a copy of the GNU General Public License
833# along with this program; if not, write to the Free Software
834# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
835# 02111-1307, USA.
836
837# serial 5
838
839AC_PREREQ(2.52)
840
841# AM_CONDITIONAL(NAME, SHELL-CONDITION)
842# -------------------------------------
843# Define a conditional.
844AC_DEFUN([AM_CONDITIONAL],
845[ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
846        [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
847AC_SUBST([$1_TRUE])
848AC_SUBST([$1_FALSE])
849if $2; then
850  $1_TRUE=
851  $1_FALSE='#'
852else
853  $1_TRUE='#'
854  $1_FALSE=
855fi
856AC_CONFIG_COMMANDS_PRE(
857[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
858  AC_MSG_ERROR([conditional \"$1\" was never defined.
859Usually this means the macro was only invoked conditionally.])
860fi])])
861
862
863# Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
864
865# This program is free software; you can redistribute it and/or modify
866# it under the terms of the GNU General Public License as published by
867# the Free Software Foundation; either version 2, or (at your option)
868# any later version.
869
870# This program is distributed in the hope that it will be useful,
871# but WITHOUT ANY WARRANTY; without even the implied warranty of
872# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
873# GNU General Public License for more details.
874
875# You should have received a copy of the GNU General Public License
876# along with this program; if not, write to the Free Software
877# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
878# 02111-1307, USA.
879
880# serial 3
881
882AC_PREREQ(2.50)
883
884# AM_PROG_LEX
885# -----------
886# Autoconf leaves LEX=: if lex or flex can't be found.  Change that to a
887# "missing" invocation, for better error output.
888AC_DEFUN([AM_PROG_LEX],
889[AC_REQUIRE([AM_MISSING_HAS_RUN])dnl
890AC_REQUIRE([AC_PROG_LEX])dnl
891if test "$LEX" = :; then
892  LEX=${am_missing_run}flex
893fi])
894
895dnl $Id: krb-prog-ln-s.m4,v 1.1 1997/12/14 15:59:01 joda Exp $
896dnl
897dnl
898dnl Better test for ln -s, ln or cp
899dnl
900
901AC_DEFUN(AC_KRB_PROG_LN_S,
902[AC_MSG_CHECKING(for ln -s or something else)
903AC_CACHE_VAL(ac_cv_prog_LN_S,
904[rm -f conftestdata
905if ln -s X conftestdata 2>/dev/null
906then
907  rm -f conftestdata
908  ac_cv_prog_LN_S="ln -s"
909else
910  touch conftestdata1
911  if ln conftestdata1 conftestdata2; then
912    rm -f conftestdata*
913    ac_cv_prog_LN_S=ln
914  else
915    ac_cv_prog_LN_S=cp
916  fi
917fi])dnl
918LN_S="$ac_cv_prog_LN_S"
919AC_MSG_RESULT($ac_cv_prog_LN_S)
920AC_SUBST(LN_S)dnl
921])
922
923
924dnl $Id: mips-abi.m4,v 1.6 2002/04/30 16:46:05 joda Exp $
925dnl
926dnl
927dnl Check for MIPS/IRIX ABI flags. Sets $abi and $abilibdirext to some
928dnl value.
929
930AC_DEFUN(AC_MIPS_ABI, [
931AC_ARG_WITH(mips_abi,
932	AC_HELP_STRING([--with-mips-abi=abi],[ABI to use for IRIX (32, n32, or 64)]))
933
934case "$host_os" in
935irix*)
936with_mips_abi="${with_mips_abi:-yes}"
937if test -n "$GCC"; then
938
939# GCC < 2.8 only supports the O32 ABI. GCC >= 2.8 has a flag to select
940# which ABI to use, but only supports (as of 2.8.1) the N32 and 64 ABIs.
941#
942# Default to N32, but if GCC doesn't grok -mabi=n32, we assume an old
943# GCC and revert back to O32. The same goes if O32 is asked for - old
944# GCCs doesn't like the -mabi option, and new GCCs can't output O32.
945#
946# Don't you just love *all* the different SGI ABIs?
947
948case "${with_mips_abi}" in 
949        32|o32) abi='-mabi=32';  abilibdirext=''     ;;
950       n32|yes) abi='-mabi=n32'; abilibdirext='32'  ;;
951        64) abi='-mabi=64';  abilibdirext='64'   ;;
952	no) abi=''; abilibdirext='';;
953         *) AC_MSG_ERROR("Invalid ABI specified") ;;
954esac
955if test -n "$abi" ; then
956ac_foo=krb_cv_gcc_`echo $abi | tr =- __`
957dnl
958dnl can't use AC_CACHE_CHECK here, since it doesn't quote CACHE-ID to
959dnl AC_MSG_RESULT
960dnl
961AC_MSG_CHECKING([if $CC supports the $abi option])
962AC_CACHE_VAL($ac_foo, [
963save_CFLAGS="$CFLAGS"
964CFLAGS="$CFLAGS $abi"
965AC_TRY_COMPILE(,int x;, eval $ac_foo=yes, eval $ac_foo=no)
966CFLAGS="$save_CFLAGS"
967])
968ac_res=`eval echo \\\$$ac_foo`
969AC_MSG_RESULT($ac_res)
970if test $ac_res = no; then
971# Try to figure out why that failed...
972case $abi in
973	-mabi=32) 
974	save_CFLAGS="$CFLAGS"
975	CFLAGS="$CFLAGS -mabi=n32"
976	AC_TRY_COMPILE(,int x;, ac_res=yes, ac_res=no)
977	CLAGS="$save_CFLAGS"
978	if test $ac_res = yes; then
979		# New GCC
980		AC_MSG_ERROR([$CC does not support the $with_mips_abi ABI])
981	fi
982	# Old GCC
983	abi=''
984	abilibdirext=''
985	;;
986	-mabi=n32|-mabi=64)
987		if test $with_mips_abi = yes; then
988			# Old GCC, default to O32
989			abi=''
990			abilibdirext=''
991		else
992			# Some broken GCC
993			AC_MSG_ERROR([$CC does not support the $with_mips_abi ABI])
994		fi
995	;;
996esac
997fi #if test $ac_res = no; then
998fi #if test -n "$abi" ; then
999else
1000case "${with_mips_abi}" in
1001        32|o32) abi='-32'; abilibdirext=''     ;;
1002       n32|yes) abi='-n32'; abilibdirext='32'  ;;
1003        64) abi='-64'; abilibdirext='64'   ;;
1004	no) abi=''; abilibdirext='';;
1005         *) AC_MSG_ERROR("Invalid ABI specified") ;;
1006esac
1007fi #if test -n "$GCC"; then
1008;;
1009esac
1010])
1011
1012dnl
1013dnl $Id: c-attribute.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
1014dnl
1015
1016dnl
1017dnl Test for __attribute__
1018dnl
1019
1020AC_DEFUN(AC_C___ATTRIBUTE__, [
1021AC_MSG_CHECKING(for __attribute__)
1022AC_CACHE_VAL(ac_cv___attribute__, [
1023AC_TRY_COMPILE([
1024#include <stdlib.h>
1025],
1026[
1027static void foo(void) __attribute__ ((noreturn));
1028
1029static void
1030foo(void)
1031{
1032  exit(1);
1033}
1034],
1035ac_cv___attribute__=yes,
1036ac_cv___attribute__=no)])
1037if test "$ac_cv___attribute__" = "yes"; then
1038  AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__])
1039fi
1040AC_MSG_RESULT($ac_cv___attribute__)
1041])
1042
1043
1044# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*-
1045
1046# serial 46 AC_PROG_LIBTOOL
1047
1048AC_DEFUN([AC_PROG_LIBTOOL],
1049[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
1050
1051# This can be used to rebuild libtool when needed
1052LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
1053
1054# Always use our own libtool.
1055LIBTOOL='$(SHELL) $(top_builddir)/libtool'
1056AC_SUBST(LIBTOOL)dnl
1057
1058# Prevent multiple expansion
1059define([AC_PROG_LIBTOOL], [])
1060])
1061
1062AC_DEFUN([AC_LIBTOOL_SETUP],
1063[AC_PREREQ(2.13)dnl
1064AC_REQUIRE([AC_ENABLE_SHARED])dnl
1065AC_REQUIRE([AC_ENABLE_STATIC])dnl
1066AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
1067AC_REQUIRE([AC_CANONICAL_HOST])dnl
1068AC_REQUIRE([AC_CANONICAL_BUILD])dnl
1069AC_REQUIRE([AC_PROG_CC])dnl
1070AC_REQUIRE([AC_PROG_LD])dnl
1071AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
1072AC_REQUIRE([AC_PROG_NM])dnl
1073AC_REQUIRE([AC_PROG_LN_S])dnl
1074AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
1075AC_REQUIRE([AC_OBJEXT])dnl
1076AC_REQUIRE([AC_EXEEXT])dnl
1077dnl
1078
1079_LT_AC_PROG_ECHO_BACKSLASH
1080# Only perform the check for file, if the check method requires it
1081case $deplibs_check_method in
1082file_magic*)
1083  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
1084    AC_PATH_MAGIC
1085  fi
1086  ;;
1087esac
1088
1089AC_CHECK_TOOL(RANLIB, ranlib, :)
1090AC_CHECK_TOOL(STRIP, strip, :)
1091
1092ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
1093ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
1094enable_win32_dll=yes, enable_win32_dll=no)
1095
1096AC_ARG_ENABLE(libtool-lock,
1097  [  --disable-libtool-lock  avoid locking (might break parallel builds)])
1098test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
1099
1100# Some flags need to be propagated to the compiler or linker for good
1101# libtool support.
1102case $host in
1103*-*-irix6*)
1104  # Find out which ABI we are using.
1105  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
1106  if AC_TRY_EVAL(ac_compile); then
1107    case `/usr/bin/file conftest.$ac_objext` in
1108    *32-bit*)
1109      LD="${LD-ld} -32"
1110      ;;
1111    *N32*)
1112      LD="${LD-ld} -n32"
1113      ;;
1114    *64-bit*)
1115      LD="${LD-ld} -64"
1116      ;;
1117    esac
1118  fi
1119  rm -rf conftest*
1120  ;;
1121
1122*-*-sco3.2v5*)
1123  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
1124  SAVE_CFLAGS="$CFLAGS"
1125  CFLAGS="$CFLAGS -belf"
1126  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
1127    [AC_LANG_SAVE
1128     AC_LANG_C
1129     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
1130     AC_LANG_RESTORE])
1131  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
1132    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
1133    CFLAGS="$SAVE_CFLAGS"
1134  fi
1135  ;;
1136
1137ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
1138[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
1139  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
1140  AC_CHECK_TOOL(AS, as, false)
1141  AC_CHECK_TOOL(OBJDUMP, objdump, false)
1142
1143  # recent cygwin and mingw systems supply a stub DllMain which the user
1144  # can override, but on older systems we have to supply one
1145  AC_CACHE_CHECK([if libtool should supply DllMain function], lt_cv_need_dllmain,
1146    [AC_TRY_LINK([],
1147      [extern int __attribute__((__stdcall__)) DllMain(void*, int, void*);
1148      DllMain (0, 0, 0);],
1149      [lt_cv_need_dllmain=no],[lt_cv_need_dllmain=yes])])
1150
1151  case $host/$CC in
1152  *-*-cygwin*/gcc*-mno-cygwin*|*-*-mingw*)
1153    # old mingw systems require "-dll" to link a DLL, while more recent ones
1154    # require "-mdll"
1155    SAVE_CFLAGS="$CFLAGS"
1156    CFLAGS="$CFLAGS -mdll"
1157    AC_CACHE_CHECK([how to link DLLs], lt_cv_cc_dll_switch,
1158      [AC_TRY_LINK([], [], [lt_cv_cc_dll_switch=-mdll],[lt_cv_cc_dll_switch=-dll])])
1159    CFLAGS="$SAVE_CFLAGS" ;;
1160  *-*-cygwin* | *-*-pw32*)
1161    # cygwin systems need to pass --dll to the linker, and not link
1162    # crt.o which will require a WinMain@16 definition.
1163    lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles" ;;
1164  esac
1165  ;;
1166  ])
1167esac
1168
1169_LT_AC_LTCONFIG_HACK
1170
1171])
1172
1173# AC_LIBTOOL_HEADER_ASSERT
1174# ------------------------
1175AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT],
1176[AC_CACHE_CHECK([whether $CC supports assert without backlinking],
1177    [lt_cv_func_assert_works],
1178    [case $host in
1179    *-*-solaris*)
1180      if test "$GCC" = yes && test "$with_gnu_ld" != yes; then
1181        case `$CC --version 2>/dev/null` in
1182        [[12]].*) lt_cv_func_assert_works=no ;;
1183        *)        lt_cv_func_assert_works=yes ;;
1184        esac
1185      fi
1186      ;;
1187    esac])
1188
1189if test "x$lt_cv_func_assert_works" = xyes; then
1190  AC_CHECK_HEADERS(assert.h)
1191fi
1192])# AC_LIBTOOL_HEADER_ASSERT
1193
1194# _LT_AC_CHECK_DLFCN
1195# --------------------
1196AC_DEFUN([_LT_AC_CHECK_DLFCN],
1197[AC_CHECK_HEADERS(dlfcn.h)
1198])# _LT_AC_CHECK_DLFCN
1199
1200# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
1201# ---------------------------------
1202AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
1203[AC_REQUIRE([AC_CANONICAL_HOST])
1204AC_REQUIRE([AC_PROG_NM])
1205AC_REQUIRE([AC_OBJEXT])
1206# Check for command to grab the raw symbol name followed by C symbol from nm.
1207AC_MSG_CHECKING([command to parse $NM output])
1208AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [dnl
1209
1210# These are sane defaults that work on at least a few old systems.
1211# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
1212
1213# Character class describing NM global symbol codes.
1214symcode='[[BCDEGRST]]'
1215
1216# Regexp to match symbols that can be accessed directly from C.
1217sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
1218
1219# Transform the above into a raw symbol and a C symbol.
1220symxfrm='\1 \2\3 \3'
1221
1222# Transform an extracted symbol line into a proper C declaration
1223lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'"
1224
1225# Transform an extracted symbol line into symbol name and symbol address
1226lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
1227
1228# Define system-specific variables.
1229case $host_os in
1230aix*)
1231  symcode='[[BCDT]]'
1232  ;;
1233cygwin* | mingw* | pw32*)
1234  symcode='[[ABCDGISTW]]'
1235  ;;
1236hpux*) # Its linker distinguishes data from code symbols
1237  lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
1238  lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
1239  ;;
1240irix*)
1241  symcode='[[BCDEGRST]]'
1242  ;;
1243solaris* | sysv5*)
1244  symcode='[[BDT]]'
1245  ;;
1246sysv4)
1247  symcode='[[DFNSTU]]'
1248  ;;
1249esac
1250
1251# Handle CRLF in mingw tool chain
1252opt_cr=
1253case $host_os in
1254mingw*)
1255  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
1256  ;;
1257esac
1258
1259# If we're using GNU nm, then use its standard symbol codes.
1260if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
1261  symcode='[[ABCDGISTW]]'
1262fi
1263
1264# Try without a prefix undercore, then with it.
1265for ac_symprfx in "" "_"; do
1266
1267  # Write the raw and C identifiers.
1268lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ 	]]\($symcode$symcode*\)[[ 	]][[ 	]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'"
1269
1270  # Check to see that the pipe works correctly.
1271  pipe_works=no
1272  rm -f conftest*
1273  cat > conftest.$ac_ext <<EOF
1274#ifdef __cplusplus
1275extern "C" {
1276#endif
1277char nm_test_var;
1278void nm_test_func(){}
1279#ifdef __cplusplus
1280}
1281#endif
1282int main(){nm_test_var='a';nm_test_func();return(0);}
1283EOF
1284
1285  if AC_TRY_EVAL(ac_compile); then
1286    # Now try to grab the symbols.
1287    nlist=conftest.nm
1288    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
1289      # Try sorting and uniquifying the output.
1290      if sort "$nlist" | uniq > "$nlist"T; then
1291	mv -f "$nlist"T "$nlist"
1292      else
1293	rm -f "$nlist"T
1294      fi
1295
1296      # Make sure that we snagged all the symbols we need.
1297      if egrep ' nm_test_var$' "$nlist" >/dev/null; then
1298	if egrep ' nm_test_func$' "$nlist" >/dev/null; then
1299	  cat <<EOF > conftest.$ac_ext
1300#ifdef __cplusplus
1301extern "C" {
1302#endif
1303
1304EOF
1305	  # Now generate the symbol file.
1306	  eval "$lt_cv_global_symbol_to_cdecl"' < "$nlist" >> conftest.$ac_ext'
1307
1308	  cat <<EOF >> conftest.$ac_ext
1309#if defined (__STDC__) && __STDC__
1310# define lt_ptr void *
1311#else
1312# define lt_ptr char *
1313# define const
1314#endif
1315
1316/* The mapping between symbol names and symbols. */
1317const struct {
1318  const char *name;
1319  lt_ptr address;
1320}
1321lt_preloaded_symbols[[]] =
1322{
1323EOF
1324	  sed "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext
1325	  cat <<\EOF >> conftest.$ac_ext
1326  {0, (lt_ptr) 0}
1327};
1328
1329#ifdef __cplusplus
1330}
1331#endif
1332EOF
1333	  # Now try linking the two files.
1334	  mv conftest.$ac_objext conftstm.$ac_objext
1335	  save_LIBS="$LIBS"
1336	  save_CFLAGS="$CFLAGS"
1337	  LIBS="conftstm.$ac_objext"
1338	  CFLAGS="$CFLAGS$no_builtin_flag"
1339	  if AC_TRY_EVAL(ac_link) && test -s conftest; then
1340	    pipe_works=yes
1341	  fi
1342	  LIBS="$save_LIBS"
1343	  CFLAGS="$save_CFLAGS"
1344	else
1345	  echo "cannot find nm_test_func in $nlist" >&AC_FD_CC
1346	fi
1347      else
1348	echo "cannot find nm_test_var in $nlist" >&AC_FD_CC
1349      fi
1350    else
1351      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC
1352    fi
1353  else
1354    echo "$progname: failed program was:" >&AC_FD_CC
1355    cat conftest.$ac_ext >&5
1356  fi
1357  rm -f conftest* conftst*
1358
1359  # Do not use the global_symbol_pipe unless it works.
1360  if test "$pipe_works" = yes; then
1361    break
1362  else
1363    lt_cv_sys_global_symbol_pipe=
1364  fi
1365done
1366])
1367global_symbol_pipe="$lt_cv_sys_global_symbol_pipe"
1368if test -z "$lt_cv_sys_global_symbol_pipe"; then
1369  global_symbol_to_cdecl=
1370  global_symbol_to_c_name_address=
1371else
1372  global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl"
1373  global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address"
1374fi
1375if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address";
1376then
1377  AC_MSG_RESULT(failed)
1378else
1379  AC_MSG_RESULT(ok)
1380fi
1381]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
1382
1383# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
1384# ---------------------------------
1385AC_DEFUN([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR],
1386[# Find the correct PATH separator.  Usually this is `:', but
1387# DJGPP uses `;' like DOS.
1388if test "X${PATH_SEPARATOR+set}" != Xset; then
1389  UNAME=${UNAME-`uname 2>/dev/null`}
1390  case X$UNAME in
1391    *-DOS) lt_cv_sys_path_separator=';' ;;
1392    *)     lt_cv_sys_path_separator=':' ;;
1393  esac
1394  PATH_SEPARATOR=$lt_cv_sys_path_separator
1395fi
1396])# _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
1397
1398# _LT_AC_PROG_ECHO_BACKSLASH
1399# --------------------------
1400# Add some code to the start of the generated configure script which
1401# will find an echo command which doesn't interpret backslashes.
1402AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
1403[ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
1404			      [AC_DIVERT_PUSH(NOTICE)])
1405_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR
1406
1407# Check that we are running under the correct shell.
1408SHELL=${CONFIG_SHELL-/bin/sh}
1409
1410case X$ECHO in
1411X*--fallback-echo)
1412  # Remove one level of quotation (which was required for Make).
1413  ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
1414  ;;
1415esac
1416
1417echo=${ECHO-echo}
1418if test "X[$]1" = X--no-reexec; then
1419  # Discard the --no-reexec flag, and continue.
1420  shift
1421elif test "X[$]1" = X--fallback-echo; then
1422  # Avoid inline document here, it may be left over
1423  :
1424elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
1425  # Yippee, $echo works!
1426  :
1427else
1428  # Restart under the correct shell.
1429  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
1430fi
1431
1432if test "X[$]1" = X--fallback-echo; then
1433  # used as fallback echo
1434  shift
1435  cat <<EOF
1436$*
1437EOF
1438  exit 0
1439fi
1440
1441# The HP-UX ksh and POSIX shell print the target directory to stdout
1442# if CDPATH is set.
1443if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
1444
1445if test -z "$ECHO"; then
1446if test "X${echo_test_string+set}" != Xset; then
1447# find a string as large as possible, as long as the shell can cope with it
1448  for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
1449    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
1450    if (echo_test_string="`eval $cmd`") 2>/dev/null &&
1451       echo_test_string="`eval $cmd`" &&
1452       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
1453    then
1454      break
1455    fi
1456  done
1457fi
1458
1459if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
1460   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
1461   test "X$echo_testing_string" = "X$echo_test_string"; then
1462  :
1463else
1464  # The Solaris, AIX, and Digital Unix default echo programs unquote
1465  # backslashes.  This makes it impossible to quote backslashes using
1466  #   echo "$something" | sed 's/\\/\\\\/g'
1467  #
1468  # So, first we look for a working echo in the user's PATH.
1469
1470  IFS="${IFS= 	}"; save_ifs="$IFS"; IFS=$PATH_SEPARATOR
1471  for dir in $PATH /usr/ucb; do
1472    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
1473       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
1474       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
1475       test "X$echo_testing_string" = "X$echo_test_string"; then
1476      echo="$dir/echo"
1477      break
1478    fi
1479  done
1480  IFS="$save_ifs"
1481
1482  if test "X$echo" = Xecho; then
1483    # We didn't find a better echo, so look for alternatives.
1484    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
1485       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
1486       test "X$echo_testing_string" = "X$echo_test_string"; then
1487      # This shell has a builtin print -r that does the trick.
1488      echo='print -r'
1489    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
1490	 test "X$CONFIG_SHELL" != X/bin/ksh; then
1491      # If we have ksh, try running configure again with it.
1492      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
1493      export ORIGINAL_CONFIG_SHELL
1494      CONFIG_SHELL=/bin/ksh
1495      export CONFIG_SHELL
1496      exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
1497    else
1498      # Try using printf.
1499      echo='printf %s\n'
1500      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
1501	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
1502	 test "X$echo_testing_string" = "X$echo_test_string"; then
1503	# Cool, printf works
1504	:
1505      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
1506	   test "X$echo_testing_string" = 'X\t' &&
1507	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
1508	   test "X$echo_testing_string" = "X$echo_test_string"; then
1509	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
1510	export CONFIG_SHELL
1511	SHELL="$CONFIG_SHELL"
1512	export SHELL
1513	echo="$CONFIG_SHELL [$]0 --fallback-echo"
1514      elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
1515	   test "X$echo_testing_string" = 'X\t' &&
1516	   echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
1517	   test "X$echo_testing_string" = "X$echo_test_string"; then
1518	echo="$CONFIG_SHELL [$]0 --fallback-echo"
1519      else
1520	# maybe with a smaller string...
1521	prev=:
1522
1523	for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
1524	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
1525	  then
1526	    break
1527	  fi
1528	  prev="$cmd"
1529	done
1530
1531	if test "$prev" != 'sed 50q "[$]0"'; then
1532	  echo_test_string=`eval $prev`
1533	  export echo_test_string
1534	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
1535	else
1536	  # Oops.  We lost completely, so just stick with echo.
1537	  echo=echo
1538	fi
1539      fi
1540    fi
1541  fi
1542fi
1543fi
1544
1545# Copy echo and quote the copy suitably for passing to libtool from
1546# the Makefile, instead of quoting the original, which is used later.
1547ECHO=$echo
1548if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
1549   ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
1550fi
1551
1552AC_SUBST(ECHO)
1553AC_DIVERT_POP
1554])# _LT_AC_PROG_ECHO_BACKSLASH
1555
1556# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
1557#                           ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
1558# ------------------------------------------------------------------
1559AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
1560[if test "$cross_compiling" = yes; then :
1561  [$4]
1562else
1563  AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
1564  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1565  lt_status=$lt_dlunknown
1566  cat > conftest.$ac_ext <<EOF
1567[#line __oline__ "configure"
1568#include "confdefs.h"
1569
1570#if HAVE_DLFCN_H
1571#include <dlfcn.h>
1572#endif
1573
1574#include <stdio.h>
1575
1576#ifdef RTLD_GLOBAL
1577#  define LT_DLGLOBAL		RTLD_GLOBAL
1578#else
1579#  ifdef DL_GLOBAL
1580#    define LT_DLGLOBAL		DL_GLOBAL
1581#  else
1582#    define LT_DLGLOBAL		0
1583#  endif
1584#endif
1585
1586/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
1587   find out it does not work in some platform. */
1588#ifndef LT_DLLAZY_OR_NOW
1589#  ifdef RTLD_LAZY
1590#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
1591#  else
1592#    ifdef DL_LAZY
1593#      define LT_DLLAZY_OR_NOW		DL_LAZY
1594#    else
1595#      ifdef RTLD_NOW
1596#        define LT_DLLAZY_OR_NOW	RTLD_NOW
1597#      else
1598#        ifdef DL_NOW
1599#          define LT_DLLAZY_OR_NOW	DL_NOW
1600#        else
1601#          define LT_DLLAZY_OR_NOW	0
1602#        endif
1603#      endif
1604#    endif
1605#  endif
1606#endif
1607
1608#ifdef __cplusplus
1609extern "C" void exit (int);
1610#endif
1611
1612void fnord() { int i=42;}
1613int main ()
1614{
1615  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
1616  int status = $lt_dlunknown;
1617
1618  if (self)
1619    {
1620      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
1621      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
1622      /* dlclose (self); */
1623    }
1624
1625    exit (status);
1626}]
1627EOF
1628  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
1629    (./conftest; exit; ) 2>/dev/null
1630    lt_status=$?
1631    case x$lt_status in
1632      x$lt_dlno_uscore) $1 ;;
1633      x$lt_dlneed_uscore) $2 ;;
1634      x$lt_unknown|x*) $3 ;;
1635    esac
1636  else :
1637    # compilation failed
1638    $3
1639  fi
1640fi
1641rm -fr conftest*
1642])# _LT_AC_TRY_DLOPEN_SELF
1643
1644# AC_LIBTOOL_DLOPEN_SELF
1645# -------------------
1646AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
1647[if test "x$enable_dlopen" != xyes; then
1648  enable_dlopen=unknown
1649  enable_dlopen_self=unknown
1650  enable_dlopen_self_static=unknown
1651else
1652  lt_cv_dlopen=no
1653  lt_cv_dlopen_libs=
1654
1655  case $host_os in
1656  beos*)
1657    lt_cv_dlopen="load_add_on"
1658    lt_cv_dlopen_libs=
1659    lt_cv_dlopen_self=yes
1660    ;;
1661
1662  cygwin* | mingw* | pw32*)
1663    lt_cv_dlopen="LoadLibrary"
1664    lt_cv_dlopen_libs=
1665   ;;
1666
1667  *)
1668    AC_CHECK_FUNC([shl_load],
1669          [lt_cv_dlopen="shl_load"],
1670      [AC_CHECK_LIB([dld], [shl_load],
1671            [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
1672	[AC_CHECK_FUNC([dlopen],
1673	      [lt_cv_dlopen="dlopen"],
1674	  [AC_CHECK_LIB([dl], [dlopen],
1675	        [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
1676	    [AC_CHECK_LIB([svld], [dlopen],
1677	          [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
1678	      [AC_CHECK_LIB([dld], [dld_link],
1679	            [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
1680	      ])
1681	    ])
1682	  ])
1683	])
1684      ])
1685    ;;
1686  esac
1687
1688  if test "x$lt_cv_dlopen" != xno; then
1689    enable_dlopen=yes
1690  else
1691    enable_dlopen=no
1692  fi
1693
1694  case $lt_cv_dlopen in
1695  dlopen)
1696    save_CPPFLAGS="$CPPFLAGS"
1697    AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
1698    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
1699
1700    save_LDFLAGS="$LDFLAGS"
1701    eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
1702
1703    save_LIBS="$LIBS"
1704    LIBS="$lt_cv_dlopen_libs $LIBS"
1705
1706    AC_CACHE_CHECK([whether a program can dlopen itself],
1707	  lt_cv_dlopen_self, [dnl
1708	  _LT_AC_TRY_DLOPEN_SELF(
1709	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
1710	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
1711    ])
1712
1713    if test "x$lt_cv_dlopen_self" = xyes; then
1714      LDFLAGS="$LDFLAGS $link_static_flag"
1715      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
1716    	  lt_cv_dlopen_self_static, [dnl
1717	  _LT_AC_TRY_DLOPEN_SELF(
1718	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
1719	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
1720      ])
1721    fi
1722
1723    CPPFLAGS="$save_CPPFLAGS"
1724    LDFLAGS="$save_LDFLAGS"
1725    LIBS="$save_LIBS"
1726    ;;
1727  esac
1728
1729  case $lt_cv_dlopen_self in
1730  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
1731  *) enable_dlopen_self=unknown ;;
1732  esac
1733
1734  case $lt_cv_dlopen_self_static in
1735  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
1736  *) enable_dlopen_self_static=unknown ;;
1737  esac
1738fi
1739])# AC_LIBTOOL_DLOPEN_SELF
1740
1741AC_DEFUN([_LT_AC_LTCONFIG_HACK],
1742[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])dnl
1743# Sed substitution that helps us do robust quoting.  It backslashifies
1744# metacharacters that are still active within double-quoted strings.
1745Xsed='sed -e s/^X//'
1746sed_quote_subst='s/\([[\\"\\`$\\\\]]\)/\\\1/g'
1747
1748# Same as above, but do not quote variable references.
1749double_quote_subst='s/\([[\\"\\`\\\\]]\)/\\\1/g'
1750
1751# Sed substitution to delay expansion of an escaped shell variable in a
1752# double_quote_subst'ed string.
1753delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
1754
1755# Constants:
1756rm="rm -f"
1757
1758# Global variables:
1759default_ofile=libtool
1760can_build_shared=yes
1761
1762# All known linkers require a `.a' archive for static linking (except M$VC,
1763# which needs '.lib').
1764libext=a
1765ltmain="$ac_aux_dir/ltmain.sh"
1766ofile="$default_ofile"
1767with_gnu_ld="$lt_cv_prog_gnu_ld"
1768need_locks="$enable_libtool_lock"
1769
1770old_CC="$CC"
1771old_CFLAGS="$CFLAGS"
1772
1773# Set sane defaults for various variables
1774test -z "$AR" && AR=ar
1775test -z "$AR_FLAGS" && AR_FLAGS=cru
1776test -z "$AS" && AS=as
1777test -z "$CC" && CC=cc
1778test -z "$DLLTOOL" && DLLTOOL=dlltool
1779test -z "$LD" && LD=ld
1780test -z "$LN_S" && LN_S="ln -s"
1781test -z "$MAGIC_CMD" && MAGIC_CMD=file
1782test -z "$NM" && NM=nm
1783test -z "$OBJDUMP" && OBJDUMP=objdump
1784test -z "$RANLIB" && RANLIB=:
1785test -z "$STRIP" && STRIP=:
1786test -z "$ac_objext" && ac_objext=o
1787
1788if test x"$host" != x"$build"; then
1789  ac_tool_prefix=${host_alias}-
1790else
1791  ac_tool_prefix=
1792fi
1793
1794# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
1795case $host_os in
1796linux-gnu*) ;;
1797linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
1798esac
1799
1800case $host_os in
1801aix3*)
1802  # AIX sometimes has problems with the GCC collect2 program.  For some
1803  # reason, if we set the COLLECT_NAMES environment variable, the problems
1804  # vanish in a puff of smoke.
1805  if test "X${COLLECT_NAMES+set}" != Xset; then
1806    COLLECT_NAMES=
1807    export COLLECT_NAMES
1808  fi
1809  ;;
1810esac
1811
1812# Determine commands to create old-style static archives.
1813old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
1814old_postinstall_cmds='chmod 644 $oldlib'
1815old_postuninstall_cmds=
1816
1817if test -n "$RANLIB"; then
1818  case $host_os in
1819  openbsd*)
1820    old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds"
1821    ;;
1822  *)
1823    old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds"
1824    ;;
1825  esac
1826  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
1827fi
1828
1829# Allow CC to be a program name with arguments.
1830set dummy $CC
1831compiler="[$]2"
1832
1833AC_MSG_CHECKING([for objdir])
1834rm -f .libs 2>/dev/null
1835mkdir .libs 2>/dev/null
1836if test -d .libs; then
1837  objdir=.libs
1838else
1839  # MS-DOS does not allow filenames that begin with a dot.
1840  objdir=_libs
1841fi
1842rmdir .libs 2>/dev/null
1843AC_MSG_RESULT($objdir)
1844
1845
1846AC_ARG_WITH(pic,
1847[  --with-pic              try to use only PIC/non-PIC objects [default=use both]],
1848pic_mode="$withval", pic_mode=default)
1849test -z "$pic_mode" && pic_mode=default
1850
1851# We assume here that the value for lt_cv_prog_cc_pic will not be cached
1852# in isolation, and that seeing it set (from the cache) indicates that
1853# the associated values are set (in the cache) correctly too.
1854AC_MSG_CHECKING([for $compiler option to produce PIC])
1855AC_CACHE_VAL(lt_cv_prog_cc_pic,
1856[ lt_cv_prog_cc_pic=
1857  lt_cv_prog_cc_shlib=
1858  lt_cv_prog_cc_wl=
1859  lt_cv_prog_cc_static=
1860  lt_cv_prog_cc_no_builtin=
1861  lt_cv_prog_cc_can_build_shared=$can_build_shared
1862
1863  if test "$GCC" = yes; then
1864    lt_cv_prog_cc_wl='-Wl,'
1865    lt_cv_prog_cc_static='-static'
1866
1867    case $host_os in
1868    aix*)
1869      # Below there is a dirty hack to force normal static linking with -ldl
1870      # The problem is because libdl dynamically linked with both libc and
1871      # libC (AIX C++ library), which obviously doesn't included in libraries
1872      # list by gcc. This cause undefined symbols with -static flags.
1873      # This hack allows C programs to be linked with "-static -ldl", but
1874      # not sure about C++ programs.
1875      lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC"
1876      ;;
1877    amigaos*)
1878      # FIXME: we need at least 68020 code to build shared libraries, but
1879      # adding the `-m68020' flag to GCC prevents building anything better,
1880      # like `-m68040'.
1881      lt_cv_prog_cc_pic='-m68020 -resident32 -malways-restore-a4'
1882      ;;
1883    beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
1884      # PIC is the default for these OSes.
1885      ;;
1886    darwin* | rhapsody*)
1887      # PIC is the default on this platform
1888      # Common symbols not allowed in MH_DYLIB files
1889      lt_cv_prog_cc_pic='-fno-common'
1890      ;;
1891    cygwin* | mingw* | pw32* | os2*)
1892      # This hack is so that the source file can tell whether it is being
1893      # built for inclusion in a dll (and should export symbols for example).
1894      lt_cv_prog_cc_pic='-DDLL_EXPORT'
1895      ;;
1896    sysv4*MP*)
1897      if test -d /usr/nec; then
1898	 lt_cv_prog_cc_pic=-Kconform_pic
1899      fi
1900      ;;
1901    *)
1902      lt_cv_prog_cc_pic='-fPIC'
1903      ;;
1904    esac
1905  else
1906    # PORTME Check for PIC flags for the system compiler.
1907    case $host_os in
1908    aix3* | aix4* | aix5*)
1909      lt_cv_prog_cc_wl='-Wl,'
1910      # All AIX code is PIC.
1911      if test "$host_cpu" = ia64; then
1912	# AIX 5 now supports IA64 processor
1913	lt_cv_prog_cc_static='-Bstatic'
1914      else
1915	lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp'
1916      fi
1917      ;;
1918
1919    hpux9* | hpux10* | hpux11*)
1920      # Is there a better lt_cv_prog_cc_static that works with the bundled CC?
1921      lt_cv_prog_cc_wl='-Wl,'
1922      lt_cv_prog_cc_static="${lt_cv_prog_cc_wl}-a ${lt_cv_prog_cc_wl}archive"
1923      lt_cv_prog_cc_pic='+Z'
1924      ;;
1925
1926    irix5* | irix6*)
1927      lt_cv_prog_cc_wl='-Wl,'
1928      lt_cv_prog_cc_static='-non_shared'
1929      # PIC (with -KPIC) is the default.
1930      ;;
1931
1932    cygwin* | mingw* | pw32* | os2*)
1933      # This hack is so that the source file can tell whether it is being
1934      # built for inclusion in a dll (and should export symbols for example).
1935      lt_cv_prog_cc_pic='-DDLL_EXPORT'
1936      ;;
1937
1938    newsos6)
1939      lt_cv_prog_cc_pic='-KPIC'
1940      lt_cv_prog_cc_static='-Bstatic'
1941      ;;
1942
1943    osf3* | osf4* | osf5*)
1944      # All OSF/1 code is PIC.
1945      lt_cv_prog_cc_wl='-Wl,'
1946      lt_cv_prog_cc_static='-non_shared'
1947      ;;
1948
1949    sco3.2v5*)
1950      lt_cv_prog_cc_pic='-Kpic'
1951      lt_cv_prog_cc_static='-dn'
1952      lt_cv_prog_cc_shlib='-belf'
1953      ;;
1954
1955    solaris*)
1956      lt_cv_prog_cc_pic='-KPIC'
1957      lt_cv_prog_cc_static='-Bstatic'
1958      lt_cv_prog_cc_wl='-Wl,'
1959      ;;
1960
1961    sunos4*)
1962      lt_cv_prog_cc_pic='-PIC'
1963      lt_cv_prog_cc_static='-Bstatic'
1964      lt_cv_prog_cc_wl='-Qoption ld '
1965      ;;
1966
1967    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
1968      lt_cv_prog_cc_pic='-KPIC'
1969      lt_cv_prog_cc_static='-Bstatic'
1970      if test "x$host_vendor" = xsni; then
1971	lt_cv_prog_cc_wl='-LD'
1972      else
1973	lt_cv_prog_cc_wl='-Wl,'
1974      fi
1975      ;;
1976
1977    uts4*)
1978      lt_cv_prog_cc_pic='-pic'
1979      lt_cv_prog_cc_static='-Bstatic'
1980      ;;
1981
1982    sysv4*MP*)
1983      if test -d /usr/nec ;then
1984	lt_cv_prog_cc_pic='-Kconform_pic'
1985	lt_cv_prog_cc_static='-Bstatic'
1986      fi
1987      ;;
1988
1989    *)
1990      lt_cv_prog_cc_can_build_shared=no
1991      ;;
1992    esac
1993  fi
1994])
1995if test -z "$lt_cv_prog_cc_pic"; then
1996  AC_MSG_RESULT([none])
1997else
1998  AC_MSG_RESULT([$lt_cv_prog_cc_pic])
1999
2000  # Check to make sure the pic_flag actually works.
2001  AC_MSG_CHECKING([if $compiler PIC flag $lt_cv_prog_cc_pic works])
2002  AC_CACHE_VAL(lt_cv_prog_cc_pic_works, [dnl
2003    save_CFLAGS="$CFLAGS"
2004    CFLAGS="$CFLAGS $lt_cv_prog_cc_pic -DPIC"
2005    AC_TRY_COMPILE([], [], [dnl
2006      case $host_os in
2007      hpux9* | hpux10* | hpux11*)
2008	# On HP-UX, both CC and GCC only warn that PIC is supported... then
2009	# they create non-PIC objects.  So, if there were any warnings, we
2010	# assume that PIC is not supported.
2011	if test -s conftest.err; then
2012	  lt_cv_prog_cc_pic_works=no
2013	else
2014	  lt_cv_prog_cc_pic_works=yes
2015	fi
2016	;;
2017      *)
2018	lt_cv_prog_cc_pic_works=yes
2019	;;
2020      esac
2021    ], [dnl
2022      lt_cv_prog_cc_pic_works=no
2023    ])
2024    CFLAGS="$save_CFLAGS"
2025  ])
2026
2027  if test "X$lt_cv_prog_cc_pic_works" = Xno; then
2028    lt_cv_prog_cc_pic=
2029    lt_cv_prog_cc_can_build_shared=no
2030  else
2031    lt_cv_prog_cc_pic=" $lt_cv_prog_cc_pic"
2032  fi
2033
2034  AC_MSG_RESULT([$lt_cv_prog_cc_pic_works])
2035fi
2036
2037# Check for any special shared library compilation flags.
2038if test -n "$lt_cv_prog_cc_shlib"; then
2039  AC_MSG_WARN([\`$CC' requires \`$lt_cv_prog_cc_shlib' to build shared libraries])
2040  if echo "$old_CC $old_CFLAGS " | egrep -e "[[ 	]]$lt_cv_prog_cc_shlib[[ 	]]" >/dev/null; then :
2041  else
2042   AC_MSG_WARN([add \`$lt_cv_prog_cc_shlib' to the CC or CFLAGS env variable and reconfigure])
2043    lt_cv_prog_cc_can_build_shared=no
2044  fi
2045fi
2046
2047AC_MSG_CHECKING([if $compiler static flag $lt_cv_prog_cc_static works])
2048AC_CACHE_VAL([lt_cv_prog_cc_static_works], [dnl
2049  lt_cv_prog_cc_static_works=no
2050  save_LDFLAGS="$LDFLAGS"
2051  LDFLAGS="$LDFLAGS $lt_cv_prog_cc_static"
2052  AC_TRY_LINK([], [], [lt_cv_prog_cc_static_works=yes])
2053  LDFLAGS="$save_LDFLAGS"
2054])
2055
2056# Belt *and* braces to stop my trousers falling down:
2057test "X$lt_cv_prog_cc_static_works" = Xno && lt_cv_prog_cc_static=
2058AC_MSG_RESULT([$lt_cv_prog_cc_static_works])
2059
2060pic_flag="$lt_cv_prog_cc_pic"
2061special_shlib_compile_flags="$lt_cv_prog_cc_shlib"
2062wl="$lt_cv_prog_cc_wl"
2063link_static_flag="$lt_cv_prog_cc_static"
2064no_builtin_flag="$lt_cv_prog_cc_no_builtin"
2065can_build_shared="$lt_cv_prog_cc_can_build_shared"
2066
2067
2068# Check to see if options -o and -c are simultaneously supported by compiler
2069AC_MSG_CHECKING([if $compiler supports -c -o file.$ac_objext])
2070AC_CACHE_VAL([lt_cv_compiler_c_o], [
2071$rm -r conftest 2>/dev/null
2072mkdir conftest
2073cd conftest
2074echo "int some_variable = 0;" > conftest.$ac_ext
2075mkdir out
2076# According to Tom Tromey, Ian Lance Taylor reported there are C compilers
2077# that will create temporary files in the current directory regardless of
2078# the output directory.  Thus, making CWD read-only will cause this test
2079# to fail, enabling locking or at least warning the user not to do parallel
2080# builds.
2081chmod -w .
2082save_CFLAGS="$CFLAGS"
2083CFLAGS="$CFLAGS -o out/conftest2.$ac_objext"
2084compiler_c_o=no
2085if { (eval echo configure:__oline__: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.$ac_objext; then
2086  # The compiler can only warn and ignore the option if not recognized
2087  # So say no if there are warnings
2088  if test -s out/conftest.err; then
2089    lt_cv_compiler_c_o=no
2090  else
2091    lt_cv_compiler_c_o=yes
2092  fi
2093else
2094  # Append any errors to the config.log.
2095  cat out/conftest.err 1>&AC_FD_CC
2096  lt_cv_compiler_c_o=no
2097fi
2098CFLAGS="$save_CFLAGS"
2099chmod u+w .
2100$rm conftest* out/*
2101rmdir out
2102cd ..
2103rmdir conftest
2104$rm -r conftest 2>/dev/null
2105])
2106compiler_c_o=$lt_cv_compiler_c_o
2107AC_MSG_RESULT([$compiler_c_o])
2108
2109if test x"$compiler_c_o" = x"yes"; then
2110  # Check to see if we can write to a .lo
2111  AC_MSG_CHECKING([if $compiler supports -c -o file.lo])
2112  AC_CACHE_VAL([lt_cv_compiler_o_lo], [
2113  lt_cv_compiler_o_lo=no
2114  save_CFLAGS="$CFLAGS"
2115  CFLAGS="$CFLAGS -c -o conftest.lo"
2116  save_objext="$ac_objext"
2117  ac_objext=lo
2118  AC_TRY_COMPILE([], [int some_variable = 0;], [dnl
2119    # The compiler can only warn and ignore the option if not recognized
2120    # So say no if there are warnings
2121    if test -s conftest.err; then
2122      lt_cv_compiler_o_lo=no
2123    else
2124      lt_cv_compiler_o_lo=yes
2125    fi
2126  ])
2127  ac_objext="$save_objext"
2128  CFLAGS="$save_CFLAGS"
2129  ])
2130  compiler_o_lo=$lt_cv_compiler_o_lo
2131  AC_MSG_RESULT([$compiler_o_lo])
2132else
2133  compiler_o_lo=no
2134fi
2135
2136# Check to see if we can do hard links to lock some files if needed
2137hard_links="nottested"
2138if test "$compiler_c_o" = no && test "$need_locks" != no; then
2139  # do not overwrite the value of need_locks provided by the user
2140  AC_MSG_CHECKING([if we can lock with hard links])
2141  hard_links=yes
2142  $rm conftest*
2143  ln conftest.a conftest.b 2>/dev/null && hard_links=no
2144  touch conftest.a
2145  ln conftest.a conftest.b 2>&5 || hard_links=no
2146  ln conftest.a conftest.b 2>/dev/null && hard_links=no
2147  AC_MSG_RESULT([$hard_links])
2148  if test "$hard_links" = no; then
2149    AC_MSG_WARN([\`$CC' does not support \`-c -o', so \`make -j' may be unsafe])
2150    need_locks=warn
2151  fi
2152else
2153  need_locks=no
2154fi
2155
2156if test "$GCC" = yes; then
2157  # Check to see if options -fno-rtti -fno-exceptions are supported by compiler
2158  AC_MSG_CHECKING([if $compiler supports -fno-rtti -fno-exceptions])
2159  echo "int some_variable = 0;" > conftest.$ac_ext
2160  save_CFLAGS="$CFLAGS"
2161  CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.$ac_ext"
2162  compiler_rtti_exceptions=no
2163  AC_TRY_COMPILE([], [int some_variable = 0;], [dnl
2164    # The compiler can only warn and ignore the option if not recognized
2165    # So say no if there are warnings
2166    if test -s conftest.err; then
2167      compiler_rtti_exceptions=no
2168    else
2169      compiler_rtti_exceptions=yes
2170    fi
2171  ])
2172  CFLAGS="$save_CFLAGS"
2173  AC_MSG_RESULT([$compiler_rtti_exceptions])
2174
2175  if test "$compiler_rtti_exceptions" = "yes"; then
2176    no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions'
2177  else
2178    no_builtin_flag=' -fno-builtin'
2179  fi
2180fi
2181
2182# See if the linker supports building shared libraries.
2183AC_MSG_CHECKING([whether the linker ($LD) supports shared libraries])
2184
2185allow_undefined_flag=
2186no_undefined_flag=
2187need_lib_prefix=unknown
2188need_version=unknown
2189# when you set need_version to no, make sure it does not cause -set_version
2190# flags to be left without arguments
2191archive_cmds=
2192archive_expsym_cmds=
2193old_archive_from_new_cmds=
2194old_archive_from_expsyms_cmds=
2195export_dynamic_flag_spec=
2196whole_archive_flag_spec=
2197thread_safe_flag_spec=
2198hardcode_into_libs=no
2199hardcode_libdir_flag_spec=
2200hardcode_libdir_separator=
2201hardcode_direct=no
2202hardcode_minus_L=no
2203hardcode_shlibpath_var=unsupported
2204runpath_var=
2205link_all_deplibs=unknown
2206always_export_symbols=no
2207export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols'
2208# include_expsyms should be a list of space-separated symbols to be *always*
2209# included in the symbol list
2210include_expsyms=
2211# exclude_expsyms can be an egrep regular expression of symbols to exclude
2212# it will be wrapped by ` (' and `)$', so one must not match beginning or
2213# end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
2214# as well as any symbol that contains `d'.
2215exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
2216# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
2217# platforms (ab)use it in PIC code, but their linkers get confused if
2218# the symbol is explicitly referenced.  Since portable code cannot
2219# rely on this symbol name, it's probably fine to never include it in
2220# preloaded symbol tables.
2221extract_expsyms_cmds=
2222
2223case $host_os in
2224cygwin* | mingw* | pw32*)
2225  # FIXME: the MSVC++ port hasn't been tested in a loooong time
2226  # When not using gcc, we currently assume that we are using
2227  # Microsoft Visual C++.
2228  if test "$GCC" != yes; then
2229    with_gnu_ld=no
2230  fi
2231  ;;
2232openbsd*)
2233  with_gnu_ld=no
2234  ;;
2235esac
2236
2237ld_shlibs=yes
2238if test "$with_gnu_ld" = yes; then
2239  # If archive_cmds runs LD, not CC, wlarc should be empty
2240  wlarc='${wl}'
2241
2242  # See if GNU ld supports shared libraries.
2243  case $host_os in
2244  aix3* | aix4* | aix5*)
2245    # On AIX, the GNU linker is very broken
2246    # Note:Check GNU linker on AIX 5-IA64 when/if it becomes available.
2247    ld_shlibs=no
2248    cat <<EOF 1>&2
2249
2250*** Warning: the GNU linker, at least up to release 2.9.1, is reported
2251*** to be unable to reliably create shared libraries on AIX.
2252*** Therefore, libtool is disabling shared libraries support.  If you
2253*** really care for shared libraries, you may want to modify your PATH
2254*** so that a non-GNU linker is found, and then restart.
2255
2256EOF
2257    ;;
2258
2259  amigaos*)
2260    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
2261    hardcode_libdir_flag_spec='-L$libdir'
2262    hardcode_minus_L=yes
2263
2264    # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
2265    # that the semantics of dynamic libraries on AmigaOS, at least up
2266    # to version 4, is to share data among multiple programs linked
2267    # with the same dynamic library.  Since this doesn't match the
2268    # behavior of shared libraries on other platforms, we can use
2269    # them.
2270    ld_shlibs=no
2271    ;;
2272
2273  beos*)
2274    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
2275      allow_undefined_flag=unsupported
2276      # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
2277      # support --undefined.  This deserves some investigation.  FIXME
2278      archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
2279    else
2280      ld_shlibs=no
2281    fi
2282    ;;
2283
2284  cygwin* | mingw* | pw32*)
2285    # hardcode_libdir_flag_spec is actually meaningless, as there is
2286    # no search path for DLLs.
2287    hardcode_libdir_flag_spec='-L$libdir'
2288    allow_undefined_flag=unsupported
2289    always_export_symbols=yes
2290
2291    extract_expsyms_cmds='test -f $output_objdir/impgen.c || \
2292      sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //;s/^# *$//; p; }" -e d < $''0 > $output_objdir/impgen.c~
2293      test -f $output_objdir/impgen.exe || (cd $output_objdir && \
2294      if test "x$HOST_CC" != "x" ; then $HOST_CC -o impgen impgen.c ; \
2295      else $CC -o impgen impgen.c ; fi)~
2296      $output_objdir/impgen $dir/$soroot > $output_objdir/$soname-def'
2297
2298    old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $output_objdir/$soname-def --output-lib $output_objdir/$newlib'
2299
2300    # cygwin and mingw dlls have different entry points and sets of symbols
2301    # to exclude.
2302    # FIXME: what about values for MSVC?
2303    dll_entry=__cygwin_dll_entry@12
2304    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12~
2305    case $host_os in
2306    mingw*)
2307      # mingw values
2308      dll_entry=_DllMainCRTStartup@12
2309      dll_exclude_symbols=DllMain@12,DllMainCRTStartup@12,DllEntryPoint@12~
2310      ;;
2311    esac
2312
2313    # mingw and cygwin differ, and it's simplest to just exclude the union
2314    # of the two symbol sets.
2315    dll_exclude_symbols=DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
2316
2317    # recent cygwin and mingw systems supply a stub DllMain which the user
2318    # can override, but on older systems we have to supply one (in ltdll.c)
2319    if test "x$lt_cv_need_dllmain" = "xyes"; then
2320      ltdll_obj='$output_objdir/$soname-ltdll.'"$ac_objext "
2321      ltdll_cmds='test -f $output_objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $''0 > $output_objdir/$soname-ltdll.c~
2322	test -f $output_objdir/$soname-ltdll.$ac_objext || (cd $output_objdir && $CC -c $soname-ltdll.c)~'
2323    else
2324      ltdll_obj=
2325      ltdll_cmds=
2326    fi
2327
2328    # Extract the symbol export list from an `--export-all' def file,
2329    # then regenerate the def file from the symbol export list, so that
2330    # the compiled dll only exports the symbol export list.
2331    # Be careful not to strip the DATA tag left be newer dlltools.
2332    export_symbols_cmds="$ltdll_cmds"'
2333      $DLLTOOL --export-all --exclude-symbols '$dll_exclude_symbols' --output-def $output_objdir/$soname-def '$ltdll_obj'$libobjs $convenience~
2334      sed -e "1,/EXPORTS/d" -e "s/ @ [[0-9]]*//" -e "s/ *;.*$//" < $output_objdir/$soname-def > $export_symbols'
2335
2336    # If the export-symbols file already is a .def file (1st line
2337    # is EXPORTS), use it as is.
2338    # If DATA tags from a recent dlltool are present, honour them!
2339    archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
2340	cp $export_symbols $output_objdir/$soname-def;
2341      else
2342	echo EXPORTS > $output_objdir/$soname-def;
2343	_lt_hint=1;
2344	cat $export_symbols | while read symbol; do
2345	 set dummy \$symbol;
2346	 case \[$]# in
2347	   2) echo "   \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;;
2348	   *) echo "     \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;;
2349	 esac;
2350	 _lt_hint=`expr 1 + \$_lt_hint`;
2351	done;
2352      fi~
2353      '"$ltdll_cmds"'
2354      $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
2355      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp~
2356      $CC -Wl,--base-file,$output_objdir/$soname-base $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~
2357      $DLLTOOL --as=$AS --dllname $soname --exclude-symbols '$dll_exclude_symbols' --def $output_objdir/$soname-def --base-file $output_objdir/$soname-base --output-exp $output_objdir/$soname-exp --output-lib $output_objdir/$libname.dll.a~
2358      $CC $output_objdir/$soname-exp '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags'
2359    ;;
2360
2361  netbsd*)
2362    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
2363      archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
2364      wlarc=
2365    else
2366      archive_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
2367      archive_expsym_cmds='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
2368    fi
2369    ;;
2370
2371  solaris* | sysv5*)
2372    if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
2373      ld_shlibs=no
2374      cat <<EOF 1>&2
2375
2376*** Warning: The releases 2.8.* of the GNU linker cannot reliably
2377*** create shared libraries on Solaris systems.  Therefore, libtool
2378*** is disabling shared libraries support.  We urge you to upgrade GNU
2379*** binutils to release 2.9.1 or newer.  Another option is to modify
2380*** your PATH or compiler configuration so that the native linker is
2381*** used, and then restart.
2382
2383EOF
2384    elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
2385      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
2386      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
2387    else
2388      ld_shlibs=no
2389    fi
2390    ;;
2391
2392  sunos4*)
2393    archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
2394    wlarc=
2395    hardcode_direct=yes
2396    hardcode_shlibpath_var=no
2397    ;;
2398
2399  *)
2400    if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
2401      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
2402      archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
2403    else
2404      ld_shlibs=no
2405    fi
2406    ;;
2407  esac
2408
2409  if test "$ld_shlibs" = yes; then
2410    runpath_var=LD_RUN_PATH
2411    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
2412    export_dynamic_flag_spec='${wl}--export-dynamic'
2413    case $host_os in
2414    cygwin* | mingw* | pw32*)
2415      # dlltool doesn't understand --whole-archive et. al.
2416      whole_archive_flag_spec=
2417      ;;
2418    *)
2419      # ancient GNU ld didn't support --whole-archive et. al.
2420      if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then
2421	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
2422      else
2423	whole_archive_flag_spec=
2424      fi
2425      ;;
2426    esac
2427  fi
2428else
2429  # PORTME fill in a description of your system's linker (not GNU ld)
2430  case $host_os in
2431  aix3*)
2432    allow_undefined_flag=unsupported
2433    always_export_symbols=yes
2434    archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
2435    # Note: this linker hardcodes the directories in LIBPATH if there
2436    # are no directories specified by -L.
2437    hardcode_minus_L=yes
2438    if test "$GCC" = yes && test -z "$link_static_flag"; then
2439      # Neither direct hardcoding nor static linking is supported with a
2440      # broken collect2.
2441      hardcode_direct=unsupported
2442    fi
2443    ;;
2444
2445  aix4* | aix5*)
2446    if test "$host_cpu" = ia64; then
2447      # On IA64, the linker does run time linking by default, so we don't
2448      # have to do anything special.
2449      aix_use_runtimelinking=no
2450      exp_sym_flag='-Bexport'
2451      no_entry_flag=""
2452    else
2453      aix_use_runtimelinking=no
2454
2455      # Test if we are trying to use run time linking or normal
2456      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
2457      # need to do runtime linking.
2458      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
2459	for ld_flag in $LDFLAGS; do
2460	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
2461	    aix_use_runtimelinking=yes
2462	    break
2463	  fi
2464	done
2465      esac
2466
2467      exp_sym_flag='-bexport'
2468      no_entry_flag='-bnoentry'
2469    fi
2470
2471    # When large executables or shared objects are built, AIX ld can
2472    # have problems creating the table of contents.  If linking a library
2473    # or program results in "error TOC overflow" add -mminimal-toc to
2474    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
2475    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
2476
2477    hardcode_direct=yes
2478    archive_cmds=''
2479    hardcode_libdir_separator=':'
2480    if test "$GCC" = yes; then
2481      case $host_os in aix4.[[012]]|aix4.[[012]].*)
2482	collect2name=`${CC} -print-prog-name=collect2`
2483	if test -f "$collect2name" && \
2484	  strings "$collect2name" | grep resolve_lib_name >/dev/null
2485	then
2486	  # We have reworked collect2
2487	  hardcode_direct=yes
2488	else
2489	  # We have old collect2
2490	  hardcode_direct=unsupported
2491	  # It fails to find uninstalled libraries when the uninstalled
2492	  # path is not listed in the libpath.  Setting hardcode_minus_L
2493	  # to unsupported forces relinking
2494	  hardcode_minus_L=yes
2495	  hardcode_libdir_flag_spec='-L$libdir'
2496	  hardcode_libdir_separator=
2497	fi
2498      esac
2499
2500      shared_flag='-shared'
2501    else
2502      # not using gcc
2503      if test "$host_cpu" = ia64; then
2504	shared_flag='${wl}-G'
2505      else
2506	if test "$aix_use_runtimelinking" = yes; then
2507	  shared_flag='${wl}-G'
2508	else
2509	  shared_flag='${wl}-bM:SRE'
2510	fi
2511      fi
2512    fi
2513
2514    # It seems that -bexpall can do strange things, so it is better to
2515    # generate a list of symbols to export.
2516    always_export_symbols=yes
2517    if test "$aix_use_runtimelinking" = yes; then
2518      # Warning - without using the other runtime loading flags (-brtl),
2519      # -berok will link without error, but may produce a broken library.
2520      allow_undefined_flag='-berok'
2521      hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
2522      archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag"
2523    else
2524      if test "$host_cpu" = ia64; then
2525	hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
2526	allow_undefined_flag="-z nodefs"
2527	archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"
2528      else
2529	hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
2530	# Warning - without using the other run time loading flags,
2531	# -berok will link without error, but may produce a broken library.
2532	allow_undefined_flag='${wl}-berok'
2533	# This is a bit strange, but is similar to how AIX traditionally builds
2534	# it's shared libraries.
2535	archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname'
2536      fi
2537    fi
2538    ;;
2539
2540  amigaos*)
2541    archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
2542    hardcode_libdir_flag_spec='-L$libdir'
2543    hardcode_minus_L=yes
2544    # see comment about different semantics on the GNU ld section
2545    ld_shlibs=no
2546    ;;
2547
2548  cygwin* | mingw* | pw32*)
2549    # When not using gcc, we currently assume that we are using
2550    # Microsoft Visual C++.
2551    # hardcode_libdir_flag_spec is actually meaningless, as there is
2552    # no search path for DLLs.
2553    hardcode_libdir_flag_spec=' '
2554    allow_undefined_flag=unsupported
2555    # Tell ltmain to make .lib files, not .a files.
2556    libext=lib
2557    # FIXME: Setting linknames here is a bad hack.
2558    archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames='
2559    # The linker will automatically build a .lib file if we build a DLL.
2560    old_archive_from_new_cmds='true'
2561    # FIXME: Should let the user specify the lib program.
2562    old_archive_cmds='lib /OUT:$oldlib$oldobjs$old_deplibs'
2563    fix_srcfile_path='`cygpath -w "$srcfile"`'
2564    ;;
2565
2566  darwin* | rhapsody*)
2567    case "$host_os" in
2568    rhapsody* | darwin1.[[012]])
2569      allow_undefined_flag='-undefined suppress'
2570      ;;
2571    *) # Darwin 1.3 on
2572      allow_undefined_flag='-flat_namespace -undefined suppress'
2573      ;;
2574    esac
2575    # FIXME: Relying on posixy $() will cause problems for
2576    #        cross-compilation, but unfortunately the echo tests do not
2577    #        yet detect zsh echo's removal of \ escapes.
2578    archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring'
2579    # We need to add '_' to the symbols in $export_symbols first
2580    #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
2581    hardcode_direct=yes
2582    hardcode_shlibpath_var=no
2583    whole_archive_flag_spec='-all_load $convenience'
2584    ;;
2585
2586  freebsd1*)
2587    ld_shlibs=no
2588    ;;
2589
2590  # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
2591  # support.  Future versions do this automatically, but an explicit c++rt0.o
2592  # does not break anything, and helps significantly (at the cost of a little
2593  # extra space).
2594  freebsd2.2*)
2595    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
2596    hardcode_libdir_flag_spec='-R$libdir'
2597    hardcode_direct=yes
2598    hardcode_shlibpath_var=no
2599    ;;
2600
2601  # Unfortunately, older versions of FreeBSD 2 do not have this feature.
2602  freebsd2*)
2603    archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
2604    hardcode_direct=yes
2605    hardcode_minus_L=yes
2606    hardcode_shlibpath_var=no
2607    ;;
2608
2609  # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
2610  freebsd*)
2611    archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
2612    hardcode_libdir_flag_spec='-R$libdir'
2613    hardcode_direct=yes
2614    hardcode_shlibpath_var=no
2615    ;;
2616
2617  hpux9* | hpux10* | hpux11*)
2618    case $host_os in
2619    hpux9*) archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' ;;
2620    *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' ;;
2621    esac
2622    hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
2623    hardcode_libdir_separator=:
2624    hardcode_direct=yes
2625    hardcode_minus_L=yes # Not in the search PATH, but as the default
2626			 # location of the library.
2627    export_dynamic_flag_spec='${wl}-E'
2628    ;;
2629
2630  irix5* | irix6*)
2631    if test "$GCC" = yes; then
2632      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
2633    else
2634      archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
2635    fi
2636    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
2637    hardcode_libdir_separator=:
2638    link_all_deplibs=yes
2639    ;;
2640
2641  netbsd*)
2642    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
2643      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
2644    else
2645      archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
2646    fi
2647    hardcode_libdir_flag_spec='-R$libdir'
2648    hardcode_direct=yes
2649    hardcode_shlibpath_var=no
2650    ;;
2651
2652  newsos6)
2653    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
2654    hardcode_direct=yes
2655    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
2656    hardcode_libdir_separator=:
2657    hardcode_shlibpath_var=no
2658    ;;
2659
2660  openbsd*)
2661    hardcode_direct=yes
2662    hardcode_shlibpath_var=no
2663    if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
2664      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags'
2665      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
2666      export_dynamic_flag_spec='${wl}-E'
2667    else
2668      case "$host_os" in
2669      openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
2670	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
2671	hardcode_libdir_flag_spec='-R$libdir'
2672        ;;
2673      *)
2674        archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags'
2675        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
2676        ;;
2677      esac
2678    fi
2679    ;;
2680
2681  os2*)
2682    hardcode_libdir_flag_spec='-L$libdir'
2683    hardcode_minus_L=yes
2684    allow_undefined_flag=unsupported
2685    archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
2686    old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
2687    ;;
2688
2689  osf3*)
2690    if test "$GCC" = yes; then
2691      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
2692      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
2693    else
2694      allow_undefined_flag=' -expect_unresolved \*'
2695      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
2696    fi
2697    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
2698    hardcode_libdir_separator=:
2699    ;;
2700
2701  osf4* | osf5*)	# as osf3* with the addition of -msym flag
2702    if test "$GCC" = yes; then
2703      allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
2704      archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
2705      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
2706    else
2707      allow_undefined_flag=' -expect_unresolved \*'
2708      archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
2709      archive_expsym_cmds='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
2710      $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp'
2711
2712      #Both c and cxx compiler support -rpath directly
2713      hardcode_libdir_flag_spec='-rpath $libdir'
2714    fi
2715    hardcode_libdir_separator=:
2716    ;;
2717
2718  sco3.2v5*)
2719    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
2720    hardcode_shlibpath_var=no
2721    runpath_var=LD_RUN_PATH
2722    hardcode_runpath_var=yes
2723    export_dynamic_flag_spec='${wl}-Bexport'
2724    ;;
2725
2726  solaris*)
2727    # gcc --version < 3.0 without binutils cannot create self contained
2728    # shared libraries reliably, requiring libgcc.a to resolve some of
2729    # the object symbols generated in some cases.  Libraries that use
2730    # assert need libgcc.a to resolve __eprintf, for example.  Linking
2731    # a copy of libgcc.a into every shared library to guarantee resolving
2732    # such symbols causes other problems:  According to Tim Van Holder
2733    # <tim.van.holder@pandora.be>, C++ libraries end up with a separate
2734    # (to the application) exception stack for one thing.
2735    no_undefined_flag=' -z defs'
2736    if test "$GCC" = yes; then
2737      case `$CC --version 2>/dev/null` in
2738      [[12]].*)
2739	cat <<EOF 1>&2
2740
2741*** Warning: Releases of GCC earlier than version 3.0 cannot reliably
2742*** create self contained shared libraries on Solaris systems, without
2743*** introducing a dependency on libgcc.a.  Therefore, libtool is disabling
2744*** -no-undefined support, which will at least allow you to build shared
2745*** libraries.  However, you may find that when you link such libraries
2746*** into an application without using GCC, you have to manually add
2747*** \`gcc --print-libgcc-file-name\` to the link command.  We urge you to
2748*** upgrade to a newer version of GCC.  Another option is to rebuild your
2749*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer.
2750
2751EOF
2752        no_undefined_flag=
2753	;;
2754      esac
2755    fi
2756    # $CC -shared without GNU ld will not create a library from C++
2757    # object files and a static libstdc++, better avoid it by now
2758    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
2759    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
2760		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
2761    hardcode_libdir_flag_spec='-R$libdir'
2762    hardcode_shlibpath_var=no
2763    case $host_os in
2764    solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
2765    *) # Supported since Solaris 2.6 (maybe 2.5.1?)
2766      whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;;
2767    esac
2768    link_all_deplibs=yes
2769    ;;
2770
2771  sunos4*)
2772    if test "x$host_vendor" = xsequent; then
2773      # Use $CC to link under sequent, because it throws in some extra .o
2774      # files that make .init and .fini sections work.
2775      archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
2776    else
2777      archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
2778    fi
2779    hardcode_libdir_flag_spec='-L$libdir'
2780    hardcode_direct=yes
2781    hardcode_minus_L=yes
2782    hardcode_shlibpath_var=no
2783    ;;
2784
2785  sysv4)
2786    if test "x$host_vendor" = xsno; then
2787      archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags'
2788      hardcode_direct=yes # is this really true???
2789    else
2790      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
2791      hardcode_direct=no #Motorola manual says yes, but my tests say they lie
2792    fi
2793    runpath_var='LD_RUN_PATH'
2794    hardcode_shlibpath_var=no
2795    ;;
2796
2797  sysv4.3*)
2798    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
2799    hardcode_shlibpath_var=no
2800    export_dynamic_flag_spec='-Bexport'
2801    ;;
2802
2803  sysv5*)
2804    no_undefined_flag=' -z text'
2805    # $CC -shared without GNU ld will not create a library from C++
2806    # object files and a static libstdc++, better avoid it by now
2807    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
2808    archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
2809		$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
2810    hardcode_libdir_flag_spec=
2811    hardcode_shlibpath_var=no
2812    runpath_var='LD_RUN_PATH'
2813    ;;
2814
2815  uts4*)
2816    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
2817    hardcode_libdir_flag_spec='-L$libdir'
2818    hardcode_shlibpath_var=no
2819    ;;
2820
2821  dgux*)
2822    archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
2823    hardcode_libdir_flag_spec='-L$libdir'
2824    hardcode_shlibpath_var=no
2825    ;;
2826
2827  sysv4*MP*)
2828    if test -d /usr/nec; then
2829      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
2830      hardcode_shlibpath_var=no
2831      runpath_var=LD_RUN_PATH
2832      hardcode_runpath_var=yes
2833      ld_shlibs=yes
2834    fi
2835    ;;
2836
2837  sysv4.2uw2*)
2838    archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
2839    hardcode_direct=yes
2840    hardcode_minus_L=no
2841    hardcode_shlibpath_var=no
2842    hardcode_runpath_var=yes
2843    runpath_var=LD_RUN_PATH
2844    ;;
2845
2846  sysv5uw7* | unixware7*)
2847    no_undefined_flag='${wl}-z ${wl}text'
2848    if test "$GCC" = yes; then
2849      archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
2850    else
2851      archive_cmds='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
2852    fi
2853    runpath_var='LD_RUN_PATH'
2854    hardcode_shlibpath_var=no
2855    ;;
2856
2857  *)
2858    ld_shlibs=no
2859    ;;
2860  esac
2861fi
2862AC_MSG_RESULT([$ld_shlibs])
2863test "$ld_shlibs" = no && can_build_shared=no
2864
2865# Check hardcoding attributes.
2866AC_MSG_CHECKING([how to hardcode library paths into programs])
2867hardcode_action=
2868if test -n "$hardcode_libdir_flag_spec" || \
2869   test -n "$runpath_var"; then
2870
2871  # We can hardcode non-existant directories.
2872  if test "$hardcode_direct" != no &&
2873     # If the only mechanism to avoid hardcoding is shlibpath_var, we
2874     # have to relink, otherwise we might link with an installed library
2875     # when we should be linking with a yet-to-be-installed one
2876     ## test "$hardcode_shlibpath_var" != no &&
2877     test "$hardcode_minus_L" != no; then
2878    # Linking always hardcodes the temporary library directory.
2879    hardcode_action=relink
2880  else
2881    # We can link without hardcoding, and we can hardcode nonexisting dirs.
2882    hardcode_action=immediate
2883  fi
2884else
2885  # We cannot hardcode anything, or else we can only hardcode existing
2886  # directories.
2887  hardcode_action=unsupported
2888fi
2889AC_MSG_RESULT([$hardcode_action])
2890
2891striplib=
2892old_striplib=
2893AC_MSG_CHECKING([whether stripping libraries is possible])
2894if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
2895  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
2896  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
2897  AC_MSG_RESULT([yes])
2898else
2899  AC_MSG_RESULT([no])
2900fi
2901
2902reload_cmds='$LD$reload_flag -o $output$reload_objs'
2903test -z "$deplibs_check_method" && deplibs_check_method=unknown
2904
2905# PORTME Fill in your ld.so characteristics
2906AC_MSG_CHECKING([dynamic linker characteristics])
2907library_names_spec=
2908libname_spec='lib$name'
2909soname_spec=
2910postinstall_cmds=
2911postuninstall_cmds=
2912finish_cmds=
2913finish_eval=
2914shlibpath_var=
2915shlibpath_overrides_runpath=unknown
2916version_type=none
2917dynamic_linker="$host_os ld.so"
2918sys_lib_dlsearch_path_spec="/lib /usr/lib"
2919sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
2920
2921case $host_os in
2922aix3*)
2923  version_type=linux
2924  library_names_spec='${libname}${release}.so$versuffix $libname.a'
2925  shlibpath_var=LIBPATH
2926
2927  # AIX has no versioning support, so we append a major version to the name.
2928  soname_spec='${libname}${release}.so$major'
2929  ;;
2930
2931aix4* | aix5*)
2932  version_type=linux
2933  if test "$host_cpu" = ia64; then
2934    # AIX 5 supports IA64
2935    library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so'
2936    shlibpath_var=LD_LIBRARY_PATH
2937  else
2938    # With GCC up to 2.95.x, collect2 would create an import file
2939    # for dependence libraries.  The import file would start with
2940    # the line `#! .'.  This would cause the generated library to
2941    # depend on `.', always an invalid library.  This was fixed in
2942    # development snapshots of GCC prior to 3.0.
2943    case $host_os in
2944      aix4 | aix4.[[01]] | aix4.[[01]].*)
2945	if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
2946	     echo ' yes '
2947	     echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
2948	  :
2949	else
2950	  can_build_shared=no
2951	fi
2952	;;
2953    esac
2954    # AIX (on Power*) has no versioning support, so currently we can
2955    # not hardcode correct soname into executable. Probably we can
2956    # add versioning support to collect2, so additional links can
2957    # be useful in future.
2958    if test "$aix_use_runtimelinking" = yes; then
2959      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
2960      # instead of lib<name>.a to let people know that these are not
2961      # typical AIX shared libraries.
2962      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
2963    else
2964      # We preserve .a as extension for shared libraries through AIX4.2
2965      # and later when we are not doing run time linking.
2966      library_names_spec='${libname}${release}.a $libname.a'
2967      soname_spec='${libname}${release}.so$major'
2968    fi
2969    shlibpath_var=LIBPATH
2970  fi
2971  ;;
2972
2973amigaos*)
2974  library_names_spec='$libname.ixlibrary $libname.a'
2975  # Create ${libname}_ixlibrary.a entries in /sys/libs.
2976  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
2977  ;;
2978
2979beos*)
2980  library_names_spec='${libname}.so'
2981  dynamic_linker="$host_os ld.so"
2982  shlibpath_var=LIBRARY_PATH
2983  ;;
2984
2985bsdi4*)
2986  version_type=linux
2987  need_version=no
2988  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
2989  soname_spec='${libname}${release}.so$major'
2990  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
2991  shlibpath_var=LD_LIBRARY_PATH
2992  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
2993  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
2994  export_dynamic_flag_spec=-rdynamic
2995  # the default ld.so.conf also contains /usr/contrib/lib and
2996  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
2997  # libtool to hard-code these into programs
2998  ;;
2999
3000cygwin* | mingw* | pw32*)
3001  version_type=windows
3002  need_version=no
3003  need_lib_prefix=no
3004  case $GCC,$host_os in
3005  yes,cygwin*)
3006    library_names_spec='$libname.dll.a'
3007    soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll'
3008    postinstall_cmds='dlpath=`bash 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~
3009      dldir=$destdir/`dirname \$dlpath`~
3010      test -d \$dldir || mkdir -p \$dldir~
3011      $install_prog .libs/$dlname \$dldir/$dlname'
3012    postuninstall_cmds='dldll=`bash 2>&1 -c '\''. $file; echo \$dlname'\''`~
3013      dlpath=$dir/\$dldll~
3014       $rm \$dlpath'
3015    ;;
3016  yes,mingw*)
3017    library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll'
3018    sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"`
3019    ;;
3020  yes,pw32*)
3021    library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll'
3022    ;;
3023  *)
3024    library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib'
3025    ;;
3026  esac
3027  dynamic_linker='Win32 ld.exe'
3028  # FIXME: first we should search . and the directory the executable is in
3029  shlibpath_var=PATH
3030  ;;
3031
3032darwin* | rhapsody*)
3033  dynamic_linker="$host_os dyld"
3034  version_type=darwin
3035  need_lib_prefix=no
3036  need_version=no
3037  # FIXME: Relying on posixy $() will cause problems for
3038  #        cross-compilation, but unfortunately the echo tests do not
3039  #        yet detect zsh echo's removal of \ escapes.
3040  library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)'
3041  soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)'
3042  shlibpath_overrides_runpath=yes
3043  shlibpath_var=DYLD_LIBRARY_PATH
3044  ;;
3045
3046freebsd1*)
3047  dynamic_linker=no
3048  ;;
3049
3050freebsd*)
3051  objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
3052  version_type=freebsd-$objformat
3053  case $version_type in
3054    freebsd-elf*)
3055      library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
3056      need_version=no
3057      need_lib_prefix=no
3058      ;;
3059    freebsd-*)
3060      library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix'
3061      need_version=yes
3062      ;;
3063  esac
3064  shlibpath_var=LD_LIBRARY_PATH
3065  case $host_os in
3066  freebsd2*)
3067    shlibpath_overrides_runpath=yes
3068    ;;
3069  *)
3070    shlibpath_overrides_runpath=no
3071    hardcode_into_libs=yes
3072    ;;
3073  esac
3074  ;;
3075
3076gnu*)
3077  version_type=linux
3078  need_lib_prefix=no
3079  need_version=no
3080  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so'
3081  soname_spec='${libname}${release}.so$major'
3082  shlibpath_var=LD_LIBRARY_PATH
3083  hardcode_into_libs=yes
3084  ;;
3085
3086hpux9* | hpux10* | hpux11*)
3087  # Give a soname corresponding to the major version so that dld.sl refuses to
3088  # link against other versions.
3089  dynamic_linker="$host_os dld.sl"
3090  version_type=sunos
3091  need_lib_prefix=no
3092  need_version=no
3093  shlibpath_var=SHLIB_PATH
3094  shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
3095  library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl'
3096  soname_spec='${libname}${release}.sl$major'
3097  # HP-UX runs *really* slowly unless shared libraries are mode 555.
3098  postinstall_cmds='chmod 555 $lib'
3099  ;;
3100
3101irix5* | irix6*)
3102  version_type=irix
3103  need_lib_prefix=no
3104  need_version=no
3105  soname_spec='${libname}${release}.so$major'
3106  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so'
3107  case $host_os in
3108  irix5*)
3109    libsuff= shlibsuff=
3110    ;;
3111  *)
3112    case $LD in # libtool.m4 will add one of these switches to LD
3113    *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;;
3114    *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;;
3115    *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;;
3116    *) libsuff= shlibsuff= libmagic=never-match;;
3117    esac
3118    ;;
3119  esac
3120  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
3121  shlibpath_overrides_runpath=no
3122  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
3123  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
3124  ;;
3125
3126# No shared lib support for Linux oldld, aout, or coff.
3127linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
3128  dynamic_linker=no
3129  ;;
3130
3131# This must be Linux ELF.
3132linux-gnu*)
3133  version_type=linux
3134  need_lib_prefix=no
3135  need_version=no
3136  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
3137  soname_spec='${libname}${release}.so$major'
3138  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
3139  shlibpath_var=LD_LIBRARY_PATH
3140  shlibpath_overrides_runpath=no
3141  # This implies no fast_install, which is unacceptable.
3142  # Some rework will be needed to allow for fast_install
3143  # before this can be enabled.
3144  hardcode_into_libs=yes
3145
3146  # We used to test for /lib/ld.so.1 and disable shared libraries on
3147  # powerpc, because MkLinux only supported shared libraries with the
3148  # GNU dynamic linker.  Since this was broken with cross compilers,
3149  # most powerpc-linux boxes support dynamic linking these days and
3150  # people can always --disable-shared, the test was removed, and we
3151  # assume the GNU/Linux dynamic linker is in use.
3152  dynamic_linker='GNU/Linux ld.so'
3153  ;;
3154
3155netbsd*)
3156  version_type=sunos
3157  need_lib_prefix=no
3158  need_version=no
3159  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
3160    library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
3161    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
3162    dynamic_linker='NetBSD (a.out) ld.so'
3163  else
3164    library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so'
3165    soname_spec='${libname}${release}.so$major'
3166    dynamic_linker='NetBSD ld.elf_so'
3167  fi
3168  shlibpath_var=LD_LIBRARY_PATH
3169  shlibpath_overrides_runpath=yes
3170  hardcode_into_libs=yes
3171  ;;
3172
3173newsos6)
3174  version_type=linux
3175  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
3176  shlibpath_var=LD_LIBRARY_PATH
3177  shlibpath_overrides_runpath=yes
3178  ;;
3179
3180openbsd*)
3181  version_type=sunos
3182  need_lib_prefix=no
3183  need_version=no
3184  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
3185    case "$host_os" in
3186    openbsd2.[[89]] | openbsd2.[[89]].*)
3187      shlibpath_overrides_runpath=no
3188      ;;
3189    *)
3190      shlibpath_overrides_runpath=yes
3191      ;;
3192    esac
3193  else
3194    shlibpath_overrides_runpath=yes
3195  fi
3196  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
3197  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
3198  shlibpath_var=LD_LIBRARY_PATH
3199  ;;
3200
3201os2*)
3202  libname_spec='$name'
3203  need_lib_prefix=no
3204  library_names_spec='$libname.dll $libname.a'
3205  dynamic_linker='OS/2 ld.exe'
3206  shlibpath_var=LIBPATH
3207  ;;
3208
3209osf3* | osf4* | osf5*)
3210  version_type=osf
3211  need_version=no
3212  soname_spec='${libname}${release}.so'
3213  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so'
3214  shlibpath_var=LD_LIBRARY_PATH
3215  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
3216  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
3217  ;;
3218
3219sco3.2v5*)
3220  version_type=osf
3221  soname_spec='${libname}${release}.so$major'
3222  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
3223  shlibpath_var=LD_LIBRARY_PATH
3224  ;;
3225
3226solaris*)
3227  version_type=linux
3228  need_lib_prefix=no
3229  need_version=no
3230  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
3231  soname_spec='${libname}${release}.so$major'
3232  shlibpath_var=LD_LIBRARY_PATH
3233  shlibpath_overrides_runpath=yes
3234  hardcode_into_libs=yes
3235  # ldd complains unless libraries are executable
3236  postinstall_cmds='chmod +x $lib'
3237  ;;
3238
3239sunos4*)
3240  version_type=sunos
3241  library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix'
3242  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
3243  shlibpath_var=LD_LIBRARY_PATH
3244  shlibpath_overrides_runpath=yes
3245  if test "$with_gnu_ld" = yes; then
3246    need_lib_prefix=no
3247  fi
3248  need_version=yes
3249  ;;
3250
3251sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
3252  version_type=linux
3253  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
3254  soname_spec='${libname}${release}.so$major'
3255  shlibpath_var=LD_LIBRARY_PATH
3256  case $host_vendor in
3257    sni)
3258      shlibpath_overrides_runpath=no
3259      ;;
3260    motorola)
3261      need_lib_prefix=no
3262      need_version=no
3263      shlibpath_overrides_runpath=no
3264      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
3265      ;;
3266  esac
3267  ;;
3268
3269uts4*)
3270  version_type=linux
3271  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
3272  soname_spec='${libname}${release}.so$major'
3273  shlibpath_var=LD_LIBRARY_PATH
3274  ;;
3275
3276dgux*)
3277  version_type=linux
3278  need_lib_prefix=no
3279  need_version=no
3280  library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
3281  soname_spec='${libname}${release}.so$major'
3282  shlibpath_var=LD_LIBRARY_PATH
3283  ;;
3284
3285sysv4*MP*)
3286  if test -d /usr/nec ;then
3287    version_type=linux
3288    library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
3289    soname_spec='$libname.so.$major'
3290    shlibpath_var=LD_LIBRARY_PATH
3291  fi
3292  ;;
3293
3294*)
3295  dynamic_linker=no
3296  ;;
3297esac
3298AC_MSG_RESULT([$dynamic_linker])
3299test "$dynamic_linker" = no && can_build_shared=no
3300
3301# Report the final consequences.
3302AC_MSG_CHECKING([if libtool supports shared libraries])
3303AC_MSG_RESULT([$can_build_shared])
3304
3305AC_MSG_CHECKING([whether to build shared libraries])
3306test "$can_build_shared" = "no" && enable_shared=no
3307
3308# On AIX, shared libraries and static libraries use the same namespace, and
3309# are all built from PIC.
3310case "$host_os" in
3311aix3*)
3312  test "$enable_shared" = yes && enable_static=no
3313  if test -n "$RANLIB"; then
3314    archive_cmds="$archive_cmds~\$RANLIB \$lib"
3315    postinstall_cmds='$RANLIB $lib'
3316  fi
3317  ;;
3318
3319aix4*)
3320  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
3321    test "$enable_shared" = yes && enable_static=no
3322  fi
3323  ;;
3324esac
3325AC_MSG_RESULT([$enable_shared])
3326
3327AC_MSG_CHECKING([whether to build static libraries])
3328# Make sure either enable_shared or enable_static is yes.
3329test "$enable_shared" = yes || enable_static=yes
3330AC_MSG_RESULT([$enable_static])
3331
3332if test "$hardcode_action" = relink; then
3333  # Fast installation is not supported
3334  enable_fast_install=no
3335elif test "$shlibpath_overrides_runpath" = yes ||
3336     test "$enable_shared" = no; then
3337  # Fast installation is not necessary
3338  enable_fast_install=needless
3339fi
3340
3341variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
3342if test "$GCC" = yes; then
3343  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
3344fi
3345
3346AC_LIBTOOL_DLOPEN_SELF
3347
3348if test "$enable_shared" = yes && test "$GCC" = yes; then
3349  case $archive_cmds in
3350  *'~'*)
3351    # FIXME: we may have to deal with multi-command sequences.
3352    ;;
3353  '$CC '*)
3354    # Test whether the compiler implicitly links with -lc since on some
3355    # systems, -lgcc has to come before -lc. If gcc already passes -lc
3356    # to ld, don't add -lc before -lgcc.
3357    AC_MSG_CHECKING([whether -lc should be explicitly linked in])
3358    AC_CACHE_VAL([lt_cv_archive_cmds_need_lc],
3359    [$rm conftest*
3360    echo 'static int dummy;' > conftest.$ac_ext
3361
3362    if AC_TRY_EVAL(ac_compile); then
3363      soname=conftest
3364      lib=conftest
3365      libobjs=conftest.$ac_objext
3366      deplibs=
3367      wl=$lt_cv_prog_cc_wl
3368      compiler_flags=-v
3369      linker_flags=-v
3370      verstring=
3371      output_objdir=.
3372      libname=conftest
3373      save_allow_undefined_flag=$allow_undefined_flag
3374      allow_undefined_flag=
3375      if AC_TRY_EVAL(archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
3376      then
3377	lt_cv_archive_cmds_need_lc=no
3378      else
3379	lt_cv_archive_cmds_need_lc=yes
3380      fi
3381      allow_undefined_flag=$save_allow_undefined_flag
3382    else
3383      cat conftest.err 1>&5
3384    fi])
3385    AC_MSG_RESULT([$lt_cv_archive_cmds_need_lc])
3386    ;;
3387  esac
3388fi
3389need_lc=${lt_cv_archive_cmds_need_lc-yes}
3390
3391# The second clause should only fire when bootstrapping the
3392# libtool distribution, otherwise you forgot to ship ltmain.sh
3393# with your package, and you will get complaints that there are
3394# no rules to generate ltmain.sh.
3395if test -f "$ltmain"; then
3396  :
3397else
3398  # If there is no Makefile yet, we rely on a make rule to execute
3399  # `config.status --recheck' to rerun these tests and create the
3400  # libtool script then.
3401  test -f Makefile && make "$ltmain"
3402fi
3403
3404if test -f "$ltmain"; then
3405  trap "$rm \"${ofile}T\"; exit 1" 1 2 15
3406  $rm -f "${ofile}T"
3407
3408  echo creating $ofile
3409
3410  # Now quote all the things that may contain metacharacters while being
3411  # careful not to overquote the AC_SUBSTed values.  We take copies of the
3412  # variables and quote the copies for generation of the libtool script.
3413  for var in echo old_CC old_CFLAGS \
3414    AR AR_FLAGS CC LD LN_S NM SHELL \
3415    reload_flag reload_cmds wl \
3416    pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
3417    thread_safe_flag_spec whole_archive_flag_spec libname_spec \
3418    library_names_spec soname_spec \
3419    RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
3420    old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \
3421    postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \
3422    old_striplib striplib file_magic_cmd export_symbols_cmds \
3423    deplibs_check_method allow_undefined_flag no_undefined_flag \
3424    finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \
3425    global_symbol_to_c_name_address \
3426    hardcode_libdir_flag_spec hardcode_libdir_separator  \
3427    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
3428    compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do
3429
3430    case $var in
3431    reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
3432    old_postinstall_cmds | old_postuninstall_cmds | \
3433    export_symbols_cmds | archive_cmds | archive_expsym_cmds | \
3434    extract_expsyms_cmds | old_archive_from_expsyms_cmds | \
3435    postinstall_cmds | postuninstall_cmds | \
3436    finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
3437      # Double-quote double-evaled strings.
3438      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
3439      ;;
3440    *)
3441      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
3442      ;;
3443    esac
3444  done
3445
3446  cat <<__EOF__ > "${ofile}T"
3447#! $SHELL
3448
3449# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
3450# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
3451# NOTE: Changes made to this file will be lost: look at ltmain.sh.
3452#
3453# Copyright (C) 1996-2000 Free Software Foundation, Inc.
3454# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
3455#
3456# This program is free software; you can redistribute it and/or modify
3457# it under the terms of the GNU General Public License as published by
3458# the Free Software Foundation; either version 2 of the License, or
3459# (at your option) any later version.
3460#
3461# This program is distributed in the hope that it will be useful, but
3462# WITHOUT ANY WARRANTY; without even the implied warranty of
3463# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
3464# General Public License for more details.
3465#
3466# You should have received a copy of the GNU General Public License
3467# along with this program; if not, write to the Free Software
3468# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
3469#
3470# As a special exception to the GNU General Public License, if you
3471# distribute this file as part of a program that contains a
3472# configuration script generated by Autoconf, you may include it under
3473# the same distribution terms that you use for the rest of that program.
3474
3475# Sed that helps us avoid accidentally triggering echo(1) options like -n.
3476Xsed="sed -e s/^X//"
3477
3478# The HP-UX ksh and POSIX shell print the target directory to stdout
3479# if CDPATH is set.
3480if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi
3481
3482# ### BEGIN LIBTOOL CONFIG
3483
3484# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
3485
3486# Shell to use when invoking shell scripts.
3487SHELL=$lt_SHELL
3488
3489# Whether or not to build shared libraries.
3490build_libtool_libs=$enable_shared
3491
3492# Whether or not to build static libraries.
3493build_old_libs=$enable_static
3494
3495# Whether or not to add -lc for building shared libraries.
3496build_libtool_need_lc=$need_lc
3497
3498# Whether or not to optimize for fast installation.
3499fast_install=$enable_fast_install
3500
3501# The host system.
3502host_alias=$host_alias
3503host=$host
3504
3505# An echo program that does not interpret backslashes.
3506echo=$lt_echo
3507
3508# The archiver.
3509AR=$lt_AR
3510AR_FLAGS=$lt_AR_FLAGS
3511
3512# The default C compiler.
3513CC=$lt_CC
3514
3515# Is the compiler the GNU C compiler?
3516with_gcc=$GCC
3517
3518# The linker used to build libraries.
3519LD=$lt_LD
3520
3521# Whether we need hard or soft links.
3522LN_S=$lt_LN_S
3523
3524# A BSD-compatible nm program.
3525NM=$lt_NM
3526
3527# A symbol stripping program
3528STRIP=$STRIP
3529
3530# Used to examine libraries when file_magic_cmd begins "file"
3531MAGIC_CMD=$MAGIC_CMD
3532
3533# Used on cygwin: DLL creation program.
3534DLLTOOL="$DLLTOOL"
3535
3536# Used on cygwin: object dumper.
3537OBJDUMP="$OBJDUMP"
3538
3539# Used on cygwin: assembler.
3540AS="$AS"
3541
3542# The name of the directory that contains temporary libtool files.
3543objdir=$objdir
3544
3545# How to create reloadable object files.
3546reload_flag=$lt_reload_flag
3547reload_cmds=$lt_reload_cmds
3548
3549# How to pass a linker flag through the compiler.
3550wl=$lt_wl
3551
3552# Object file suffix (normally "o").
3553objext="$ac_objext"
3554
3555# Old archive suffix (normally "a").
3556libext="$libext"
3557
3558# Executable file suffix (normally "").
3559exeext="$exeext"
3560
3561# Additional compiler flags for building library objects.
3562pic_flag=$lt_pic_flag
3563pic_mode=$pic_mode
3564
3565# Does compiler simultaneously support -c and -o options?
3566compiler_c_o=$lt_compiler_c_o
3567
3568# Can we write directly to a .lo ?
3569compiler_o_lo=$lt_compiler_o_lo
3570
3571# Must we lock files when doing compilation ?
3572need_locks=$lt_need_locks
3573
3574# Do we need the lib prefix for modules?
3575need_lib_prefix=$need_lib_prefix
3576
3577# Do we need a version for libraries?
3578need_version=$need_version
3579
3580# Whether dlopen is supported.
3581dlopen_support=$enable_dlopen
3582
3583# Whether dlopen of programs is supported.
3584dlopen_self=$enable_dlopen_self
3585
3586# Whether dlopen of statically linked programs is supported.
3587dlopen_self_static=$enable_dlopen_self_static
3588
3589# Compiler flag to prevent dynamic linking.
3590link_static_flag=$lt_link_static_flag
3591
3592# Compiler flag to turn off builtin functions.
3593no_builtin_flag=$lt_no_builtin_flag
3594
3595# Compiler flag to allow reflexive dlopens.
3596export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
3597
3598# Compiler flag to generate shared objects directly from archives.
3599whole_archive_flag_spec=$lt_whole_archive_flag_spec
3600
3601# Compiler flag to generate thread-safe objects.
3602thread_safe_flag_spec=$lt_thread_safe_flag_spec
3603
3604# Library versioning type.
3605version_type=$version_type
3606
3607# Format of library name prefix.
3608libname_spec=$lt_libname_spec
3609
3610# List of archive names.  First name is the real one, the rest are links.
3611# The last name is the one that the linker finds with -lNAME.
3612library_names_spec=$lt_library_names_spec
3613
3614# The coded name of the library, if different from the real name.
3615soname_spec=$lt_soname_spec
3616
3617# Commands used to build and install an old-style archive.
3618RANLIB=$lt_RANLIB
3619old_archive_cmds=$lt_old_archive_cmds
3620old_postinstall_cmds=$lt_old_postinstall_cmds
3621old_postuninstall_cmds=$lt_old_postuninstall_cmds
3622
3623# Create an old-style archive from a shared archive.
3624old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
3625
3626# Create a temporary old-style archive to link instead of a shared archive.
3627old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
3628
3629# Commands used to build and install a shared archive.
3630archive_cmds=$lt_archive_cmds
3631archive_expsym_cmds=$lt_archive_expsym_cmds
3632postinstall_cmds=$lt_postinstall_cmds
3633postuninstall_cmds=$lt_postuninstall_cmds
3634
3635# Commands to strip libraries.
3636old_striplib=$lt_old_striplib
3637striplib=$lt_striplib
3638
3639# Method to check whether dependent libraries are shared objects.
3640deplibs_check_method=$lt_deplibs_check_method
3641
3642# Command to use when deplibs_check_method == file_magic.
3643file_magic_cmd=$lt_file_magic_cmd
3644
3645# Flag that allows shared libraries with undefined symbols to be built.
3646allow_undefined_flag=$lt_allow_undefined_flag
3647
3648# Flag that forces no undefined symbols.
3649no_undefined_flag=$lt_no_undefined_flag
3650
3651# Commands used to finish a libtool library installation in a directory.
3652finish_cmds=$lt_finish_cmds
3653
3654# Same as above, but a single script fragment to be evaled but not shown.
3655finish_eval=$lt_finish_eval
3656
3657# Take the output of nm and produce a listing of raw symbols and C names.
3658global_symbol_pipe=$lt_global_symbol_pipe
3659
3660# Transform the output of nm in a proper C declaration
3661global_symbol_to_cdecl=$lt_global_symbol_to_cdecl
3662
3663# Transform the output of nm in a C name address pair
3664global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address
3665
3666# This is the shared library runtime path variable.
3667runpath_var=$runpath_var
3668
3669# This is the shared library path variable.
3670shlibpath_var=$shlibpath_var
3671
3672# Is shlibpath searched before the hard-coded library search path?
3673shlibpath_overrides_runpath=$shlibpath_overrides_runpath
3674
3675# How to hardcode a shared library path into an executable.
3676hardcode_action=$hardcode_action
3677
3678# Whether we should hardcode library paths into libraries.
3679hardcode_into_libs=$hardcode_into_libs
3680
3681# Flag to hardcode \$libdir into a binary during linking.
3682# This must work even if \$libdir does not exist.
3683hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
3684
3685# Whether we need a single -rpath flag with a separated argument.
3686hardcode_libdir_separator=$lt_hardcode_libdir_separator
3687
3688# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
3689# resulting binary.
3690hardcode_direct=$hardcode_direct
3691
3692# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
3693# resulting binary.
3694hardcode_minus_L=$hardcode_minus_L
3695
3696# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
3697# the resulting binary.
3698hardcode_shlibpath_var=$hardcode_shlibpath_var
3699
3700# Variables whose values should be saved in libtool wrapper scripts and
3701# restored at relink time.
3702variables_saved_for_relink="$variables_saved_for_relink"
3703
3704# Whether libtool must link a program against all its dependency libraries.
3705link_all_deplibs=$link_all_deplibs
3706
3707# Compile-time system search path for libraries
3708sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
3709
3710# Run-time system search path for libraries
3711sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
3712
3713# Fix the shell variable \$srcfile for the compiler.
3714fix_srcfile_path="$fix_srcfile_path"
3715
3716# Set to yes if exported symbols are required.
3717always_export_symbols=$always_export_symbols
3718
3719# The commands to list exported symbols.
3720export_symbols_cmds=$lt_export_symbols_cmds
3721
3722# The commands to extract the exported symbol list from a shared archive.
3723extract_expsyms_cmds=$lt_extract_expsyms_cmds
3724
3725# Symbols that should not be listed in the preloaded symbols.
3726exclude_expsyms=$lt_exclude_expsyms
3727
3728# Symbols that must always be exported.
3729include_expsyms=$lt_include_expsyms
3730
3731# ### END LIBTOOL CONFIG
3732
3733__EOF__
3734
3735  case $host_os in
3736  aix3*)
3737    cat <<\EOF >> "${ofile}T"
3738
3739# AIX sometimes has problems with the GCC collect2 program.  For some
3740# reason, if we set the COLLECT_NAMES environment variable, the problems
3741# vanish in a puff of smoke.
3742if test "X${COLLECT_NAMES+set}" != Xset; then
3743  COLLECT_NAMES=
3744  export COLLECT_NAMES
3745fi
3746EOF
3747    ;;
3748  esac
3749
3750  case $host_os in
3751  cygwin* | mingw* | pw32* | os2*)
3752    cat <<'EOF' >> "${ofile}T"
3753      # This is a source program that is used to create dlls on Windows
3754      # Don't remove nor modify the starting and closing comments
3755# /* ltdll.c starts here */
3756# #define WIN32_LEAN_AND_MEAN
3757# #include <windows.h>
3758# #undef WIN32_LEAN_AND_MEAN
3759# #include <stdio.h>
3760#
3761# #ifndef __CYGWIN__
3762# #  ifdef __CYGWIN32__
3763# #    define __CYGWIN__ __CYGWIN32__
3764# #  endif
3765# #endif
3766#
3767# #ifdef __cplusplus
3768# extern "C" {
3769# #endif
3770# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
3771# #ifdef __cplusplus
3772# }
3773# #endif
3774#
3775# #ifdef __CYGWIN__
3776# #include <cygwin/cygwin_dll.h>
3777# DECLARE_CYGWIN_DLL( DllMain );
3778# #endif
3779# HINSTANCE __hDllInstance_base;
3780#
3781# BOOL APIENTRY
3782# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
3783# {
3784#   __hDllInstance_base = hInst;
3785#   return TRUE;
3786# }
3787# /* ltdll.c ends here */
3788	# This is a source program that is used to create import libraries
3789	# on Windows for dlls which lack them. Don't remove nor modify the
3790	# starting and closing comments
3791# /* impgen.c starts here */
3792# /*   Copyright (C) 1999-2000 Free Software Foundation, Inc.
3793#
3794#  This file is part of GNU libtool.
3795#
3796#  This program is free software; you can redistribute it and/or modify
3797#  it under the terms of the GNU General Public License as published by
3798#  the Free Software Foundation; either version 2 of the License, or
3799#  (at your option) any later version.
3800#
3801#  This program is distributed in the hope that it will be useful,
3802#  but WITHOUT ANY WARRANTY; without even the implied warranty of
3803#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3804#  GNU General Public License for more details.
3805#
3806#  You should have received a copy of the GNU General Public License
3807#  along with this program; if not, write to the Free Software
3808#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
3809#  */
3810#
3811# #include <stdio.h>		/* for printf() */
3812# #include <unistd.h>		/* for open(), lseek(), read() */
3813# #include <fcntl.h>		/* for O_RDONLY, O_BINARY */
3814# #include <string.h>		/* for strdup() */
3815#
3816# /* O_BINARY isn't required (or even defined sometimes) under Unix */
3817# #ifndef O_BINARY
3818# #define O_BINARY 0
3819# #endif
3820#
3821# static unsigned int
3822# pe_get16 (fd, offset)
3823#      int fd;
3824#      int offset;
3825# {
3826#   unsigned char b[2];
3827#   lseek (fd, offset, SEEK_SET);
3828#   read (fd, b, 2);
3829#   return b[0] + (b[1]<<8);
3830# }
3831#
3832# static unsigned int
3833# pe_get32 (fd, offset)
3834#     int fd;
3835#     int offset;
3836# {
3837#   unsigned char b[4];
3838#   lseek (fd, offset, SEEK_SET);
3839#   read (fd, b, 4);
3840#   return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
3841# }
3842#
3843# static unsigned int
3844# pe_as32 (ptr)
3845#      void *ptr;
3846# {
3847#   unsigned char *b = ptr;
3848#   return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
3849# }
3850#
3851# int
3852# main (argc, argv)
3853#     int argc;
3854#     char *argv[];
3855# {
3856#     int dll;
3857#     unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
3858#     unsigned long export_rva, export_size, nsections, secptr, expptr;
3859#     unsigned long name_rvas, nexp;
3860#     unsigned char *expdata, *erva;
3861#     char *filename, *dll_name;
3862#
3863#     filename = argv[1];
3864#
3865#     dll = open(filename, O_RDONLY|O_BINARY);
3866#     if (dll < 1)
3867# 	return 1;
3868#
3869#     dll_name = filename;
3870#
3871#     for (i=0; filename[i]; i++)
3872# 	if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
3873# 	    dll_name = filename + i +1;
3874#
3875#     pe_header_offset = pe_get32 (dll, 0x3c);
3876#     opthdr_ofs = pe_header_offset + 4 + 20;
3877#     num_entries = pe_get32 (dll, opthdr_ofs + 92);
3878#
3879#     if (num_entries < 1) /* no exports */
3880# 	return 1;
3881#
3882#     export_rva = pe_get32 (dll, opthdr_ofs + 96);
3883#     export_size = pe_get32 (dll, opthdr_ofs + 100);
3884#     nsections = pe_get16 (dll, pe_header_offset + 4 +2);
3885#     secptr = (pe_header_offset + 4 + 20 +
3886# 	      pe_get16 (dll, pe_header_offset + 4 + 16));
3887#
3888#     expptr = 0;
3889#     for (i = 0; i < nsections; i++)
3890#     {
3891# 	char sname[8];
3892# 	unsigned long secptr1 = secptr + 40 * i;
3893# 	unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
3894# 	unsigned long vsize = pe_get32 (dll, secptr1 + 16);
3895# 	unsigned long fptr = pe_get32 (dll, secptr1 + 20);
3896# 	lseek(dll, secptr1, SEEK_SET);
3897# 	read(dll, sname, 8);
3898# 	if (vaddr <= export_rva && vaddr+vsize > export_rva)
3899# 	{
3900# 	    expptr = fptr + (export_rva - vaddr);
3901# 	    if (export_rva + export_size > vaddr + vsize)
3902# 		export_size = vsize - (export_rva - vaddr);
3903# 	    break;
3904# 	}
3905#     }
3906#
3907#     expdata = (unsigned char*)malloc(export_size);
3908#     lseek (dll, expptr, SEEK_SET);
3909#     read (dll, expdata, export_size);
3910#     erva = expdata - export_rva;
3911#
3912#     nexp = pe_as32 (expdata+24);
3913#     name_rvas = pe_as32 (expdata+32);
3914#
3915#     printf ("EXPORTS\n");
3916#     for (i = 0; i<nexp; i++)
3917#     {
3918# 	unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
3919# 	printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
3920#     }
3921#
3922#     return 0;
3923# }
3924# /* impgen.c ends here */
3925
3926EOF
3927    ;;
3928  esac
3929
3930  # We use sed instead of cat because bash on DJGPP gets confused if
3931  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
3932  # text mode, it properly converts lines to CR/LF.  This bash problem
3933  # is reportedly fixed, but why not run on old versions too?
3934  sed '$q' "$ltmain" >> "${ofile}T" || (rm -f "${ofile}T"; exit 1)
3935
3936  mv -f "${ofile}T" "$ofile" || \
3937    (rm -f "$ofile" && cp "${ofile}T" "$ofile" && rm -f "${ofile}T")
3938  chmod +x "$ofile"
3939fi
3940
3941])# _LT_AC_LTCONFIG_HACK
3942
3943# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
3944AC_DEFUN([AC_LIBTOOL_DLOPEN], [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
3945
3946# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
3947AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
3948
3949# AC_ENABLE_SHARED - implement the --enable-shared flag
3950# Usage: AC_ENABLE_SHARED[(DEFAULT)]
3951#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
3952#   `yes'.
3953AC_DEFUN([AC_ENABLE_SHARED],
3954[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
3955AC_ARG_ENABLE(shared,
3956changequote(<<, >>)dnl
3957<<  --enable-shared[=PKGS]  build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
3958changequote([, ])dnl
3959[p=${PACKAGE-default}
3960case $enableval in
3961yes) enable_shared=yes ;;
3962no) enable_shared=no ;;
3963*)
3964  enable_shared=no
3965  # Look at the argument we got.  We use all the common list separators.
3966  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
3967  for pkg in $enableval; do
3968    if test "X$pkg" = "X$p"; then
3969      enable_shared=yes
3970    fi
3971  done
3972  IFS="$ac_save_ifs"
3973  ;;
3974esac],
3975enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
3976])
3977
3978# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
3979AC_DEFUN([AC_DISABLE_SHARED],
3980[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
3981AC_ENABLE_SHARED(no)])
3982
3983# AC_ENABLE_STATIC - implement the --enable-static flag
3984# Usage: AC_ENABLE_STATIC[(DEFAULT)]
3985#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
3986#   `yes'.
3987AC_DEFUN([AC_ENABLE_STATIC],
3988[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
3989AC_ARG_ENABLE(static,
3990changequote(<<, >>)dnl
3991<<  --enable-static[=PKGS]  build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
3992changequote([, ])dnl
3993[p=${PACKAGE-default}
3994case $enableval in
3995yes) enable_static=yes ;;
3996no) enable_static=no ;;
3997*)
3998  enable_static=no
3999  # Look at the argument we got.  We use all the common list separators.
4000  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
4001  for pkg in $enableval; do
4002    if test "X$pkg" = "X$p"; then
4003      enable_static=yes
4004    fi
4005  done
4006  IFS="$ac_save_ifs"
4007  ;;
4008esac],
4009enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
4010])
4011
4012# AC_DISABLE_STATIC - set the default static flag to --disable-static
4013AC_DEFUN([AC_DISABLE_STATIC],
4014[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
4015AC_ENABLE_STATIC(no)])
4016
4017
4018# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
4019# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
4020#   Where DEFAULT is either `yes' or `no'.  If omitted, it defaults to
4021#   `yes'.
4022AC_DEFUN([AC_ENABLE_FAST_INSTALL],
4023[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
4024AC_ARG_ENABLE(fast-install,
4025changequote(<<, >>)dnl
4026<<  --enable-fast-install[=PKGS]  optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
4027changequote([, ])dnl
4028[p=${PACKAGE-default}
4029case $enableval in
4030yes) enable_fast_install=yes ;;
4031no) enable_fast_install=no ;;
4032*)
4033  enable_fast_install=no
4034  # Look at the argument we got.  We use all the common list separators.
4035  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
4036  for pkg in $enableval; do
4037    if test "X$pkg" = "X$p"; then
4038      enable_fast_install=yes
4039    fi
4040  done
4041  IFS="$ac_save_ifs"
4042  ;;
4043esac],
4044enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
4045])
4046
4047# AC_DISABLE_FAST_INSTALL - set the default to --disable-fast-install
4048AC_DEFUN([AC_DISABLE_FAST_INSTALL],
4049[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
4050AC_ENABLE_FAST_INSTALL(no)])
4051
4052# AC_LIBTOOL_PICMODE - implement the --with-pic flag
4053# Usage: AC_LIBTOOL_PICMODE[(MODE)]
4054#   Where MODE is either `yes' or `no'.  If omitted, it defaults to
4055#   `both'.
4056AC_DEFUN([AC_LIBTOOL_PICMODE],
4057[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
4058pic_mode=ifelse($#,1,$1,default)])
4059
4060
4061# AC_PATH_TOOL_PREFIX - find a file program which can recognise shared library
4062AC_DEFUN([AC_PATH_TOOL_PREFIX],
4063[AC_MSG_CHECKING([for $1])
4064AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
4065[case $MAGIC_CMD in
4066  /*)
4067  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
4068  ;;
4069  ?:/*)
4070  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a dos path.
4071  ;;
4072  *)
4073  ac_save_MAGIC_CMD="$MAGIC_CMD"
4074  IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS=":"
4075dnl $ac_dummy forces splitting on constant user-supplied paths.
4076dnl POSIX.2 word splitting is done only on the output of word expansions,
4077dnl not every word.  This closes a longstanding sh security hole.
4078  ac_dummy="ifelse([$2], , $PATH, [$2])"
4079  for ac_dir in $ac_dummy; do
4080    test -z "$ac_dir" && ac_dir=.
4081    if test -f $ac_dir/$1; then
4082      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
4083      if test -n "$file_magic_test_file"; then
4084	case $deplibs_check_method in
4085	"file_magic "*)
4086	  file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`"
4087	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
4088	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
4089	    egrep "$file_magic_regex" > /dev/null; then
4090	    :
4091	  else
4092	    cat <<EOF 1>&2
4093
4094*** Warning: the command libtool uses to detect shared libraries,
4095*** $file_magic_cmd, produces output that libtool cannot recognize.
4096*** The result is that libtool may fail to recognize shared libraries
4097*** as such.  This will affect the creation of libtool libraries that
4098*** depend on shared libraries, but programs linked with such libtool
4099*** libraries will work regardless of this problem.  Nevertheless, you
4100*** may want to report the problem to your system manager and/or to
4101*** bug-libtool@gnu.org
4102
4103EOF
4104	  fi ;;
4105	esac
4106      fi
4107      break
4108    fi
4109  done
4110  IFS="$ac_save_ifs"
4111  MAGIC_CMD="$ac_save_MAGIC_CMD"
4112  ;;
4113esac])
4114MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
4115if test -n "$MAGIC_CMD"; then
4116  AC_MSG_RESULT($MAGIC_CMD)
4117else
4118  AC_MSG_RESULT(no)
4119fi
4120])
4121
4122
4123# AC_PATH_MAGIC - find a file program which can recognise a shared library
4124AC_DEFUN([AC_PATH_MAGIC],
4125[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl
4126AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin:$PATH)
4127if test -z "$lt_cv_path_MAGIC_CMD"; then
4128  if test -n "$ac_tool_prefix"; then
4129    AC_PATH_TOOL_PREFIX(file, /usr/bin:$PATH)
4130  else
4131    MAGIC_CMD=:
4132  fi
4133fi
4134])
4135
4136
4137# AC_PROG_LD - find the path to the GNU or non-GNU linker
4138AC_DEFUN([AC_PROG_LD],
4139[AC_ARG_WITH(gnu-ld,
4140[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
4141test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
4142AC_REQUIRE([AC_PROG_CC])dnl
4143AC_REQUIRE([AC_CANONICAL_HOST])dnl
4144AC_REQUIRE([AC_CANONICAL_BUILD])dnl
4145AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl
4146ac_prog=ld
4147if test "$GCC" = yes; then
4148  # Check if gcc -print-prog-name=ld gives a path.
4149  AC_MSG_CHECKING([for ld used by GCC])
4150  case $host in
4151  *-*-mingw*)
4152    # gcc leaves a trailing carriage return which upsets mingw
4153    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
4154  *)
4155    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
4156  esac
4157  case $ac_prog in
4158    # Accept absolute paths.
4159    [[\\/]]* | [[A-Za-z]]:[[\\/]]*)
4160      re_direlt='/[[^/]][[^/]]*/\.\./'
4161      # Canonicalize the path of ld
4162      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
4163      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
4164	ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
4165      done
4166      test -z "$LD" && LD="$ac_prog"
4167      ;;
4168  "")
4169    # If it fails, then pretend we aren't using GCC.
4170    ac_prog=ld
4171    ;;
4172  *)
4173    # If it is relative, then search for the first ld in PATH.
4174    with_gnu_ld=unknown
4175    ;;
4176  esac
4177elif test "$with_gnu_ld" = yes; then
4178  AC_MSG_CHECKING([for GNU ld])
4179else
4180  AC_MSG_CHECKING([for non-GNU ld])
4181fi
4182AC_CACHE_VAL(lt_cv_path_LD,
4183[if test -z "$LD"; then
4184  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
4185  for ac_dir in $PATH; do
4186    test -z "$ac_dir" && ac_dir=.
4187    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
4188      lt_cv_path_LD="$ac_dir/$ac_prog"
4189      # Check to see if the program is GNU ld.  I'd rather use --version,
4190      # but apparently some GNU ld's only accept -v.
4191      # Break only if it was the GNU/non-GNU ld that we prefer.
4192      if "$lt_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
4193	test "$with_gnu_ld" != no && break
4194      else
4195	test "$with_gnu_ld" != yes && break
4196      fi
4197    fi
4198  done
4199  IFS="$ac_save_ifs"
4200else
4201  lt_cv_path_LD="$LD" # Let the user override the test with a path.
4202fi])
4203LD="$lt_cv_path_LD"
4204if test -n "$LD"; then
4205  AC_MSG_RESULT($LD)
4206else
4207  AC_MSG_RESULT(no)
4208fi
4209test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
4210AC_PROG_LD_GNU
4211])
4212
4213# AC_PROG_LD_GNU -
4214AC_DEFUN([AC_PROG_LD_GNU],
4215[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
4216[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
4217if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
4218  lt_cv_prog_gnu_ld=yes
4219else
4220  lt_cv_prog_gnu_ld=no
4221fi])
4222with_gnu_ld=$lt_cv_prog_gnu_ld
4223])
4224
4225# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
4226#   -- PORTME Some linkers may need a different reload flag.
4227AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
4228[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
4229[lt_cv_ld_reload_flag='-r'])
4230reload_flag=$lt_cv_ld_reload_flag
4231test -n "$reload_flag" && reload_flag=" $reload_flag"
4232])
4233
4234# AC_DEPLIBS_CHECK_METHOD - how to check for library dependencies
4235#  -- PORTME fill in with the dynamic library characteristics
4236AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
4237[AC_CACHE_CHECK([how to recognise dependant libraries],
4238lt_cv_deplibs_check_method,
4239[lt_cv_file_magic_cmd='$MAGIC_CMD'
4240lt_cv_file_magic_test_file=
4241lt_cv_deplibs_check_method='unknown'
4242# Need to set the preceding variable on all platforms that support
4243# interlibrary dependencies.
4244# 'none' -- dependencies not supported.
4245# `unknown' -- same as none, but documents that we really don't know.
4246# 'pass_all' -- all dependencies passed with no checks.
4247# 'test_compile' -- check by making test program.
4248# 'file_magic [[regex]]' -- check by looking for files in library path
4249# which responds to the $file_magic_cmd with a given egrep regex.
4250# If you have `file' or equivalent on your system and you're not sure
4251# whether `pass_all' will *always* work, you probably want this one.
4252
4253case $host_os in
4254aix4* | aix5*)
4255  lt_cv_deplibs_check_method=pass_all
4256  ;;
4257
4258beos*)
4259  lt_cv_deplibs_check_method=pass_all
4260  ;;
4261
4262bsdi4*)
4263  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
4264  lt_cv_file_magic_cmd='/usr/bin/file -L'
4265  lt_cv_file_magic_test_file=/shlib/libc.so
4266  ;;
4267
4268cygwin* | mingw* | pw32*)
4269  lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
4270  lt_cv_file_magic_cmd='$OBJDUMP -f'
4271  ;;
4272
4273darwin* | rhapsody*)
4274  lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
4275  lt_cv_file_magic_cmd='/usr/bin/file -L'
4276  case "$host_os" in
4277  rhapsody* | darwin1.[[012]])
4278    lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1`
4279    ;;
4280  *) # Darwin 1.3 on
4281    lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
4282    ;;
4283  esac
4284  ;;
4285
4286freebsd*)
4287  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
4288    case $host_cpu in
4289    i*86 )
4290      # Not sure whether the presence of OpenBSD here was a mistake.
4291      # Let's accept both of them until this is cleared up.
4292      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library'
4293      lt_cv_file_magic_cmd=/usr/bin/file
4294      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
4295      ;;
4296    esac
4297  else
4298    lt_cv_deplibs_check_method=pass_all
4299  fi
4300  ;;
4301
4302gnu*)
4303  lt_cv_deplibs_check_method=pass_all
4304  ;;
4305
4306hpux10.20*|hpux11*)
4307  lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
4308  lt_cv_file_magic_cmd=/usr/bin/file
4309  lt_cv_file_magic_test_file=/usr/lib/libc.sl
4310  ;;
4311
4312irix5* | irix6*)
4313  case $host_os in
4314  irix5*)
4315    # this will be overridden with pass_all, but let us keep it just in case
4316    lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1"
4317    ;;
4318  *)
4319    case $LD in
4320    *-32|*"-32 ") libmagic=32-bit;;
4321    *-n32|*"-n32 ") libmagic=N32;;
4322    *-64|*"-64 ") libmagic=64-bit;;
4323    *) libmagic=never-match;;
4324    esac
4325    # this will be overridden with pass_all, but let us keep it just in case
4326    lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1"
4327    ;;
4328  esac
4329  lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*`
4330  lt_cv_deplibs_check_method=pass_all
4331  ;;
4332
4333# This must be Linux ELF.
4334linux-gnu*)
4335  case $host_cpu in
4336  alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* )
4337    lt_cv_deplibs_check_method=pass_all ;;
4338  *)
4339    # glibc up to 2.1.1 does not perform some relocations on ARM
4340    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;;
4341  esac
4342  lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
4343  ;;
4344
4345netbsd*)
4346  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
4347    lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so\.[[0-9]]+\.[[0-9]]+$'
4348  else
4349    lt_cv_deplibs_check_method='match_pattern /lib[[^/\.]]+\.so$'
4350  fi
4351  ;;
4352
4353newos6*)
4354  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
4355  lt_cv_file_magic_cmd=/usr/bin/file
4356  lt_cv_file_magic_test_file=/usr/lib/libnls.so
4357  ;;
4358
4359openbsd*)
4360  lt_cv_file_magic_cmd=/usr/bin/file
4361  lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
4362  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
4363    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object'
4364  else
4365    lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library'
4366  fi
4367  ;;
4368
4369osf3* | osf4* | osf5*)
4370  # this will be overridden with pass_all, but let us keep it just in case
4371  lt_cv_deplibs_check_method='file_magic COFF format alpha shared library'
4372  lt_cv_file_magic_test_file=/shlib/libc.so
4373  lt_cv_deplibs_check_method=pass_all
4374  ;;
4375
4376sco3.2v5*)
4377  lt_cv_deplibs_check_method=pass_all
4378  ;;
4379
4380solaris*)
4381  lt_cv_deplibs_check_method=pass_all
4382  lt_cv_file_magic_test_file=/lib/libc.so
4383  ;;
4384
4385sysv5uw[[78]]* | sysv4*uw2*)
4386  lt_cv_deplibs_check_method=pass_all
4387  ;;
4388
4389sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
4390  case $host_vendor in
4391  motorola)
4392    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
4393    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
4394    ;;
4395  ncr)
4396    lt_cv_deplibs_check_method=pass_all
4397    ;;
4398  sequent)
4399    lt_cv_file_magic_cmd='/bin/file'
4400    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
4401    ;;
4402  sni)
4403    lt_cv_file_magic_cmd='/bin/file'
4404    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
4405    lt_cv_file_magic_test_file=/lib/libc.so
4406    ;;
4407  esac
4408  ;;
4409esac
4410])
4411file_magic_cmd=$lt_cv_file_magic_cmd
4412deplibs_check_method=$lt_cv_deplibs_check_method
4413])
4414
4415
4416# AC_PROG_NM - find the path to a BSD-compatible name lister
4417AC_DEFUN([AC_PROG_NM],
4418[AC_REQUIRE([_LT_AC_LIBTOOL_SYS_PATH_SEPARATOR])dnl
4419AC_MSG_CHECKING([for BSD-compatible nm])
4420AC_CACHE_VAL(lt_cv_path_NM,
4421[if test -n "$NM"; then
4422  # Let the user override the test.
4423  lt_cv_path_NM="$NM"
4424else
4425  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
4426  for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
4427    test -z "$ac_dir" && ac_dir=.
4428    tmp_nm=$ac_dir/${ac_tool_prefix}nm
4429    if test -f $tmp_nm || test -f $tmp_nm$ac_exeext ; then
4430      # Check to see if the nm accepts a BSD-compat flag.
4431      # Adding the `sed 1q' prevents false positives on HP-UX, which says:
4432      #   nm: unknown option "B" ignored
4433      # Tru64's nm complains that /dev/null is an invalid object file
4434      if ($tmp_nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep '(/dev/null|Invalid file or object type)' >/dev/null; then
4435	lt_cv_path_NM="$tmp_nm -B"
4436	break
4437      elif ($tmp_nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
4438	lt_cv_path_NM="$tmp_nm -p"
4439	break
4440      else
4441	lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
4442	continue # so that we can try to find one that supports BSD flags
4443      fi
4444    fi
4445  done
4446  IFS="$ac_save_ifs"
4447  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
4448fi])
4449NM="$lt_cv_path_NM"
4450AC_MSG_RESULT([$NM])
4451])
4452
4453# AC_CHECK_LIBM - check for math library
4454AC_DEFUN([AC_CHECK_LIBM],
4455[AC_REQUIRE([AC_CANONICAL_HOST])dnl
4456LIBM=
4457case $host in
4458*-*-beos* | *-*-cygwin* | *-*-pw32*)
4459  # These system don't have libm
4460  ;;
4461*-ncr-sysv4.3*)
4462  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
4463  AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
4464  ;;
4465*)
4466  AC_CHECK_LIB(m, main, LIBM="-lm")
4467  ;;
4468esac
4469])
4470
4471# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
4472# the libltdl convenience library and INCLTDL to the include flags for
4473# the libltdl header and adds --enable-ltdl-convenience to the
4474# configure arguments.  Note that LIBLTDL and INCLTDL are not
4475# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called.  If DIR is not
4476# provided, it is assumed to be `libltdl'.  LIBLTDL will be prefixed
4477# with '${top_builddir}/' and INCLTDL will be prefixed with
4478# '${top_srcdir}/' (note the single quotes!).  If your package is not
4479# flat and you're not using automake, define top_builddir and
4480# top_srcdir appropriately in the Makefiles.
4481AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
4482[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
4483  case $enable_ltdl_convenience in
4484  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
4485  "") enable_ltdl_convenience=yes
4486      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
4487  esac
4488  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
4489  INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
4490])
4491
4492# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
4493# the libltdl installable library and INCLTDL to the include flags for
4494# the libltdl header and adds --enable-ltdl-install to the configure
4495# arguments.  Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
4496# AC_CONFIG_SUBDIRS called.  If DIR is not provided and an installed
4497# libltdl is not found, it is assumed to be `libltdl'.  LIBLTDL will
4498# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
4499# with '${top_srcdir}/' (note the single quotes!).  If your package is
4500# not flat and you're not using automake, define top_builddir and
4501# top_srcdir appropriately in the Makefiles.
4502# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
4503AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
4504[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
4505  AC_CHECK_LIB(ltdl, main,
4506  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
4507  [if test x"$enable_ltdl_install" = xno; then
4508     AC_MSG_WARN([libltdl not installed, but installation disabled])
4509   else
4510     enable_ltdl_install=yes
4511   fi
4512  ])
4513  if test x"$enable_ltdl_install" = x"yes"; then
4514    ac_configure_args="$ac_configure_args --enable-ltdl-install"
4515    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
4516    INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
4517  else
4518    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
4519    LIBLTDL="-lltdl"
4520    INCLTDL=
4521  fi
4522])
4523
4524# old names
4525AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
4526AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
4527AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
4528AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
4529AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
4530AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
4531AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
4532
4533# This is just to silence aclocal about the macro not being used
4534ifelse([AC_DISABLE_FAST_INSTALL])
4535
4536dnl $Id: wflags.m4,v 1.3 1999/03/11 12:11:41 joda Exp $
4537dnl
4538dnl set WFLAGS
4539
4540AC_DEFUN(AC_WFLAGS,[
4541WFLAGS_NOUNUSED=""
4542WFLAGS_NOIMPLICITINT=""
4543if test -z "$WFLAGS" -a "$GCC" = "yes"; then
4544  # -Wno-implicit-int for broken X11 headers
4545  # leave these out for now:
4546  #   -Wcast-align doesn't work well on alpha osf/1
4547  #   -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast
4548  #   -Wmissing-declarations -Wnested-externs
4549  WFLAGS="ifelse($#, 0,-Wall, $1)"
4550  WFLAGS_NOUNUSED="-Wno-unused"
4551  WFLAGS_NOIMPLICITINT="-Wno-implicit-int"
4552fi
4553AC_SUBST(WFLAGS)dnl
4554AC_SUBST(WFLAGS_NOUNUSED)dnl
4555AC_SUBST(WFLAGS_NOIMPLICITINT)dnl
4556])
4557
4558dnl $Id: db.m4,v 1.8 2002/05/17 15:32:21 joda Exp $
4559dnl
4560dnl tests for various db libraries
4561dnl
4562AC_DEFUN([rk_DB],[
4563AC_ARG_ENABLE(berkeley-db,
4564                       AC_HELP_STRING([--disable-berkeley-db],
4565                                      [if you don't want berkeley db]),[
4566])
4567
4568have_ndbm=no
4569db_type=unknown
4570
4571if test "$enable_berkeley_db" != no; then
4572
4573  AC_CHECK_HEADERS([				\
4574	db4/db.h				\
4575	db3/db.h				\
4576	db.h					\
4577	db_185.h				\
4578  ])
4579
4580dnl db_create is used by db3 and db4
4581
4582  AC_FIND_FUNC_NO_LIBS(db_create, db4 db3 db, [
4583  #include <stdio.h>
4584  #ifdef HAVE_DB4_DB_H
4585  #include <db4/db.h>
4586  #elif defined(HAVE_DB3_DB_H)
4587  #include <db3/db.h>
4588  #else
4589  #include <db.h>
4590  #endif
4591  ],[NULL, NULL, 0])
4592
4593  if test "$ac_cv_func_db_create" = "yes"; then
4594    db_type=db3
4595    if test "$ac_cv_funclib_db_create" != "yes"; then
4596      DBLIB="$ac_cv_funclib_db_create"
4597    else
4598      DBLIB=""
4599    fi
4600    AC_DEFINE(HAVE_DB3, 1, [define if you have a berkeley db3/4 library])
4601  else
4602
4603dnl dbopen is used by db1/db2
4604
4605    AC_FIND_FUNC_NO_LIBS(dbopen, db2 db, [
4606    #include <stdio.h>
4607    #if defined(HAVE_DB2_DB_H)
4608    #include <db2/db.h>
4609    #elif defined(HAVE_DB_185_H)
4610    #include <db_185.h>
4611    #elif defined(HAVE_DB_H)
4612    #include <db.h>
4613    #else
4614    #error no db.h
4615    #endif
4616    ],[NULL, 0, 0, 0, NULL])
4617
4618    if test "$ac_cv_func_dbopen" = "yes"; then
4619      db_type=db1
4620      if test "$ac_cv_funclib_dbopen" != "yes"; then
4621        DBLIB="$ac_cv_funclib_dbopen"
4622      else
4623        DBLIB=""
4624      fi
4625      AC_DEFINE(HAVE_DB1, 1, [define if you have a berkeley db1/2 library])
4626    fi
4627  fi
4628
4629dnl test for ndbm compatability
4630
4631  if test "$ac_cv_func_dbm_firstkey" != yes; then
4632    AC_FIND_FUNC_NO_LIBS2(dbm_firstkey, $ac_cv_funclib_dbopen $ac_cv_funclib_db_create, [
4633    #include <stdio.h>
4634    #define DB_DBM_HSEARCH 1
4635    #include <db.h>
4636    DBM *dbm;
4637    ],[NULL])
4638  
4639    if test "$ac_cv_func_dbm_firstkey" = "yes"; then
4640      if test "$ac_cv_funclib_dbm_firstkey" != "yes"; then
4641        LIB_NDBM="$ac_cv_funclib_dbm_firstkey"
4642      else
4643        LIB_NDBM=""
4644      fi
4645      AC_DEFINE(HAVE_DB_NDBM, 1, [define if you have ndbm compat in db])
4646      AC_DEFINE(HAVE_NEW_DB, 1, [Define if NDBM really is DB (creates files *.db)])
4647    else
4648      $as_unset ac_cv_func_dbm_firstkey
4649      $as_unset ac_cv_funclib_dbm_firstkey
4650    fi
4651  fi
4652
4653fi # berkeley db
4654
4655if test "$db_type" = "unknown" -o "$ac_cv_func_dbm_firstkey" = ""; then
4656
4657  AC_CHECK_HEADERS([				\
4658	dbm.h					\
4659	ndbm.h					\
4660  ])
4661
4662  AC_FIND_FUNC_NO_LIBS(dbm_firstkey, ndbm, [
4663  #include <stdio.h>
4664  #if defined(HAVE_NDBM_H)
4665  #include <ndbm.h>
4666  #elif defined(HAVE_DBM_H)
4667  #include <dbm.h>
4668  #endif
4669  DBM *dbm;
4670  ],[NULL])
4671
4672  if test "$ac_cv_func_dbm_firstkey" = "yes"; then
4673    if test "$ac_cv_funclib_dbm_firstkey" != "yes"; then
4674      LIB_NDBM="$ac_cv_funclib_dbm_firstkey"
4675    else
4676      LIB_NDBM=""
4677    fi
4678    AC_DEFINE(HAVE_NDBM, 1, [define if you have a ndbm library])dnl
4679    have_ndbm=yes
4680    if test "$db_type" = "unknown"; then
4681      db_type=ndbm
4682      DBLIB="$LIB_NDBM"
4683    fi
4684  else
4685
4686    $as_unset ac_cv_func_dbm_firstkey
4687    $as_unset ac_cv_funclib_dbm_firstkey
4688
4689    AC_CHECK_HEADERS([				\
4690	  gdbm/ndbm.h				\
4691    ])
4692
4693    AC_FIND_FUNC_NO_LIBS(dbm_firstkey, gdbm, [
4694    #include <stdio.h>
4695    #include <gdbm/ndbm.h>
4696    DBM *dbm;
4697    ],[NULL])
4698
4699    if test "$ac_cv_func_dbm_firstkey" = "yes"; then
4700      if test "$ac_cv_funclib_dbm_firstkey" != "yes"; then
4701	LIB_NDBM="$ac_cv_funclib_dbm_firstkey"
4702      else
4703	LIB_NDBM=""
4704      fi
4705      AC_DEFINE(HAVE_NDBM, 1, [define if you have a ndbm library])dnl
4706      have_ndbm=yes
4707      if test "$db_type" = "unknown"; then
4708	db_type=ndbm
4709	DBLIB="$LIB_NDBM"
4710      fi
4711    fi
4712  fi
4713
4714fi # unknown
4715
4716if test "$have_ndbm" = "yes"; then
4717  AC_MSG_CHECKING([if ndbm is implemented with db])
4718  AC_TRY_RUN([
4719#include <unistd.h>
4720#include <fcntl.h>
4721#if defined(HAVE_GDBM_NDBM_H)
4722#include <gdbm/ndbm.h>
4723#elif defined(HAVE_NDBM_H)
4724#include <ndbm.h>
4725#elif defined(HAVE_DBM_H)
4726#include <dbm.h>
4727#endif
4728int main()
4729{
4730  DBM *d;
4731
4732  d = dbm_open("conftest", O_RDWR | O_CREAT, 0666);
4733  if (d == NULL)
4734    return 1;
4735  dbm_close(d);
4736  return 0;
4737}],[
4738    if test -f conftest.db; then
4739      AC_MSG_RESULT([yes])
4740      AC_DEFINE(HAVE_NEW_DB, 1, [Define if NDBM really is DB (creates files *.db)])
4741    else
4742      AC_MSG_RESULT([no])
4743    fi],[AC_MSG_RESULT([no])])
4744fi
4745
4746AM_CONDITIONAL(HAVE_DB1, test "$db_type" = db1)dnl
4747AM_CONDITIONAL(HAVE_DB3, test "$db_type" = db3)dnl
4748AM_CONDITIONAL(HAVE_NDBM, test "$db_type" = ndbm)dnl
4749
4750DBLIB="$LDFLAGS $DBLIB"
4751AC_SUBST(DBLIB)dnl
4752AC_SUBST(LIB_NDBM)dnl
4753])
4754
4755dnl $Id: find-func-no-libs.m4,v 1.5 1999/10/30 21:08:18 assar Exp $
4756dnl
4757dnl
4758dnl Look for function in any of the specified libraries
4759dnl
4760
4761dnl AC_FIND_FUNC_NO_LIBS(func, libraries, includes, arguments, extra libs, extra args)
4762AC_DEFUN(AC_FIND_FUNC_NO_LIBS, [
4763AC_FIND_FUNC_NO_LIBS2([$1], ["" $2], [$3], [$4], [$5], [$6])])
4764
4765dnl $Id: find-func-no-libs2.m4,v 1.6 2001/09/01 10:57:32 assar Exp $
4766dnl
4767dnl
4768dnl Look for function in any of the specified libraries
4769dnl
4770
4771dnl AC_FIND_FUNC_NO_LIBS2(func, libraries, includes, arguments, extra libs, extra args)
4772AC_DEFUN(AC_FIND_FUNC_NO_LIBS2, [
4773
4774AC_MSG_CHECKING([for $1])
4775AC_CACHE_VAL(ac_cv_funclib_$1,
4776[
4777if eval "test \"\$ac_cv_func_$1\" != yes" ; then
4778	ac_save_LIBS="$LIBS"
4779	for ac_lib in $2; do
4780		case "$ac_lib" in
4781		"") ;;
4782		yes) ac_lib="" ;;
4783		no) continue ;;
4784		-l*) ;;
4785		*) ac_lib="-l$ac_lib" ;;
4786		esac
4787		LIBS="$6 $ac_lib $5 $ac_save_LIBS"
4788		AC_TRY_LINK([$3],[$1($4)],eval "if test -n \"$ac_lib\";then ac_cv_funclib_$1=$ac_lib; else ac_cv_funclib_$1=yes; fi";break)
4789	done
4790	eval "ac_cv_funclib_$1=\${ac_cv_funclib_$1-no}"
4791	LIBS="$ac_save_LIBS"
4792fi
4793])
4794
4795eval "ac_res=\$ac_cv_funclib_$1"
4796
4797if false; then
4798	AC_CHECK_FUNCS($1)
4799dnl	AC_CHECK_LIBS($2, foo)
4800fi
4801# $1
4802eval "ac_tr_func=HAVE_[]upcase($1)"
4803eval "ac_tr_lib=HAVE_LIB[]upcase($ac_res | sed -e 's/-l//')"
4804eval "LIB_$1=$ac_res"
4805
4806case "$ac_res" in
4807	yes)
4808	eval "ac_cv_func_$1=yes"
4809	eval "LIB_$1="
4810	AC_DEFINE_UNQUOTED($ac_tr_func)
4811	AC_MSG_RESULT([yes])
4812	;;
4813	no)
4814	eval "ac_cv_func_$1=no"
4815	eval "LIB_$1="
4816	AC_MSG_RESULT([no])
4817	;;
4818	*)
4819	eval "ac_cv_func_$1=yes"
4820	eval "ac_cv_lib_`echo "$ac_res" | sed 's/-l//'`=yes"
4821	AC_DEFINE_UNQUOTED($ac_tr_func)
4822	AC_DEFINE_UNQUOTED($ac_tr_lib)
4823	AC_MSG_RESULT([yes, in $ac_res])
4824	;;
4825esac
4826AC_SUBST(LIB_$1)
4827])
4828
4829dnl $Id: roken-frag.m4,v 1.42 2002/08/26 13:26:52 assar Exp $
4830dnl
4831dnl some code to get roken working
4832dnl
4833dnl rk_ROKEN(subdir)
4834dnl
4835AC_DEFUN(rk_ROKEN, [
4836
4837AC_REQUIRE([rk_CONFIG_HEADER])
4838
4839DIR_roken=roken
4840LIB_roken='$(top_builddir)/$1/libroken.la'
4841INCLUDES_roken='-I$(top_builddir)/$1 -I$(top_srcdir)/$1'
4842
4843dnl Checks for programs
4844AC_REQUIRE([AC_PROG_CC])
4845AC_REQUIRE([AC_PROG_AWK])
4846AC_REQUIRE([AC_OBJEXT])
4847AC_REQUIRE([AC_EXEEXT])
4848AC_REQUIRE([AC_PROG_LIBTOOL])
4849
4850AC_REQUIRE([AC_MIPS_ABI])
4851
4852dnl C characteristics
4853
4854AC_REQUIRE([AC_C___ATTRIBUTE__])
4855AC_REQUIRE([AC_C_INLINE])
4856AC_REQUIRE([AC_C_CONST])
4857AC_WFLAGS(-Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs)
4858
4859AC_REQUIRE([rk_DB])
4860
4861dnl C types
4862
4863AC_REQUIRE([AC_TYPE_SIZE_T])
4864AC_HAVE_TYPE([ssize_t],[#include <unistd.h>])
4865AC_REQUIRE([AC_TYPE_PID_T])
4866AC_REQUIRE([AC_TYPE_UID_T])
4867AC_HAVE_TYPE([long long])
4868
4869AC_REQUIRE([rk_RETSIGTYPE])
4870
4871dnl Checks for header files.
4872AC_REQUIRE([AC_HEADER_STDC])
4873AC_REQUIRE([AC_HEADER_TIME])
4874
4875AC_CHECK_HEADERS([\
4876	arpa/inet.h				\
4877	arpa/nameser.h				\
4878	config.h				\
4879	crypt.h					\
4880	dirent.h				\
4881	errno.h					\
4882	err.h					\
4883	fcntl.h					\
4884	grp.h					\
4885	ifaddrs.h				\
4886	net/if.h				\
4887	netdb.h					\
4888	netinet/in.h				\
4889	netinet/in6.h				\
4890	netinet/in_systm.h			\
4891	netinet6/in6.h				\
4892	netinet6/in6_var.h			\
4893	paths.h					\
4894	pwd.h					\
4895	resolv.h				\
4896	rpcsvc/ypclnt.h				\
4897	shadow.h				\
4898	sys/bswap.h				\
4899	sys/ioctl.h				\
4900	sys/param.h				\
4901	sys/proc.h				\
4902	sys/resource.h				\
4903	sys/socket.h				\
4904	sys/sockio.h				\
4905	sys/stat.h				\
4906	sys/sysctl.h				\
4907	sys/time.h				\
4908	sys/tty.h				\
4909	sys/types.h				\
4910	sys/uio.h				\
4911	sys/utsname.h				\
4912	sys/wait.h				\
4913	syslog.h				\
4914	termios.h				\
4915	unistd.h				\
4916	userconf.h				\
4917	usersec.h				\
4918	util.h					\
4919	vis.h					\
4920])
4921	
4922AC_REQUIRE([CHECK_NETINET_IP_AND_TCP])
4923
4924AM_CONDITIONAL(have_err_h, test "$ac_cv_header_err_h" = yes)
4925AM_CONDITIONAL(have_fnmatch_h, test "$ac_cv_header_fnmatch_h" = yes)
4926AM_CONDITIONAL(have_ifaddrs_h, test "$ac_cv_header_ifaddrs_h" = yes)
4927AM_CONDITIONAL(have_vis_h, test "$ac_cv_header_vis_h" = yes)
4928
4929dnl Check for functions and libraries
4930
4931AC_FIND_FUNC(socket, socket)
4932AC_FIND_FUNC(gethostbyname, nsl)
4933AC_FIND_FUNC(syslog, syslog)
4934
4935AC_KRB_IPV6
4936
4937AC_FIND_FUNC(gethostbyname2, inet6 ip6)
4938
4939AC_FIND_FUNC(res_search, resolv,
4940[
4941#include <stdio.h>
4942#ifdef HAVE_SYS_TYPES_H
4943#include <sys/types.h>
4944#endif
4945#ifdef HAVE_NETINET_IN_H
4946#include <netinet/in.h>
4947#endif
4948#ifdef HAVE_ARPA_NAMESER_H
4949#include <arpa/nameser.h>
4950#endif
4951#ifdef HAVE_RESOLV_H
4952#include <resolv.h>
4953#endif
4954],
4955[0,0,0,0,0])
4956
4957AC_FIND_FUNC(dn_expand, resolv,
4958[
4959#include <stdio.h>
4960#ifdef HAVE_SYS_TYPES_H
4961#include <sys/types.h>
4962#endif
4963#ifdef HAVE_NETINET_IN_H
4964#include <netinet/in.h>
4965#endif
4966#ifdef HAVE_ARPA_NAMESER_H
4967#include <arpa/nameser.h>
4968#endif
4969#ifdef HAVE_RESOLV_H
4970#include <resolv.h>
4971#endif
4972],
4973[0,0,0,0,0])
4974
4975rk_CHECK_VAR(_res, 
4976[#include <stdio.h>
4977#ifdef HAVE_SYS_TYPES_H
4978#include <sys/types.h>
4979#endif
4980#ifdef HAVE_NETINET_IN_H
4981#include <netinet/in.h>
4982#endif
4983#ifdef HAVE_ARPA_NAMESER_H
4984#include <arpa/nameser.h>
4985#endif
4986#ifdef HAVE_RESOLV_H
4987#include <resolv.h>
4988#endif])
4989
4990
4991AC_BROKEN_SNPRINTF
4992AC_BROKEN_VSNPRINTF
4993
4994AC_BROKEN_GLOB
4995if test "$ac_cv_func_glob_working" != yes; then
4996	AC_LIBOBJ(glob)
4997fi
4998AM_CONDITIONAL(have_glob_h, test "$ac_cv_func_glob_working" = yes)
4999
5000
5001AC_CHECK_FUNCS([				\
5002	asnprintf				\
5003	asprintf				\
5004	atexit					\
5005	cgetent					\
5006	getconfattr				\
5007	getprogname				\
5008	getrlimit				\
5009	getspnam				\
5010	initstate				\
5011	issetugid				\
5012	on_exit					\
5013	random					\
5014	setprogname				\
5015	setstate				\
5016	strsvis					\
5017	strunvis				\
5018	strvis					\
5019	strvisx					\
5020	svis					\
5021	sysconf					\
5022	sysctl					\
5023	uname					\
5024	unvis					\
5025	vasnprintf				\
5026	vasprintf				\
5027	vis					\
5028])
5029
5030if test "$ac_cv_func_cgetent" = no; then
5031	AC_LIBOBJ(getcap)
5032fi
5033
5034AC_REQUIRE([AC_FUNC_GETLOGIN])
5035
5036AC_FIND_FUNC_NO_LIBS(getsockopt,,
5037[#ifdef HAVE_SYS_TYPES_H
5038#include <sys/types.h>
5039#endif
5040#ifdef HAVE_SYS_SOCKET_H
5041#include <sys/socket.h>
5042#endif],
5043[0,0,0,0,0])
5044AC_FIND_FUNC_NO_LIBS(setsockopt,,
5045[#ifdef HAVE_SYS_TYPES_H
5046#include <sys/types.h>
5047#endif
5048#ifdef HAVE_SYS_SOCKET_H
5049#include <sys/socket.h>
5050#endif],
5051[0,0,0,0,0])
5052
5053AC_FIND_IF_NOT_BROKEN(hstrerror, resolv,
5054[#ifdef HAVE_NETDB_H
5055#include <netdb.h>
5056#endif],
505717)
5058AC_NEED_PROTO([
5059#ifdef HAVE_NETDB_H
5060#include <netdb.h>
5061#endif],
5062hstrerror)
5063
5064AC_FOREACH([rk_func], [asprintf vasprintf asnprintf vasnprintf],
5065	[AC_NEED_PROTO([
5066	#include <stdio.h>
5067	#include <string.h>],
5068	rk_func)])
5069
5070AC_FIND_FUNC_NO_LIBS(bswap16,,
5071[#ifdef HAVE_SYS_BSWAP_H
5072#include <sys/bswap.h>
5073#endif],0)
5074
5075AC_FIND_FUNC_NO_LIBS(bswap32,,
5076[#ifdef HAVE_SYS_BSWAP_H
5077#include <sys/bswap.h>
5078#endif],0)
5079
5080AC_FIND_FUNC_NO_LIBS(pidfile,util,
5081[#ifdef HAVE_UTIL_H
5082#include <util.h>
5083#endif],0)
5084
5085AC_FIND_IF_NOT_BROKEN(getaddrinfo,,
5086[#ifdef HAVE_NETDB_H
5087#include <netdb.h>
5088#endif],[0,0,0,0])
5089
5090AC_FIND_IF_NOT_BROKEN(getnameinfo,,
5091[#ifdef HAVE_NETDB_H
5092#include <netdb.h>
5093#endif],[0,0,0,0,0,0,0])
5094
5095AC_FIND_IF_NOT_BROKEN(freeaddrinfo,,
5096[#ifdef HAVE_NETDB_H
5097#include <netdb.h>
5098#endif],[0])
5099
5100AC_FIND_IF_NOT_BROKEN(gai_strerror,,
5101[#ifdef HAVE_NETDB_H
5102#include <netdb.h>
5103#endif],[0])
5104
5105AC_BROKEN([					\
5106	chown					\
5107	copyhostent				\
5108	daemon					\
5109	ecalloc					\
5110	emalloc					\
5111	erealloc				\
5112	estrdup					\
5113	err					\
5114	errx					\
5115	fchown					\
5116	flock					\
5117	fnmatch					\
5118	freehostent				\
5119	getcwd					\
5120	getdtablesize				\
5121	getegid					\
5122	geteuid					\
5123	getgid					\
5124	gethostname				\
5125	getifaddrs				\
5126	getipnodebyaddr				\
5127	getipnodebyname				\
5128	getopt					\
5129	gettimeofday				\
5130	getuid					\
5131	getusershell				\
5132	initgroups				\
5133	innetgr					\
5134	iruserok				\
5135	localtime_r				\
5136	lstat					\
5137	memmove					\
5138	mkstemp					\
5139	putenv					\
5140	rcmd					\
5141	readv					\
5142	recvmsg					\
5143	sendmsg					\
5144	setegid					\
5145	setenv					\
5146	seteuid					\
5147	strcasecmp				\
5148	strdup					\
5149	strerror				\
5150	strftime				\
5151	strlcat					\
5152	strlcpy					\
5153	strlwr					\
5154	strncasecmp				\
5155	strndup					\
5156	strnlen					\
5157	strptime				\
5158	strsep					\
5159	strsep_copy				\
5160	strtok_r				\
5161	strupr					\
5162	swab					\
5163	unsetenv				\
5164	verr					\
5165	verrx					\
5166	vsyslog					\
5167	vwarn					\
5168	vwarnx					\
5169	warn					\
5170	warnx					\
5171	writev					\
5172])
5173
5174AC_FOREACH([rk_func], [strndup strsep strtok_r],
5175	[AC_NEED_PROTO([#include <string.h>], rk_func)])
5176
5177AC_FOREACH([rk_func], [strsvis strunvis strvis strvisx svis unvis vis],
5178[AC_NEED_PROTO([#ifdef HAVE_VIS_H
5179#include <vis.h>
5180#endif], rk_func)])
5181
5182AC_BROKEN2(inet_aton,
5183[#ifdef HAVE_SYS_TYPES_H
5184#include <sys/types.h>
5185#endif
5186#ifdef HAVE_SYS_SOCKET_H
5187#include <sys/socket.h>
5188#endif
5189#ifdef HAVE_NETINET_IN_H
5190#include <netinet/in.h>
5191#endif
5192#ifdef HAVE_ARPA_INET_H
5193#include <arpa/inet.h>
5194#endif],
5195[0,0])
5196
5197AC_BROKEN2(inet_ntop,
5198[#ifdef HAVE_SYS_TYPES_H
5199#include <sys/types.h>
5200#endif
5201#ifdef HAVE_SYS_SOCKET_H
5202#include <sys/socket.h>
5203#endif
5204#ifdef HAVE_NETINET_IN_H
5205#include <netinet/in.h>
5206#endif
5207#ifdef HAVE_ARPA_INET_H
5208#include <arpa/inet.h>
5209#endif],
5210[0, 0, 0, 0])
5211
5212AC_BROKEN2(inet_pton,
5213[#ifdef HAVE_SYS_TYPES_H
5214#include <sys/types.h>
5215#endif
5216#ifdef HAVE_SYS_SOCKET_H
5217#include <sys/socket.h>
5218#endif
5219#ifdef HAVE_NETINET_IN_H
5220#include <netinet/in.h>
5221#endif
5222#ifdef HAVE_ARPA_INET_H
5223#include <arpa/inet.h>
5224#endif],
5225[0,0,0])
5226
5227dnl
5228dnl Check for sa_len in struct sockaddr, 
5229dnl needs to come before the getnameinfo test
5230dnl
5231AC_HAVE_STRUCT_FIELD(struct sockaddr, sa_len, [#include <sys/types.h>
5232#include <sys/socket.h>])
5233
5234if test "$ac_cv_func_getnameinfo" = "yes"; then
5235  rk_BROKEN_GETNAMEINFO
5236  if test "$ac_cv_func_getnameinfo_broken" = yes; then
5237	AC_LIBOBJ(getnameinfo)
5238  fi
5239fi
5240
5241if test "$ac_cv_func_getaddrinfo" = "yes"; then
5242  rk_BROKEN_GETADDRINFO
5243  if test "$ac_cv_func_getaddrinfo_numserv" = no; then
5244	AC_LIBOBJ(getaddrinfo)
5245	AC_LIBOBJ(freeaddrinfo)
5246  fi
5247fi
5248
5249AC_NEED_PROTO([#include <stdlib.h>], setenv)
5250AC_NEED_PROTO([#include <stdlib.h>], unsetenv)
5251AC_NEED_PROTO([#include <unistd.h>], gethostname)
5252AC_NEED_PROTO([#include <unistd.h>], mkstemp)
5253AC_NEED_PROTO([#include <unistd.h>], getusershell)
5254
5255AC_NEED_PROTO([
5256#ifdef HAVE_SYS_TYPES_H
5257#include <sys/types.h>
5258#endif
5259#ifdef HAVE_SYS_SOCKET_H
5260#include <sys/socket.h>
5261#endif
5262#ifdef HAVE_NETINET_IN_H
5263#include <netinet/in.h>
5264#endif
5265#ifdef HAVE_ARPA_INET_H
5266#include <arpa/inet.h>
5267#endif],
5268inet_aton)
5269
5270AC_FIND_FUNC_NO_LIBS(crypt, crypt)dnl
5271
5272AC_REQUIRE([rk_BROKEN_REALLOC])dnl
5273
5274dnl AC_KRB_FUNC_GETCWD_BROKEN
5275
5276dnl
5277dnl Checks for prototypes and declarations
5278dnl
5279
5280AC_PROTO_COMPAT([
5281#ifdef HAVE_SYS_TYPES_H
5282#include <sys/types.h>
5283#endif
5284#ifdef HAVE_SYS_SOCKET_H
5285#include <sys/socket.h>
5286#endif
5287#ifdef HAVE_NETINET_IN_H
5288#include <netinet/in.h>
5289#endif
5290#ifdef HAVE_ARPA_INET_H
5291#include <arpa/inet.h>
5292#endif
5293#ifdef HAVE_NETDB_H
5294#include <netdb.h>
5295#endif
5296],
5297gethostbyname, struct hostent *gethostbyname(const char *))
5298
5299AC_PROTO_COMPAT([
5300#ifdef HAVE_SYS_TYPES_H
5301#include <sys/types.h>
5302#endif
5303#ifdef HAVE_SYS_SOCKET_H
5304#include <sys/socket.h>
5305#endif
5306#ifdef HAVE_NETINET_IN_H
5307#include <netinet/in.h>
5308#endif
5309#ifdef HAVE_ARPA_INET_H
5310#include <arpa/inet.h>
5311#endif
5312#ifdef HAVE_NETDB_H
5313#include <netdb.h>
5314#endif
5315],
5316gethostbyaddr, struct hostent *gethostbyaddr(const void *, size_t, int))
5317
5318AC_PROTO_COMPAT([
5319#ifdef HAVE_SYS_TYPES_H
5320#include <sys/types.h>
5321#endif
5322#ifdef HAVE_SYS_SOCKET_H
5323#include <sys/socket.h>
5324#endif
5325#ifdef HAVE_NETINET_IN_H
5326#include <netinet/in.h>
5327#endif
5328#ifdef HAVE_ARPA_INET_H
5329#include <arpa/inet.h>
5330#endif
5331#ifdef HAVE_NETDB_H
5332#include <netdb.h>
5333#endif
5334],
5335getservbyname, struct servent *getservbyname(const char *, const char *))
5336
5337AC_PROTO_COMPAT([
5338#ifdef HAVE_SYS_TYPES_H
5339#include <sys/types.h>
5340#endif
5341#ifdef HAVE_SYS_SOCKET_H
5342#include <sys/socket.h>
5343#endif
5344],
5345getsockname, int getsockname(int, struct sockaddr*, socklen_t*))
5346
5347AC_PROTO_COMPAT([
5348#ifdef HAVE_SYSLOG_H
5349#include <syslog.h>
5350#endif
5351],
5352openlog, void openlog(const char *, int, int))
5353
5354AC_NEED_PROTO([
5355#ifdef HAVE_CRYPT_H
5356#include <crypt.h>
5357#endif
5358#ifdef HAVE_UNISTD_H
5359#include <unistd.h>
5360#endif
5361],
5362crypt)
5363
5364dnl variables
5365
5366rk_CHECK_VAR(h_errno, 
5367[#ifdef HAVE_SYS_TYPES_H
5368#include <sys/types.h>
5369#endif
5370#ifdef HAVE_NETDB_H
5371#include <netdb.h>
5372#endif])
5373
5374rk_CHECK_VAR(h_errlist, 
5375[#ifdef HAVE_NETDB_H
5376#include <netdb.h>
5377#endif])
5378
5379rk_CHECK_VAR(h_nerr, 
5380[#ifdef HAVE_NETDB_H
5381#include <netdb.h>
5382#endif])
5383
5384rk_CHECK_VAR([__progname], 
5385[#ifdef HAVE_ERR_H
5386#include <err.h>
5387#endif])
5388
5389AC_CHECK_DECLARATION([#include <stdlib.h>
5390#ifdef HAVE_UNISTD_H
5391#include <unistd.h>
5392#endif], optarg)
5393AC_CHECK_DECLARATION([#include <stdlib.h>
5394#ifdef HAVE_UNISTD_H
5395#include <unistd.h>
5396#endif], optind)
5397AC_CHECK_DECLARATION([#include <stdlib.h>
5398#ifdef HAVE_UNISTD_H
5399#include <unistd.h>
5400#endif], opterr)
5401AC_CHECK_DECLARATION([#include <stdlib.h>
5402#ifdef HAVE_UNISTD_H
5403#include <unistd.h>
5404#endif], optopt)
5405
5406AC_CHECK_DECLARATION([#include <stdlib.h>], environ)
5407
5408dnl
5409dnl Check for fields in struct tm
5410dnl
5411
5412AC_HAVE_STRUCT_FIELD(struct tm, tm_gmtoff, [#include <time.h>])
5413AC_HAVE_STRUCT_FIELD(struct tm, tm_zone, [#include <time.h>])
5414
5415dnl
5416dnl or do we have a variable `timezone' ?
5417dnl
5418
5419rk_CHECK_VAR(timezone,[#include <time.h>])
5420rk_CHECK_VAR(altzone,[#include <time.h>])
5421
5422AC_HAVE_TYPE([sa_family_t],[#include <sys/socket.h>])
5423AC_HAVE_TYPE([socklen_t],[#include <sys/socket.h>])
5424AC_HAVE_TYPE([struct sockaddr], [#include <sys/socket.h>])
5425AC_HAVE_TYPE([struct sockaddr_storage], [#include <sys/socket.h>])
5426AC_HAVE_TYPE([struct addrinfo], [#include <netdb.h>])
5427AC_HAVE_TYPE([struct ifaddrs], [#include <ifaddrs.h>])
5428AC_HAVE_TYPE([struct iovec],[
5429#include <sys/types.h>
5430#include <sys/uio.h>
5431])
5432AC_HAVE_TYPE([struct msghdr],[
5433#include <sys/types.h>
5434#include <sys/socket.h>
5435])
5436
5437dnl
5438dnl Check for struct winsize
5439dnl
5440
5441AC_KRB_STRUCT_WINSIZE
5442
5443dnl
5444dnl Check for struct spwd
5445dnl
5446
5447AC_KRB_STRUCT_SPWD
5448
5449dnl won't work with automake
5450dnl moved to AC_OUTPUT in configure.in
5451dnl AC_CONFIG_FILES($1/Makefile)
5452
5453LIB_roken="${LIB_roken} \$(LIB_crypt) \$(LIB_dbopen)"
5454
5455AC_SUBST(DIR_roken)dnl
5456AC_SUBST(LIB_roken)dnl
5457AC_SUBST(INCLUDES_roken)dnl
5458])
5459
5460dnl $Id: have-type.m4,v 1.6 2000/07/15 18:10:00 joda Exp $
5461dnl
5462dnl check for existance of a type
5463
5464dnl AC_HAVE_TYPE(TYPE,INCLUDES)
5465AC_DEFUN(AC_HAVE_TYPE, [
5466AC_REQUIRE([AC_HEADER_STDC])
5467cv=`echo "$1" | sed 'y%./+- %__p__%'`
5468AC_MSG_CHECKING(for $1)
5469AC_CACHE_VAL([ac_cv_type_$cv],
5470AC_TRY_COMPILE(
5471[#include <sys/types.h>
5472#if STDC_HEADERS
5473#include <stdlib.h>
5474#include <stddef.h>
5475#endif
5476$2],
5477[$1 foo;],
5478eval "ac_cv_type_$cv=yes",
5479eval "ac_cv_type_$cv=no"))dnl
5480ac_foo=`eval echo \\$ac_cv_type_$cv`
5481AC_MSG_RESULT($ac_foo)
5482if test "$ac_foo" = yes; then
5483  ac_tr_hdr=HAVE_`echo $1 | sed 'y%abcdefghijklmnopqrstuvwxyz./- %ABCDEFGHIJKLMNOPQRSTUVWXYZ____%'`
5484if false; then
5485	AC_CHECK_TYPES($1)
5486fi
5487  AC_DEFINE_UNQUOTED($ac_tr_hdr, 1, [Define if you have type `$1'])
5488fi
5489])
5490
5491dnl
5492dnl $Id: retsigtype.m4,v 1.1 2000/07/15 18:05:56 joda Exp $
5493dnl
5494dnl Figure out return type of signal handlers, and define SIGRETURN macro
5495dnl that can be used to return from one
5496dnl
5497AC_DEFUN(rk_RETSIGTYPE,[
5498AC_TYPE_SIGNAL
5499if test "$ac_cv_type_signal" = "void" ; then
5500	AC_DEFINE(VOID_RETSIGTYPE, 1, [Define if signal handlers return void.])
5501fi
5502AC_SUBST(VOID_RETSIGTYPE)
5503AH_BOTTOM([#ifdef VOID_RETSIGTYPE
5504#define SIGRETURN(x) return
5505#else
5506#define SIGRETURN(x) return (RETSIGTYPE)(x)
5507#endif])
5508])
5509dnl
5510dnl $Id: check-netinet-ip-and-tcp.m4,v 1.3 2000/07/18 10:33:02 joda Exp $
5511dnl
5512
5513dnl extra magic check for netinet/{ip.h,tcp.h} because on irix 6.5.3
5514dnl you have to include standards.h before including these files
5515
5516AC_DEFUN(CHECK_NETINET_IP_AND_TCP,
5517[
5518AC_CHECK_HEADERS(standards.h)
5519for i in netinet/ip.h netinet/tcp.h; do
5520
5521cv=`echo "$i" | sed 'y%./+-%__p_%'`
5522
5523AC_CACHE_CHECK([for $i],ac_cv_header_$cv,
5524[AC_TRY_CPP([\
5525#ifdef HAVE_STANDARDS_H
5526#include <standards.h>
5527#endif
5528#include <$i>
5529],
5530eval "ac_cv_header_$cv=yes",
5531eval "ac_cv_header_$cv=no")])
5532ac_res=`eval echo \\$ac_cv_header_$cv`
5533if test "$ac_res" = yes; then
5534	ac_tr_hdr=HAVE_`echo $i | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
5535	AC_DEFINE_UNQUOTED($ac_tr_hdr, 1)
5536fi
5537done
5538if false;then
5539	AC_CHECK_HEADERS(netinet/ip.h netinet/tcp.h)
5540fi
5541])
5542
5543dnl $Id: find-func.m4,v 1.1 1997/12/14 15:58:58 joda Exp $
5544dnl
5545dnl AC_FIND_FUNC(func, libraries, includes, arguments)
5546AC_DEFUN(AC_FIND_FUNC, [
5547AC_FIND_FUNC_NO_LIBS([$1], [$2], [$3], [$4])
5548if test -n "$LIB_$1"; then
5549	LIBS="$LIB_$1 $LIBS"
5550fi
5551])
5552
5553dnl $Id: krb-ipv6.m4,v 1.13 2002/04/30 16:48:13 joda Exp $
5554dnl
5555dnl test for IPv6
5556dnl
5557AC_DEFUN(AC_KRB_IPV6, [
5558AC_ARG_WITH(ipv6,
5559	AC_HELP_STRING([--without-ipv6],[do not enable IPv6 support]),[
5560if test "$withval" = "no"; then
5561	ac_cv_lib_ipv6=no
5562fi])
5563save_CFLAGS="${CFLAGS}"
5564AC_CACHE_CHECK([for IPv6 stack type], v6type,
5565[dnl check for different v6 implementations (by itojun)
5566v6type=unknown
5567v6lib=none
5568
5569for i in v6d toshiba kame inria zeta linux; do
5570	case $i in
5571	v6d)
5572		AC_EGREP_CPP(yes, [
5573#include </usr/local/v6/include/sys/types.h>
5574#ifdef __V6D__
5575yes
5576#endif],
5577			[v6type=$i; v6lib=v6;
5578			v6libdir=/usr/local/v6/lib;
5579			CFLAGS="-I/usr/local/v6/include $CFLAGS"])
5580		;;
5581	toshiba)
5582		AC_EGREP_CPP(yes, [
5583#include <sys/param.h>
5584#ifdef _TOSHIBA_INET6
5585yes
5586#endif],
5587			[v6type=$i; v6lib=inet6;
5588			v6libdir=/usr/local/v6/lib;
5589			CFLAGS="-DINET6 $CFLAGS"])
5590		;;
5591	kame)
5592		AC_EGREP_CPP(yes, [
5593#include <netinet/in.h>
5594#ifdef __KAME__
5595yes
5596#endif],
5597			[v6type=$i; v6lib=inet6;
5598			v6libdir=/usr/local/v6/lib;
5599			CFLAGS="-DINET6 $CFLAGS"])
5600		;;
5601	inria)
5602		AC_EGREP_CPP(yes, [
5603#include <netinet/in.h>
5604#ifdef IPV6_INRIA_VERSION
5605yes
5606#endif],
5607			[v6type=$i; CFLAGS="-DINET6 $CFLAGS"])
5608		;;
5609	zeta)
5610		AC_EGREP_CPP(yes, [
5611#include <sys/param.h>
5612#ifdef _ZETA_MINAMI_INET6
5613yes
5614#endif],
5615			[v6type=$i; v6lib=inet6;
5616			v6libdir=/usr/local/v6/lib;
5617			CFLAGS="-DINET6 $CFLAGS"])
5618		;;
5619	linux)
5620		if test -d /usr/inet6; then
5621			v6type=$i
5622			v6lib=inet6
5623			v6libdir=/usr/inet6
5624			CFLAGS="-DINET6 $CFLAGS"
5625		fi
5626		;;
5627	esac
5628	if test "$v6type" != "unknown"; then
5629		break
5630	fi
5631done
5632
5633if test "$v6lib" != "none"; then
5634	for dir in $v6libdir /usr/local/v6/lib /usr/local/lib; do
5635		if test -d $dir -a -f $dir/lib$v6lib.a; then
5636			LIBS="-L$dir -l$v6lib $LIBS"
5637			break
5638		fi
5639	done
5640fi
5641])
5642
5643AC_CACHE_CHECK([for IPv6], ac_cv_lib_ipv6, [
5644AC_TRY_LINK([
5645#ifdef HAVE_SYS_TYPES_H
5646#include <sys/types.h>
5647#endif
5648#ifdef HAVE_SYS_SOCKET_H
5649#include <sys/socket.h>
5650#endif
5651#ifdef HAVE_NETINET_IN_H
5652#include <netinet/in.h>
5653#endif
5654#ifdef HAVE_NETINET_IN6_H
5655#include <netinet/in6.h>
5656#endif
5657],
5658[
5659 struct sockaddr_in6 sin6;
5660 int s;
5661
5662 s = socket(AF_INET6, SOCK_DGRAM, 0);
5663
5664 sin6.sin6_family = AF_INET6;
5665 sin6.sin6_port = htons(17);
5666 sin6.sin6_addr = in6addr_any;
5667 bind(s, (struct sockaddr *)&sin6, sizeof(sin6));
5668],
5669ac_cv_lib_ipv6=yes,
5670ac_cv_lib_ipv6=no)])
5671if test "$ac_cv_lib_ipv6" = yes; then
5672  AC_DEFINE(HAVE_IPV6, 1, [Define if you have IPv6.])
5673else
5674  CFLAGS="${save_CFLAGS}"
5675fi
5676
5677if test "$ac_cv_lib_ipv6" = yes; then
5678	AC_CACHE_CHECK([for in6addr_loopback],[ac_cv_var_in6addr_loopback],[
5679	AC_TRY_LINK([
5680#ifdef HAVE_SYS_TYPES_H
5681#include <sys/types.h>
5682#endif
5683#ifdef HAVE_SYS_SOCKET_H
5684#include <sys/socket.h>
5685#endif
5686#ifdef HAVE_NETINET_IN_H
5687#include <netinet/in.h>
5688#endif
5689#ifdef HAVE_NETINET_IN6_H
5690#include <netinet/in6.h>
5691#endif],[
5692struct sockaddr_in6 sin6;
5693sin6.sin6_addr = in6addr_loopback;
5694],ac_cv_var_in6addr_loopback=yes,ac_cv_var_in6addr_loopback=no)])
5695	if test "$ac_cv_var_in6addr_loopback" = yes; then
5696		AC_DEFINE(HAVE_IN6ADDR_LOOPBACK, 1, 
5697			[Define if you have the in6addr_loopback variable])
5698	fi
5699fi
5700])
5701dnl $Id: check-var.m4,v 1.6 2001/08/21 12:00:16 joda Exp $
5702dnl
5703dnl rk_CHECK_VAR(variable, includes)
5704AC_DEFUN([rk_CHECK_VAR], [
5705AC_MSG_CHECKING(for $1)
5706AC_CACHE_VAL(ac_cv_var_$1, [
5707AC_TRY_LINK([extern int $1;
5708int foo() { return $1; }],
5709	    [foo()],
5710	    ac_cv_var_$1=yes, ac_cv_var_$1=no)
5711])
5712ac_foo=`eval echo \\$ac_cv_var_$1`
5713AC_MSG_RESULT($ac_foo)
5714if test "$ac_foo" = yes; then
5715	AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]$1), 1, 
5716		[Define if you have the `]$1[' variable.])
5717	m4_ifval([$2], AC_CHECK_DECLARATION([$2],[$1]))
5718fi
5719])
5720
5721AC_WARNING_ENABLE([obsolete])
5722AU_DEFUN([AC_CHECK_VAR], [rk_CHECK_VAR([$2], [$1])], [foo])
5723dnl $Id: check-declaration.m4,v 1.3 1999/03/01 13:03:08 joda Exp $
5724dnl
5725dnl
5726dnl Check if we need the declaration of a variable
5727dnl
5728
5729dnl AC_HAVE_DECLARATION(includes, variable)
5730AC_DEFUN(AC_CHECK_DECLARATION, [
5731AC_MSG_CHECKING([if $2 is properly declared])
5732AC_CACHE_VAL(ac_cv_var_$2_declaration, [
5733AC_TRY_COMPILE([$1
5734extern struct { int foo; } $2;],
5735[$2.foo = 1;],
5736eval "ac_cv_var_$2_declaration=no",
5737eval "ac_cv_var_$2_declaration=yes")
5738])
5739
5740define(foo, [HAVE_]translit($2, [a-z], [A-Z])[_DECLARATION])
5741
5742AC_MSG_RESULT($ac_cv_var_$2_declaration)
5743if eval "test \"\$ac_cv_var_$2_declaration\" = yes"; then
5744	AC_DEFINE(foo, 1, [define if your system declares $2])
5745fi
5746undefine([foo])
5747])
5748
5749dnl $Id: broken-snprintf.m4,v 1.4 2001/09/01 11:56:05 assar Exp $
5750dnl
5751AC_DEFUN(AC_BROKEN_SNPRINTF, [
5752AC_CACHE_CHECK(for working snprintf,ac_cv_func_snprintf_working,
5753ac_cv_func_snprintf_working=yes
5754AC_TRY_RUN([
5755#include <stdio.h>
5756#include <string.h>
5757int main()
5758{
5759	char foo[[3]];
5760	snprintf(foo, 2, "12");
5761	return strcmp(foo, "1");
5762}],:,ac_cv_func_snprintf_working=no,:))
5763
5764if test "$ac_cv_func_snprintf_working" = yes; then
5765	AC_DEFINE_UNQUOTED(HAVE_SNPRINTF, 1, [define if you have a working snprintf])
5766fi
5767if test "$ac_cv_func_snprintf_working" = yes; then
5768AC_NEED_PROTO([#include <stdio.h>],snprintf)
5769fi
5770])
5771
5772AC_DEFUN(AC_BROKEN_VSNPRINTF,[
5773AC_CACHE_CHECK(for working vsnprintf,ac_cv_func_vsnprintf_working,
5774ac_cv_func_vsnprintf_working=yes
5775AC_TRY_RUN([
5776#include <stdio.h>
5777#include <string.h>
5778#include <stdarg.h>
5779
5780int foo(int num, ...)
5781{
5782	char bar[[3]];
5783	va_list arg;
5784	va_start(arg, num);
5785	vsnprintf(bar, 2, "%s", arg);
5786	va_end(arg);
5787	return strcmp(bar, "1");
5788}
5789
5790
5791int main()
5792{
5793	return foo(0, "12");
5794}],:,ac_cv_func_vsnprintf_working=no,:))
5795
5796if test "$ac_cv_func_vsnprintf_working" = yes; then
5797	AC_DEFINE_UNQUOTED(HAVE_VSNPRINTF, 1, [define if you have a working vsnprintf])
5798fi
5799if test "$ac_cv_func_vsnprintf_working" = yes; then
5800AC_NEED_PROTO([#include <stdio.h>],vsnprintf)
5801fi
5802])
5803
5804dnl $Id: need-proto.m4,v 1.4 2002/08/23 15:07:41 joda Exp $
5805dnl
5806dnl
5807dnl Check if we need the prototype for a function
5808dnl
5809
5810dnl AC_NEED_PROTO(includes, function)
5811
5812AC_DEFUN(AC_NEED_PROTO, [
5813if test "$ac_cv_func_$2+set" != set -o "$ac_cv_func_$2" = yes; then
5814AC_CACHE_CHECK([if $2 needs a prototype], ac_cv_func_$2_noproto,
5815AC_TRY_COMPILE([$1],
5816[struct foo { int foo; } xx;
5817extern int $2 (struct foo*);
5818$2(&xx);
5819],
5820eval "ac_cv_func_$2_noproto=yes",
5821eval "ac_cv_func_$2_noproto=no"))
5822if test "$ac_cv_func_$2_noproto" = yes; then
5823	AC_DEFINE(AS_TR_CPP(NEED_[]$2[]_PROTO), 1,
5824		[define if the system is missing a prototype for $2()])
5825fi
5826fi
5827])
5828
5829dnl $Id: broken-glob.m4,v 1.4 2001/06/19 09:59:46 assar Exp $
5830dnl
5831dnl check for glob(3)
5832dnl
5833AC_DEFUN(AC_BROKEN_GLOB,[
5834AC_CACHE_CHECK(for working glob, ac_cv_func_glob_working,
5835ac_cv_func_glob_working=yes
5836AC_TRY_LINK([
5837#include <stdio.h>
5838#include <glob.h>],[
5839glob(NULL, GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE|
5840#ifdef GLOB_MAXPATH
5841GLOB_MAXPATH
5842#else
5843GLOB_LIMIT
5844#endif
5845,
5846NULL, NULL);
5847],:,ac_cv_func_glob_working=no,:))
5848
5849if test "$ac_cv_func_glob_working" = yes; then
5850	AC_DEFINE(HAVE_GLOB, 1, [define if you have a glob() that groks 
5851	GLOB_BRACE, GLOB_NOCHECK, GLOB_QUOTE, GLOB_TILDE, and GLOB_LIMIT])
5852fi
5853if test "$ac_cv_func_glob_working" = yes; then
5854AC_NEED_PROTO([#include <stdio.h>
5855#include <glob.h>],glob)
5856fi
5857])
5858
5859dnl
5860dnl $Id: krb-func-getlogin.m4,v 1.1 1999/07/13 17:45:30 assar Exp $
5861dnl
5862dnl test for POSIX (broken) getlogin
5863dnl
5864
5865
5866AC_DEFUN(AC_FUNC_GETLOGIN, [
5867AC_CHECK_FUNCS(getlogin setlogin)
5868if test "$ac_cv_func_getlogin" = yes; then
5869AC_CACHE_CHECK(if getlogin is posix, ac_cv_func_getlogin_posix, [
5870if test "$ac_cv_func_getlogin" = yes -a "$ac_cv_func_setlogin" = yes; then
5871	ac_cv_func_getlogin_posix=no
5872else
5873	ac_cv_func_getlogin_posix=yes
5874fi
5875])
5876if test "$ac_cv_func_getlogin_posix" = yes; then
5877	AC_DEFINE(POSIX_GETLOGIN, 1, [Define if getlogin has POSIX flavour (and not BSD).])
5878fi
5879fi
5880])
5881
5882dnl $Id: find-if-not-broken.m4,v 1.4 2002/05/19 19:37:08 joda Exp $
5883dnl
5884dnl
5885dnl Mix between AC_FIND_FUNC and AC_BROKEN
5886dnl
5887
5888AC_DEFUN(AC_FIND_IF_NOT_BROKEN,
5889[AC_FIND_FUNC([$1], [$2], [$3], [$4])
5890if eval "test \"$ac_cv_func_$1\" != yes"; then 
5891	rk_LIBOBJ([$1])
5892fi
5893])
5894
5895dnl $Id: broken.m4,v 1.6 2002/05/19 19:36:52 joda Exp $
5896dnl
5897dnl
5898dnl Same as AC _REPLACE_FUNCS, just define HAVE_func if found in normal
5899dnl libraries 
5900
5901AC_DEFUN([AC_BROKEN],
5902[AC_FOREACH([rk_func], [$1],
5903	[AC_CHECK_FUNC(rk_func,
5904		[AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]rk_func), 1, 
5905			[Define if you have the function `]rk_func['.])],
5906		[rk_LIBOBJ(rk_func)])])])
5907
5908dnl $Id: broken2.m4,v 1.4 2002/05/19 22:16:46 joda Exp $
5909dnl
5910dnl AC_BROKEN but with more arguments
5911
5912dnl AC_BROKEN2(func, includes, arguments)
5913AC_DEFUN([AC_BROKEN2],
5914[AC_MSG_CHECKING([for $1])
5915AC_CACHE_VAL(ac_cv_func_[]$1,
5916[AC_TRY_LINK([$2],
5917[
5918/* The GNU C library defines this for functions which it implements
5919    to always fail with ENOSYS.  Some functions are actually named
5920    something starting with __ and the normal name is an alias.  */
5921#if defined (__stub_$1) || defined (__stub___$1)
5922choke me
5923#else
5924$1($3)
5925#endif
5926], [eval "ac_cv_func_[]$1=yes"], [eval "ac_cv_func_[]$1=no"])])
5927if eval "test \"\${ac_cv_func_[]$1}\" = yes"; then
5928  AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]$1), 1, define)
5929  AC_MSG_RESULT(yes)
5930else
5931  AC_MSG_RESULT(no)
5932  rk_LIBOBJ($1)
5933fi])
5934
5935dnl $Id: have-struct-field.m4,v 1.6 1999/07/29 01:44:32 assar Exp $
5936dnl
5937dnl check for fields in a structure
5938dnl
5939dnl AC_HAVE_STRUCT_FIELD(struct, field, headers)
5940
5941AC_DEFUN(AC_HAVE_STRUCT_FIELD, [
5942define(cache_val, translit(ac_cv_type_$1_$2, [A-Z ], [a-z_]))
5943AC_CACHE_CHECK([for $2 in $1], cache_val,[
5944AC_TRY_COMPILE([$3],[$1 x; x.$2;],
5945cache_val=yes,
5946cache_val=no)])
5947if test "$cache_val" = yes; then
5948	define(foo, translit(HAVE_$1_$2, [a-z ], [A-Z_]))
5949	AC_DEFINE(foo, 1, [Define if $1 has field $2.])
5950	undefine([foo])
5951fi
5952undefine([cache_val])
5953])
5954
5955dnl $Id: broken-getnameinfo.m4,v 1.2 2000/12/05 09:09:00 joda Exp $
5956dnl
5957dnl test for broken AIX getnameinfo
5958
5959AC_DEFUN(rk_BROKEN_GETNAMEINFO,[
5960AC_CACHE_CHECK([if getnameinfo is broken], ac_cv_func_getnameinfo_broken,
5961AC_TRY_RUN([[#include <stdio.h>
5962#include <sys/types.h>
5963#include <sys/socket.h>
5964#include <netinet/in.h>
5965#include <netdb.h>
5966
5967int
5968main(int argc, char **argv)
5969{
5970  struct sockaddr_in sin;
5971  char host[256];
5972  memset(&sin, 0, sizeof(sin));
5973#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
5974  sin.sin_len = sizeof(sin);
5975#endif
5976  sin.sin_family = AF_INET;
5977  sin.sin_addr.s_addr = 0xffffffff;
5978  sin.sin_port = 0;
5979  return getnameinfo((struct sockaddr*)&sin, sizeof(sin), host, sizeof(host),
5980	      NULL, 0, 0);
5981}
5982]], ac_cv_func_getnameinfo_broken=no, ac_cv_func_getnameinfo_broken=yes))])
5983
5984dnl $Id: broken-getaddrinfo.m4,v 1.3 2002/08/20 14:09:40 joda Exp $
5985dnl
5986dnl test if getaddrinfo can handle numeric services
5987
5988AC_DEFUN(rk_BROKEN_GETADDRINFO,[
5989AC_CACHE_CHECK([if getaddrinfo handles numeric services], ac_cv_func_getaddrinfo_numserv,
5990AC_TRY_RUN([[#include <stdio.h>
5991#include <sys/types.h>
5992#include <sys/socket.h>
5993#include <netdb.h>
5994
5995int
5996main(int argc, char **argv)
5997{
5998	struct addrinfo hints, *ai;
5999	memset(&hints, 0, sizeof(hints));
6000	hints.ai_flags = AI_PASSIVE;
6001	hints.ai_socktype = SOCK_STREAM;
6002	hints.ai_family = PF_UNSPEC;
6003	if(getaddrinfo(NULL, "17", &hints, &ai) != 0)
6004		return 1;
6005	return 0;
6006}
6007]], ac_cv_func_getaddrinfo_numserv=yes, ac_cv_func_getaddrinfo_numserv=no))])
6008
6009dnl
6010dnl $Id: broken-realloc.m4,v 1.1 2000/07/15 18:05:36 joda Exp $
6011dnl
6012dnl Test for realloc that doesn't handle NULL as first parameter
6013dnl
6014AC_DEFUN(rk_BROKEN_REALLOC, [
6015AC_CACHE_CHECK(if realloc if broken, ac_cv_func_realloc_broken, [
6016ac_cv_func_realloc_broken=no
6017AC_TRY_RUN([
6018#include <stddef.h>
6019#include <stdlib.h>
6020
6021int main()
6022{
6023	return realloc(NULL, 17) == NULL;
6024}
6025],:, ac_cv_func_realloc_broken=yes, :)
6026])
6027if test "$ac_cv_func_realloc_broken" = yes ; then
6028	AC_DEFINE(BROKEN_REALLOC, 1, [Define if realloc(NULL) doesn't work.])
6029fi
6030AH_BOTTOM([#ifdef BROKEN_REALLOC
6031#define realloc(X, Y) isoc_realloc((X), (Y))
6032#define isoc_realloc(X, Y) ((X) ? realloc((X), (Y)) : malloc(Y))
6033#endif])
6034])
6035
6036dnl $Id: proto-compat.m4,v 1.3 1999/03/01 13:03:48 joda Exp $
6037dnl
6038dnl
6039dnl Check if the prototype of a function is compatible with another one
6040dnl
6041
6042dnl AC_PROTO_COMPAT(includes, function, prototype)
6043
6044AC_DEFUN(AC_PROTO_COMPAT, [
6045AC_CACHE_CHECK([if $2 is compatible with system prototype],
6046ac_cv_func_$2_proto_compat,
6047AC_TRY_COMPILE([$1],
6048[$3;],
6049eval "ac_cv_func_$2_proto_compat=yes",
6050eval "ac_cv_func_$2_proto_compat=no"))
6051define([foo], translit($2, [a-z], [A-Z])[_PROTO_COMPATIBLE])
6052if test "$ac_cv_func_$2_proto_compat" = yes; then
6053	AC_DEFINE(foo, 1, [define if prototype of $2 is compatible with
6054	$3])
6055fi
6056undefine([foo])
6057])
6058dnl $Id: krb-struct-winsize.m4,v 1.3 2001/09/01 11:56:05 assar Exp $
6059dnl
6060dnl
6061dnl Search for struct winsize
6062dnl
6063
6064AC_DEFUN(AC_KRB_STRUCT_WINSIZE, [
6065AC_MSG_CHECKING(for struct winsize)
6066AC_CACHE_VAL(ac_cv_struct_winsize, [
6067ac_cv_struct_winsize=no
6068for i in sys/termios.h sys/ioctl.h; do
6069AC_EGREP_HEADER(
6070struct[[ 	]]*winsize,dnl
6071$i, ac_cv_struct_winsize=yes; break)dnl
6072done
6073])
6074if test "$ac_cv_struct_winsize" = "yes"; then
6075  AC_DEFINE(HAVE_STRUCT_WINSIZE, 1, [define if struct winsize is declared in sys/termios.h])
6076fi
6077AC_MSG_RESULT($ac_cv_struct_winsize)
6078AC_EGREP_HEADER(ws_xpixel, termios.h, 
6079	AC_DEFINE(HAVE_WS_XPIXEL, 1, [define if struct winsize has ws_xpixel]))
6080AC_EGREP_HEADER(ws_ypixel, termios.h, 
6081	AC_DEFINE(HAVE_WS_YPIXEL, 1, [define if struct winsize has ws_ypixel]))
6082])
6083
6084dnl $Id: krb-struct-spwd.m4,v 1.3 1999/07/13 21:04:11 assar Exp $
6085dnl
6086dnl Test for `struct spwd'
6087
6088AC_DEFUN(AC_KRB_STRUCT_SPWD, [
6089AC_MSG_CHECKING(for struct spwd)
6090AC_CACHE_VAL(ac_cv_struct_spwd, [
6091AC_TRY_COMPILE(
6092[#include <pwd.h>
6093#ifdef HAVE_SHADOW_H
6094#include <shadow.h>
6095#endif],
6096[struct spwd foo;],
6097ac_cv_struct_spwd=yes,
6098ac_cv_struct_spwd=no)
6099])
6100AC_MSG_RESULT($ac_cv_struct_spwd)
6101
6102if test "$ac_cv_struct_spwd" = "yes"; then
6103  AC_DEFINE(HAVE_STRUCT_SPWD, 1, [define if you have struct spwd])
6104fi
6105])
6106
6107dnl $Id: test-package.m4,v 1.11 2002/08/28 19:30:48 joda Exp $
6108dnl
6109dnl rk_TEST_PACKAGE(package,headers,libraries,extra libs,
6110dnl			default locations, conditional, config-program)
6111
6112AC_DEFUN(rk_TEST_PACKAGE,[
6113AC_ARG_WITH($1,
6114	AC_HELP_STRING([--with-$1=dir],[use $1 in dir]))
6115AC_ARG_WITH($1-lib,
6116	AC_HELP_STRING([--with-$1-lib=dir],[use $1 libraries in dir]),
6117[if test "$withval" = "yes" -o "$withval" = "no"; then
6118  AC_MSG_ERROR([No argument for --with-$1-lib])
6119elif test "X$with_$1" = "X"; then
6120  with_$1=yes
6121fi])
6122AC_ARG_WITH($1-include,
6123	AC_HELP_STRING([--with-$1-include=dir],[use $1 headers in dir]),
6124[if test "$withval" = "yes" -o "$withval" = "no"; then
6125  AC_MSG_ERROR([No argument for --with-$1-include])
6126elif test "X$with_$1" = "X"; then
6127  with_$1=yes
6128fi])
6129AC_ARG_WITH($1-config,
6130	AC_HELP_STRING([--with-$1-config=path],[config program for $1]))
6131
6132m4_ifval([$6],
6133	m4_define([rk_pkgname], $6),
6134	m4_define([rk_pkgname], AS_TR_CPP($1)))
6135
6136AC_MSG_CHECKING(for $1)
6137
6138case "$with_$1" in
6139yes|"") d='$5' ;;
6140no)	d= ;;
6141*)	d="$with_$1" ;;
6142esac
6143
6144header_dirs=
6145lib_dirs=
6146for i in $d; do
6147	if test "$with_$1_include" = ""; then
6148		if test -d "$i/include/$1"; then
6149			header_dirs="$header_dirs $i/include/$1"
6150		fi
6151		if test -d "$i/include"; then
6152			header_dirs="$header_dirs $i/include"
6153		fi
6154	fi
6155	if test "$with_$1_lib" = ""; then
6156		if test -d "$i/lib$abilibdirext"; then
6157			lib_dirs="$lib_dirs $i/lib$abilibdirext"
6158		fi
6159	fi
6160done
6161
6162if test "$with_$1_include"; then
6163	header_dirs="$with_$1_include $header_dirs"
6164fi
6165if test "$with_$1_lib"; then
6166	lib_dirs="$with_$1_lib $lib_dirs"
6167fi
6168
6169if test "$with_$1_config" = ""; then
6170	with_$1_config='$7'
6171fi
6172
6173$1_cflags=
6174$1_libs=
6175
6176case "$with_$1_config" in
6177yes|no|"")
6178	;;
6179*)
6180	$1_cflags="`$with_$1_config --cflags 2>&1`"
6181	$1_libs="`$with_$1_config --libs 2>&1`"
6182	;;
6183esac
6184
6185found=no
6186if test "$with_$1" != no; then
6187	save_CFLAGS="$CFLAGS"
6188	save_LIBS="$LIBS"
6189	if test "$[]$1_cflags" -a "$[]$1_libs"; then
6190		CFLAGS="$[]$1_cflags $save_CFLAGS"
6191		LIBS="$[]$1_libs $save_LIBS"
6192		AC_TRY_LINK([$2],,[
6193			INCLUDE_$1="$[]$1_cflags"
6194			LIB_$1="$[]$1_libs"
6195			AC_MSG_RESULT([from $with_$1_config])
6196			found=yes])
6197	fi
6198	if test "$found" = no; then
6199		ires= lres=
6200		for i in $header_dirs; do
6201			CFLAGS="-I$i $save_CFLAGS"
6202			AC_TRY_COMPILE([$2],,ires=$i;break)
6203		done
6204		for i in $lib_dirs; do
6205			LIBS="-L$i $3 $4 $save_LIBS"
6206			AC_TRY_LINK([$2],,lres=$i;break)
6207		done
6208		if test "$ires" -a "$lres" -a "$with_$1" != "no"; then
6209			INCLUDE_$1="-I$ires"
6210			LIB_$1="-L$lres $3"
6211			found=yes
6212			AC_MSG_RESULT([headers $ires, libraries $lres])
6213		fi
6214	fi
6215	CFLAGS="$save_CFLAGS"
6216	LIBS="$save_LIBS"
6217fi
6218
6219if test "$found" = yes; then
6220	AC_DEFINE_UNQUOTED(rk_pkgname, 1, [Define if you have the $1 package.])
6221	with_$1=yes
6222else
6223	with_$1=no
6224	INCLUDE_$1=
6225	LIB_$1=
6226	AC_MSG_RESULT(no)
6227fi
6228
6229AC_SUBST(INCLUDE_$1)
6230AC_SUBST(LIB_$1)
6231])
6232
6233dnl $Id: otp.m4,v 1.2 2002/05/19 20:51:08 joda Exp $
6234dnl
6235dnl check requirements for OTP library
6236dnl
6237AC_DEFUN([rk_OTP],[
6238AC_REQUIRE([rk_DB])dnl
6239AC_ARG_ENABLE(otp,
6240	AC_HELP_STRING([--disable-otp],[if you don't want OTP support]))
6241if test "$enable_otp" = yes -a "$db_type" = unknown; then
6242	AC_MSG_ERROR([OTP requires a NDBM/DB compatible library])
6243fi
6244if test "$enable_otp" != no; then
6245	if test "$db_type" != unknown; then
6246		enable_otp=yes
6247	else
6248		enable_otp=no
6249	fi
6250fi
6251if test "$enable_otp" = yes; then
6252	AC_DEFINE(OTP, 1, [Define if you want OTP support in applications.])
6253	LIB_otp='$(top_builddir)/lib/otp/libotp.la'
6254	AC_SUBST(LIB_otp)
6255fi
6256AC_MSG_CHECKING([whether to enable OTP library])
6257AC_MSG_RESULT($enable_otp)
6258AM_CONDITIONAL(OTP, test "$enable_otp" = yes)dnl
6259])
6260
6261dnl $Id: osfc2.m4,v 1.3 2002/04/30 16:46:18 joda Exp $
6262dnl
6263dnl enable OSF C2 stuff
6264
6265AC_DEFUN(AC_CHECK_OSFC2,[
6266AC_ARG_ENABLE(osfc2,
6267	AC_HELP_STRING([--enable-osfc2],[enable some OSF C2 support]))
6268LIB_security=
6269if test "$enable_osfc2" = yes; then
6270	AC_DEFINE(HAVE_OSFC2, 1, [Define to enable basic OSF C2 support.])
6271	LIB_security=-lsecurity
6272fi
6273AC_SUBST(LIB_security)
6274])
6275
6276dnl $Id: check-man.m4,v 1.3 2000/11/30 01:47:17 joda Exp $
6277dnl check how to format manual pages
6278dnl
6279
6280AC_DEFUN(rk_CHECK_MAN,
6281[AC_PATH_PROG(NROFF, nroff)
6282AC_PATH_PROG(GROFF, groff)
6283AC_CACHE_CHECK(how to format man pages,ac_cv_sys_man_format,
6284[cat > conftest.1 << END
6285.Dd January 1, 1970
6286.Dt CONFTEST 1
6287.Sh NAME
6288.Nm conftest
6289.Nd
6290foobar
6291END
6292
6293if test "$NROFF" ; then
6294	for i in "-mdoc" "-mandoc"; do
6295		if "$NROFF" $i conftest.1 2> /dev/null | \
6296			grep Jan > /dev/null 2>&1 ; then
6297			ac_cv_sys_man_format="$NROFF $i"
6298			break
6299		fi
6300	done
6301fi
6302if test "$ac_cv_sys_man_format" = "" -a "$GROFF" ; then
6303	for i in "-mdoc" "-mandoc"; do
6304		if "$GROFF" -Tascii $i conftest.1 2> /dev/null | \
6305			grep Jan > /dev/null 2>&1 ; then
6306			ac_cv_sys_man_format="$GROFF -Tascii $i"
6307			break
6308		fi
6309	done
6310fi
6311if test "$ac_cv_sys_man_format"; then
6312	ac_cv_sys_man_format="$ac_cv_sys_man_format \[$]< > \[$]@"
6313fi
6314])
6315if test "$ac_cv_sys_man_format"; then
6316	CATMAN="$ac_cv_sys_man_format"
6317	AC_SUBST(CATMAN)
6318fi
6319AM_CONDITIONAL(CATMAN, test "$CATMAN")
6320AC_CACHE_CHECK(extension of pre-formatted manual pages,ac_cv_sys_catman_ext,
6321[if grep _suffix /etc/man.conf > /dev/null 2>&1; then
6322	ac_cv_sys_catman_ext=0
6323else
6324	ac_cv_sys_catman_ext=number
6325fi
6326])
6327if test "$ac_cv_sys_catman_ext" = number; then
6328	CATMANEXT='$$section'
6329else
6330	CATMANEXT=0
6331fi
6332AC_SUBST(CATMANEXT)
6333])
6334dnl
6335dnl $Id: krb-bigendian.m4,v 1.8 2002/08/28 19:20:19 joda Exp $
6336dnl
6337
6338dnl check if this computer is little or big-endian
6339dnl if we can figure it out at compile-time then don't define the cpp symbol
6340dnl otherwise test for it and define it.  also allow options for overriding
6341dnl it when cross-compiling
6342
6343AC_DEFUN(KRB_C_BIGENDIAN, [
6344AC_ARG_ENABLE(bigendian,
6345	AC_HELP_STRING([--enable-bigendian],[the target is big endian]),
6346krb_cv_c_bigendian=yes)
6347AC_ARG_ENABLE(littleendian,
6348	AC_HELP_STRING([--enable-littleendian],[the target is little endian]),
6349krb_cv_c_bigendian=no)
6350AC_CACHE_CHECK(whether byte order is known at compile time,
6351krb_cv_c_bigendian_compile,
6352[AC_TRY_COMPILE([
6353#include <sys/types.h>
6354#include <sys/param.h>],[
6355#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
6356 bogus endian macros
6357#endif], krb_cv_c_bigendian_compile=yes, krb_cv_c_bigendian_compile=no)])
6358AC_CACHE_CHECK(whether byte ordering is bigendian, krb_cv_c_bigendian,[
6359  if test "$krb_cv_c_bigendian_compile" = "yes"; then
6360    AC_TRY_COMPILE([
6361#include <sys/types.h>
6362#include <sys/param.h>],[
6363#if BYTE_ORDER != BIG_ENDIAN
6364  not big endian
6365#endif], krb_cv_c_bigendian=yes, krb_cv_c_bigendian=no)
6366  else
6367    AC_TRY_RUN([main () {
6368      /* Are we little or big endian?  From Harbison&Steele.  */
6369      union
6370      {
6371	long l;
6372	char c[sizeof (long)];
6373    } u;
6374    u.l = 1;
6375    exit (u.c[sizeof (long) - 1] == 1);
6376  }], krb_cv_c_bigendian=no, krb_cv_c_bigendian=yes,
6377  AC_MSG_ERROR([specify either --enable-bigendian or --enable-littleendian]))
6378  fi
6379])
6380if test "$krb_cv_c_bigendian" = "yes"; then
6381  AC_DEFINE(WORDS_BIGENDIAN, 1, [define if target is big endian])dnl
6382fi
6383if test "$krb_cv_c_bigendian_compile" = "yes"; then
6384  AC_DEFINE(ENDIANESS_IN_SYS_PARAM_H, 1, [define if sys/param.h defines the endiness])dnl
6385fi
6386AH_BOTTOM([
6387#if ENDIANESS_IN_SYS_PARAM_H
6388#  include <sys/types.h>
6389#  include <sys/param.h>
6390#  if BYTE_ORDER == BIG_ENDIAN
6391#  define WORDS_BIGENDIAN 1
6392#  endif
6393#endif
6394])
6395])
6396
6397dnl
6398dnl $Id: aix.m4,v 1.9 2002/08/28 19:19:43 joda Exp $
6399dnl
6400
6401AC_DEFUN(rk_AIX,[
6402
6403aix=no
6404case "$host" in 
6405*-*-aix3*)
6406	aix=3
6407	;;
6408*-*-aix4*|*-*-aix5*)
6409	aix=4
6410	;;
6411esac
6412
6413AM_CONDITIONAL(AIX, test "$aix" != no)dnl
6414AM_CONDITIONAL(AIX4, test "$aix" = 4)
6415
6416
6417AC_ARG_ENABLE(dynamic-afs,
6418	AC_HELP_STRING([--disable-dynamic-afs],
6419		[do not use loaded AFS library with AIX]))
6420
6421if test "$aix" != no; then
6422	if test "$enable_dynamic_afs" != no; then
6423		AC_REQUIRE([rk_DLOPEN])
6424		if test "$ac_cv_func_dlopen" = no; then
6425			AC_FIND_FUNC_NO_LIBS(loadquery, ld)
6426		fi
6427		if test "$ac_cv_func_dlopen" != no; then
6428			AIX_EXTRA_KAFS='$(LIB_dlopen)'
6429		elif test "$ac_cv_func_loadquery" != no; then
6430			AIX_EXTRA_KAFS='$(LIB_loadquery)'
6431		else
6432			AC_MSG_NOTICE([not using dynloaded AFS library])
6433			AIX_EXTRA_KAFS=
6434			enable_dynamic_afs=no
6435		fi
6436	else
6437		AIX_EXTRA_KAFS=
6438	fi
6439fi
6440
6441AM_CONDITIONAL(AIX_DYNAMIC_AFS, test "$enable_dynamic_afs" != no)dnl
6442AC_SUBST(AIX_EXTRA_KAFS)dnl
6443
6444AH_BOTTOM([#if _AIX
6445#define _ALL_SOURCE
6446/* XXX this is gross, but kills about a gazillion warnings */
6447struct ether_addr;
6448struct sockaddr;
6449struct sockaddr_dl;
6450struct sockaddr_in;
6451#endif])
6452
6453])
6454
6455dnl
6456dnl $Id: dlopen.m4,v 1.1 2002/08/28 16:32:16 joda Exp $
6457dnl
6458
6459AC_DEFUN([rk_DLOPEN], [
6460	AC_FIND_FUNC_NO_LIBS(dlopen, dl)
6461	AM_CONDITIONAL(HAVE_DLOPEN, test "$ac_cv_funclib_dlopen" != no)
6462])
6463
6464dnl
6465dnl $Id: irix.m4,v 1.1 2002/08/28 19:11:44 joda Exp $
6466dnl
6467
6468AC_DEFUN([rk_IRIX],
6469[
6470irix=no
6471case "$host" in
6472*-*-irix4*) 
6473	AC_DEFINE([IRIX4], 1,
6474		[Define if you are running IRIX 4.])
6475	irix=yes
6476	;;
6477*-*-irix*) 
6478	irix=yes
6479	;;
6480esac
6481AM_CONDITIONAL(IRIX, test "$irix" != no)dnl
6482
6483AH_BOTTOM([
6484/* IRIX 4 braindamage */
6485#if IRIX == 4 && !defined(__STDC__)
6486#define __STDC__ 0
6487#endif
6488])
6489])
6490
6491dnl
6492dnl $Id: sunos.m4,v 1.1 2002/08/28 19:53:51 joda Exp $
6493dnl
6494
6495AC_DEFUN([rk_SUNOS],[
6496sunos=no
6497case "$host" in 
6498*-*-sunos4*)
6499	sunos=40
6500	;;
6501*-*-solaris2.7)
6502	sunos=57
6503	;;
6504*-*-solaris2.[89])
6505	sunos=58
6506	;;
6507*-*-solaris2*)
6508	sunos=50
6509	;;
6510esac
6511if test "$sunos" != no; then
6512	AC_DEFINE_UNQUOTED(SunOS, $sunos, 
6513		[Define to what version of SunOS you are running.])
6514fi
6515])
6516dnl 
6517dnl See if there is any X11 present
6518dnl
6519dnl $Id: check-x.m4,v 1.2 1999/11/05 04:25:23 assar Exp $
6520
6521AC_DEFUN(KRB_CHECK_X,[
6522AC_PATH_XTRA
6523
6524# try to figure out if we need any additional ld flags, like -R
6525# and yes, the autoconf X test is utterly broken
6526if test "$no_x" != yes; then
6527	AC_CACHE_CHECK(for special X linker flags,krb_cv_sys_x_libs_rpath,[
6528	ac_save_libs="$LIBS"
6529	ac_save_cflags="$CFLAGS"
6530	CFLAGS="$CFLAGS $X_CFLAGS"
6531	krb_cv_sys_x_libs_rpath=""
6532	krb_cv_sys_x_libs=""
6533	for rflag in "" "-R" "-R " "-rpath "; do
6534		if test "$rflag" = ""; then
6535			foo="$X_LIBS"
6536		else
6537			foo=""
6538			for flag in $X_LIBS; do
6539			case $flag in
6540			-L*)
6541				foo="$foo $flag `echo $flag | sed \"s/-L/$rflag/\"`"
6542				;;
6543			*)
6544				foo="$foo $flag"
6545				;;
6546			esac
6547			done
6548		fi
6549		LIBS="$ac_save_libs $foo $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
6550		AC_TRY_RUN([
6551		#include <X11/Xlib.h>
6552		foo()
6553		{
6554		XOpenDisplay(NULL);
6555		}
6556		main()
6557		{
6558		return 0;
6559		}
6560		], krb_cv_sys_x_libs_rpath="$rflag"; krb_cv_sys_x_libs="$foo"; break,:)
6561	done
6562	LIBS="$ac_save_libs"
6563	CFLAGS="$ac_save_cflags"
6564	])
6565	X_LIBS="$krb_cv_sys_x_libs"
6566fi
6567])
6568
6569dnl $Id: check-xau.m4,v 1.3 1999/05/14 01:17:06 assar Exp $
6570dnl
6571dnl check for Xau{Read,Write}Auth and XauFileName
6572dnl
6573AC_DEFUN(AC_CHECK_XAU,[
6574save_CFLAGS="$CFLAGS"
6575CFLAGS="$X_CFLAGS $CFLAGS"
6576save_LIBS="$LIBS"
6577dnl LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS $LIBS"
6578LIBS="$X_PRE_LIBS $X_EXTRA_LIBS $LIBS"
6579save_LDFLAGS="$LDFLAGS"
6580LDFLAGS="$LDFLAGS $X_LIBS"
6581
6582
6583AC_FIND_FUNC_NO_LIBS(XauWriteAuth, X11 Xau)
6584ac_xxx="$LIBS"
6585LIBS="$LIB_XauWriteAuth $LIBS"
6586AC_FIND_FUNC_NO_LIBS(XauReadAuth, X11 Xau)
6587LIBS="$LIB_XauReadAauth $LIBS"
6588AC_FIND_FUNC_NO_LIBS(XauFileName, X11 Xau)
6589LIBS="$ac_xxx"
6590
6591case "$ac_cv_funclib_XauWriteAuth" in
6592yes)	;;
6593no)	;;
6594*)	if test "$ac_cv_funclib_XauReadAuth" = yes; then
6595		if test "$ac_cv_funclib_XauFileName" = yes; then
6596			LIB_XauReadAuth="$LIB_XauWriteAuth"
6597		else
6598			LIB_XauReadAuth="$LIB_XauWriteAuth $LIB_XauFileName"
6599		fi
6600	else
6601		if test "$ac_cv_funclib_XauFileName" = yes; then
6602			LIB_XauReadAuth="$LIB_XauReadAuth $LIB_XauWriteAuth"
6603		else
6604			LIB_XauReadAuth="$LIB_XauReadAuth $LIB_XauWriteAuth $LIB_XauFileName"
6605		fi
6606	fi
6607	;;
6608esac
6609
6610if test "$AUTOMAKE" != ""; then
6611	AM_CONDITIONAL(NEED_WRITEAUTH, test "$ac_cv_func_XauWriteAuth" != "yes")
6612else
6613	AC_SUBST(NEED_WRITEAUTH_TRUE)
6614	AC_SUBST(NEED_WRITEAUTH_FALSE)
6615	if test "$ac_cv_func_XauWriteAuth" != "yes"; then
6616		NEED_WRITEAUTH_TRUE=
6617		NEED_WRITEAUTH_FALSE='#'
6618	else
6619		NEED_WRITEAUTH_TRUE='#'
6620		NEED_WRITEAUTH_FALSE=
6621	fi
6622fi
6623CFLAGS=$save_CFLAGS
6624LIBS=$save_LIBS
6625LDFLAGS=$save_LDFLAGS
6626])
6627
6628dnl $Id: check-type-extra.m4,v 1.2 1999/03/01 09:52:23 joda Exp $
6629dnl
6630dnl ac_check_type + extra headers
6631
6632dnl AC_CHECK_TYPE_EXTRA(TYPE, DEFAULT, HEADERS)
6633AC_DEFUN(AC_CHECK_TYPE_EXTRA,
6634[AC_REQUIRE([AC_HEADER_STDC])dnl
6635AC_MSG_CHECKING(for $1)
6636AC_CACHE_VAL(ac_cv_type_$1,
6637[AC_EGREP_CPP(dnl
6638changequote(<<,>>)dnl
6639<<$1[^a-zA-Z_0-9]>>dnl
6640changequote([,]), [#include <sys/types.h>
6641#if STDC_HEADERS
6642#include <stdlib.h>
6643#include <stddef.h>
6644#endif
6645$3], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl
6646AC_MSG_RESULT($ac_cv_type_$1)
6647if test $ac_cv_type_$1 = no; then
6648  AC_DEFINE($1, $2, [Define this to what the type $1 should be.])
6649fi
6650])
6651
6652dnl
6653dnl $Id: capabilities.m4,v 1.2 1999/09/01 11:02:26 joda Exp $
6654dnl
6655
6656dnl
6657dnl Test SGI capabilities
6658dnl
6659
6660AC_DEFUN(KRB_CAPABILITIES,[
6661
6662AC_CHECK_HEADERS(capability.h sys/capability.h)
6663
6664AC_CHECK_FUNCS(sgi_getcapabilitybyname cap_set_proc)
6665])
6666
6667dnl $Id: check-getpwnam_r-posix.m4,v 1.2 1999/03/23 16:47:31 joda Exp $
6668dnl
6669dnl check for getpwnam_r, and if it's posix or not
6670
6671AC_DEFUN(AC_CHECK_GETPWNAM_R_POSIX,[
6672AC_FIND_FUNC_NO_LIBS(getpwnam_r,c_r)
6673if test "$ac_cv_func_getpwnam_r" = yes; then
6674	AC_CACHE_CHECK(if getpwnam_r is posix,ac_cv_func_getpwnam_r_posix,
6675	ac_libs="$LIBS"
6676	LIBS="$LIBS $LIB_getpwnam_r"
6677	AC_TRY_RUN([
6678#include <pwd.h>
6679int main()
6680{
6681	struct passwd pw, *pwd;
6682	return getpwnam_r("", &pw, NULL, 0, &pwd) < 0;
6683}
6684],ac_cv_func_getpwnam_r_posix=yes,ac_cv_func_getpwnam_r_posix=no,:)
6685LIBS="$ac_libs")
6686if test "$ac_cv_func_getpwnam_r_posix" = yes; then
6687	AC_DEFINE(POSIX_GETPWNAM_R, 1, [Define if getpwnam_r has POSIX flavour.])
6688fi
6689fi
6690])
6691dnl $Id: crypto.m4,v 1.11 2002/08/28 23:09:05 assar Exp $
6692dnl
6693dnl test for crypto libraries:
6694dnl - libcrypto (from openssl)
6695dnl - libdes (from krb4)
6696dnl - own-built libdes
6697
6698AC_DEFUN([KRB_CRYPTO],[
6699crypto_lib=unknown
6700AC_WITH_ALL([openssl])
6701
6702DIR_des=
6703
6704AC_MSG_CHECKING([for crypto library])
6705
6706openssl=no
6707if test "$crypto_lib" = "unknown" -a "$with_openssl" != "no"; then
6708
6709  save_CPPFLAGS="$CPPFLAGS"
6710  save_LIBS="$LIBS"
6711  INCLUDE_des=
6712  LIB_des=
6713  if test "$with_openssl_include" != ""; then
6714    INCLUDE_des="-I${with_openssl}/include"
6715  fi
6716  if test "$with_openssl_lib" != ""; then
6717    LIB_des="-L${with_openssl}/lib"
6718  fi
6719  CPPFLAGS="${INCLUDE_des} ${CPPFLAGS}"
6720  LIB_des="${LIB_des} -lcrypto"
6721  LIB_des_a="$LIB_des"
6722  LIB_des_so="$LIB_des"
6723  LIB_des_appl="$LIB_des"
6724  LIBS="${LIBS} ${LIB_des}"
6725  AC_TRY_LINK([
6726  #include <openssl/md4.h>
6727  #include <openssl/md5.h>
6728  #include <openssl/sha.h>
6729  #include <openssl/des.h>
6730  #include <openssl/rc4.h>
6731  ],
6732  [
6733    void *schedule = 0;
6734    MD4_CTX md4;
6735    MD5_CTX md5;
6736    SHA_CTX sha1;
6737
6738    MD4_Init(&md4);
6739    MD5_Init(&md5);
6740    SHA1_Init(&sha1);
6741
6742    des_cbc_encrypt(0, 0, 0, schedule, 0, 0);
6743    RC4(0, 0, 0, 0);
6744  ], [
6745  crypto_lib=libcrypto openssl=yes
6746  AC_MSG_RESULT([libcrypto])])
6747  CPPFLAGS="$save_CPPFLAGS"
6748  LIBS="$save_LIBS"
6749fi
6750
6751if test "$crypto_lib" = "unknown" -a "$with_krb4" != "no"; then
6752	save_CPPFLAGS="$CPPFLAGS"
6753	save_LIBS="$LIBS"
6754
6755	cdirs= clibs=
6756	for i in $LIB_krb4; do
6757		case "$i" in
6758		-L*) cdirs="$cdirs $i";;
6759		-l*) clibs="$clibs $i";;
6760		esac
6761	done
6762
6763	ires=
6764	for i in $INCLUDE_krb4; do
6765		CFLAGS="$i $save_CFLAGS"
6766		AC_TRY_COMPILE([
6767			#undef KRB5 /* makes md4.h et al unhappy */
6768			#define KRB4
6769			#include <openssl/md4.h>
6770			#include <openssl/md5.h>
6771			#include <openssl/sha.h>
6772			#include <openssl/des.h>
6773			#include <openssl/rc4.h>
6774			], [
6775			MD4_CTX md4;
6776			MD5_CTX md5;
6777			SHA_CTX sha1;
6778
6779			MD4_Init(&md4);
6780			MD5_Init(&md5);
6781			SHA1_Init(&sha1);
6782
6783			des_cbc_encrypt(0, 0, 0, 0, 0, 0);
6784			RC4(0, 0, 0, 0);],openssl=yes ires="$i"; break)
6785		AC_TRY_COMPILE([
6786			#undef KRB5 /* makes md4.h et al unhappy */
6787			#define KRB4
6788			#include <md4.h>
6789			#include <md5.h>
6790			#include <sha.h>
6791			#include <des.h>
6792			#include <rc4.h>
6793			], [
6794			MD4_CTX md4;
6795			MD5_CTX md5;
6796			SHA_CTX sha1;
6797
6798			MD4_Init(&md4);
6799			MD5_Init(&md5);
6800			SHA1_Init(&sha1);
6801
6802			des_cbc_encrypt(0, 0, 0, 0, 0, 0);
6803			RC4(0, 0, 0, 0);],ires="$i"; break)
6804	done
6805	lres=
6806	for i in $cdirs; do
6807		for j in $clibs; do
6808			LIBS="$i $j $save_LIBS"
6809			if test "$openssl" = yes; then
6810			AC_TRY_LINK([
6811				#undef KRB5 /* makes md4.h et al unhappy */
6812				#define KRB4
6813				#include <openssl/md4.h>
6814				#include <openssl/md5.h>
6815				#include <openssl/sha.h>
6816				#include <openssl/des.h>
6817				#include <openssl/rc4.h>
6818				], [
6819				MD4_CTX md4;
6820				MD5_CTX md5;
6821				SHA_CTX sha1;
6822	
6823				MD4_Init(&md4);
6824				MD5_Init(&md5);
6825				SHA1_Init(&sha1);
6826	
6827				des_cbc_encrypt(0, 0, 0, 0, 0, 0);
6828				RC4(0, 0, 0, 0);],lres="$i $j"; break 2)
6829			else
6830			AC_TRY_LINK([
6831				#undef KRB5 /* makes md4.h et al unhappy */
6832				#define KRB4
6833				#include <md4.h>
6834				#include <md5.h>
6835				#include <sha.h>
6836				#include <des.h>
6837				#include <rc4.h>
6838				], [
6839				MD4_CTX md4;
6840				MD5_CTX md5;
6841				SHA_CTX sha1;
6842	
6843				MD4_Init(&md4);
6844				MD5_Init(&md5);
6845				SHA1_Init(&sha1);
6846	
6847				des_cbc_encrypt(0, 0, 0, 0, 0, 0);
6848				RC4(0, 0, 0, 0);],lres="$i $j"; break 2)
6849			fi
6850		done
6851	done
6852	CFLAGS="$save_CFLAGS"
6853	LIBS="$save_LIBS"
6854	if test "$ires" -a "$lres"; then
6855		INCLUDE_des="$ires"
6856		LIB_des="$lres"
6857		crypto_lib=krb4
6858		AC_MSG_RESULT([same as krb4])
6859		LIB_des_a='$(LIB_des)'
6860		LIB_des_so='$(LIB_des)'
6861		LIB_des_appl='$(LIB_des)'
6862	fi
6863fi
6864
6865if test "$crypto_lib" = "unknown"; then
6866
6867  DIR_des='des'
6868  LIB_des='$(top_builddir)/lib/des/libdes.la'
6869  LIB_des_a='$(top_builddir)/lib/des/.libs/libdes.a'
6870  LIB_des_so='$(top_builddir)/lib/des/.libs/libdes.so'
6871  LIB_des_appl="-ldes"
6872
6873  AC_MSG_RESULT([included libdes])
6874
6875fi
6876
6877if test "$openssl" = "yes"; then
6878  AC_DEFINE([HAVE_OPENSSL], 1, [define to use openssl's libcrypto])
6879fi
6880AM_CONDITIONAL(HAVE_OPENSSL, test "$openssl" = yes)dnl
6881
6882AC_SUBST(DIR_des)
6883AC_SUBST(INCLUDE_des)
6884AC_SUBST(LIB_des)
6885AC_SUBST(LIB_des_a)
6886AC_SUBST(LIB_des_so)
6887AC_SUBST(LIB_des_appl)
6888])
6889
6890dnl
6891dnl $Id: with-all.m4,v 1.1 2001/08/29 17:01:23 assar Exp $
6892dnl
6893
6894dnl AC_WITH_ALL(name)
6895
6896AC_DEFUN([AC_WITH_ALL], [
6897AC_ARG_WITH($1,
6898	AC_HELP_STRING([--with-$1=dir],
6899		[use $1 in dir]))
6900
6901AC_ARG_WITH($1-lib,
6902	AC_HELP_STRING([--with-$1-lib=dir],
6903		[use $1 libraries in dir]),
6904[if test "$withval" = "yes" -o "$withval" = "no"; then
6905  AC_MSG_ERROR([No argument for --with-$1-lib])
6906elif test "X$with_$1" = "X"; then
6907  with_$1=yes
6908fi])
6909
6910AC_ARG_WITH($1-include,
6911	AC_HELP_STRING([--with-$1-include=dir],
6912		[use $1 headers in dir]),
6913[if test "$withval" = "yes" -o "$withval" = "no"; then
6914  AC_MSG_ERROR([No argument for --with-$1-include])
6915elif test "X$with_$1" = "X"; then
6916  with_$1=yes
6917fi])
6918
6919case "$with_$1" in
6920yes)	;;
6921no)	;;
6922"")	;;
6923*)	if test "$with_$1_include" = ""; then
6924		with_$1_include="$with_$1/include"
6925	fi
6926	if test "$with_$1_lib" = ""; then
6927		with_$1_lib="$with_$1/lib$abilibdirext"
6928	fi
6929	;;
6930esac
6931])
6932dnl $Id: krb-readline.m4,v 1.5 2002/08/29 02:22:32 assar Exp $
6933dnl
6934dnl Tests for readline functions
6935dnl
6936
6937dnl el_init
6938
6939AC_DEFUN(KRB_READLINE,[
6940AC_FIND_FUNC_NO_LIBS(el_init, edit, [], [], [$LIB_tgetent])
6941if test "$ac_cv_func_el_init" = yes ; then
6942	AC_CACHE_CHECK(for four argument el_init, ac_cv_func_el_init_four,[
6943		AC_TRY_COMPILE([#include <stdio.h>
6944			#include <histedit.h>],
6945			[el_init("", NULL, NULL, NULL);],
6946			ac_cv_func_el_init_four=yes,
6947			ac_cv_func_el_init_four=no)])
6948	if test "$ac_cv_func_el_init_four" = yes; then
6949		AC_DEFINE(HAVE_FOUR_VALUED_EL_INIT, 1, [Define if el_init takes four arguments.])
6950	fi
6951fi
6952
6953dnl readline
6954
6955ac_foo=no
6956if test "$with_readline" = yes; then
6957	:
6958elif test "$ac_cv_func_readline" = yes; then
6959	:
6960elif test "$ac_cv_func_el_init" = yes; then
6961	ac_foo=yes
6962	LIB_readline="\$(top_builddir)/lib/editline/libel_compat.la \$(LIB_el_init) \$(LIB_tgetent)"
6963else
6964	LIB_readline="\$(top_builddir)/lib/editline/libeditline.la \$(LIB_tgetent)"
6965fi
6966AM_CONDITIONAL(el_compat, test "$ac_foo" = yes)
6967AC_DEFINE(HAVE_READLINE, 1, 
6968	[Define if you have a readline compatible library.])dnl
6969
6970])
6971
6972dnl
6973dnl $Id: telnet.m4,v 1.1 2002/08/28 19:19:01 joda Exp $
6974dnl
6975dnl stuff used by telnet
6976
6977AC_DEFUN([rk_TELNET],[
6978AC_DEFINE(AUTHENTICATION, 1, 
6979	[Define if you want authentication support in telnet.])dnl
6980AC_DEFINE(ENCRYPTION, 1,
6981	[Define if you want encryption support in telnet.])dnl
6982AC_DEFINE(DES_ENCRYPTION, 1,
6983	[Define if you want to use DES encryption in telnet.])dnl
6984AC_DEFINE(DIAGNOSTICS, 1,
6985	[Define this to enable diagnostics in telnet.])dnl
6986AC_DEFINE(OLD_ENVIRON, 1,
6987	[Define this to enable old environment option in telnet.])dnl
6988if false; then
6989	AC_DEFINE(ENV_HACK, 1,
6990		[Define this if you want support for broken ENV_{VAR,VAL} telnets.])
6991fi
6992
6993# Simple test for streamspty, based on the existance of getmsg(), alas
6994# this breaks on SunOS4 which have streams but BSD-like ptys
6995#
6996# And also something wierd has happend with dec-osf1, fallback to bsd-ptys
6997
6998case "$host" in
6999*-*-aix3*|*-*-sunos4*|*-*-osf*|*-*-hpux1[[01]]*)
7000	;;
7001*)
7002	AC_CHECK_FUNC(getmsg)
7003	if test "$ac_cv_func_getmsg" = "yes"; then
7004		AC_CACHE_CHECK([if getmsg works], ac_cv_func_getmsg_works,
7005		AC_TRY_RUN([
7006			#include <stdio.h>
7007			#include <errno.h>
7008
7009			int main()
7010			{
7011			  int ret;
7012			  ret = getmsg(open("/dev/null", 0), NULL, NULL, NULL);
7013			  if(ret < 0 && errno == ENOSYS)
7014			    return 1;
7015			  return 0;
7016			}
7017			], ac_cv_func_getmsg_works=yes, 
7018			ac_cv_func_getmsg_works=no,
7019			ac_cv_func_getmsg_works=no))
7020		if test "$ac_cv_func_getmsg_works" = "yes"; then
7021			AC_DEFINE(HAVE_GETMSG, 1,
7022				[Define if you have a working getmsg.])
7023			AC_DEFINE(STREAMSPTY, 1,
7024				[Define if you have streams ptys.])
7025		fi
7026	fi
7027	;;
7028esac
7029
7030AH_BOTTOM([
7031#if defined(ENCRYPTION) && !defined(AUTHENTICATION)
7032#define AUTHENTICATION 1
7033#endif
7034
7035/* Set this to the default system lead string for telnetd 
7036 * can contain %-escapes: %s=sysname, %m=machine, %r=os-release
7037 * %v=os-version, %t=tty, %h=hostname, %d=date and time
7038 */
7039#undef USE_IM
7040
7041/* Used with login -p */
7042#undef LOGIN_ARGS
7043
7044/* set this to a sensible login */
7045#ifndef LOGIN_PATH
7046#define LOGIN_PATH BINDIR "/login"
7047#endif
7048])
7049])
7050
7051dnl $Id: check-compile-et.m4,v 1.6 2001/09/02 17:08:48 assar Exp $
7052dnl
7053dnl CHECK_COMPILE_ET
7054AC_DEFUN([CHECK_COMPILE_ET], [
7055
7056AC_CHECK_PROG(COMPILE_ET, compile_et, [compile_et])
7057
7058krb_cv_compile_et="no"
7059if test "${COMPILE_ET}" = "compile_et"; then
7060
7061dnl We have compile_et.  Now let's see if it supports `prefix' and `index'.
7062AC_MSG_CHECKING(whether compile_et has the features we need)
7063cat > conftest_et.et <<'EOF'
7064error_table conf
7065prefix CONFTEST
7066index 1
7067error_code CODE1, "CODE1"
7068index 128
7069error_code CODE2, "CODE2"
7070end
7071EOF
7072if ${COMPILE_ET} conftest_et.et >/dev/null 2>&1; then
7073  dnl XXX Some systems have <et/com_err.h>.
7074  save_CPPFLAGS="${save_CPPFLAGS}"
7075  if test -d "/usr/include/et"; then
7076    CPPFLAGS="-I/usr/include/et ${CPPFLAGS}"
7077  fi
7078  dnl Check that the `prefix' and `index' directives were honored.
7079  AC_TRY_RUN([
7080#include <com_err.h>
7081#include <string.h>
7082#include "conftest_et.h"
7083int main(){return (CONFTEST_CODE2 - CONFTEST_CODE1) != 127;}
7084  ], [krb_cv_compile_et="yes"],[CPPFLAGS="${save_CPPFLAGS}"])
7085fi
7086AC_MSG_RESULT(${krb_cv_compile_et})
7087rm -fr conftest*
7088fi
7089
7090if test "${krb_cv_compile_et}" = "yes"; then
7091  dnl Since compile_et seems to work, let's check libcom_err
7092  krb_cv_save_LIBS="${LIBS}"
7093  LIBS="${LIBS} -lcom_err"
7094  AC_MSG_CHECKING(for com_err)
7095  AC_TRY_LINK([#include <com_err.h>],[
7096    const char *p;
7097    p = error_message(0);
7098  ],[krb_cv_com_err="yes"],[krb_cv_com_err="no"; CPPFLAGS="${save_CPPFLAGS}"])
7099  AC_MSG_RESULT(${krb_cv_com_err})
7100  LIBS="${krb_cv_save_LIBS}"
7101else
7102  dnl Since compile_et doesn't work, forget about libcom_err
7103  krb_cv_com_err="no"
7104fi
7105
7106dnl Only use the system's com_err if we found compile_et, libcom_err, and
7107dnl com_err.h.
7108if test "${krb_cv_com_err}" = "yes"; then
7109    DIR_com_err=""
7110    LIB_com_err="-lcom_err"
7111    LIB_com_err_a=""
7112    LIB_com_err_so=""
7113    AC_MSG_NOTICE(Using the already-installed com_err)
7114else
7115    COMPILE_ET="\$(top_builddir)/lib/com_err/compile_et"
7116    DIR_com_err="com_err"
7117    LIB_com_err="\$(top_builddir)/lib/com_err/libcom_err.la"
7118    LIB_com_err_a="\$(top_builddir)/lib/com_err/.libs/libcom_err.a"
7119    LIB_com_err_so="\$(top_builddir)/lib/com_err/.libs/libcom_err.so"
7120    AC_MSG_NOTICE(Using our own com_err)
7121fi
7122AC_SUBST(DIR_com_err)
7123AC_SUBST(LIB_com_err)
7124AC_SUBST(LIB_com_err_a)
7125AC_SUBST(LIB_com_err_so)
7126
7127])
7128
7129dnl $Id: auth-modules.m4,v 1.3 2002/08/28 15:04:57 nectar Exp $
7130dnl
7131dnl Figure what authentication modules should be built
7132
7133AC_DEFUN(AC_AUTH_MODULES,[
7134AC_MSG_CHECKING(which authentication modules should be built)
7135
7136LIB_AUTH_SUBDIRS=
7137
7138if test "$ac_cv_header_siad_h" = yes; then
7139	LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS sia"
7140fi
7141
7142case "${host}" in
7143*-*-freebsd*)	ac_cv_want_pam_krb4=no ;;
7144*)		ac_cv_want_pam_krb4=yes ;;
7145esac
7146
7147if test "$ac_cv_want_pam_krb4" = yes -a \
7148    "$ac_cv_header_security_pam_modules_h" = yes -a \
7149    "$enable_shared" = yes; then
7150	LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS pam"
7151fi
7152
7153case "${host}" in
7154*-*-irix[[56]]*) LIB_AUTH_SUBDIRS="$LIB_AUTH_SUBDIRS afskauthlib" ;;
7155esac
7156
7157AC_MSG_RESULT($LIB_AUTH_SUBDIRS)
7158
7159AC_SUBST(LIB_AUTH_SUBDIRS)dnl
7160])
7161
7162dnl
7163dnl $Id: destdirs.m4,v 1.2 2002/08/12 15:12:50 joda Exp $
7164dnl
7165
7166AC_DEFUN([rk_DESTDIRS], [
7167# This is done by AC_OUTPUT but we need the result here.
7168test "x$prefix" = xNONE && prefix=$ac_default_prefix
7169test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
7170
7171AC_FOREACH([rk_dir], [bin lib libexec localstate sbin sysconf], [
7172	x="${rk_dir[]dir}"
7173	eval y="$x"
7174	while test "x$y" != "x$x"; do
7175		x="$y"
7176		eval y="$x"
7177	done
7178	AC_DEFINE_UNQUOTED(AS_TR_CPP(rk_dir[]dir), "$x", [path to ]rk_dir[])])
7179])
7180
7181