* confh4.test: Corrected final test.
[automake.git] / aclocal.m4
blob891da2c2084ff66fab312981858123c08eebbcbb
1 dnl aclocal.m4 generated automatically by aclocal 1.4a
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
13 # Do all the work for Automake.  This macro actually does too much --
14 # some checks are only needed if your package does certain things.
15 # But this isn't really a big deal.
17 # serial 1
19 dnl Usage:
20 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
22 AC_DEFUN(AM_INIT_AUTOMAKE,
23 [AC_REQUIRE([AC_PROG_INSTALL])
24 dnl We require 2.13 because we rely on SHELL being computed by configure.
25 AC_PREREQ([2.13])
26 PACKAGE=[$1]
27 AC_SUBST(PACKAGE)
28 VERSION=[$2]
29 AC_SUBST(VERSION)
30 dnl test to see if srcdir already configured
31 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
32   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
34 ifelse([$3],,
35 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
36 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
37 AC_REQUIRE([AM_SANITY_CHECK])
38 AC_REQUIRE([AC_ARG_PROGRAM])
39 dnl FIXME This is truly gross.
40 missing_dir=`cd $ac_aux_dir && pwd`
41 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
42 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
43 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
44 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
45 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
46 dnl Set install_sh for make dist
47 install_sh="$missing_dir/install-sh"
48 test -f "$install_sh" || install_sh="$missing_dir/install.sh"
49 AC_SUBST(install_sh)
50 dnl We check for tar when the user configures the end package.
51 dnl This is sad, since we only need this for "dist".  However,
52 dnl there's no other good way to do it.  We prefer GNU tar if
53 dnl we can find it.  If we can't find a tar, it doesn't really matter.
54 AC_CHECK_PROGS(AMTAR, gnutar gtar tar)
55 dnl We need awk for the "check" target.  The system "awk" is bad on
56 dnl some platforms.
57 AC_REQUIRE([AC_PROG_AWK])
58 AMTARFLAGS=
59 if test -n "$AMTAR"; then
60   if $SHELL -c "$AMTAR --version" > /dev/null 2>&1; then
61     dnl We have GNU tar.
62     AMTARFLAGS=o
63   fi
65 AC_SUBST(AMTARFLAGS)
66 AC_REQUIRE([AC_PROG_MAKE_SET])])
69 # Check to make sure that the build environment is sane.
72 AC_DEFUN(AM_SANITY_CHECK,
73 [AC_MSG_CHECKING([whether build environment is sane])
74 # Just in case
75 sleep 1
76 echo timestamp > conftestfile
77 # Do `set' in a subshell so we don't clobber the current shell's
78 # arguments.  Must try -L first in case configure is actually a
79 # symlink; some systems play weird games with the mod time of symlinks
80 # (eg FreeBSD returns the mod time of the symlink's containing
81 # directory).
82 if (
83    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
84    if test "[$]*" = "X"; then
85       # -L didn't work.
86       set X `ls -t $srcdir/configure conftestfile`
87    fi
88    if test "[$]*" != "X $srcdir/configure conftestfile" \
89       && test "[$]*" != "X conftestfile $srcdir/configure"; then
91       # If neither matched, then we have a broken ls.  This can happen
92       # if, for instance, CONFIG_SHELL is bash and it inherits a
93       # broken ls alias from the environment.  This has actually
94       # happened.  Such a system could not be considered "sane".
95       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
96 alias in your environment])
97    fi
99    test "[$]2" = conftestfile
100    )
101 then
102    # Ok.
103    :
104 else
105    AC_MSG_ERROR([newly created file is older than distributed files!
106 Check your system clock])
108 rm -f conftest*
109 AC_MSG_RESULT(yes)])
111 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
112 dnl The program must properly implement --version.
113 AC_DEFUN(AM_MISSING_PROG,
114 [AC_MSG_CHECKING(for working $2)
115 # Run test in a subshell; some versions of sh will print an error if
116 # an executable is not found, even if stderr is redirected.
117 # Redirect stdin to placate older versions of autoconf.  Sigh.
118 if ($2 --version) < /dev/null > /dev/null 2>&1; then
119    $1=$2
120    AC_MSG_RESULT(found)
121 else
122    $1="$3/missing $2"
123    AC_MSG_RESULT(missing)
125 AC_SUBST($1)])