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 1:20 PM, Roland McGrath <roland@hack.frob.com> wrote:
>> 2012-03-21 ?H.J. Lu ?<hongjiu.lu@intel.com>
>>
>> ? ? ? * sysdeps/x86_64/preconfigure: New file.
>
> Should be:
>
> ? ? ? ?* sysdeps/x86_64/preconfigure.in: New file.
> ? ? ? ?* sysdeps/x86_64/preconfigure: New generated file.

Updated.

>> diff --git a/sysdeps/x86_64/preconfigure b/sysdeps/x86_64/preconfigure
>
> It's normal to omit the generated files when posting a patch.
>
>> + ?AC_CACHE_CHECK(if we are building for x32, libc_cv_x32, [dnl
>
> The usual convention is something like:
>
> AC_CACHE_CHECK([whether $CC compiles in -mx32 mode by default], ...

$CC may not compile in -mx32 mode by default.  But we can set -mx32 in CFLAGS.

>> +cat > conftest.c <<\EOF
>> +#ifdef __LP64__
>> +# error not x32
>> +#endif
>> +EOF
>> + ?dnl
>> + ?if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&AS_MESSAGE_LOG_FD); then
>
> Why not use AC_TRY_COMPILE?
>

I'd like to take $CFLAGS $CPPFLAGS into account, which aren't
used in AC_TRY_COMPILE.

Here is the updated patch.  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..1b20742
--- /dev/null
+++ b/sysdeps/x86_64/preconfigure.in
@@ -0,0 +1,27 @@
+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, libc_cv_x32, [dnl
+cat > conftest.c <<\EOF
+#ifdef __LP64__
+# error not x32
+#endif
+EOF
+  dnl
+  if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&AS_MESSAGE_LOG_FD); then
+    libc_cv_x32=yes
+  else
+    libc_cv_x32=no
+  fi
+  rm -f conftest*])
+  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]