This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Move system-specific settings out of toplevel configure.in and config.make.in


On Wed, 20 Mar 2013, Roland McGrath wrote:

> This is a good thing.  It looks odd to me for the rhs to be a variable name
> instead of the value, i.e. the macro inserting the $ instead of the uses
> doing that.  Since this macro can be used in conditionals and such, it
> seems reasonable that it might be used in ways other than just using a
> variable verbatim.

Here's a version where an arbitrary shell string can be used rather
than an implicit $ being inserted.  (The changes to the generated
configure scripts are identical to those from the previous version of
the patch.)

2013-03-20  Joseph Myers  <joseph@codesourcery.com>

	* aclocal.m4 (LIBC_CONFIG_VAR): New autoconf macro.
	* config.make.in (config-cflags-sse4): Remove variable.
	(config-cflags-avx): Likewise.
	(config-cflags-sse2avx): Likewise.
	(config-cflags-novzeroupper): Likewise.
	(config-asflags-i686): Likewise.
	(have-mfma4): Likewise.
	(have-as-vis3): Likewise.
	(MIG): Likewise.
	* configure.in (MIG): Do not AC_SUBST.
	(libc_cv_cc_nofma): Move AC_SUBST next to configure test.
	(libc_cv_cc_sse4): Do not AC_SUBST.
	(libc_cv_cc_avx): Likewise.
	(libc_cv_cc_sse2avx): Likewise.
	(libc_cv_cc_novzeroupper): Likewise.
	(libc_cv_cc_fma4): Likewise.
	(libc_cv_as_i686): Likewise.
	(libc_cv_sparc_as_vis3): Likewise.
	* sysdeps/i386/configure.in (config-cflags-sse4): Set using
	LIBC_CONFIG_VAR.
	(config-asflags-i686): Likewise.
	(config-cflags-avx): Likewise.
	(config-cflags-sse2avx): Likewise.
	(have-mfma4): Likewise.
	(config-cflags-novzeroupper): Likewise.
	* sysdeps/mach/configure.in (MIG): Likewise.
	* sysdeps/sparc/configure.in (have-as-vis3): Likewise.
	* sysdeps/x86_64/configure.in (config-cflags-sse4): Set using
	LIBC_CONFIG_VAR.
	(config-cflags-avx): Likewise.
	(config-cflags-sse2avx): Likewise.
	(have-mfma4): Likewise.
	(config-cflags-novzeroupper): Likewise.
	* configure: Regenerated.
	* sysdeps/i386/configure: Likewise.
	* sysdeps/mach/configure: Likewise.
	* sysdeps/sparc/configure: Likewise.
	* sysdeps/x86_64/configure: Likewise.

diff --git a/aclocal.m4 b/aclocal.m4
index 956ea86..042a7e3 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -241,3 +241,10 @@ else
   $4
 fi
 AC_MSG_RESULT($libc_linker_feature)])
