diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/autoconf/functions.m4 | 47 | ||||
-rw-r--r-- | lib/autoconf/general.m4 | 6 | ||||
-rw-r--r-- | lib/autoconf/headers.m4 | 55 | ||||
-rw-r--r-- | lib/autoconf/status.m4 | 9 | ||||
-rw-r--r-- | lib/m4sugar/m4sugar.m4 | 21 |
5 files changed, 108 insertions, 30 deletions
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 index 44730096..645a7c60 100644 --- a/lib/autoconf/functions.m4 +++ b/lib/autoconf/functions.m4 @@ -78,6 +78,34 @@ m4_define([_AH_CHECK_FUNC], [AH_TEMPLATE(AS_TR_CPP([HAVE_$1]), [Define to 1 if you have the `$1' function.])]) +# _AC_CHECK_FUNCS_ONE_U(FUNCTION) +# ------------------------------- +# Perform the actions that need to be performed unconditionally +# for every FUNCTION that *could* be checked for by AC_CHECK_FUNCS. +m4_define([_AC_CHECK_FUNCS_ONE_U], +[AS_LITERAL_WORD_IF([$1], + [_AH_CHECK_FUNC([$1])], + [AC_DIAGNOSE([syntax], [AC_CHECK_FUNCS($1): you should use literals])])]) + +# _AC_CHECK_FUNCS_ONE_S(FUNCTION) +# ------------------------------- +# If FUNCTION exists, define HAVE_FUNCTION. FUNCTION must be literal. +# Used by AC_CHECK_FUNCS for its simplest case, when its FUNCTION list +# is fully literal and no optional actions were supplied. +m4_define([_AC_CHECK_FUNCS_ONE_S], +[_AH_CHECK_FUNC([$1])]dnl +[AC_CHECK_FUNC([$1], + [AC_DEFINE(AS_TR_CPP([HAVE_$1]))])]) + +# _AC_CHECK_FUNCS_ONE_C(FUNCTION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------------------------------------- +# If FUNCTION exists, define HAVE_FUNCTION and execute ACTION-IF-FOUND. +# Otherwise execute ACTION-IF-NOT-FOUND. FUNCTION can be a shell variable. +# Used by AC_CHECK_FUNCS for complex cases. +m4_define([_AC_CHECK_FUNCS_ONE_C], +[AC_CHECK_FUNC([$1], + [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_]$1)) $2], + [$3])]) # AC_CHECK_FUNCS(FUNCTION..., [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # --------------------------------------------------------------------- @@ -87,17 +115,14 @@ m4_define([_AH_CHECK_FUNC], # available for each found function. Either ACTION may include # `break' to stop the search. AC_DEFUN([AC_CHECK_FUNCS], -[m4_map_args_w([$1], [_AH_CHECK_FUNC(], [)])]dnl -[m4_if([$2$3]AS_LITERAL_IF([$1], [[yes]], [[no]]), [yes], - [m4_map_args_w([$1], [_$0(], [)])], - [AS_FOR([AC_func], [ac_func], [$1], [_$0(AC_func, [$2], [$3])])])dnl -])# AC_CHECK_FUNCS +[_$0(m4_validate_w([$1]), [$2], [$3])]) m4_define([_AC_CHECK_FUNCS], -[AC_CHECK_FUNC([$1], - [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_]$1)) $2], - [$3])dnl -]) +[m4_if([$2$3]AS_LITERAL_IF([$1], [[yes]], [[no]]), [yes], + [m4_map_args_w([$1], [_AC_CHECK_FUNCS_ONE_S(], [)])], + [m4_map_args_w([$1], [_AC_CHECK_FUNCS_ONE_U(], [)])] + [AS_FOR([AC_func], [ac_func], [$1], + [_AC_CHECK_FUNCS_ONE_C(AC_func, [$2], [$3])])])]) # _AC_CHECK_FUNC_ONCE(FUNCTION) @@ -114,7 +139,7 @@ m4_define([_AC_CHECK_FUNC_ONCE], # Add each whitespace-separated name in FUNCTION to the list of functions # to check once. AC_DEFUN([AC_CHECK_FUNCS_ONCE], -[m4_map_args_w([$1], [_AC_CHECK_FUNC_ONCE(], [)])]) +[m4_map_args_w(m4_validate_w([$1]), [_AC_CHECK_FUNC_ONCE(], [)])]) # _AC_FUNCS_EXPANSION(LANG) # ------------------------- @@ -177,7 +202,7 @@ m4_define([_AC_REPLACE_FUNC_NL], # equivalent of AC_CHECK_FUNC, then call AC_LIBOBJ if the function # was not found. AC_DEFUN([AC_REPLACE_FUNCS], -[_$0(m4_flatten([$1]))]) +[_$0(m4_validate_w([$1]))]) m4_define([_AC_REPLACE_FUNCS], [AS_LITERAL_IF([$1], diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index e80f7eb0..e725d88c 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -1791,7 +1791,8 @@ m4_define([_AC_CONFIG_MACRO_DIRS], # If no directory has been traced yet, then this macro also triggers # a trace of AC_CONFIG_MACRO_DIR on the first directory. AC_DEFUN([AC_CONFIG_MACRO_DIRS], -[m4_map_args_w([$1], [_$0(_$0_USED()[$0], ], [)])]) +[m4_map_args_w(m4_validate_w([$1]), + [_$0(_$0_USED()[$0], ], [)])]) # AC_CONFIG_MACRO_DIR(DIR) # ------------------------ @@ -2879,7 +2880,8 @@ m4_define([_AC_CHECK_FILES], # ACTION-IF-FOUND or ACTION-IF-NOT-FOUND. For files that exist, also # provide the preprocessor variable HAVE_FILE. AC_DEFUN([AC_CHECK_FILES], -[m4_map_args_w([$1], [AC_CHECK_FILE(_$0(], [)[$2], [$3])])]) +[m4_map_args_w(m4_validate_w([$1]), + [AC_CHECK_FILE(_$0(], [)[$2], [$3])])]) ## ------------------------------- ## diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4 index be528261..ae8bf28f 100644 --- a/lib/autoconf/headers.m4 +++ b/lib/autoconf/headers.m4 @@ -173,6 +173,37 @@ m4_define([_AH_CHECK_HEADER], m4_define([AH_CHECK_HEADERS], [m4_foreach_w([AC_Header], [$1], [_AH_CHECK_HEADER(m4_defn([AC_Header]))])]) +# _AC_CHECK_HEADERS_ONE_U(HEADER-FILE) +# ------------------------------- +# Perform the actions that need to be performed unconditionally +# for every HEADER-FILE that *could* be checked for by AC_CHECK_HEADERS. +m4_define([_AC_CHECK_HEADERS_ONE_U], +[AS_LITERAL_WORD_IF([$1], + [_AH_CHECK_HEADER([$1])], + [AC_DIAGNOSE([syntax], [AC_CHECK_HEADERS($1): you should use literals])])]) + +# _AC_CHECK_HEADERS_ONE_S(HEADER-FILE, [INCLUDES]) +# ------------------------------- +# If HEADER-FILE exists, define HAVE_HEADER_FILE. HEADER-FILE must be literal. +# Used by AC_CHECK_HEADERS for its simplest case, when its HEADER-FILE list +# is fully literal and no optional actions were supplied. +# INCLUDES is as for AC_CHECK_HEADER. +m4_define([_AC_CHECK_HEADERS_ONE_S], +[_AH_CHECK_HEADER([$1])]dnl +[AC_CHECK_HEADER([$1], + [AC_DEFINE(AS_TR_CPP([HAVE_$1]))], [], [$2])]) + +# _AC_CHECK_HEADERS_ONE_C(HEADER-FILE, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND], [INCLUDES]) +# ------------------------------------------------------------------------- +# If HEADER-FILE exists, define HAVE_HEADER-FILE and execute ACTION-IF-FOUND. +# Otherwise execute ACTION-IF-NOT-FOUND. HEADER-FILE can be a shell variable. +# Used by AC_CHECK_HEADERS for complex cases. +# INCLUDES is as for AC_CHECK_HEADER. +m4_define([_AC_CHECK_HEADERS_ONE_C], +[AC_CHECK_HEADER([$1], + [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_]$1)) $2], + [$3], [$4])]) # AC_CHECK_HEADERS(HEADER-FILE..., # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], @@ -184,17 +215,14 @@ m4_define([AH_CHECK_HEADERS], # preprocessor definition HAVE_HEADER_FILE available for each found # header. Either ACTION may include `break' to stop the search. AC_DEFUN([AC_CHECK_HEADERS], -[m4_map_args_w([$1], [_AH_CHECK_HEADER(], [)])]dnl -[m4_if([$2$3]AS_LITERAL_IF([$1], [[yes]], [[no]]), [yes], - [m4_map_args_w([$1], [_$0(], [, [], [], [$4])])], - [AS_FOR([AC_header], [ac_header], [$1], [_$0(AC_header, [$2], [$3], [$4])])])dnl -])# AC_CHECK_HEADERS +[_$0(m4_validate_w([$1]), [$2], [$3], [$4])]) m4_define([_AC_CHECK_HEADERS], -[AC_CHECK_HEADER([$1], - [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_]$1)) $2], - [$3], [$4])dnl -]) +[m4_if([$2$3]AS_LITERAL_IF([$1], [[yes]], [[no]]), [yes], + [m4_map_args_w([$1], [_AC_CHECK_HEADERS_ONE_S(], [, [$4])])], + [m4_map_args_w([$1], [_AC_CHECK_HEADERS_ONE_U(], [)])]dnl + [AS_FOR([AC_header], [ac_header], [$1], + [_AC_CHECK_HEADERS_ONE_C(AC_header, [$2], [$3], [$4])])])]) # _AC_CHECK_HEADER_ONCE(HEADER-FILE) @@ -217,10 +245,8 @@ m4_define([_AC_CHECK_HEADER_ONCE], # and vice versa. AC_DEFUN([AC_CHECK_HEADERS_ONCE], [AC_REQUIRE([AC_CHECK_INCLUDES_DEFAULT])]dnl - [_AC_CHECK_HEADERS_ONCE([$1])]) + [m4_map_args_w(m4_validate_w([$1]), [_AC_CHECK_HEADER_ONCE(], [)])]) -AC_DEFUN([_AC_CHECK_HEADERS_ONCE], - [m4_map_args_w([$1], [_AC_CHECK_HEADER_ONCE(], [)])]) # _AC_HEADERS_EXPANSION(LANG) # --------------------------- @@ -289,8 +315,9 @@ ac_includes_default="\ # include <unistd.h> #endif" ])]dnl -[_AC_CHECK_HEADERS_ONCE( - [sys/types.h sys/stat.h strings.h inttypes.h stdint.h unistd.h])]dnl +[m4_map_args([_AC_CHECK_HEADER_ONCE], + [sys/types.h], [sys/stat.h], [strings.h], + [inttypes.h], [stdint.h], [unistd.h])]dnl dnl For backward compatibility, provide unconditional AC_DEFINEs of dnl HAVE_STDLIB_H, HAVE_STRING_H, and STDC_HEADERS. [AC_DEFINE([HAVE_STDLIB_H], [1], diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4 index 5c0a6456..cb337d74 100644 --- a/lib/autoconf/status.m4 +++ b/lib/autoconf/status.m4 @@ -1096,15 +1096,18 @@ m4_define([AC_OUTPUT_COMMANDS_POST]) # included, if for instance the user refused a part of the tree. # This is used in _AC_OUTPUT_SUBDIRS. AC_DEFUN([AC_CONFIG_SUBDIRS], +[_$0(m4_validate_w([$1]))]) + +m4_define([_AC_CONFIG_SUBDIRS], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])]dnl [AC_REQUIRE([AC_DISABLE_OPTION_CHECKING])]dnl +[AS_LITERAL_IF([$1], [], + [AC_DIAGNOSE([syntax], [$0: you should use literals])])]dnl [m4_map_args_w([$1], [_AC_CONFIG_UNIQUE([SUBDIRS], _AC_CONFIG_COMPUTE_DEST(], [))])]dnl [m4_append([_AC_LIST_SUBDIRS], [$1], [ ])]dnl -[AS_LITERAL_IF([$1], [], - [AC_DIAGNOSE([syntax], [$0: you should use literals])])]dnl -[AC_SUBST([subdirs], ["$subdirs m4_normalize([$1])"])]) +[AC_SUBST([subdirs], ["$subdirs $1"])]) # _AC_OUTPUT_SUBDIRS diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4 index 6a191345..b42fc1a6 100644 --- a/lib/m4sugar/m4sugar.m4 +++ b/lib/m4sugar/m4sugar.m4 @@ -2412,6 +2412,27 @@ m4_define([m4_normalize], [m4_strip(m4_flatten([$1]))]) +# m4_validate_w(STRING) +# --------------------- +# Expands into m4_normalize(m4_expand([STRING])), but if that is not +# the same as just m4_normalize([STRING]), issue a warning. +# +# This is used in several Autoconf macros that take a +# whitespace-separated list of symbols as an argument. Ideally that +# list would not be expanded before use, but several packages used +# `dnl' to put comments inside those lists, so they must be expanded +# for compatibility's sake. +m4_define([m4_validate_w], +[_m4_validate_w(m4_normalize([$1]), m4_normalize(m4_expand([$1])))]) + +m4_define([_m4_validate_w], +[m4_if([$1], [$2], [], + [m4_warn([obsolete], [whitespace-separated list contains macros; +in a future version of Autoconf they will not be expanded]dnl +m4_if(m4_bregexp([$1], [\bdn[l]\b]), -1, [], [ +note: `dn@&t@l' is a macro]))])dnl +[$2]]) + # m4_join(SEP, ARG1, ARG2...) # --------------------------- |