[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 09/12] use a shell function for AC_CHECK_TYPE
From: |
Eric Blake |
Subject: |
Re: [PATCH 09/12] use a shell function for AC_CHECK_TYPE |
Date: |
Sat, 01 Nov 2008 12:02:37 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 Mnenhy/0.7.5.666 |
According to Paolo Bonzini on 11/1/2008 11:54 AM:
> I must say I don't like it much, unless it gives a net improvement of at
> least 2-3% on coreutils, say. But I disagree on the math: doesn't it
> save only one cat *but also* one rm?
It takes two cat's per AC_LANG_CONFTEST to build conftest.$ac_ext, so by
building it once instead of twice we save two processes. But each
AC_COMPILE_IFELSE does an rm of all built files, and if AC_LANG_CONFTEST
was not run, we must add an extra 'rm -f conftest.$ac_ext' after the
compile test, explaining the added rm.
For reference, here's the difference pre- and post-patch to the configure
file.
--- configure.gold 2008-11-01 10:10:52.639500000 -0600
+++ configure 2008-11-01 11:59:59.827000000 -0600
@@ -2294,36 +2294,30 @@
int
main ()
{
-if (sizeof ($2))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_func_c_try_compile "$LINENO"; then
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h - <<_ACEOF >>conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-if (sizeof (($2)))
- return 0;
+#ifndef ac_type_check2
+ if (sizeof ($2))
+ return 0;
+#else
+ if (sizeof (($2)))
+ return 0;
+#endif
;
return 0;
}
_ACEOF
-if ac_func_c_try_compile "$LINENO"; then
+ if ac_func_c_try_compile "$LINENO"; then
+ ac_save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS -Dac_type_check2"
+ if ac_func_c_try_compile "$LINENO"; then
:
else
eval "$3=yes"
fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext
+ CFLAGS=$ac_save_C
fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext
+ rm -f conftest.$ac_ext
fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
--
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden