Invoke AC_PROG_SED to ensure a portable, working sed is available instead of assuming one is present and risking obscure configure-time failures. Replace direct sed invocations with the detected $(SED) variable so the build consistently uses the correct version.
Signed-off-by: Bill Roberts <[email protected]> --- configure.ac | 41 +++++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/configure.ac b/configure.ac index d91d740d2..4d1921ee2 100644 --- a/configure.ac +++ b/configure.ac @@ -84,6 +84,7 @@ AM_MAINTAINER_MODE # Check for extra tools needed by configure AC_PROG_GREP +AC_PROG_SED AC_ARG_ENABLE(assert, AS_HELP_STRING([--enable-assert],[enable ASSERT checking [default=no]]), @@ -280,7 +281,7 @@ if test $enable_fake_cpuid = yes && test $enable_fat = no ; then fi -tmp_host=`echo $host_cpu | sed 's/\./_/'` +tmp_host=`echo $host_cpu | $SED 's/\./_/'` AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_$tmp_host) GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_HOST_CPU_$tmp_host')", POST) @@ -2163,7 +2164,7 @@ for abi in $abilist; do # $gcc_cflags becomes a fallback for $gcc_32_cflags (the last in the # abilist), but there's no fallback for $gcc_64_cflags. # - abi1=[`echo _$abi | sed 's/[.]//g'`] + abi1=[`echo _$abi | $SED 's/[.]//g'`] if test $abi = $abi_last; then abi2=; else abi2="$abi1"; fi # Compiler choices under this ABI @@ -2179,7 +2180,7 @@ for abi in $abilist; do # CC="/usr/local/bin/gcc -pipe" will give "gcc". # for ccbase in $CC; do break; done - ccbase=`echo $ccbase | sed 's:.*/::'` + ccbase=`echo $ccbase | $SED 's:.*/::'` # If this $ccbase is in $cclist_chosen then it's a compiler we know and # we can do flags defaulting with it. If not, then $cclist_chosen is @@ -2463,7 +2464,7 @@ if test $found_compiler = yes; then CPPFLAGS="$cppflags" # Could easily have this in config.h too, if desired. - ABI_nodots=`echo $ABI | sed 's/\./_/'` + ABI_nodots=`echo $ABI | $SED 's/\./_/'` GMP_DEFINE_RAW("define_not_for_expansion(\`HAVE_ABI_$ABI_nodots')", POST) eval GMP_NONSTD_ABI=\"\$GMP_NONSTD_ABI_$ABI_nodots\" @@ -2582,7 +2583,7 @@ if test $enable_cxx != no; then cxxflags_cflags=$CFLAGS cxxflags_list="cflags $cxxflags_list" if test "$ac_prog_cxx_g" = no; then - cxxflags_cflags=`echo "$cxxflags_cflags" | sed -e 's/ -g //' -e 's/^-g //' -e 's/ -g$//'` + cxxflags_cflags=`echo "$cxxflags_cflags" | $SED -e 's/ -g //' -e 's/^-g //' -e 's/ -g$//'` fi fi @@ -2710,10 +2711,6 @@ echo " MPN_PATH=\"$path\"" CL_AS_NOEXECSTACK -AC_PROG_SED -# FIXME: AC_PROG_SED above is a hack (LT_PATH_NM uses $SED), it normally -# happens as part of LT_INIT, and we are not supposed to call LT_PATH_NM before -# LT_INIT, but the comments in acinclude.m4 say we want it before LT_INIT... GMP_PROG_AR GMP_PROG_NM @@ -3326,7 +3323,7 @@ DECL_$tmp_fbase (__MPN(${tmp_fbase}_init));" >>fat.h tmp_mparam=$srcdir/mpn/$tmp_dir/gmp-mparam.h if test -f $tmp_mparam; then for tmp_tn in $fat_thresholds; do - tmp_thresh=`sed -n "s/^#define $tmp_tn[ ]*\\([0-9][0-9]*\\).*$/\\1/p" $tmp_mparam` + tmp_thresh=`$SED -n "s/^#define $tmp_tn[ ]*\\([0-9][0-9]*\\).*$/\\1/p" $tmp_mparam` if test -n "$tmp_thresh"; then THRESH_ASM_SETUP=["${THRESH_ASM_SETUP}define($tmp_tn,$tmp_thresh) "] @@ -3354,7 +3351,7 @@ DECL_$tmp_fbase (__MPN(${tmp_fbase}_init));" >>fat.h # If the host uses a non-standard ABI, check if tmp_file supports it # if test -n "$GMP_NONSTD_ABI" && test $tmp_ext != "c"; then - abi=[`sed -n 's/^[ ]*ABI_SUPPORT(\(.*\))/\1/p' $tmp_file `] + abi=[`$SED -n 's/^[ ]*ABI_SUPPORT(\(.*\))/\1/p' $tmp_file `] if echo "$abi" | $GREP -q "\\b${GMP_NONSTD_ABI}\\b"; then true else @@ -3369,7 +3366,7 @@ DECL_$tmp_fbase (__MPN(${tmp_fbase}_init));" >>fat.h # carry-in variant, eg. divrem_1c or modexact_1c_odd case $tmp_fbase in - *_1*) tmp_fbasec=`echo $tmp_fbase | sed 's/_1/_1c/'` ;; + *_1*) tmp_fbasec=`echo $tmp_fbase | $SED 's/_1/_1c/'` ;; *) tmp_fbasec=${tmp_fbase}c ;; esac @@ -3508,12 +3505,12 @@ for tmp_fn in $gmp_mpn_functions; do # to operate on full limbs ;; *) - nails=[`sed -n 's/^[ ]*NAILS_SUPPORT(\(.*\))/\1/p' $tmp_file `] + nails=[`$SED -n 's/^[ ]*NAILS_SUPPORT(\(.*\))/\1/p' $tmp_file `] for n in $nails; do case $n in *-*) - n_start=`echo "$n" | sed -n 's/\(.*\)-.*/\1/p'` - n_end=`echo "$n" | sed -n 's/.*-\(.*\)/\1/p'` + n_start=`echo "$n" | $SED -n 's/\(.*\)-.*/\1/p'` + n_end=`echo "$n" | $SED -n 's/.*-\(.*\)/\1/p'` ;; *) n_start=$n @@ -3535,7 +3532,7 @@ for tmp_fn in $gmp_mpn_functions; do # If the host uses a non-standard ABI, check if tmp_file supports it # if test -n "$GMP_NONSTD_ABI" && test $tmp_ext != "c"; then - abi=[`sed -n 's/^[ ]*ABI_SUPPORT(\(.*\))/\1/p' $tmp_file `] + abi=[`$SED -n 's/^[ ]*ABI_SUPPORT(\(.*\))/\1/p' $tmp_file `] if echo "$abi" | $GREP -q "\\b${GMP_NONSTD_ABI}\\b"; then true else @@ -3561,8 +3558,8 @@ for tmp_fn in $gmp_mpn_functions; do # that multi-function files get grepped here repeatedly. # The PROLOGUE pattern excludes the optional second parameter. gmp_ep=[` - sed -n 's/^[ ]*MULFUNC_PROLOGUE(\(.*\))/\1/p' $tmp_file ; - sed -n 's/^[ ]*PROLOGUE(\([^,]*\).*)/\1/p' $tmp_file + $SED -n 's/^[ ]*MULFUNC_PROLOGUE(\(.*\))/\1/p' $tmp_file ; + $SED -n 's/^[ ]*PROLOGUE(\([^,]*\).*)/\1/p' $tmp_file `] for gmp_tmp in $gmp_ep; do AC_DEFINE_UNQUOTED(HAVE_NATIVE_$gmp_tmp) @@ -3744,7 +3741,7 @@ fi if test "$gmp_asm_syntax_testing" != no; then SAVE_CFLAGS="$CFLAGS" - CFLAGS="`echo $SAVE_CFLAGS | sed 's;-flto[[-=a-z0-9]]*;;g'`" + CFLAGS="`echo $SAVE_CFLAGS | $SED 's;-flto[[-=a-z0-9]]*;;g'`" GMP_ASM_TEXT GMP_ASM_DATA GMP_ASM_LABEL_SUFFIX @@ -3921,7 +3918,7 @@ AC_DEFINE_UNQUOTED(GMP_MPARAM_H_SUGGEST, "$gmp_mparam_source", # if test -z "$fat_path"; then for i in SQR_TOOM2_THRESHOLD BMOD_1_TO_MOD_1_THRESHOLD SHLD_SLOW SHRD_SLOW; do - value=`sed -n 's/^#define '$i'[ ]*\([0-9A-Z][0-9A-Z_]*\).*$/\1/p' $gmp_mparam_source` + value=`$SED -n 's/^#define '$i'[ ]*\([0-9A-Z][0-9A-Z_]*\).*$/\1/p' $gmp_mparam_source` if test -n "$value"; then GMP_DEFINE_RAW(["define(<$i>,<$value>)"]) fi @@ -3954,7 +3951,7 @@ GMP_DEFINE_RAW(["define(<SIZEOF_UNSIGNED>,<$ac_cv_sizeof_unsigned>)"]) # probably wouldn't want to be fatal, none of the libgmp assembler code # depends on ulong. # -mparam_bits=[`sed -n 's/^#define GMP_LIMB_BITS[ ][ ]*\([0-9]*\).*$/\1/p' $gmp_mparam_source`] +mparam_bits=[`$SED -n 's/^#define GMP_LIMB_BITS[ ][ ]*\([0-9]*\).*$/\1/p' $gmp_mparam_source`] if test -n "$mparam_bits" && test "$mparam_bits" -ne $GMP_LIMB_BITS; then if test "$test_CFLAGS" = set; then AC_MSG_ERROR([Oops, mp_limb_t is $GMP_LIMB_BITS bits, but the assembler code @@ -3982,7 +3979,7 @@ TUNE_SQR_OBJ= test -d tune || mkdir tune case $sqr_basecase_source in *.asm) - sqr_max=[`sed -n 's/^def...(SQR_TOOM2_THRESHOLD_MAX, *\([0-9]*\))/\1/p' $sqr_basecase_source`] + sqr_max=[`$SED -n 's/^def...(SQR_TOOM2_THRESHOLD_MAX, *\([0-9]*\))/\1/p' $sqr_basecase_source`] if test -n "$sqr_max"; then TUNE_SQR_OBJ=sqr_asm.o AC_DEFINE_UNQUOTED(TUNE_SQR_TOOM2_MAX,$sqr_max, -- 2.51.0 _______________________________________________ gmp-devel mailing list [email protected] https://gmplib.org/mailman/listinfo/gmp-devel