+
+dnl Add a makefile variable, with value set from a shell string
+dnl (expanded by the shell inside double quotes), to config.make.
+dnl LIBC_CONFIG_VAR(make-variable, shell-value)
+AC_DEFUN([LIBC_CONFIG_VAR],
+[config_vars="$config_vars
+$1 = $2"])
diff --git a/config.make.in b/config.make.in
index 2cab2f3..b01b70b 100644
--- a/config.make.in
+++ b/config.make.in
@@ -37,12 +37,7 @@ cflags-cpu = @libc_cv_cc_submachine@
 asflags-cpu = @libc_cv_cc_submachine@
 
 config-extra-cflags = @libc_extra_cflags@
-config-cflags-sse4 = @libc_cv_cc_sse4@
-config-cflags-avx = @libc_cv_cc_avx@
-config-cflags-sse2avx = @libc_cv_cc_sse2avx@
-config-cflags-novzeroupper = @libc_cv_cc_novzeroupper@
 config-cflags-nofma = @libc_cv_cc_nofma@
-config-asflags-i686 = @libc_cv_as_i686@
 
 defines = @DEFINES@
 sysheaders = @sysheaders@
@@ -58,8 +53,6 @@ old-glibc-headers = @old_glibc_headers@
 unwind-find-fde = @libc_cv_gcc_unwind_find_fde@
 have-forced-unwind = @libc_cv_forced_unwind@
 have-fpie = @libc_cv_fpie@
-have-mfma4 = @libc_cv_cc_fma4@
-have-as-vis3 = @libc_cv_sparc_as_vis3@
 gnu89-inline-CFLAGS = @gnu89_inline@
 have-ssp = @libc_cv_ssp@
 have-selinux = @have_selinux@
@@ -115,7 +108,6 @@ AR = @AR@
 NM = @NM@
 MAKEINFO = @MAKEINFO@
 AS = $(CC) -c
-MIG = @MIG@
 BISON = @BISON@
 AUTOCONF = @AUTOCONF@
 OBJDUMP = @OBJDUMP@
diff --git a/configure b/configure
index 2dc7eeb..088bef0 100755
--- a/configure
+++ b/configure
@@ -581,14 +581,6 @@ shared
 static
 ldd_rewrite_script
 use_ldconfig
-libc_cv_sparc_as_vis3
-libc_cv_as_i686
-libc_cv_cc_nofma
-libc_cv_cc_fma4
-libc_cv_cc_novzeroupper
-libc_cv_cc_sse2avx
-libc_cv_cc_avx
-libc_cv_cc_sse4
 libc_cv_forced_unwind
 libc_cv_rootsbindir
 libc_cv_localstatedir
@@ -607,6 +599,7 @@ have_libcap
 have_libaudit
 LIBGD
 libc_cv_cc_submachine
+libc_cv_cc_nofma
 exceptions
 gnu89_inline
 libc_cv_ssp
@@ -639,7 +632,6 @@ MSGFMT
 MAKE
 LD
 AS
-MIG
 OBJCOPY
 OBJDUMP
 AR
@@ -6912,6 +6904,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_nofma" >&5
 $as_echo "$libc_cv_cc_nofma" >&6; }
 
+
 if test -n "$submachine"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler option for CPU variant" >&5
 $as_echo_n "checking for compiler option for CPU variant... " >&6; }
@@ -7367,15 +7360,6 @@ fi
 
 
 
-
-
-
-
-
-
-
-
-
 if test x$use_ldconfig = xyes; then
   $as_echo "#define USE_LDCONFIG 1" >>confdefs.h
 
diff --git a/configure.in b/configure.in
index cb31730..bbdf156 100644
--- a/configure.in
+++ b/configure.in
@@ -954,7 +954,6 @@ fi
 AC_PROG_LN_S
 
 LIBC_PROG_BINUTILS
-AC_SUBST(MIG)dnl Needed by sysdeps/mach/configure.in
 
 # Accept binutils 2.20 or newer.
 AC_CHECK_PROG_VER(AS, $AS, --version,
@@ -1948,6 +1947,7 @@ libc_cv_cc_nofma=
 for opt in -ffp-contract=off -mno-fused-madd; do
   LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
 done])
+AC_SUBST(libc_cv_cc_nofma)
 
 if test -n "$submachine"; then
   AC_CACHE_CHECK([for compiler option for CPU variant],
@@ -2160,16 +2160,6 @@ AC_SUBST(libc_cv_localstatedir)
 AC_SUBST(libc_cv_rootsbindir)
 AC_SUBST(libc_cv_forced_unwind)
 
-dnl sysdeps/CPU/configure.in checks set this via arch-specific asm tests
-AC_SUBST(libc_cv_cc_sse4)
-AC_SUBST(libc_cv_cc_avx)
-AC_SUBST(libc_cv_cc_sse2avx)
-AC_SUBST(libc_cv_cc_novzeroupper)
-AC_SUBST(libc_cv_cc_fma4)
-AC_SUBST(libc_cv_cc_nofma)
-AC_SUBST(libc_cv_as_i686)
-AC_SUBST(libc_cv_sparc_as_vis3)
-
 if test x$use_ldconfig = xyes; then
   AC_DEFINE(USE_LDCONFIG)
 fi
diff --git a/sysdeps/i386/configure b/sysdeps/i386/configure
index 7b3683f..d81b613 100644
--- a/sysdeps/i386/configure
+++ b/sysdeps/i386/configure
@@ -66,6 +66,8 @@ if test $libc_cv_cc_sse4 = yes; then
   $as_echo "#define HAVE_SSE4_SUPPORT 1" >>confdefs.h
 
 fi
+config_vars="$config_vars
+config-cflags-sse4 = $libc_cv_cc_sse4"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler -mtune=i686 support" >&5
 $as_echo_n "checking for assembler -mtune=i686 support... " >&6; }
