diff --git a/autoconf/m4/pa_add_flags.m4 b/autoconf/m4/pa_add_flags.m4 index a02868be..766f4820 100644 --- a/autoconf/m4/pa_add_flags.m4 +++ b/autoconf/m4/pa_add_flags.m4 @@ -6,34 +6,38 @@ dnl by all languages affected by [flagvar], if those languages have dnl been previously seen in the script. dnl -------------------------------------------------------------------------- AC_DEFUN([PA_ADD_FLAGS], -[ - AS_VAR_PUSHDEF([old], [_$0_$1_orig]) - AS_VAR_PUSHDEF([ok], [_$0_$1_ok]) +[ AS_VAR_PUSHDEF([old],[PA_SHSYM([_$0_$1_orig])]) AS_VAR_PUSHDEF([flags], [$1]) + AS_VAR_PUSHDEF([cache],[PA_SHSYM([pa_cv_$1_$2])]) - AS_VAR_COPY([old], [flags]) - AS_VAR_SET([flags], ["$flags $2"]) - AS_VAR_SET([ok], [yes]) + AS_VAR_COPY([old],[flags]) - PA_LANG_FOREACH(PA_FLAGS_LANGLIST($1), - [AS_VAR_IF([ok], [yes], - [AC_MSG_CHECKING([if $]_AC_CC[ accepts $2]) - PA_BUILD_IFELSE([], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AS_VAR_SET([ok], [no])])]) - ]) + AC_CACHE_VAL([cache], + [AS_VAR_APPEND([flags],[' $2']) + AS_VAR_SET([cache],[yes]) + PA_LANG_FOREACH([PA_FLAGS_LANGLIST($1)], + [AS_VAR_IF([cache],[yes], + [AC_MSG_CHECKING([whether $]_AC_CC[ accepts $2]) + m4_case([$1], + [LDFLAGS], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])], + [],[AS_VAR_SET([cache],[no])])], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])], + [],[AS_VAR_SET([cache],[no])])]) + AC_MSG_RESULT([$cache]) + ])]) + AS_VAR_COPY([flags],[old]) + ]) - AS_VAR_IF([ok], [yes], - [m4_ifnblank([$3],[AS_VAR_SET([flags], ["$old $3"])]) - m4_foreach_w([_pa_add_flags_flag], [m4_ifblank([$3],[$2],[$3])], - [AC_DEFINE(PA_SYM([$1_]_pa_add_flags_flag), 1, - [Define to 1 if compiled with the ]_pa_add_flags_flag[ compiler flag])]) - $4], - [AS_VAR_SET([flags], ["$old"]) - $5]) + AS_VAR_IF([cache],[yes], + [m4_define([_pa_add_flags_newflags],[m4_default([$3],[$2])])dnl + AS_VAR_APPEND([flags],[' _pa_add_flags_newflags']) + m4_foreach_w([_pa_add_flags_flag],[_pa_add_flags_newflags], + [AC_DEFINE(PA_SYM([$1_]_pa_add_flags_flag), 1, + [Define to 1 if compiled with ]_pa_add_flags_flag[ in $1])]) +$4],[$5]) + AS_VAR_POPDEF([cache]) AS_VAR_POPDEF([flags]) - AS_VAR_POPDEF([ok]) AS_VAR_POPDEF([old]) ]) diff --git a/autoconf/m4/pa_add_headers.m4 b/autoconf/m4/pa_add_headers.m4 index daaf7dd0..5c058e4e 100644 --- a/autoconf/m4/pa_add_headers.m4 +++ b/autoconf/m4/pa_add_headers.m4 @@ -5,10 +5,9 @@ dnl Call AC_CHECK_HEADERS_ONCE(), and add to ac_includes_default if found dnl -------------------------------------------------------------------------- AC_DEFUN([_PA_ADD_HEADER], [AC_CHECK_HEADERS_ONCE([$1]) -AS_IF([test x$ac_ac_header_$1 = xyes], +AS_IF([test "x$]PA_SHSYM([ac_cv_header_$1])[" = xyes], [ac_includes_default="$ac_includes_default #include <$1>" ]) ]) -AC_DEFUN([PA_ADD_HEADERS], -[m4_map_args_w([$1],[_PA_ADD_HEADER(],[)])]) +AC_DEFUN([PA_ADD_HEADERS],[m4_map_args([_PA_ADD_HEADER],$@)]) diff --git a/autoconf/m4/pa_add_langflags.m4 b/autoconf/m4/pa_add_langflags.m4 index 05c3114f..97364d93 100644 --- a/autoconf/m4/pa_add_langflags.m4 +++ b/autoconf/m4/pa_add_langflags.m4 @@ -1,27 +1,9 @@ dnl -------------------------------------------------------------------------- dnl PA_ADD_LANGFLAGS(flag...) dnl -dnl Attempt to add the option in the given list to each compiler flags -dnl (CFLAGS, CXXFLAGS, ...), if it doesn't break compilation. +dnl Attempt to add the first accepted option in the given list to each +dnl compiler flags (CFLAGS, CXXFLAGS, ...). dnl -------------------------------------------------------------------------- -m4_defun([_PA_LANGFLAG_VAR], -[m4_case([$1], - [C], [CFLAGS], - [C++], [CXXFLAGS], - [Fortran 77], [FFLAGS], - [Fortran], [FCFLAGS], - [Erlang], [ERLCFLAGS], - [Objective C], [OBJCFLAGS], - [Objective C++], [OBJCXXFLAGS], - [Go], [GOFLAGS], - [m4_fatal([PA_ADD_LANGFLAGS: Unknown language: $1])])]) - AC_DEFUN([PA_ADD_LANGFLAGS], -[m4_pushdef([_pa_langflags],m4_dquote($1))dnl -m4_set_foreach(_PA_LANG_SEEN_SET,[_pa_lang],dnl -[_pa_flag_found=no - m4_foreach_w([_pa_flag], _pa_langflags, - [AS_IF([test $_pa_flag_found = no], - [PA_ADD_FLAGS(_PA_LANGFLAG_VAR(_pa_lang),_pa_flag,[],[_pa_flag_found=yes])]) - ])]) -m4_popdef([_pa_langflags])]) +[PA_LANG_FOREACH(PA_LANG_HAVE_FLAGVAR_LIST, + [PA_FIND_FLAGS(m4_quote(PA_LANG_FLAGVAR),[$@])])]) diff --git a/autoconf/m4/pa_build_ifelse.m4 b/autoconf/m4/pa_build_ifelse.m4 deleted file mode 100644 index 1aacfcd7..00000000 --- a/autoconf/m4/pa_build_ifelse.m4 +++ /dev/null @@ -1,16 +0,0 @@ -dnl -------------------------------------------------------------------------- -dnl PA_BUILD_IFELSE(input [,success [,failure]]) -dnl -dnl Same as AC_LINK_IFELSE for languages where linking is applicable, -dnl otherwise AC_COMPILE_IFELSE. -dnl -dnl If the first argument is empty, use _AC_LANG_IO_PROGRAM. -dnl -------------------------------------------------------------------------- -m4_defun([_PA_BUILD_IFELSE], -[m4_case(_AC_LANG, - [Erlang], [AC_COMPILE_IFELSE($@)], - [AC_LINK_IFELSE($@)])]) - -AC_DEFUN([PA_BUILD_IFELSE], -[_PA_BUILD_IFELSE([m4_ifblank([$1],[AC_LANG_SOURCE(_AC_LANG_IO_PROGRAM)], - [$1])],[$2],[$3])]) diff --git a/autoconf/m4/pa_csym.m4 b/autoconf/m4/pa_csym.m4 index ea0bf809..68334c15 100644 --- a/autoconf/m4/pa_csym.m4 +++ b/autoconf/m4/pa_csym.m4 @@ -7,7 +7,7 @@ dnl to X (so C++ -> CXX). Unlike PA_SYM(), do not compact multiple dnl underscores. dnl -------------------------------------------------------------------------- AC_DEFUN([PA_CSYM], -[m4_toupper(m4_bpatsubsts(m4_quote(m4_toupper(m4_normalize([$*]))), +[m4_bpatsubsts(m4_quote(m4_toupper(m4_normalize([$*]))), [[ ]+],[],[\+],[X],[^\(.\)\([0123456789].*\)$],[[[\1_\2]]], [[^ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]],[_], -[^._\(.*\)_.$],[[[\1]]]))]) +[^._\(.*\)_.$],[[[\1]]])]) diff --git a/autoconf/m4/pa_flags_langlist.m4 b/autoconf/m4/pa_flags_langlist.m4 index 2ef5ded2..b9a9c78b 100644 --- a/autoconf/m4/pa_flags_langlist.m4 +++ b/autoconf/m4/pa_flags_langlist.m4 @@ -5,7 +5,7 @@ dnl Return a list of languages affected by the variable flagvar. dnl If flagvar is unknown, assume it affects the current language. dnl -------------------------------------------------------------------------- AC_DEFUN([PA_FLAGS_LANGLIST], -[m4_dquote(m4_case([$1], +[m4_case([$1], [CPPFLAGS], [[C],[C++],[Objective C],[Objective C++]], [CFLAGS], [[C]], [CXXFLAGS], [[C++]], @@ -16,4 +16,4 @@ AC_DEFUN([PA_FLAGS_LANGLIST], [OBJCXXFLAGS], [[Objective C++]], [GOFLAGS], [[Go]], [LDFLAGS], [[C],[C++],[Fortran 77],[Fortran],[Objective C],[Objective C++],[Go]], - m4_dquote(_AC_LANG)))]) + m4_quote(_AC_LANG))]) diff --git a/autoconf/m4/pa_func_attribute.m4 b/autoconf/m4/pa_func_attribute.m4 index a0b69b3a..5b475bfd 100644 --- a/autoconf/m4/pa_func_attribute.m4 +++ b/autoconf/m4/pa_func_attribute.m4 @@ -17,7 +17,7 @@ AC_DEFUN([_PA_FUNC_ATTRIBUTE], m4_define([_pa_fam],ifelse([$2],[],[],[(m4_join([,],m4_for(_pa_n,1,m4_count($2),1,[m4_quote([x]_pa_n),])))])) m4_define([_pa_suf],ifelse([$2],[],[],[m4_count($2)])) m4_define([_pa_mac],ifelse([$6],[],[$1_func]_pa_suf,[$6])) - AC_MSG_CHECKING([if $CC supports the $1]_pa_faa[ function attribute]) + AC_MSG_CHECKING([whether $]_AC_CC[ supports the $1]_pa_faa[ function attribute]) AC_COMPILE_IFELSE([AC_LANG_SOURCE([ AC_INCLUDES_DEFAULT PA_ATTRIBUTE_SYNTAX @@ -50,7 +50,7 @@ AC_DEFUN([_PA_FUNC_PTR_ATTRIBUTE], m4_define([_pa_fam],ifelse([$2],[],[],[(m4_join([,],m4_for(_pa_n,1,m4_count($2),1,[m4_quote([x]_pa_n),])))])) m4_define([_pa_suf],ifelse([$2],[],[],[m4_count($2)])) m4_define([_pa_mac],ifelse([$6],[],[$1_func]_pa_suf,[$6])_ptr) - AC_MSG_CHECKING([if $CC supports the $1]_pa_faa[ function attribute on pointers]) + AC_MSG_CHECKING([whether $]_AC_CC[ supports the $1]_pa_faa[ function attribute on pointers]) AC_COMPILE_IFELSE([AC_LANG_SOURCE([ AC_INCLUDES_DEFAULT PA_ATTRIBUTE_SYNTAX diff --git a/autoconf/m4/pa_func_attribute_error.m4 b/autoconf/m4/pa_func_attribute_error.m4 index bd6a12a7..035c2c93 100644 --- a/autoconf/m4/pa_func_attribute_error.m4 +++ b/autoconf/m4/pa_func_attribute_error.m4 @@ -11,7 +11,7 @@ dnl This doesn't use a function pointer because there is no need: dnl the error function will never be a function pointer. dnl -------------------------------------------------------------------------- AC_DEFUN([PA_FUNC_ATTRIBUTE_ERROR], -[AC_MSG_CHECKING([if $CC supports the error function attribute]) +[AC_MSG_CHECKING([whether $]_AC_CC[ supports the error function attribute]) AC_COMPILE_IFELSE([AC_LANG_SOURCE([ AC_INCLUDES_DEFAULT PA_ATTRIBUTE_SYNTAX diff --git a/autoconf/m4/pa_have_func.m4 b/autoconf/m4/pa_have_func.m4 index d32b1fd1..46203e6b 100644 --- a/autoconf/m4/pa_have_func.m4 +++ b/autoconf/m4/pa_have_func.m4 @@ -13,22 +13,25 @@ AC_DEFUN([_PA_HAVE_FUNC_INCLUDE], ])]) AC_DEFUN([PA_HAVE_FUNC], -[AC_CACHE_CHECK([for $1], [pa_cv_func_$1], +[AS_VAR_PUSHDEF([cache],[PA_SHSYM([pa_cv_func_$1])]) + AC_CACHE_CHECK([for $1], [cache], [ m4_ifnblank([$3],[AC_CHECK_HEADERS_ONCE($3)])dnl m4_pushdef([pa_func_args],m4_strip(m4_default([$2],[(0)])))dnl m4_pushdef([pa_func_type],m4_default([$4],[void]))dnl AC_LINK_IFELSE([AC_LANG_PROGRAM( +[AC_INCLUDES_DEFAULT] m4_map_args_w([$3], [_PA_HAVE_FUNC_INCLUDE(], [)]), m4_cond(pa_func_type,[void],[ (void)$1]pa_func_args[;],[ ]pa_func_type[ tmp = $1]pa_func_args[; (void)tmp;]) -)],[pa_cv_func_$1=yes],[pa_cv_func_$1=no]) +)],[AS_VAR_SET([cache],[yes])],[AS_VAR_SET([cache],[no])]) m4_popdef([pa_func_args])dnl m4_popdef([pa_func_type])dnl ]) -AS_IF([test "x$pa_cv_func_$1" = xyes], +AS_VAR_IF([cache],[yes], [AC_DEFINE(PA_CSYM([HAVE_$1]), 1, -["Define to 1 if you have the `$1' intrinsic function."])])]) +["Define to 1 if you have the `$1' intrinsic function."])]) +]) diff --git a/autoconf/m4/pa_lang_flagvar.m4 b/autoconf/m4/pa_lang_flagvar.m4 new file mode 100644 index 00000000..269d4e3b --- /dev/null +++ b/autoconf/m4/pa_lang_flagvar.m4 @@ -0,0 +1,21 @@ +dnl -------------------------------------------------------------------------- +dnl PA_LANG_FLAGVAR([language]) +dnl +dnl Return the name of the compiler flag variable for the current or +dnl specified language. Returns empty if the variable name is not known. +dnl -------------------------------------------------------------------------- +AC_DEFUN([PA_LANG_FLAGVAR], +[m4_case(m4_quote(m4_default([$1],m4_quote(_AC_LANG))), + [C], [CFLAGS], + [C++], [CXXFLAGS], + [Fortran 77], [FFLAGS], + [Fortran], [FCFLAGS], + [Erlang], [ERLCFLAGS], + [Objective C], [OBJCFLAGS], + [Objective C++], [OBJCXXFLAGS], + [Go], [GOFLAGS], + [m4_fatal([PA_LANG_FLAGVAR: Unknown language: $1])])]) + +AC_DEFUN([PA_LANG_HAVE_FLAGVAR_LIST], + [[[C], [C++], [Fortran 77], [Fortran], [Erlang], + [Objective C], [Objective C++], [Go]]]) diff --git a/autoconf/m4/pa_lang_foreach.m4 b/autoconf/m4/pa_lang_foreach.m4 index 650913d8..5807db5a 100644 --- a/autoconf/m4/pa_lang_foreach.m4 +++ b/autoconf/m4/pa_lang_foreach.m4 @@ -4,12 +4,14 @@ dnl dnl Expand [body] for each language encountered in the configure script also dnl present in [subset], or all if [subset] is empty dnl -------------------------------------------------------------------------- -AC_DEFUN([_PA_LANG_DO],dnl -[AC_LANG([$2])dnl -$1]) +AC_DEFUN([_PA_LANG_FOREACH], +[m4_pushdef([pa_lang_for_each])dnl +m4_foreach([pa_lang_for_each],$1,[dnl +AC_LANG_PUSH(pa_lang_for_each) +$2 +AC_LANG_POP(pa_lang_for_each) +])dnl +m4_popdef([pa_lang_for_each])]) -AC_DEFUN([PA_LANG_FOREACH],dnl -[m4_pushdef([_pa_lang_foreach_current],[_AC_LANG])dnl -m4_map_args([m4_curry([_PA_LANG_DO],[$2])],m4_unquote(PA_LANG_SEEN_LIST($1)))dnl -AC_LANG(_pa_lang_foreach_current)dnl -m4_popdef([_pa_lang_foreach_current])]) +AC_DEFUN([PA_LANG_FOREACH], +[_PA_LANG_FOREACH(m4_dquote(PA_LANG_SEEN_LIST(m4_dquote($1))),[$2])]) diff --git a/autoconf/m4/pa_lang_seen_list.m4 b/autoconf/m4/pa_lang_seen_list.m4 index d5240136..b0123c1a 100644 --- a/autoconf/m4/pa_lang_seen_list.m4 +++ b/autoconf/m4/pa_lang_seen_list.m4 @@ -7,14 +7,10 @@ dnl dnl This relies on overriding _AC_LANG_SET(from, to), dnl the internal implementation of _AC_LANG. dnl -------------------------------------------------------------------------- -m4_ifndef([_PA_LANG_SET], -[m4_rename([_AC_LANG_SET], [_PA_LANG_SET])dnl -m4_defun([_AC_LANG_SET], [m4_set_add([_PA_LANG_SEEN_SET],[$2])dnl -_PA_LANG_SET($@)])]) - AC_DEFUN([PA_LANG_SEEN_LIST], +[m4_ifblank([$1], +[m4_define([_pa_lang_seen_list_out],m4_dquote(m4_set_list(PA_LANG_SEEN_SET)))], [m4_set_delete([_pa_lang_seen_subset])dnl -m4_pushdef([_pa_lang_seen_subset_list],m4_ifnblank([$1],[$1],m4_dquote(m4_set_list([_PA_LANG_SEEN_SET]))))dnl -m4_set_add_all([_pa_lang_seen_subset],_pa_lang_seen_subset_list)dnl -m4_cdr(m4_set_intersection([_pa_lang_seen_subset],[_PA_LANG_SEEN_SET]))dnl -m4_popdef([_pa_lang_seen_subset_list])]) +m4_set_add_all([_pa_lang_seen_subset],$1)dnl +m4_define([_pa_lang_seen_list_out],m4_dquote(m4_cdr(m4_set_intersection([_pa_lang_seen_subset],PA_LANG_SEEN_SET))))dnl +m4_dquote(_pa_lang_seen_list_out)])]) diff --git a/autoconf/m4/pa_lang_seen_set.m4 b/autoconf/m4/pa_lang_seen_set.m4 new file mode 100644 index 00000000..c1bb126a --- /dev/null +++ b/autoconf/m4/pa_lang_seen_set.m4 @@ -0,0 +1,19 @@ +dnl -------------------------------------------------------------------------- +dnl PA_LANG_SEEN_SET +dnl +dnl Set of the languages that have been used in the configuration. +dnl +dnl This relies on overriding _AC_LANG_SET(from, to), +dnl the internal implementation of _AC_LANG. +dnl +dnl The very first language transition [] -> [C] is ignored, because +dnl it is done from AC_INIT regardless of any user specified language. +dnl -------------------------------------------------------------------------- + +m4_ifndef([_PA_LANG_SET], +[m4_rename([_AC_LANG_SET], [_PA_LANG_SET]) +m4_set_delete([_pa_lang_seen_set]) +m4_defun([_AC_LANG_SET], +[m4_ifnblank([$1],[m4_set_add([_pa_lang_seen_set],[$2])])_PA_LANG_SET($@)])]) + +AC_DEFUN([PA_LANG_SEEN_SET],[[_pa_lang_seen_set]]) diff --git a/autoconf/m4/pa_option_debug.m4 b/autoconf/m4/pa_option_debug.m4 index ae7d9db8..6b1a40b3 100644 --- a/autoconf/m4/pa_option_debug.m4 +++ b/autoconf/m4/pa_option_debug.m4 @@ -6,8 +6,8 @@ dnl --enable-debug is set or not. Some flags are set regardless... dnl -------------------------------------------------------------------------- AC_DEFUN([PA_OPTION_DEBUG], [PA_ARG_DISABLED([gdb], [disable gdb debug extensions], - [PA_ADD_LANGFLAGS([-g3])], [PA_ADD_LANGFLAGS([-ggdb3 -g3])]) + [PA_ADD_LANGFLAGS([-g3])], [PA_ADD_LANGFLAGS([-ggdb3],[-g3])]) PA_ARG_ENABLED([debug], [optimize for debugging], - [PA_ADD_LANGFLAGS([-Og -O0]) + [PA_ADD_LANGFLAGS([-Og],[-O0]) $1], [$2])]) diff --git a/autoconf/m4/pa_option_gc.m4 b/autoconf/m4/pa_option_gc.m4 index febb61bf..863cadb9 100644 --- a/autoconf/m4/pa_option_gc.m4 +++ b/autoconf/m4/pa_option_gc.m4 @@ -9,6 +9,6 @@ AC_DEFUN([PA_OPTION_GC], [do not compile with dead code garbage collection support], [], [PA_ADD_LDFLAGS([-Wl,--as-needed]) - PA_ADD_CFLAGS([-ffunction-sections]) - PA_ADD_CFLAGS([-fdata-sections]) + PA_ADD_LANGFLAGS([-ffunction-sections]) + PA_ADD_LANGFLAGS([-fdata-sections]) PA_ADD_LDFLAGS([-Wl,--gc-sections])])]) diff --git a/autoconf/m4/pa_option_lto.m4 b/autoconf/m4/pa_option_lto.m4 index ea5456b6..88f361b8 100644 --- a/autoconf/m4/pa_option_lto.m4 +++ b/autoconf/m4/pa_option_lto.m4 @@ -7,15 +7,15 @@ dnl but that could change in the future -- to force disabled by default, dnl set to "no". dnl -------------------------------------------------------------------------- AC_DEFUN([PA_OPTION_LTO], -[PA_ARG_BOOL([lto], +[AC_BEFORE([$0],[AC_PROG_AR])dnl + AC_BEFORE([$0],[AC_PROG_RANLIB])dnl + PA_ARG_BOOL([lto], [Try to enable link-time optimization for this compiler], - [$1], - [PA_ADD_LANGFLAGS([-flto=auto -flto]) -PA_ADD_LANGFLAGS([-ffat-lto-objects]) -dnl Note: we use _PROG rather than _TOOL since we are prepending the full -dnl CC name which ought to already contain the host triplet if needed - ccbase=`echo "$CC" | awk '{ print $1; }'` - AC_CHECK_PROGS(CC_AR, [${ccbase}-ar], [$ac_cv_prog_AR]) - AR="$CC_AR" - AC_CHECK_PROGS(CC_RANLIB, [${ccbase}-ranlib], [$ac_cv_prog_RANLIB]) - RANLIB="$CC_RANLIB"])]) + [m4_default([$1],[no])], + [PA_FIND_FLAGS([-flto=auto],[-flto]) + PA_FIND_FLAGS([-ffat-lto-objects]) + PA_FIND_FLAGS([-fuse-linker-plugin]) + + AS_IF([test x$ac_compiler_gnu = xyes], + [AC_CHECK_TOOL(AR, [gcc-ar], [ar], [:]) + AC_CHECK_TOOL(RANLIB, [gcc-ranlib], [ranlib], [:])])])]) diff --git a/autoconf/m4/pa_option_sanitizer.m4 b/autoconf/m4/pa_option_sanitizer.m4 index 17ab0ad0..d096e16f 100644 --- a/autoconf/m4/pa_option_sanitizer.m4 +++ b/autoconf/m4/pa_option_sanitizer.m4 @@ -6,6 +6,6 @@ dnl -------------------------------------------------------------------------- AC_DEFUN([PA_OPTION_SANITIZER], [PA_ARG_ENABLED([sanitizer], [compile with sanitizers enabled], - [PA_ADD_CFLAGS([-fno-omit-frame-pointer]) - PA_ADD_CFLAGS([-fsanitize=address]) - PA_ADD_CFLAGS([-fsanitize=undefined])])]) + [PA_ADD_LANGFLAGS([-fno-omit-frame-pointer]) + PA_ADD_LANGFLAGS([-fsanitize=address]) + PA_ADD_LANGFLAGS([-fsanitize=undefined])])]) diff --git a/autoconf/m4/pa_shsym.m4 b/autoconf/m4/pa_shsym.m4 new file mode 100644 index 00000000..0bf02924 --- /dev/null +++ b/autoconf/m4/pa_shsym.m4 @@ -0,0 +1,14 @@ +dnl -------------------------------------------------------------------------- +dnl PA_SHSYM(...) +dnl +dnl Convert a (semi-) arbitrary string to a shell symbol +dnl Convert non-shell characters to underscores, except + which is converted +dnl to x (so C++ -> cxx). Unlike PA_SYM(), do not compact multiple +dnl underscores. +dnl +dnl This currently differs from PA_CSYM only in not doing case conversion. +dnl -------------------------------------------------------------------------- +AC_DEFUN([PA_SHSYM], +[m4_bpatsubsts(m4_quote(m4_normalize([$*])), +[[ ]+],[],[\+],[x],[[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]],[_], +[^._\(.*\)_.$],[[[\1]]])])