From: Akim Demaille Date: Wed, 25 Oct 2000 17:51:10 +0000 (+0000) Subject: Move the Autoconf independent shell macros into the file X-Git-Tag: autoconf-2.50~521 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a14a5e7ca516cee29c1bf96d7527d055dfb66f4e;p=thirdparty%2Fautoconf.git Move the Autoconf independent shell macros into the file `shell.m4' and the name space `AS_*'. * acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET) (AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to... * shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P) (AS_DIRNAME): here, a new file. Adjust all dependencies. * tests/base.m4 (m4_wrap): Eve out into... * tests/shell.m4: here, new file. * tests/base.m4 (AC_SHELL_MKDIR_P) (AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into... * tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED): here, new file. Adjust the test suite. --- diff --git a/ChangeLog b/ChangeLog index 21304f574..4ff5c7e70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2000-10-25 Akim Demaille + + Move the Autoconf independent shell macros into the file + `shell.m4' and the name space `AS_*'. + + * acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET) + (AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to... + * shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P) + (AS_DIRNAME): here, a new file. + Adjust all dependencies. + + * tests/base.m4 (m4_wrap): Eve out into... + * tests/shell.m4: here, new file. + * tests/base.m4 (AC_SHELL_MKDIR_P) + (AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into... + * tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED): + here, new file. + Adjust the test suite. + 2000-10-25 Akim Demaille * acgeneral.m4 (AC_SHELL_DIRNAME): Split its code into... diff --git a/Makefile.am b/Makefile.am index 1afcddf5b..4729717a7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,9 +35,13 @@ EXTRA_SCRIPTS = autoscan # s/nodistpackageDATA/nodist_pkgdata_DATA/ # and adapt dependencies once we use a more recent Automake +m4sources = m4sugar.m4 shell.m4 \ + autoconf.m4 \ + acgeneral.m4 acoldnames.m4 acspecific.m4 aclang.m4 acversion.m4 \ + acfunctions.m4 + distpkgdataDATA = acfunctions acheaders acidentifiers acmakevars acprograms \ - m4sugar.m4 acgeneral.m4 acoldnames.m4 acspecific.m4 \ - autoconf.m4 aclang.m4 acversion.m4 acfunctions.m4 + $(m4sources) nodistpkgdataDATA = autoconf.m4f @@ -143,10 +147,7 @@ editpl = sed \ .m4.m4f: $(M4) -I $(srcdir) $(srcdir)/$*.m4 --freeze-state=$*.m4f -common = m4sugar.m4 acgeneral.m4 acspecific.m4 acoldnames.m4 acversion.m4 \ - aclang.m4 acfunctions.m4 - -autoconf.m4f: autoconf.m4 $(common) +autoconf.m4f: $(m4sources) ## ---------- ## diff --git a/Makefile.in b/Makefile.in index 94f0e005b..f1b5d0df9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -80,7 +80,10 @@ EXTRA_SCRIPTS = autoscan # s/nodistpackageDATA/nodist_pkgdata_DATA/ # and adapt dependencies once we use a more recent Automake -distpkgdataDATA = acfunctions acheaders acidentifiers acmakevars acprograms m4sugar.m4 acgeneral.m4 acoldnames.m4 acspecific.m4 autoconf.m4 aclang.m4 acversion.m4 acfunctions.m4 +m4sources = m4sugar.m4 shell.m4 autoconf.m4 acgeneral.m4 acoldnames.m4 acspecific.m4 aclang.m4 acversion.m4 acfunctions.m4 + + +distpkgdataDATA = acfunctions acheaders acidentifiers acmakevars acprograms $(m4sources) nodistpkgdataDATA = autoconf.m4f @@ -103,9 +106,6 @@ editsh = sed -e 's,@datadir\@,$(pkgdatadir),g' -e 's,@M4\@,$(M4),g' -e 's,@AW editpl = sed -e 's,@datadir\@,$(pkgdatadir),g' -e 's,@PERL\@,$(PERL),g' -e 's,@VERSION\@,$(VERSION),g' -e 's,@PACKAGE\@,$(PACKAGE),g' - -common = m4sugar.m4 acgeneral.m4 acspecific.m4 acoldnames.m4 acversion.m4 aclang.m4 acfunctions.m4 - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = @@ -458,7 +458,7 @@ $(bin_SCRIPTS): configure.in .m4.m4f: $(M4) -I $(srcdir) $(srcdir)/$*.m4 --freeze-state=$*.m4f -autoconf.m4f: autoconf.m4 $(common) +autoconf.m4f: $(m4sources) wget-update: $(WGET) ftp://ftp.gnu.org/gnu/GNUinfo/standards.texi -O $(srcdir)/doc/standards.texi diff --git a/acfunctions.m4 b/acfunctions.m4 index 85c6cc6e9..f7351ddab 100644 --- a/acfunctions.m4 +++ b/acfunctions.m4 @@ -69,8 +69,8 @@ AC_CACHE_CHECK([for $1], ac_var, [AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])], [AC_VAR_SET(ac_var, yes)], [AC_VAR_SET(ac_var, no)])]) -AC_SHELL_IFELSE([test AC_VAR_GET(ac_var) = yes], - [$2], [$3])dnl +AS_IFELSE([test AC_VAR_GET(ac_var) = yes], + [$2], [$3])dnl AC_VAR_POPDEF([ac_var])dnl ])# AC_CHECK_FUNC diff --git a/acgeneral.m4 b/acgeneral.m4 index 59a953c93..9b3f07911 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -811,133 +811,6 @@ AH_VERBATIM([zzzz]_AH_COUNTER, [$1])]) define([_AH_COUNTER], [0]) -## --------------------- ## -## Some /bin/sh idioms. ## -## --------------------- ## - - -# AC_SHELL_IFELSE(TEST, [IF-TRUE], [IF-FALSE]) -# -------------------------------------------- -# Expand into -# | if TEST; then -# | IF-TRUE -# | else -# | IF-FALSE -# | fi -# with simplifications is IF-TRUE and/or IF-FALSE is empty. -define([AC_SHELL_IFELSE], -[ifval([$2$3], -[if $1; then - ifval([$2], [$2], :) -m4_ifvanl([$3], -[else - $3])dnl -fi -])dnl -])# AC_SHELL_IFELSE - - -# _AC_SHELL_TMPDIR(PREFIX) -# ------------------------ -# Create as safely as possible a temporary directory which name is -# inspired by PREFIX (should be 2-4 chars max), and set trap -# mechanisms to remove it. -define([_AC_SHELL_TMPDIR], -[# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap 'exit $?' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} -{ - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/$1XXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=$TMPDIR/$1$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - exit 1; -}dnl -])# _AC_SHELL_TMPDIR - - -# AC_SHELL_UNSET(VAR, [VALUE-IF-UNSET-NOT-SUPPORTED = `']) -# -------------------------------------------------------- -# Try to unset the env VAR, otherwise set it to -# VALUE-IF-UNSET-NOT-SUPPORTED. `ac_unset' must have been computed. -define([AC_SHELL_UNSET], -[$ac_unset $1 || test "${$1+set}" != set || { $1=$2; export $1; }]) - - -# AC_SHELL_MKDIR_P(PATH) -# ---------------------- -# Emulate `mkdir -p' with plain `mkdir'. -define([AC_SHELL_MKDIR_P], -[{ case $1 in - [[\\/]]* | ?:[[\\/]]* ) ac_incr_dir=;; - *) ac_incr_dir=.;; -esac -ac_dummy="$1" -for ac_mkdir_dir in `IFS=/; set X $ac_dummy; shift; echo "$[@]"`; do - ac_incr_dir=$ac_incr_dir/$ac_mkdir_dir - test -d $ac_incr_dir || mkdir $ac_incr_dir -done; } -])# AC_SHELL_MKDIR_P - - -# AC_SHELL_DIRNAME(PATHNAME) -# -------------------------- -# Simulate running `dirname(1)' on PATHNAME, not all systems have it. -# This macro must be usable from inside ` `. -# -# Paul Eggert answers: -# Question: Under UN*X, should `//1' give `/'? -# -# No, under some older flavors of Unix, leading // is a special path -# name: it refers to a "super-root" and is used to access other -# machines' files. Leading ///, ////, etc. are equivalent to /; but -# leading // is special. I think this tradition started with Apollo -# Domain/OS, an OS that is still in use on some older hosts. -# -# POSIX.2 allows but does not require the special treatment for //. -# It says that the behavior of dirname on path names of the form -# //([^/]+/*)? is implementation defined. In these cases, GNU dirname -# returns /, but it's more portable to return // as this works even on -# those older flavors of Unix. -# -# I have heard rumors that this special treatment of // may be dropped -# in future versions of POSIX, but for now it's still the standard. -# -# Prefer expr to echo|sed, since expr is usually faster and it handles -# backslashes and newlines correctly. However, older expr -# implementations (e.g. SunOS 4 expr and Solaris 8 /usr/ucb/expr) have -# a silly length limit that causes expr to fail if the matched -# substring is longer than 120 bytes. So fall back on echo|sed if -# expr fails. -define([AC_SHELL_DIRNAME_EXPR], -[expr X[]$1 : 'X\(.*[[^/]]\)//*[[^/][^/]]*/*$' \| \ - X[]$1 : 'X\(//\)[[^/]]' \| \ - X[]$1 : 'X\(//\)$' \| \ - X[]$1 : 'X\(/\)' \| \ - . : '\(.\)']) - -define([AC_SHELL_DIRNAME_SED], -[echo "X[]$1" | - sed ['/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q']]) - -define([AC_SHELL_DIRNAME], -[AC_SHELL_DIRNAME_EXPR([$1]) 2>/dev/null || -AC_SHELL_DIRNAME_SED([$1])]) ## --------------------------------------------------- ## @@ -999,7 +872,7 @@ define([AC_VAR_TEST_SET], # Implement a shell `if-then-else' depending whether VARIABLE is set # or not. Polymorphic. define([AC_VAR_SET_IFELSE], -[AC_SHELL_IFELSE([AC_VAR_TEST_SET([$1])], [$2], [$3])]) +[AS_IFELSE([AC_VAR_TEST_SET([$1])], [$2], [$3])]) # AC_VAR_PUSHDEF and AC_VAR_POPDEF @@ -1946,14 +1819,14 @@ else fi # NLS nuisances. -AC_SHELL_UNSET([LANG], [C]) -AC_SHELL_UNSET([LC_ALL], [C]) -AC_SHELL_UNSET([LC_TIME], [C]) -AC_SHELL_UNSET([LC_CTYPE], [C]) -AC_SHELL_UNSET([LANGUAGE], [C]) -AC_SHELL_UNSET([LC_COLLATE], [C]) -AC_SHELL_UNSET([LC_NUMERIC], [C]) -AC_SHELL_UNSET([LC_MESSAGES], [C]) +AS_UNSET([LANG], [C]) +AS_UNSET([LC_ALL], [C]) +AS_UNSET([LC_TIME], [C]) +AS_UNSET([LC_CTYPE], [C]) +AS_UNSET([LANGUAGE], [C]) +AS_UNSET([LC_COLLATE], [C]) +AS_UNSET([LC_NUMERIC], [C]) +AS_UNSET([LC_MESSAGES], [C]) # IFS # We need space, tab and new line, in precisely that order. @@ -1962,7 +1835,7 @@ ac_nl=' IFS=" $ac_nl" # CDPATH. -AC_SHELL_UNSET([CDPATH], [:]) +AS_UNSET([CDPATH], [:]) ]) @@ -3052,8 +2925,8 @@ dnl foo.MEMBER; foo.patsubst([$1], [^[^.]*\.]);])], AC_VAR_SET(ac_Member, yes), AC_VAR_SET(ac_Member, no))]) -AC_SHELL_IFELSE([test AC_VAR_GET(ac_Member) = yes], - [$2], [$3])dnl +AS_IFELSE([test AC_VAR_GET(ac_Member) = yes], + [$2], [$3])dnl AC_VAR_POPDEF([ac_Member])dnl ])# AC_CHECK_MEMBER @@ -3300,7 +3173,7 @@ dnl We reimplement AC_MSG_CHECKING (mostly) to avoid the ... in the middle. echo $ECHO_N "checking for prefix by $ECHO_C" >&AC_FD_MSG AC_PATH_PROG(m4_quote(AC_Prog), [$1]) if test -n "$ac_cv_path_[]AC_Prog"; then - prefix=`AC_SHELL_DIRNAME([$ac_cv_path_[]AC_Prog])` + prefix=`AS_DIRNAME([$ac_cv_path_[]AC_Prog])` fi fi popdef([AC_Prog])dnl @@ -3340,7 +3213,7 @@ AC_TRY_LINK_FUNC([$1], break]) done LIBS=$ac_func_search_save_LIBS]) -AC_SHELL_IFELSE([test "$ac_cv_search_$1" != no], +AS_IFELSE([test "$ac_cv_search_$1" != no], [test "$ac_cv_search_$1" = "none required" || LIBS="$ac_cv_search_$1 $LIBS" $3], [$4])[]dnl @@ -3378,9 +3251,9 @@ AC_TRY_LINK_FUNC([$2], [AC_VAR_SET(ac_Lib, yes)], [AC_VAR_SET(ac_Lib, no)]) LIBS=$ac_check_lib_save_LIBS]) -AC_SHELL_IFELSE([test AC_VAR_GET(ac_Lib) = yes], - [m4_default([$3], - [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_LIB$1)) +AS_IFELSE([test AC_VAR_GET(ac_Lib) = yes], + [m4_default([$3], + [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_LIB$1)) LIBS="-l$1 $LIBS" ])], [$4])dnl @@ -3659,8 +3532,8 @@ AC_CACHE_CHECK([for $1], ac_Header, [AC_TRY_CPP([#include <$1> ], AC_VAR_SET(ac_Header, yes), AC_VAR_SET(ac_Header, no))]) -AC_SHELL_IFELSE([test AC_VAR_GET(ac_Header) = yes], - [$2], [$3])dnl +AS_IFELSE([test AC_VAR_GET(ac_Header) = yes], + [$2], [$3])dnl AC_VAR_POPDEF([ac_Header])dnl ])# AC_CHECK_HEADER @@ -3704,8 +3577,8 @@ if test -r "$1"; then else AC_VAR_SET(ac_File, no) fi]) -AC_SHELL_IFELSE([test AC_VAR_GET(ac_File) = yes], - [$2], [$3])dnl +AS_IFELSE([test AC_VAR_GET(ac_File) = yes], + [$2], [$3])dnl AC_VAR_POPDEF([ac_File])dnl ])# AC_CHECK_FILE @@ -3740,8 +3613,8 @@ AC_CACHE_CHECK([whether $1 is declared], ac_Symbol, #endif ])], AC_VAR_SET(ac_Symbol, yes), AC_VAR_SET(ac_Symbol, no))]) -AC_SHELL_IFELSE([test AC_VAR_GET(ac_Symbol) = yes], - [$2], [$3])dnl +AS_IFELSE([test AC_VAR_GET(ac_Symbol) = yes], + [$2], [$3])dnl AC_VAR_POPDEF([ac_Symbol])dnl ])# AC_CHECK_DECL @@ -3972,8 +3845,8 @@ if (sizeof ($1)) return 0;])], AC_VAR_SET(ac_Type, yes), AC_VAR_SET(ac_Type, no))]) -AC_SHELL_IFELSE([test AC_VAR_GET(ac_Type) = yes], - [$2], [$3])dnl +AS_IFELSE([test AC_VAR_GET(ac_Type) = yes], + [$2], [$3])dnl AC_VAR_POPDEF([ac_Type])dnl ])# _AC_CHECK_TYPE_NEW @@ -4716,7 +4589,7 @@ ifset([AC_LIST_COMMANDS], [ : ${CONFIG_COMMANDS=$config_commands} ])dnl fi -_AC_SHELL_TMPDIR(cs) +AS_TMPDIR(cs) EOF ])[]dnl ifval @@ -4872,9 +4745,9 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue esac # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - ac_dir=`AC_SHELL_DIRNAME("$ac_file")` + ac_dir=`AS_DIRNAME("$ac_file")` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - AC_SHELL_MKDIR_P("$ac_dir") + AS_MKDIR_P("$ac_dir") ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo "$ac_dir_suffix" | sed 's,/[[^/]]*,../,g'` @@ -5194,9 +5067,9 @@ cat >>$CONFIG_STATUS <<\EOF if cmp -s $ac_file $tmp/config.h 2>/dev/null; then echo "$ac_file is unchanged" else - ac_dir=`AC_SHELL_DIRNAME("$ac_file")` + ac_dir=`AS_DIRNAME("$ac_file")` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - AC_SHELL_MKDIR_P("$ac_dir") + AS_MKDIR_P("$ac_dir") fi rm -f $ac_file mv $tmp/config.h $ac_file @@ -5245,9 +5118,9 @@ for ac_file in : $CONFIG_LINKS; do test "x$ac_file" = x: && continue rm -f $ac_dest # Make relative symlinks. - ac_dest_dir=`AC_SHELL_DIRNAME("$ac_dest")` + ac_dest_dir=`AS_DIRNAME("$ac_dest")` if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then - AC_SHELL_MKDIR_P("$ac_dest_dir") + AS_MKDIR_P("$ac_dest_dir") ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's,^\./,,'`" # A "../" for each directory in $ac_dest_dir_suffix. ac_dots=`echo $ac_dest_dir_suffix|sed 's,/[[^/]]*,../,g'` @@ -5356,7 +5229,7 @@ AC_PROVIDE_IFELSE([AC_PROG_INSTALL], echo configuring in $ac_subdir case $srcdir in .) ;; - *) AC_SHELL_MKDIR_P(./$ac_subdir) + *) AS_MKDIR_P(./$ac_subdir) if test -d ./$ac_subdir; then :; else AC_MSG_ERROR(cannot create `pwd`/$ac_subdir) @@ -5482,5 +5355,5 @@ ifelse([$2], , [AC_FATAL([$0]: missing argument 2)])dnl fi done - AC_SHELL_IFELSE([test x"$ac_exists" = xtrue], [$3], [$4]) + AS_IFELSE([test x"$ac_exists" = xtrue], [$3], [$4]) ]) diff --git a/acspecific.m4 b/acspecific.m4 index d228b5585..31df2c020 100644 --- a/acspecific.m4 +++ b/acspecific.m4 @@ -346,8 +346,8 @@ AC_CACHE_CHECK([for $1 that defines DIR], ac_Header, [DIR *dirp = 0;])], [AC_VAR_SET(ac_Header, yes)], [AC_VAR_SET(ac_Header, no)])]) -AC_SHELL_IFELSE([test AC_VAR_GET(ac_Header) = yes], - [$2], [$3])dnl +AS_IFELSE([test AC_VAR_GET(ac_Header) = yes], + [$2], [$3])dnl AC_VAR_POPDEF([ac_Header])dnl ])# _AC_CHECK_HEADER_DIRENT diff --git a/autoconf.m4 b/autoconf.m4 index bd03d4381..5ee3690c0 100644 --- a/autoconf.m4 +++ b/autoconf.m4 @@ -23,6 +23,9 @@ include(m4sugar.m4)# -*- Autoconf -*- # Do not sinclude acsite.m4 here, because it may not be installed # yet when Autoconf is frozen. # Do not sinclude ./aclocal.m4 here, to prevent it from being frozen. + +m4_include(shell.m4) + m4_include(acversion.m4) m4_include(acgeneral.m4) m4_include(aclang.m4) diff --git a/lib/autoconf/autoconf.m4 b/lib/autoconf/autoconf.m4 index bd03d4381..5ee3690c0 100644 --- a/lib/autoconf/autoconf.m4 +++ b/lib/autoconf/autoconf.m4 @@ -23,6 +23,9 @@ include(m4sugar.m4)# -*- Autoconf -*- # Do not sinclude acsite.m4 here, because it may not be installed # yet when Autoconf is frozen. # Do not sinclude ./aclocal.m4 here, to prevent it from being frozen. + +m4_include(shell.m4) + m4_include(acversion.m4) m4_include(acgeneral.m4) m4_include(aclang.m4) diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 index 85c6cc6e9..f7351ddab 100644 --- a/lib/autoconf/functions.m4 +++ b/lib/autoconf/functions.m4 @@ -69,8 +69,8 @@ AC_CACHE_CHECK([for $1], ac_var, [AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])], [AC_VAR_SET(ac_var, yes)], [AC_VAR_SET(ac_var, no)])]) -AC_SHELL_IFELSE([test AC_VAR_GET(ac_var) = yes], - [$2], [$3])dnl +AS_IFELSE([test AC_VAR_GET(ac_var) = yes], + [$2], [$3])dnl AC_VAR_POPDEF([ac_var])dnl ])# AC_CHECK_FUNC diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 59a953c93..9b3f07911 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -811,133 +811,6 @@ AH_VERBATIM([zzzz]_AH_COUNTER, [$1])]) define([_AH_COUNTER], [0]) -## --------------------- ## -## Some /bin/sh idioms. ## -## --------------------- ## - - -# AC_SHELL_IFELSE(TEST, [IF-TRUE], [IF-FALSE]) -# -------------------------------------------- -# Expand into -# | if TEST; then -# | IF-TRUE -# | else -# | IF-FALSE -# | fi -# with simplifications is IF-TRUE and/or IF-FALSE is empty. -define([AC_SHELL_IFELSE], -[ifval([$2$3], -[if $1; then - ifval([$2], [$2], :) -m4_ifvanl([$3], -[else - $3])dnl -fi -])dnl -])# AC_SHELL_IFELSE - - -# _AC_SHELL_TMPDIR(PREFIX) -# ------------------------ -# Create as safely as possible a temporary directory which name is -# inspired by PREFIX (should be 2-4 chars max), and set trap -# mechanisms to remove it. -define([_AC_SHELL_TMPDIR], -[# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap 'exit $?' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} -{ - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/$1XXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=$TMPDIR/$1$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 - exit 1; -}dnl -])# _AC_SHELL_TMPDIR - - -# AC_SHELL_UNSET(VAR, [VALUE-IF-UNSET-NOT-SUPPORTED = `']) -# -------------------------------------------------------- -# Try to unset the env VAR, otherwise set it to -# VALUE-IF-UNSET-NOT-SUPPORTED. `ac_unset' must have been computed. -define([AC_SHELL_UNSET], -[$ac_unset $1 || test "${$1+set}" != set || { $1=$2; export $1; }]) - - -# AC_SHELL_MKDIR_P(PATH) -# ---------------------- -# Emulate `mkdir -p' with plain `mkdir'. -define([AC_SHELL_MKDIR_P], -[{ case $1 in - [[\\/]]* | ?:[[\\/]]* ) ac_incr_dir=;; - *) ac_incr_dir=.;; -esac -ac_dummy="$1" -for ac_mkdir_dir in `IFS=/; set X $ac_dummy; shift; echo "$[@]"`; do - ac_incr_dir=$ac_incr_dir/$ac_mkdir_dir - test -d $ac_incr_dir || mkdir $ac_incr_dir -done; } -])# AC_SHELL_MKDIR_P - - -# AC_SHELL_DIRNAME(PATHNAME) -# -------------------------- -# Simulate running `dirname(1)' on PATHNAME, not all systems have it. -# This macro must be usable from inside ` `. -# -# Paul Eggert answers: -# Question: Under UN*X, should `//1' give `/'? -# -# No, under some older flavors of Unix, leading // is a special path -# name: it refers to a "super-root" and is used to access other -# machines' files. Leading ///, ////, etc. are equivalent to /; but -# leading // is special. I think this tradition started with Apollo -# Domain/OS, an OS that is still in use on some older hosts. -# -# POSIX.2 allows but does not require the special treatment for //. -# It says that the behavior of dirname on path names of the form -# //([^/]+/*)? is implementation defined. In these cases, GNU dirname -# returns /, but it's more portable to return // as this works even on -# those older flavors of Unix. -# -# I have heard rumors that this special treatment of // may be dropped -# in future versions of POSIX, but for now it's still the standard. -# -# Prefer expr to echo|sed, since expr is usually faster and it handles -# backslashes and newlines correctly. However, older expr -# implementations (e.g. SunOS 4 expr and Solaris 8 /usr/ucb/expr) have -# a silly length limit that causes expr to fail if the matched -# substring is longer than 120 bytes. So fall back on echo|sed if -# expr fails. -define([AC_SHELL_DIRNAME_EXPR], -[expr X[]$1 : 'X\(.*[[^/]]\)//*[[^/][^/]]*/*$' \| \ - X[]$1 : 'X\(//\)[[^/]]' \| \ - X[]$1 : 'X\(//\)$' \| \ - X[]$1 : 'X\(/\)' \| \ - . : '\(.\)']) - -define([AC_SHELL_DIRNAME_SED], -[echo "X[]$1" | - sed ['/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q']]) - -define([AC_SHELL_DIRNAME], -[AC_SHELL_DIRNAME_EXPR([$1]) 2>/dev/null || -AC_SHELL_DIRNAME_SED([$1])]) ## --------------------------------------------------- ## @@ -999,7 +872,7 @@ define([AC_VAR_TEST_SET], # Implement a shell `if-then-else' depending whether VARIABLE is set # or not. Polymorphic. define([AC_VAR_SET_IFELSE], -[AC_SHELL_IFELSE([AC_VAR_TEST_SET([$1])], [$2], [$3])]) +[AS_IFELSE([AC_VAR_TEST_SET([$1])], [$2], [$3])]) # AC_VAR_PUSHDEF and AC_VAR_POPDEF @@ -1946,14 +1819,14 @@ else fi # NLS nuisances. -AC_SHELL_UNSET([LANG], [C]) -AC_SHELL_UNSET([LC_ALL], [C]) -AC_SHELL_UNSET([LC_TIME], [C]) -AC_SHELL_UNSET([LC_CTYPE], [C]) -AC_SHELL_UNSET([LANGUAGE], [C]) -AC_SHELL_UNSET([LC_COLLATE], [C]) -AC_SHELL_UNSET([LC_NUMERIC], [C]) -AC_SHELL_UNSET([LC_MESSAGES], [C]) +AS_UNSET([LANG], [C]) +AS_UNSET([LC_ALL], [C]) +AS_UNSET([LC_TIME], [C]) +AS_UNSET([LC_CTYPE], [C]) +AS_UNSET([LANGUAGE], [C]) +AS_UNSET([LC_COLLATE], [C]) +AS_UNSET([LC_NUMERIC], [C]) +AS_UNSET([LC_MESSAGES], [C]) # IFS # We need space, tab and new line, in precisely that order. @@ -1962,7 +1835,7 @@ ac_nl=' IFS=" $ac_nl" # CDPATH. -AC_SHELL_UNSET([CDPATH], [:]) +AS_UNSET([CDPATH], [:]) ]) @@ -3052,8 +2925,8 @@ dnl foo.MEMBER; foo.patsubst([$1], [^[^.]*\.]);])], AC_VAR_SET(ac_Member, yes), AC_VAR_SET(ac_Member, no))]) -AC_SHELL_IFELSE([test AC_VAR_GET(ac_Member) = yes], - [$2], [$3])dnl +AS_IFELSE([test AC_VAR_GET(ac_Member) = yes], + [$2], [$3])dnl AC_VAR_POPDEF([ac_Member])dnl ])# AC_CHECK_MEMBER @@ -3300,7 +3173,7 @@ dnl We reimplement AC_MSG_CHECKING (mostly) to avoid the ... in the middle. echo $ECHO_N "checking for prefix by $ECHO_C" >&AC_FD_MSG AC_PATH_PROG(m4_quote(AC_Prog), [$1]) if test -n "$ac_cv_path_[]AC_Prog"; then - prefix=`AC_SHELL_DIRNAME([$ac_cv_path_[]AC_Prog])` + prefix=`AS_DIRNAME([$ac_cv_path_[]AC_Prog])` fi fi popdef([AC_Prog])dnl @@ -3340,7 +3213,7 @@ AC_TRY_LINK_FUNC([$1], break]) done LIBS=$ac_func_search_save_LIBS]) -AC_SHELL_IFELSE([test "$ac_cv_search_$1" != no], +AS_IFELSE([test "$ac_cv_search_$1" != no], [test "$ac_cv_search_$1" = "none required" || LIBS="$ac_cv_search_$1 $LIBS" $3], [$4])[]dnl @@ -3378,9 +3251,9 @@ AC_TRY_LINK_FUNC([$2], [AC_VAR_SET(ac_Lib, yes)], [AC_VAR_SET(ac_Lib, no)]) LIBS=$ac_check_lib_save_LIBS]) -AC_SHELL_IFELSE([test AC_VAR_GET(ac_Lib) = yes], - [m4_default([$3], - [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_LIB$1)) +AS_IFELSE([test AC_VAR_GET(ac_Lib) = yes], + [m4_default([$3], + [AC_DEFINE_UNQUOTED(AC_TR_CPP(HAVE_LIB$1)) LIBS="-l$1 $LIBS" ])], [$4])dnl @@ -3659,8 +3532,8 @@ AC_CACHE_CHECK([for $1], ac_Header, [AC_TRY_CPP([#include <$1> ], AC_VAR_SET(ac_Header, yes), AC_VAR_SET(ac_Header, no))]) -AC_SHELL_IFELSE([test AC_VAR_GET(ac_Header) = yes], - [$2], [$3])dnl +AS_IFELSE([test AC_VAR_GET(ac_Header) = yes], + [$2], [$3])dnl AC_VAR_POPDEF([ac_Header])dnl ])# AC_CHECK_HEADER @@ -3704,8 +3577,8 @@ if test -r "$1"; then else AC_VAR_SET(ac_File, no) fi]) -AC_SHELL_IFELSE([test AC_VAR_GET(ac_File) = yes], - [$2], [$3])dnl +AS_IFELSE([test AC_VAR_GET(ac_File) = yes], + [$2], [$3])dnl AC_VAR_POPDEF([ac_File])dnl ])# AC_CHECK_FILE @@ -3740,8 +3613,8 @@ AC_CACHE_CHECK([whether $1 is declared], ac_Symbol, #endif ])], AC_VAR_SET(ac_Symbol, yes), AC_VAR_SET(ac_Symbol, no))]) -AC_SHELL_IFELSE([test AC_VAR_GET(ac_Symbol) = yes], - [$2], [$3])dnl +AS_IFELSE([test AC_VAR_GET(ac_Symbol) = yes], + [$2], [$3])dnl AC_VAR_POPDEF([ac_Symbol])dnl ])# AC_CHECK_DECL @@ -3972,8 +3845,8 @@ if (sizeof ($1)) return 0;])], AC_VAR_SET(ac_Type, yes), AC_VAR_SET(ac_Type, no))]) -AC_SHELL_IFELSE([test AC_VAR_GET(ac_Type) = yes], - [$2], [$3])dnl +AS_IFELSE([test AC_VAR_GET(ac_Type) = yes], + [$2], [$3])dnl AC_VAR_POPDEF([ac_Type])dnl ])# _AC_CHECK_TYPE_NEW @@ -4716,7 +4589,7 @@ ifset([AC_LIST_COMMANDS], [ : ${CONFIG_COMMANDS=$config_commands} ])dnl fi -_AC_SHELL_TMPDIR(cs) +AS_TMPDIR(cs) EOF ])[]dnl ifval @@ -4872,9 +4745,9 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue esac # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - ac_dir=`AC_SHELL_DIRNAME("$ac_file")` + ac_dir=`AS_DIRNAME("$ac_file")` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - AC_SHELL_MKDIR_P("$ac_dir") + AS_MKDIR_P("$ac_dir") ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo "$ac_dir_suffix" | sed 's,/[[^/]]*,../,g'` @@ -5194,9 +5067,9 @@ cat >>$CONFIG_STATUS <<\EOF if cmp -s $ac_file $tmp/config.h 2>/dev/null; then echo "$ac_file is unchanged" else - ac_dir=`AC_SHELL_DIRNAME("$ac_file")` + ac_dir=`AS_DIRNAME("$ac_file")` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - AC_SHELL_MKDIR_P("$ac_dir") + AS_MKDIR_P("$ac_dir") fi rm -f $ac_file mv $tmp/config.h $ac_file @@ -5245,9 +5118,9 @@ for ac_file in : $CONFIG_LINKS; do test "x$ac_file" = x: && continue rm -f $ac_dest # Make relative symlinks. - ac_dest_dir=`AC_SHELL_DIRNAME("$ac_dest")` + ac_dest_dir=`AS_DIRNAME("$ac_dest")` if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then - AC_SHELL_MKDIR_P("$ac_dest_dir") + AS_MKDIR_P("$ac_dest_dir") ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's,^\./,,'`" # A "../" for each directory in $ac_dest_dir_suffix. ac_dots=`echo $ac_dest_dir_suffix|sed 's,/[[^/]]*,../,g'` @@ -5356,7 +5229,7 @@ AC_PROVIDE_IFELSE([AC_PROG_INSTALL], echo configuring in $ac_subdir case $srcdir in .) ;; - *) AC_SHELL_MKDIR_P(./$ac_subdir) + *) AS_MKDIR_P(./$ac_subdir) if test -d ./$ac_subdir; then :; else AC_MSG_ERROR(cannot create `pwd`/$ac_subdir) @@ -5482,5 +5355,5 @@ ifelse([$2], , [AC_FATAL([$0]: missing argument 2)])dnl fi done - AC_SHELL_IFELSE([test x"$ac_exists" = xtrue], [$3], [$4]) + AS_IFELSE([test x"$ac_exists" = xtrue], [$3], [$4]) ]) diff --git a/lib/autoconf/specific.m4 b/lib/autoconf/specific.m4 index d228b5585..31df2c020 100644 --- a/lib/autoconf/specific.m4 +++ b/lib/autoconf/specific.m4 @@ -346,8 +346,8 @@ AC_CACHE_CHECK([for $1 that defines DIR], ac_Header, [DIR *dirp = 0;])], [AC_VAR_SET(ac_Header, yes)], [AC_VAR_SET(ac_Header, no)])]) -AC_SHELL_IFELSE([test AC_VAR_GET(ac_Header) = yes], - [$2], [$3])dnl +AS_IFELSE([test AC_VAR_GET(ac_Header) = yes], + [$2], [$3])dnl AC_VAR_POPDEF([ac_Header])dnl ])# _AC_CHECK_HEADER_DIRENT diff --git a/shell.m4 b/shell.m4 new file mode 100644 index 000000000..7c3360dfb --- /dev/null +++ b/shell.m4 @@ -0,0 +1,209 @@ +divert(-1) -*- Autoconf -*- +# This file is part of Autoconf. +# M4 sugar for common shell constructs. +# Requires GNU M4 and M4sugar. +# Copyright 2000 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# +# As a special exception, the Free Software Foundation gives unlimited +# permission to copy, distribute and modify the configure scripts that +# are the output of Autoconf. You need not follow the terms of the GNU +# General Public License when using or distributing such scripts, even +# though portions of the text of Autoconf appear in them. The GNU +# General Public License (GPL) does govern all other use of the material +# that constitutes the Autoconf program. +# +# Certain portions of the Autoconf source text are designed to be copied +# (in certain cases, depending on the input) into the output of +# Autoconf. We call these the "data" portions. The rest of the Autoconf +# source text consists of comments plus executable code that decides which +# of the data portions to output in any given case. We call these +# comments and executable code the "non-data" portions. Autoconf never +# copies any of the non-data portions into its output. +# +# This special exception to the GPL applies to versions of Autoconf +# released by the Free Software Foundation. When you make and +# distribute a modified version of Autoconf, you may extend this special +# exception to the GPL to apply to your modified version as well, *unless* +# your modified version has the potential to copy into its output some +# of the text that was the non-data portion of the version that you started +# with. (In other words, unless your change moves or copies text from +# the non-data portions to the data portions.) If your modification has +# such potential, you must delete any notice of this special exception +# to the GPL from your modified version. +# +# Written by Akim Demaille, Pavel Roskin, Alexandre Oliva, Lars J. Aas +# and many other people. + +# Set the quotes, whatever the current quoting system. +changequote() +changequote([, ]) + +# Some old m4's don't support m4exit. But they provide +# equivalent functionality by core dumping because of the +# long macros we define. +ifdef([__gnu__], , +[errprint(Autoconf requires GNU m4. Install it before installing Autoconf or +set the M4 environment variable to its path name.) +m4exit(2)]) + + + +## ----------------------------- ## +## 1. Wrappers around builtins. ## +## ----------------------------- ## + +# This section is lexicographically sorted. + +# AS_IFELSE(TEST, [IF-TRUE], [IF-FALSE]) +# -------------------------------------- +# Expand into +# | if TEST; then +# | IF-TRUE +# | else +# | IF-FALSE +# | fi +# with simplifications is IF-TRUE and/or IF-FALSE is empty. +define([AS_IFELSE], +[ifval([$2$3], +[if $1; then + ifval([$2], [$2], :) +m4_ifvanl([$3], +[else + $3])dnl +fi +])dnl +])# AS_IFELSE + + +# AS_UNSET(VAR, [VALUE-IF-UNSET-NOT-SUPPORTED = `']) +# -------------------------------------------------- +# Try to unset the env VAR, otherwise set it to +# VALUE-IF-UNSET-NOT-SUPPORTED. `ac_unset' must have been computed. +define([AS_UNSET], +[$ac_unset $1 || test "${$1+set}" != set || { $1=$2; export $1; }]) + + + + +## ------------------------------------------- ## +## 2. Portable versions of common file utils. ## +## ------------------------------------------- ## + +# This section is lexicographically sorted. + + +# AS_MKDIR_P(PATH) +# ---------------- +# Emulate `mkdir -p' with plain `mkdir'. +define([AS_MKDIR_P], +[{ case $1 in + [[\\/]]* | ?:[[\\/]]* ) ac_incr_dir=;; + *) ac_incr_dir=.;; +esac +ac_dummy="$1" +for ac_mkdir_dir in `IFS=/; set X $ac_dummy; shift; echo "$[@]"`; do + ac_incr_dir=$ac_incr_dir/$ac_mkdir_dir + test -d $ac_incr_dir || mkdir $ac_incr_dir +done; } +])# AS_MKDIR_P + + +# AS_DIRNAME(PATHNAME) +# -------------------- +# Simulate running `dirname(1)' on PATHNAME, not all systems have it. +# This macro must be usable from inside ` `. +# +# Paul Eggert answers: +# Question: Under UN*X, should `//1' give `/'? +# +# No, under some older flavors of Unix, leading // is a special path +# name: it refers to a "super-root" and is used to access other +# machines' files. Leading ///, ////, etc. are equivalent to /; but +# leading // is special. I think this tradition started with Apollo +# Domain/OS, an OS that is still in use on some older hosts. +# +# POSIX.2 allows but does not require the special treatment for //. +# It says that the behavior of dirname on path names of the form +# //([^/]+/*)? is implementation defined. In these cases, GNU dirname +# returns /, but it's more portable to return // as this works even on +# those older flavors of Unix. +# +# I have heard rumors that this special treatment of // may be dropped +# in future versions of POSIX, but for now it's still the standard. +# +# Prefer expr to echo|sed, since expr is usually faster and it handles +# backslashes and newlines correctly. However, older expr +# implementations (e.g. SunOS 4 expr and Solaris 8 /usr/ucb/expr) have +# a silly length limit that causes expr to fail if the matched +# substring is longer than 120 bytes. So fall back on echo|sed if +# expr fails. +define([AS_DIRNAME_EXPR], +[expr X[]$1 : 'X\(.*[[^/]]\)//*[[^/][^/]]*/*$' \| \ + X[]$1 : 'X\(//\)[[^/]]' \| \ + X[]$1 : 'X\(//\)$' \| \ + X[]$1 : 'X\(/\)' \| \ + . : '\(.\)']) + +define([AS_DIRNAME_SED], +[echo "X[]$1" | + sed ['/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q']]) + +define([AS_DIRNAME], +[AS_DIRNAME_EXPR([$1]) 2>/dev/null || +AS_DIRNAME_SED([$1])]) + + + +## ------------------ ## +## 3. Common idioms. ## +## ------------------ ## + +# This section is lexicographically sorted. + +# AS_TMPDIR(PREFIX) +# ----------------- +# Create as safely as possible a temporary directory which name is +# inspired by PREFIX (should be 2-4 chars max), and set trap +# mechanisms to remove it. +define([AS_TMPDIR], +[# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap 'exit $?' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/$1XXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/$1$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + exit 1; +}dnl +])# AS_TMPDIR diff --git a/tests/Makefile.am b/tests/Makefile.am index 6155db761..ad07c28e6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,7 +1,7 @@ ## Process this file with automake to create Makefile.in. ## Makefile for Autoconf testsuite. -## Copyright (C) 2000 Free Software Foundation, Inc. +## Copyright 2000 Free Software Foundation, Inc. ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by @@ -20,7 +20,8 @@ AUTOMAKE_OPTIONS = gnits -SUITE = base.m4 tools.m4 semantics.m4 torture.m4 syntax.m4 update.m4 +SUITE = m4sugar.m4 shell.m4 \ + base.m4 tools.m4 semantics.m4 torture.m4 syntax.m4 update.m4 # We don't actually distribute the testsuite, since one only # needs m4 to build it, m4 being required anyway to install Autoconf. @@ -49,5 +50,5 @@ update.m4: mktests.sh $(MACRO_FILES) cd $(srcdir) && ./mktests.sh $(MACRO_FILES) CLEANFILES = debug-*.sh macro configure configure.in config.status \ -config.cache config.log config.h.in config.h + config.cache config.log config.h.in config.h DISTCLEANFILES = atconfig testsuite diff --git a/tests/Makefile.in b/tests/Makefile.in index 08528571a..316c4c076 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -66,7 +66,8 @@ standards_texi = @standards_texi@ AUTOMAKE_OPTIONS = gnits -SUITE = base.m4 tools.m4 semantics.m4 torture.m4 syntax.m4 update.m4 +SUITE = m4sugar.m4 shell.m4 base.m4 tools.m4 semantics.m4 torture.m4 syntax.m4 update.m4 + # We don't actually distribute the testsuite, since one only # needs m4 to build it, m4 being required anyway to install Autoconf. @@ -77,12 +78,12 @@ EXTRA_DIST = atgeneral.m4 atspecific.m4 suite.m4 aclocal.m4 $(SUITE MACRO_FILES = ../acgeneral.m4 ../acspecific.m4 ../acfunctions.m4 ../aclang.m4 -CLEANFILES = debug-*.sh macro configure configure.in config.status config.cache config.log config.h.in config.h +CLEANFILES = debug-*.sh macro configure configure.in config.status config.cache config.log config.h.in config.h DISTCLEANFILES = atconfig testsuite mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_CLEAN_FILES = atconfig -DIST_COMMON = Makefile.am Makefile.in atconfig.in +DIST_COMMON = Makefile.am Makefile.in atconfig.in configure.in PACKAGE = @PACKAGE@ diff --git a/tests/base.m4 b/tests/base.m4 index a53c3209d..3406bd839 100644 --- a/tests/base.m4 +++ b/tests/base.m4 @@ -2,58 +2,10 @@ cat <&2]) -define([AC_SHELL_DIRNAME_SED_TEST], -[dir=`AC_SHELL_DIRNAME_SED([$1])` -test "$dir" = "$2" || - echo "dirname_sed($1) = $dir instead of $2" >&2]) - -AC_PLAIN_SCRIPT -AC_SHELL_DIRNAME_TEST([//1], [//]) -AC_SHELL_DIRNAME_TEST([/1], [/]) -AC_SHELL_DIRNAME_TEST([./1], [.]) -AC_SHELL_DIRNAME_TEST([../../2], [../..]) -AC_SHELL_DIRNAME_TEST([//1/], [//]) -AC_SHELL_DIRNAME_TEST([/1/], [/]) -AC_SHELL_DIRNAME_TEST([./1/], [.]) -AC_SHELL_DIRNAME_TEST([../../2], [../..]) -AC_SHELL_DIRNAME_TEST([//1/3], [//1]) -AC_SHELL_DIRNAME_TEST([/1/3], [/1]) -AC_SHELL_DIRNAME_TEST([./1/3], [./1]) -AC_SHELL_DIRNAME_TEST([../../2/3], [../../2]) -AC_SHELL_DIRNAME_TEST([//1/3///], [//1]) -AC_SHELL_DIRNAME_TEST([/1/3///], [/1]) -AC_SHELL_DIRNAME_TEST([./1/3///], [./1]) -AC_SHELL_DIRNAME_TEST([../../2/3///], [../../2]) -AC_SHELL_DIRNAME_TEST([//1//3/], [//1]) -AC_SHELL_DIRNAME_TEST([/1//3/], [/1]) -AC_SHELL_DIRNAME_TEST([./1//3/], [./1]) -AC_SHELL_DIRNAME_TEST([../../2//3/], [../../2]) - -AC_SHELL_DIRNAME_SED_TEST([//1], [//]) -AC_SHELL_DIRNAME_SED_TEST([/1], [/]) -AC_SHELL_DIRNAME_SED_TEST([./1], [.]) -AC_SHELL_DIRNAME_SED_TEST([../../2], [../..]) -AC_SHELL_DIRNAME_SED_TEST([//1/], [//]) -AC_SHELL_DIRNAME_SED_TEST([/1/], [/]) -AC_SHELL_DIRNAME_SED_TEST([./1/], [.]) -AC_SHELL_DIRNAME_SED_TEST([../../2], [../..]) -AC_SHELL_DIRNAME_SED_TEST([//1/3], [//1]) -AC_SHELL_DIRNAME_SED_TEST([/1/3], [/1]) -AC_SHELL_DIRNAME_SED_TEST([./1/3], [./1]) -AC_SHELL_DIRNAME_SED_TEST([../../2/3], [../../2]) -AC_SHELL_DIRNAME_SED_TEST([//1/3///], [//1]) -AC_SHELL_DIRNAME_SED_TEST([/1/3///], [/1]) -AC_SHELL_DIRNAME_SED_TEST([./1/3///], [./1]) -AC_SHELL_DIRNAME_SED_TEST([../../2/3///], [../../2]) -AC_SHELL_DIRNAME_SED_TEST([//1//3/], [//1]) -AC_SHELL_DIRNAME_SED_TEST([/1//3/], [/1]) -AC_SHELL_DIRNAME_SED_TEST([./1//3/], [./1]) -AC_SHELL_DIRNAME_SED_TEST([../../2//3/], [../../2]) -exit 0 -]]) - -AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0, [], []) -AT_CHECK([./configure], 0) - -AT_CLEANUP(configure) diff --git a/tests/m4sugar.m4 b/tests/m4sugar.m4 new file mode 100644 index 000000000..25cfa3680 --- /dev/null +++ b/tests/m4sugar.m4 @@ -0,0 +1,54 @@ +# -*- Autoconf -*- + +cat <&2]) +define([AS_DIRNAME_SED_TEST], +[dir=`AS_DIRNAME_SED([$1])` +test "$dir" = "$2" || + echo "dirname_sed($1) = $dir instead of $2" >&2]) + +AC_PLAIN_SCRIPT +AS_DIRNAME_TEST([//1], [//]) +AS_DIRNAME_TEST([/1], [/]) +AS_DIRNAME_TEST([./1], [.]) +AS_DIRNAME_TEST([../../2], [../..]) +AS_DIRNAME_TEST([//1/], [//]) +AS_DIRNAME_TEST([/1/], [/]) +AS_DIRNAME_TEST([./1/], [.]) +AS_DIRNAME_TEST([../../2], [../..]) +AS_DIRNAME_TEST([//1/3], [//1]) +AS_DIRNAME_TEST([/1/3], [/1]) +AS_DIRNAME_TEST([./1/3], [./1]) +AS_DIRNAME_TEST([../../2/3], [../../2]) +AS_DIRNAME_TEST([//1/3///], [//1]) +AS_DIRNAME_TEST([/1/3///], [/1]) +AS_DIRNAME_TEST([./1/3///], [./1]) +AS_DIRNAME_TEST([../../2/3///], [../../2]) +AS_DIRNAME_TEST([//1//3/], [//1]) +AS_DIRNAME_TEST([/1//3/], [/1]) +AS_DIRNAME_TEST([./1//3/], [./1]) +AS_DIRNAME_TEST([../../2//3/], [../../2]) + +AS_DIRNAME_SED_TEST([//1], [//]) +AS_DIRNAME_SED_TEST([/1], [/]) +AS_DIRNAME_SED_TEST([./1], [.]) +AS_DIRNAME_SED_TEST([../../2], [../..]) +AS_DIRNAME_SED_TEST([//1/], [//]) +AS_DIRNAME_SED_TEST([/1/], [/]) +AS_DIRNAME_SED_TEST([./1/], [.]) +AS_DIRNAME_SED_TEST([../../2], [../..]) +AS_DIRNAME_SED_TEST([//1/3], [//1]) +AS_DIRNAME_SED_TEST([/1/3], [/1]) +AS_DIRNAME_SED_TEST([./1/3], [./1]) +AS_DIRNAME_SED_TEST([../../2/3], [../../2]) +AS_DIRNAME_SED_TEST([//1/3///], [//1]) +AS_DIRNAME_SED_TEST([/1/3///], [/1]) +AS_DIRNAME_SED_TEST([./1/3///], [./1]) +AS_DIRNAME_SED_TEST([../../2/3///], [../../2]) +AS_DIRNAME_SED_TEST([//1//3/], [//1]) +AS_DIRNAME_SED_TEST([/1//3/], [/1]) +AS_DIRNAME_SED_TEST([./1//3/], [./1]) +AS_DIRNAME_SED_TEST([../../2//3/], [../../2]) +exit 0 +]]) + +AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0, [], []) +AT_CHECK([./configure], 0) + +AT_CLEANUP(configure) diff --git a/tests/suite.m4 b/tests/suite.m4 index 32f345c79..b17e76f6c 100644 --- a/tests/suite.m4 +++ b/tests/suite.m4 @@ -1,4 +1,4 @@ -#!/bin/sh +#! /bin/sh # Validation suite for Autoconf # Copyright 2000 Free Software Foundation, Inc. @@ -17,7 +17,13 @@ EOF # Run the tests from the lowest level to the highest level, and from # the most selective to the easiest. -# m4sugar. +# M4sugar. +AT_INCLUDE(m4sugar.m4) + +# shell.m4. +AT_INCLUDE(shell.m4) + +# Autoconf base macros. AT_INCLUDE(base.m4) # The executables.