From: Akim Demaille Date: Sat, 25 Mar 2000 09:12:59 +0000 (+0000) Subject: * acgeneral.m4 (AC_RUN_IFELSE): New macro. X-Git-Tag: autoconf-2.50~998 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1291b2ea1bbda6b2c97ee9d34ca334bd527f392;p=thirdparty%2Fautoconf.git * acgeneral.m4 (AC_RUN_IFELSE): New macro. (AC_TRY_RUN_NATIVE): Remove. (AC_TRY_RUN): Use AC_RUN_IFELSE, not AC_TRY_RUN_NATIVE. --- diff --git a/ChangeLog b/ChangeLog index 4ce076279..a0acf0788 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2000-03-25 Akim Demaille + + * acgeneral.m4 (AC_RUN_IFELSE): New macro. + (AC_TRY_RUN_NATIVE): Remove. + (AC_TRY_RUN): Use AC_RUN_IFELSE, not AC_TRY_RUN_NATIVE. + 2000-03-25 Akim Demaille * acgeneral.m4 (AC_CHECK_LIB): Ah ah! I recognized you, even diff --git a/acgeneral.m4 b/acgeneral.m4 index 595a37e6b..b7c88b280 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -2988,38 +2988,40 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [$4], [$5]) ## -------------------------------- ## +# AC_RUN_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# ----------------------------------------------------------- +# Compile, link, and run. +AC_DEFUN([AC_RUN_IFELSE], +[cat >conftest.$ac_ext </dev/null; then + m4_default([$2], :) +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +ifval([$3], +[ $3 +])dnl +fi +rm -f conftest*[]dnl +])# AC_RUN_IFELSE + + # AC_TRY_RUN(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE], # [ACTION-IF-CROSS-COMPILING]) # -------------------------------------------------------- -AC_DEFUN(AC_TRY_RUN, +AC_DEFUN([AC_TRY_RUN], [if test "$cross_compiling" = yes; then ifelse([$4], , - [AC_WARNING([AC_TRY_RUN called without default to allow cross compiling])dnl + [AC_WARNING([AC_TRY_RUN called without default to allow cross compiling])dnl AC_MSG_ERROR(cannot run test program while cross compiling)], - [$4]) -else - AC_TRY_RUN_NATIVE([$1], [$2], [$3]) -fi -]) - - -# AC_TRY_RUN_NATIVE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) -# --------------------------------------------------------------- -# Like AC_TRY_RUN but assumes a native-environment (non-cross) compiler. -AC_DEFUN(AC_TRY_RUN_NATIVE, -[cat >conftest.$ac_ext </dev/null; then - m4_default([$2], [:]) + [$4]) else - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC - $3 + AC_RUN_IFELSE([AC_LANG_SOURCE([[$1]])], [$2], [$3]) fi -rm -fr conftest* -])# AC_TRY_RUN_NATIVE +])# AC_TRY_RUN diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 595a37e6b..b7c88b280 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -2988,38 +2988,40 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [$4], [$5]) ## -------------------------------- ## +# AC_RUN_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# ----------------------------------------------------------- +# Compile, link, and run. +AC_DEFUN([AC_RUN_IFELSE], +[cat >conftest.$ac_ext </dev/null; then + m4_default([$2], :) +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +ifval([$3], +[ $3 +])dnl +fi +rm -f conftest*[]dnl +])# AC_RUN_IFELSE + + # AC_TRY_RUN(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE], # [ACTION-IF-CROSS-COMPILING]) # -------------------------------------------------------- -AC_DEFUN(AC_TRY_RUN, +AC_DEFUN([AC_TRY_RUN], [if test "$cross_compiling" = yes; then ifelse([$4], , - [AC_WARNING([AC_TRY_RUN called without default to allow cross compiling])dnl + [AC_WARNING([AC_TRY_RUN called without default to allow cross compiling])dnl AC_MSG_ERROR(cannot run test program while cross compiling)], - [$4]) -else - AC_TRY_RUN_NATIVE([$1], [$2], [$3]) -fi -]) - - -# AC_TRY_RUN_NATIVE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) -# --------------------------------------------------------------- -# Like AC_TRY_RUN but assumes a native-environment (non-cross) compiler. -AC_DEFUN(AC_TRY_RUN_NATIVE, -[cat >conftest.$ac_ext </dev/null; then - m4_default([$2], [:]) + [$4]) else - echo "configure: failed program was:" >&AC_FD_CC - cat conftest.$ac_ext >&AC_FD_CC - $3 + AC_RUN_IFELSE([AC_LANG_SOURCE([[$1]])], [$2], [$3]) fi -rm -fr conftest* -])# AC_TRY_RUN_NATIVE +])# AC_TRY_RUN diff --git a/tests/Makefile.in b/tests/Makefile.in index 76876f22d..ff6494e27 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -80,15 +80,15 @@ PERL = perl # and some are already tested elsewhere. EGREP_EXCLUDE must filter out # the macros we don't want to test in syntax.m4. # -# - AC_CHECK decl, file, func, header, member, prog, sizeof, type +# - AC_CHECK decl, file, func, header, lib, member, prog, sizeof, type # Performed in the semantics tests. # - AC_CONFIG # They fail when the source does not exist. # - AC_INIT # AC_INIT includes all the AC_INIT macros. Note that there is an # infinite m4 recursion if AC_INIT it used twice. -# - AC_LANG -# Requires an argument. +# - AC_LANG* +# Heavily used by other macros. # - AC_PROG_(CC|CXX|F77)_(GNU|WORKS) # are used in AC_PROG_CC etc. # - AC_PATH_PROGS? @@ -101,7 +101,7 @@ PERL = perl # # Multiple `-e' to egrep are not portable, so join all the patterns together. # We use the fact that automake will replace all the `\\\n' with ` '. -FILTER_MACROS = egrep -v -e `echo '^AC_ARG_VAR$$ ^AC_CHECK_(DECL|FILE|FUNC|HEADER|MEMBER|PROG|SIZEOF|TYPE)S?$$ ^AC_CONFIG ^AC_INIT ^AC_LANG ^AC_LINKER_OPTION$$ ^AC_LINK_FILES$$ ^AC_LIST_MEMBER_OF$$ ^AC_PATH_(TOOL|PROG)S?$$ ^AC_PROG_(CC|CXX|F77)_(GNU|WORKS)$$ ^AC_REPLACE_FUNCS$$ ^AC_SEARCH_LIBS$$ ^AC_TRY _AC_' | tr ' ' '|'` +FILTER_MACROS = egrep -v -e `echo '^AC_ARG_VAR$$ ^AC_CHECK_(DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|TYPE)S?$$ ^AC_CONFIG ^AC_INIT ^AC_LANG ^AC_LINKER_OPTION$$ ^AC_LINK_FILES$$ ^AC_LIST_MEMBER_OF$$ ^AC_PATH_(TOOL|PROG)S?$$ ^AC_PROG_(CC|CXX|F77)_(GNU|WORKS)$$ ^AC_REPLACE_FUNCS$$ ^AC_SEARCH_LIBS$$ ^AC_TRY _AC_' | tr ' ' '|'` CLEANFILES = debug-*.sh macro configure configure.in config.status config.cache config.log config.h.in config.h @@ -109,7 +109,8 @@ CLEANFILES = debug-*.sh macro configure configure.in config.status config.cache 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 \ +configure.in PACKAGE = @PACKAGE@