| 1 | # Do all the work for Automake. This macro actually does too much --
|
|---|
| 2 | # some checks are only needed if your package does certain things.
|
|---|
| 3 | # But this isn't really a big deal.
|
|---|
| 4 |
|
|---|
| 5 | # serial 5
|
|---|
| 6 |
|
|---|
| 7 | # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
|
|---|
| 8 | # written in clear, in which case automake, when reading aclocal.m4,
|
|---|
| 9 | # will think it sees a *use*, and therefore will trigger all it's
|
|---|
| 10 | # C support machinery. Also note that it means that autoscan, seeing
|
|---|
| 11 | # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 | # We require 2.13 because we rely on SHELL being computed by configure.
|
|---|
| 15 | AC_PREREQ([2.13])
|
|---|
| 16 |
|
|---|
| 17 | # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
|
|---|
| 18 | # -----------------------------------------------------------
|
|---|
| 19 | # If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED.
|
|---|
| 20 | # The purpose of this macro is to provide the user with a means to
|
|---|
| 21 | # check macros which are provided without letting her know how the
|
|---|
| 22 | # information is coded.
|
|---|
| 23 | # If this macro is not defined by Autoconf, define it here.
|
|---|
| 24 | ifdef([AC_PROVIDE_IFELSE],
|
|---|
| 25 | [],
|
|---|
| 26 | [define([AC_PROVIDE_IFELSE],
|
|---|
| 27 | [ifdef([AC_PROVIDE_$1],
|
|---|
| 28 | [$2], [$3])])])
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 | # AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE])
|
|---|
| 32 | # ----------------------------------------------
|
|---|
| 33 | AC_DEFUN([AM_INIT_AUTOMAKE],
|
|---|
| 34 | [AC_REQUIRE([AC_PROG_INSTALL])dnl
|
|---|
| 35 | # test to see if srcdir already configured
|
|---|
| 36 | if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" &&
|
|---|
| 37 | test -f $srcdir/config.status; then
|
|---|
| 38 | AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first])
|
|---|
| 39 | fi
|
|---|
| 40 |
|
|---|
| 41 | # Define the identity of the package.
|
|---|
| 42 | PACKAGE=$1
|
|---|
| 43 | AC_SUBST(PACKAGE)dnl
|
|---|
| 44 | VERSION=$2
|
|---|
| 45 | AC_SUBST(VERSION)dnl
|
|---|
| 46 | ifelse([$3],,
|
|---|
| 47 | [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
|---|
| 48 | AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])
|
|---|
| 49 |
|
|---|
| 50 | # Autoconf 2.50 wants to disallow AM_ names. We explicitly allow
|
|---|
| 51 | # the ones we care about.
|
|---|
| 52 | ifdef([m4_pattern_allow],
|
|---|
| 53 | [m4_pattern_allow([^AM_[A-Z]+FLAGS])])dnl
|
|---|
| 54 |
|
|---|
| 55 | # Autoconf 2.50 always computes EXEEXT. However we need to be
|
|---|
| 56 | # compatible with 2.13, for now. So we always define EXEEXT, but we
|
|---|
| 57 | # don't compute it.
|
|---|
| 58 | AC_SUBST(EXEEXT)
|
|---|
| 59 | # Similar for OBJEXT -- only we only use OBJEXT if the user actually
|
|---|
| 60 | # requests that it be used. This is a bit dumb.
|
|---|
| 61 | : ${OBJEXT=o}
|
|---|
| 62 | AC_SUBST(OBJEXT)
|
|---|
| 63 |
|
|---|
| 64 | # Some tools Automake needs.
|
|---|
| 65 | AC_REQUIRE([AM_SANITY_CHECK])dnl
|
|---|
| 66 | AC_REQUIRE([AC_ARG_PROGRAM])dnl
|
|---|
| 67 | AM_MISSING_PROG(ACLOCAL, aclocal)
|
|---|
| 68 | AM_MISSING_PROG(AUTOCONF, autoconf)
|
|---|
| 69 | AM_MISSING_PROG(AUTOMAKE, automake)
|
|---|
| 70 | AM_MISSING_PROG(AUTOHEADER, autoheader)
|
|---|
| 71 | AM_MISSING_PROG(MAKEINFO, makeinfo)
|
|---|
| 72 | AM_MISSING_PROG(AMTAR, tar)
|
|---|
| 73 | AM_PROG_INSTALL_SH
|
|---|
| 74 | AM_PROG_INSTALL_STRIP
|
|---|
| 75 | # We need awk for the "check" target. The system "awk" is bad on
|
|---|
| 76 | # some platforms.
|
|---|
| 77 | AC_REQUIRE([AC_PROG_AWK])dnl
|
|---|
| 78 | AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
|---|
| 79 | AC_REQUIRE([AM_DEP_TRACK])dnl
|
|---|
| 80 | AC_REQUIRE([AM_SET_DEPDIR])dnl
|
|---|
| 81 | AC_PROVIDE_IFELSE([AC_PROG_][CC],
|
|---|
| 82 | [_AM_DEPENDENCIES(CC)],
|
|---|
| 83 | [define([AC_PROG_][CC],
|
|---|
| 84 | defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl
|
|---|
| 85 | AC_PROVIDE_IFELSE([AC_PROG_][CXX],
|
|---|
| 86 | [_AM_DEPENDENCIES(CXX)],
|
|---|
| 87 | [define([AC_PROG_][CXX],
|
|---|
| 88 | defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl
|
|---|
| 89 | ])
|
|---|