1dnl aclocal.m4 generated automatically by aclocal 1.4
2
3dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4dnl This file is free software; the Free Software Foundation
5dnl gives unlimited permission to copy and/or distribute it,
6dnl with or without modifications, as long as this notice is preserved.
7
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11dnl PARTICULAR PURPOSE.
12
13dnl
14dnl AC_LBL_LIBRARY_NET
15dnl
16dnl This test is for network applications that need socket() and
17dnl gethostbyname() -ish functions.  Under Solaris, those applications
18dnl need to link with "-lsocket -lnsl".  Under IRIX, they need to link
19dnl with "-lnsl" but should *not* link with "-lsocket" because
20dnl libsocket.a breaks a number of things (for instance:
21dnl gethostbyname() under IRIX 5.2, and snoop sockets under most
22dnl versions of IRIX).
23dnl
24dnl Unfortunately, many application developers are not aware of this,
25dnl and mistakenly write tests that cause -lsocket to be used under
26dnl IRIX.  It is also easy to write tests that cause -lnsl to be used
27dnl under operating systems where neither are necessary (or useful),
28dnl such as SunOS 4.1.4, which uses -lnsl for TLI.
29dnl
30dnl This test exists so that every application developer does not test
31dnl this in a different, and subtly broken fashion.
32
33dnl It has been argued that this test should be broken up into two
34dnl seperate tests, one for the resolver libraries, and one for the
35dnl libraries necessary for using Sockets API. Unfortunately, the two
36dnl are carefully intertwined and allowing the autoconf user to use
37dnl them independantly potentially results in unfortunate ordering
38dnl dependancies -- as such, such component macros would have to
39dnl carefully use indirection and be aware if the other components were
40dnl executed. Since other autoconf macros do not go to this trouble,
41dnl and almost no applications use sockets without the resolver, this
42dnl complexity has not been implemented.
43dnl
44dnl The check for libresolv is in case you are attempting to link
45dnl statically and happen to have a libresolv.a lying around (and no
46dnl libnsl.a).
47dnl
48AC_DEFUN(AC_LBL_LIBRARY_NET, [
49    # Most operating systems have gethostbyname() in the default searched
50    # libraries (i.e. libc):
51    AC_CHECK_FUNC(gethostbyname, ,
52        # Some OSes (eg. Solaris) place it in libnsl:
53        AC_CHECK_LIB(nsl, gethostbyname, ,
54            # Some strange OSes (SINIX) have it in libsocket:
55            AC_CHECK_LIB(socket, gethostbyname, ,
56                # Unfortunately libsocket sometimes depends on libnsl.
57                # AC_CHECK_LIB's API is essentially broken so the
58                # following ugliness is necessary:
59                AC_CHECK_LIB(socket, gethostbyname,
60                    LIBS="-lsocket -lnsl $LIBS",
61                    AC_CHECK_LIB(resolv, gethostbyname),
62                    -lnsl))))
63    AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket, ,
64        AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", ,
65            -lnsl)))
66    # DLPI needs putmsg under HPUX so test for -lstr while we're at it
67    AC_CHECK_LIB(str, putmsg)
68    ])
69
70# Do all the work for Automake.  This macro actually does too much --
71# some checks are only needed if your package does certain things.
72# But this isn't really a big deal.
73
74# serial 1
75
76dnl Usage:
77dnl AM_INIT_AUTOMAKE(package,version, [no-define])
78
79AC_DEFUN(AM_INIT_AUTOMAKE,
80[AC_REQUIRE([AC_PROG_INSTALL])
81PACKAGE=[$1]
82AC_SUBST(PACKAGE)
83VERSION=[$2]
84AC_SUBST(VERSION)
85dnl test to see if srcdir already configured
86if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
87  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
88fi
89ifelse([$3],,
90AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
91AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
92AC_REQUIRE([AM_SANITY_CHECK])
93AC_REQUIRE([AC_ARG_PROGRAM])
94dnl FIXME This is truly gross.
95missing_dir=`cd $ac_aux_dir && pwd`
96AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
97AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
98AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
99AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
100AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
101AC_REQUIRE([AC_PROG_MAKE_SET])])
102
103#
104# Check to make sure that the build environment is sane.
105#
106
107AC_DEFUN(AM_SANITY_CHECK,
108[AC_MSG_CHECKING([whether build environment is sane])
109# Just in case
110sleep 1
111echo timestamp > conftestfile
112# Do `set' in a subshell so we don't clobber the current shell's
113# arguments.  Must try -L first in case configure is actually a
114# symlink; some systems play weird games with the mod time of symlinks
115# (eg FreeBSD returns the mod time of the symlink's containing
116# directory).
117if (
118   set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
119   if test "[$]*" = "X"; then
120      # -L didn't work.
121      set X `ls -t $srcdir/configure conftestfile`
122   fi
123   if test "[$]*" != "X $srcdir/configure conftestfile" \
124      && test "[$]*" != "X conftestfile $srcdir/configure"; then
125
126      # If neither matched, then we have a broken ls.  This can happen
127      # if, for instance, CONFIG_SHELL is bash and it inherits a
128      # broken ls alias from the environment.  This has actually
129      # happened.  Such a system could not be considered "sane".
130      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
131alias in your environment])
132   fi
133
134   test "[$]2" = conftestfile
135   )
136then
137   # Ok.
138   :
139else
140   AC_MSG_ERROR([newly created file is older than distributed files!
141Check your system clock])
142fi
143rm -f conftest*
144AC_MSG_RESULT(yes)])
145
146dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
147dnl The program must properly implement --version.
148AC_DEFUN(AM_MISSING_PROG,
149[AC_MSG_CHECKING(for working $2)
150# Run test in a subshell; some versions of sh will print an error if
151# an executable is not found, even if stderr is redirected.
152# Redirect stdin to placate older versions of autoconf.  Sigh.
153if ($2 --version) < /dev/null > /dev/null 2>&1; then
154   $1=$2
155   AC_MSG_RESULT(found)
156else
157   $1="$3/missing $2"
158   AC_MSG_RESULT(missing)
159fi
160AC_SUBST($1)])
161
162# Like AC_CONFIG_HEADER, but automatically create stamp file.
163
164AC_DEFUN(AM_CONFIG_HEADER,
165[AC_PREREQ([2.12])
166AC_CONFIG_HEADER([$1])
167dnl When config.status generates a header, we must update the stamp-h file.
168dnl This file resides in the same directory as the config header
169dnl that is generated.  We must strip everything past the first ":",
170dnl and everything past the last "/".
171AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
172ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
173<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
174<<am_indx=1
175for am_file in <<$1>>; do
176  case " <<$>>CONFIG_HEADERS " in
177  *" <<$>>am_file "*<<)>>
178    echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
179    ;;
180  esac
181  am_indx=`expr "<<$>>am_indx" + 1`
182done<<>>dnl>>)
183changequote([,]))])
184
185