@@ -86,6 +88,8 @@ fi
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_as_i686" >&5
 $as_echo "$libc_cv_as_i686" >&6; }
+config_vars="$config_vars
+config-asflags-i686 = $libc_cv_as_i686"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVX support" >&5
 $as_echo_n "checking for AVX support... " >&6; }
@@ -110,6 +114,8 @@ if test $libc_cv_cc_avx = yes; then
   $as_echo "#define HAVE_AVX_SUPPORT 1" >>confdefs.h
 
 fi
+config_vars="$config_vars
+config-cflags-avx = $libc_cv_cc_avx"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVX encoding of SSE instructions" >&5
 $as_echo_n "checking for AVX encoding of SSE instructions... " >&6; }
@@ -134,6 +140,8 @@ if test $libc_cv_cc_sse2avx = yes; then
   $as_echo "#define HAVE_SSE2AVX_SUPPORT 1" >>confdefs.h
 
 fi
+config_vars="$config_vars
+config-cflags-sse2avx = $libc_cv_cc_sse2avx"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FMA4 support" >&5
 $as_echo_n "checking for FMA4 support... " >&6; }
@@ -158,6 +166,8 @@ if test $libc_cv_cc_fma4 = yes; then
   $as_echo "#define HAVE_FMA4_SUPPORT 1" >>confdefs.h
 
 fi
+config_vars="$config_vars
+have-mfma4 = $libc_cv_cc_fma4"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -mno-vzeroupper support" >&5
 $as_echo_n "checking for -mno-vzeroupper support... " >&6; }
@@ -178,6 +188,8 @@ fi
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_novzeroupper" >&5
 $as_echo "$libc_cv_cc_novzeroupper" >&6; }
+config_vars="$config_vars
+config-cflags-novzeroupper = $libc_cv_cc_novzeroupper"
 
 $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
 
diff --git a/sysdeps/i386/configure.in b/sysdeps/i386/configure.in
index 36cb3e4..9967a16 100644
--- a/sysdeps/i386/configure.in
+++ b/sysdeps/i386/configure.in
@@ -12,6 +12,7 @@ LIBC_TRY_CC_OPTION([-msse4], [libc_cv_cc_sse4=yes], [libc_cv_cc_sse4=no])
 if test $libc_cv_cc_sse4 = yes; then
   AC_DEFINE(HAVE_SSE4_SUPPORT)
 fi
+LIBC_CONFIG_VAR([config-cflags-sse4], [$libc_cv_cc_sse4])
 
 dnl Check if -Wa,-mtune=i686 works.
 AC_CACHE_CHECK(for assembler -mtune=i686 support, libc_cv_as_i686, [dnl
@@ -19,6 +20,7 @@ LIBC_TRY_CC_OPTION([-Wa,-mtune=i686],
 		   [libc_cv_as_i686=yes],
 		   [libc_cv_as_i686=no])
 ])
