| 1 | dnl----- Common files distribution --------------------------- *@--NOTICE--@* |
| 2 | dnl |
| 3 | dnl $Id: aclocal.m4,v 1.1 2000/05/21 11:28:30 mdw Exp $ |
| 4 | |
| 5 | dnl --- *@-AM_INIT_AUTOMAKE-@* |
| 6 | dnl |
| 7 | dnl Author: Unknown |
| 8 | dnl |
| 9 | dnl Synopsis: AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) |
| 10 | dnl |
| 11 | dnl Arguments: PACKAGE = package name |
| 12 | dnl VERSION = version number |
| 13 | dnl NO-DEFINE = if set, don't define package and version number |
| 14 | dnl |
| 15 | dnl Use: Do all the work for Automake. This macro actually does too |
| 16 | dnl much -- some checks are only needed if your package does |
| 17 | dnl certain things. But this isn't really a big deal. |
| 18 | |
| 19 | # serial 1 |
| 20 | |
| 21 | AC_DEFUN(AM_INIT_AUTOMAKE, |
| 22 | [AC_REQUIRE([AM_PROG_INSTALL]) |
| 23 | PACKAGE=[$1] |
| 24 | AC_SUBST(PACKAGE) |
| 25 | VERSION=[$2] |
| 26 | AC_SUBST(VERSION) |
| 27 | dnl test to see if srcdir already configured |
| 28 | if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then |
| 29 | AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) |
| 30 | fi |
| 31 | ifelse([$3],, |
| 32 | AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") |
| 33 | AC_DEFINE_UNQUOTED(VERSION, "$VERSION")) |
| 34 | AM_SANITY_CHECK |
| 35 | AC_ARG_PROGRAM |
| 36 | dnl FIXME This is truly gross. |
| 37 | missing_dir=`cd $ac_aux_dir && pwd` |
| 38 | AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) |
| 39 | AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) |
| 40 | AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) |
| 41 | AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) |
| 42 | AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) |
| 43 | AC_PROG_MAKE_SET]) |
| 44 | |
| 45 | dnl --- *@-AM_PROG_INSTALL-@* --- |
| 46 | dnl |
| 47 | dnl Author: Franc,ois Pinard |
| 48 | dnl |
| 49 | dnl Synopsis: AM_PROG_INSTALL |
| 50 | dnl |
| 51 | dnl Arguments: --- |
| 52 | dnl |
| 53 | dnl Use: Calls `AC_PROG_INSTALL' to find an installer. Then it sets |
| 54 | dnl `INSTALL_SCRIPT' to a suitable value if necessary. |
| 55 | |
| 56 | # serial 1 |
| 57 | |
| 58 | AC_DEFUN(AM_PROG_INSTALL, |
| 59 | [AC_PROG_INSTALL |
| 60 | test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL} -m 755' |
| 61 | AC_SUBST(INSTALL_SCRIPT)dnl |
| 62 | ]) |
| 63 | |
| 64 | dnl --- *@-AM_MISSING_PROG-@* --- |
| 65 | dnl |
| 66 | dnl Author: Unknown |
| 67 | dnl |
| 68 | dnl Synopsis: AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) |
| 69 | dnl |
| 70 | dnl Arguments: NAME = variable to set to the file's location |
| 71 | dnl PROGRAM = name of program to find |
| 72 | dnl DIRECTORY = directory to look in |
| 73 | dnl |
| 74 | dnl Use: Fakes existence of a useful GNU maintainer tool. |
| 75 | |
| 76 | AC_DEFUN(AM_MISSING_PROG, |
| 77 | [AC_MSG_CHECKING(for working $2) |
| 78 | # Run test in a subshell; some versions of sh will print an error if |
| 79 | # an executable is not found, even if stderr is redirected. |
| 80 | # Redirect stdin to placate older versions of autoconf. Sigh. |
| 81 | if ($2 --version) < /dev/null > /dev/null 2>&1; then |
| 82 | $1=$2 |
| 83 | AC_MSG_RESULT(found) |
| 84 | else |
| 85 | $1="$3/missing $2" |
| 86 | AC_MSG_RESULT(missing) |
| 87 | fi |
| 88 | AC_SUBST($1)]) |
| 89 | |
| 90 | dnl --- *@-AM_SANITY_CHECK-@* |
| 91 | dnl |
| 92 | dnl Author: Unknown |
| 93 | dnl |
| 94 | dnl Synopsis: AM_SANITY_CHECK |
| 95 | dnl |
| 96 | dnl Arguments: --- |
| 97 | dnl |
| 98 | dnl Use: Check for build environment sanity. |
| 99 | |
| 100 | AC_DEFUN(AM_SANITY_CHECK, |
| 101 | [AC_MSG_CHECKING([whether build environment is sane]) |
| 102 | # Just in case |
| 103 | sleep 1 |
| 104 | echo timestamp > conftestfile |
| 105 | # Do `set' in a subshell so we don't clobber the current shell's |
| 106 | # arguments. Must try -L first in case configure is actually a |
| 107 | # symlink; some systems play weird games with the mod time of symlinks |
| 108 | # (eg FreeBSD returns the mod time of the symlink's containing |
| 109 | # directory). |
| 110 | if ( |
| 111 | set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` |
| 112 | if test "$@" = "X"; then |
| 113 | # -L didn't work. |
| 114 | set X `ls -t $srcdir/configure conftestfile` |
| 115 | fi |
| 116 | test "[$]2" = conftestfile |
| 117 | ) |
| 118 | then |
| 119 | # Ok. |
| 120 | : |
| 121 | else |
| 122 | AC_MSG_ERROR([newly created file is older than distributed files! |
| 123 | Check your system clock]) |
| 124 | fi |
| 125 | rm -f conftest* |
| 126 | AC_MSG_RESULT(yes)]) |
| 127 | |
| 128 | dnl --- *@-mdw_GCC_FLAGS-@* --- |
| 129 | dnl |
| 130 | dnl Author: Mark Wooding |
| 131 | dnl |
| 132 | dnl Synopsis: mdw_GCC_FLAGS([FLAGS], [CFLAGS], [C++FLAGS]) |
| 133 | dnl |
| 134 | dnl Arguments: FLAGS = GCC compiler flags to add (default is |
| 135 | dnl `-pedantic -Wall') |
| 136 | dnl CFLAGS = GCC C compiler flags to add (default is empty) |
| 137 | dnl C++FLAGS = GCC C++ compiler flags to add (default is |
| 138 | dnl `-fhandle-exceptions'). |
| 139 | dnl |
| 140 | dnl Use: If the C compiler is GCC, add the compiler flags. |
| 141 | |
| 142 | AC_DEFUN(mdw_GCC_FLAGS, |
| 143 | [if test "$GCC" = "yes"; then |
| 144 | CFLAGS="$CFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])" |
| 145 | CFLAGS="$CFLAGS ifelse([$2], [], [], [$2])" |
| 146 | fi |
| 147 | if test "$GXX" = "yes"; then |
| 148 | CXXFLAGS="$CXXFLAGS ifelse([$1], [], [-pedantic -Wall], [$1])" |
| 149 | CXXFLAGS="$CXXFLAGS ifelse([$3], [], [-fhandle-exceptions], [$3])" |
| 150 | fi]) |
| 151 | |