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: PATCH: Configure x86_64 in sysdeps/x86_64/preconfigure


On Wed, Mar 21, 2012 at 2:45 PM, Roland McGrath <roland@hack.frob.com> wrote:
>> $CC may not compile in -mx32 mode by default. ?But we can set -mx32 in CFLAGS.
>
> The usual procedure for ABI-changing options is to put them into CC, not
> into CFLAGS. ?That's how one normally builds for i686 on an x86_64 host,
> for example (CC='gcc -m32'). ?This lets the usual logic for default CFLAGS
> take effect, rather than forcing you to adding -g -O2 when all you wanted
> to do was add -mx32.
>
>

Here is the patch to use AC_TRY_COMPILE.  Tested on Linux/x86-64.
OK to install?

Thanks.



-- 
H.J.
2012-03-21  H.J. Lu  <hongjiu.lu@intel.com>

	* sysdeps/x86_64/preconfigure.in: New file.
	* sysdeps/x86_64/preconfigure: New generated file.

diff --git a/sysdeps/x86_64/preconfigure.in b/sysdeps/x86_64/preconfigure.in
new file mode 100644
index 0000000..1f049c7
--- /dev/null
+++ b/sysdeps/x86_64/preconfigure.in
@@ -0,0 +1,20 @@
+GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
+# Local preconfigure fragment for sysdeps/x86_64
+
+test -n "$base_machine" || case "$machine" in
+x86_64)
+  base_machine=x86_64
+  # Check if we are building for x32.
+  AC_CACHE_CHECK(whether $CC compiles in -mx32 mode by default,
+		 libc_cv_x32, [dnl
+  AC_TRY_COMPILE(dnl
+[#ifdef __LP64__
+# error not x32
+#endif], [], libc_cv_x32=yes, libc_cv_x32=no)])
+  if test $libc_cv_x32 = yes; then
+    machine=x86_64/x32
+  else
+    machine=x86_64/64
+  fi
+  ;;
+esac

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