+LIBC_CONFIG_VAR([config-asflags-i686], [$libc_cv_as_i686])
 
 dnl Check if -mavx works.
 AC_CACHE_CHECK(for AVX support, libc_cv_cc_avx, [dnl
@@ -27,6 +29,7 @@ LIBC_TRY_CC_OPTION([-mavx], [libc_cv_cc_avx=yes], [libc_cv_cc_avx=no])
 if test $libc_cv_cc_avx = yes; then
   AC_DEFINE(HAVE_AVX_SUPPORT)
 fi
+LIBC_CONFIG_VAR([config-cflags-avx], [$libc_cv_cc_avx])
 
 dnl Check if -msse2avx works.
 AC_CACHE_CHECK(for AVX encoding of SSE instructions, libc_cv_cc_sse2avx, [dnl
@@ -37,6 +40,7 @@ LIBC_TRY_CC_OPTION([-msse2avx],
 if test $libc_cv_cc_sse2avx = yes; then
   AC_DEFINE(HAVE_SSE2AVX_SUPPORT)
 fi
+LIBC_CONFIG_VAR([config-cflags-sse2avx], [$libc_cv_cc_sse2avx])
 
 dnl Check if -mfma4 works.
 AC_CACHE_CHECK(for FMA4 support, libc_cv_cc_fma4, [dnl
@@ -45,6 +49,7 @@ LIBC_TRY_CC_OPTION([-mfma4], [libc_cv_cc_fma4=yes], [libc_cv_cc_fma4=no])
 if test $libc_cv_cc_fma4 = yes; then
   AC_DEFINE(HAVE_FMA4_SUPPORT)
 fi
+LIBC_CONFIG_VAR([have-mfma4], [$libc_cv_cc_fma4])
 
 dnl Check if -mno-vzeroupper works.
 AC_CACHE_CHECK(for -mno-vzeroupper support, libc_cv_cc_novzeroupper, [dnl
@@ -52,6 +57,7 @@ LIBC_TRY_CC_OPTION([-mno-vzeroupper],
 		   [libc_cv_cc_novzeroupper=yes],
 		   [libc_cv_cc_novzeroupper=no])
 ])
+LIBC_CONFIG_VAR([config-cflags-novzeroupper], [$libc_cv_cc_novzeroupper])
 
 dnl It is always possible to access static and hidden symbols in an
 dnl position independent way.
diff --git a/sysdeps/mach/configure b/sysdeps/mach/configure
index 33cf09b..3af3725 100644
--- a/sysdeps/mach/configure
+++ b/sysdeps/mach/configure
@@ -162,6 +162,8 @@ fi
 if test "x$MIG" = xMISSING; then
   as_fn_error $? "cannot find required build tool mig" "$LINENO" 5
 fi
+config_vars="$config_vars
+MIG = $MIG"
 
 ### Sanity checks for Mach header installation
 
diff --git a/sysdeps/mach/configure.in b/sysdeps/mach/configure.in
index 2f82c3a..db85f47 100644
--- a/sysdeps/mach/configure.in
+++ b/sysdeps/mach/configure.in
@@ -4,6 +4,7 @@ AC_CHECK_TOOL(MIG, mig, MISSING)
 if test "x$MIG" = xMISSING; then
   AC_MSG_ERROR([cannot find required build tool mig])
 fi
+LIBC_CONFIG_VAR([MIG], [$MIG])
 
 ### Sanity checks for Mach header installation
 AC_CHECK_HEADER(mach/mach_types.h,,
diff --git a/sysdeps/sparc/configure b/sysdeps/sparc/configure
index 3abba27..63e02de 100644
--- a/sysdeps/sparc/configure
+++ b/sysdeps/sparc/configure
@@ -40,6 +40,8 @@ if test $libc_cv_sparc_as_vis3 = yes; then
   $as_echo "#define HAVE_AS_VIS3_SUPPORT 1" >>confdefs.h
 
 fi
+config_vars="$config_vars
+have-as-vis3 = $libc_cv_sparc_as_vis3"
 
 # Check for a GCC emitting GOTDATA relocations.
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sparc gcc GOTDATA reloc support" >&5
diff --git a/sysdeps/sparc/configure.in b/sysdeps/sparc/configure.in
index 080be99..982077c 100644
--- a/sysdeps/sparc/configure.in
+++ b/sysdeps/sparc/configure.in
@@ -28,6 +28,7 @@ rm -f conftest*])
 if test $libc_cv_sparc_as_vis3 = yes; then
   AC_DEFINE(HAVE_AS_VIS3_SUPPORT)
 fi
+LIBC_CONFIG_VAR([have-as-vis3], [$libc_cv_sparc_as_vis3])
 
 # Check for a GCC emitting GOTDATA relocations.
 AC_CACHE_CHECK(for sparc gcc GOTDATA reloc support, libc_cv_sparc_gcc_gotdata, [dnl
diff --git a/sysdeps/x86_64/configure b/sysdeps/x86_64/configure
index 0fa0e1e..9232411 100644
--- a/sysdeps/x86_64/configure
+++ b/sysdeps/x86_64/configure
@@ -66,6 +66,8 @@ if test $libc_cv_cc_sse4 = yes; then
   $as_echo "#define HAVE_SSE4_SUPPORT 1" >>confdefs.h
 
 fi
+config_vars="$config_vars
+config-cflags-sse4 = $libc_cv_cc_sse4"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVX support" >&5
 $as_echo_n "checking for AVX support... " >&6; }
@@ -90,6 +92,8 @@ if test $libc_cv_cc_avx = yes; then
   $as_echo "#define HAVE_AVX_SUPPORT 1" >>confdefs.h
 
 fi
+config_vars="$config_vars
+config-cflags-avx = $libc_cv_cc_avx"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for AVX encoding of SSE instructions" >&5
 $as_echo_n "checking for AVX encoding of SSE instructions... " >&6; }
@@ -114,6 +118,8 @@ if test $libc_cv_cc_sse2avx = yes; then
   $as_echo "#define HAVE_SSE2AVX_SUPPORT 1" >>confdefs.h
 
 fi
+config_vars="$config_vars
+config-cflags-sse2avx = $libc_cv_cc_sse2avx"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FMA4 support" >&5
 $as_echo_n "checking for FMA4 support... " >&6; }
@@ -138,6 +144,8 @@ if test $libc_cv_cc_fma4 = yes; then
   $as_echo "#define HAVE_FMA4_SUPPORT 1" >>confdefs.h
 
 fi
+config_vars="$config_vars
+have-mfma4 = $libc_cv_cc_fma4"
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -mno-vzeroupper support" >&5
 $as_echo_n "checking for -mno-vzeroupper support... " >&6; }
@@ -158,6 +166,8 @@ fi
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_novzeroupper" >&5
 $as_echo "$libc_cv_cc_novzeroupper" >&6; }
+config_vars="$config_vars
+config-cflags-novzeroupper = $libc_cv_cc_novzeroupper"
 
 $as_echo "#define PI_STATIC_AND_HIDDEN 1" >>confdefs.h
 
diff --git a/sysdeps/x86_64/configure.in b/sysdeps/x86_64/configure.in
index 94bcd19..c682f93 100644
--- a/sysdeps/x86_64/configure.in
+++ b/sysdeps/x86_64/configure.in
@@ -12,6 +12,7 @@ LIBC_TRY_CC_OPTION([-msse4], [libc_cv_cc_sse4=yes], [libc_cv_cc_sse4=no])
 if test $libc_cv_cc_sse4 = yes; then
   AC_DEFINE(HAVE_SSE4_SUPPORT)
 fi
+LIBC_CONFIG_VAR([config-cflags-sse4], [$libc_cv_cc_sse4])
 
 dnl Check if -mavx works.
 AC_CACHE_CHECK(for AVX support, libc_cv_cc_avx, [dnl
@@ -20,6 +21,7 @@ LIBC_TRY_CC_OPTION([-mavx], [libc_cv_cc_avx=yes], [libc_cv_cc_avx=no])
 if test $libc_cv_cc_avx = yes; then
   AC_DEFINE(HAVE_AVX_SUPPORT)
 fi
+LIBC_CONFIG_VAR([config-cflags-avx], [$libc_cv_cc_avx])
 
 dnl Check if -msse2avx works.
 AC_CACHE_CHECK(for AVX encoding of SSE instructions, libc_cv_cc_sse2avx, [dnl
@@ -30,6 +32,7 @@ LIBC_TRY_CC_OPTION([-msse2avx],
 if test $libc_cv_cc_sse2avx = yes; then
   AC_DEFINE(HAVE_SSE2AVX_SUPPORT)
 fi
+LIBC_CONFIG_VAR([config-cflags-sse2avx], [$libc_cv_cc_sse2avx])
 
 dnl Check if -mfma4 works.
 AC_CACHE_CHECK(for FMA4 support, libc_cv_cc_fma4, [dnl
@@ -38,6 +41,7 @@ LIBC_TRY_CC_OPTION([-mfma4], [libc_cv_cc_fma4=yes], [libc_cv_cc_fma4=no])
 if test $libc_cv_cc_fma4 = yes; then
   AC_DEFINE(HAVE_FMA4_SUPPORT)
 fi
+LIBC_CONFIG_VAR([have-mfma4], [$libc_cv_cc_fma4])
 
 dnl Check if -mno-vzeroupper works.
 AC_CACHE_CHECK(for -mno-vzeroupper support, libc_cv_cc_novzeroupper, [dnl
@@ -45,6 +49,7 @@ LIBC_TRY_CC_OPTION([-mno-vzeroupper],
 		   [libc_cv_cc_novzeroupper=yes],
 		   [libc_cv_cc_novzeroupper=no])
 ])
+LIBC_CONFIG_VAR([config-cflags-novzeroupper], [$libc_cv_cc_novzeroupper])
 
 dnl It is always possible to access static and hidden symbols in an
 dnl position independent way.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]