summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorJohn Levon <john.levon@sun.com>2009-01-14 15:23:26 +0000
committerJohn Levon <john.levon@sun.com>2009-01-14 15:23:26 +0000
commitd052118daefca09b679571783bd207d8a814f27d (patch)
tree5a81b359d32982575462809a01baf4ba5f244306 /m4
parentqemud.c: fix error in yesterday's change: s/X_OK/R_OK/ (diff)
downloadlibvirt-d052118daefca09b679571783bd207d8a814f27d.tar.gz
libvirt-d052118daefca09b679571783bd207d8a814f27d.tar.bz2
libvirt-d052118daefca09b679571783bd207d8a814f27d.zip
Improve compiler flag checking
Diffstat (limited to 'm4')
-rw-r--r--m4/compiler-flags.m418
1 files changed, 12 insertions, 6 deletions
diff --git a/m4/compiler-flags.m4 b/m4/compiler-flags.m4
index cf4cba938..4940a1e6d 100644
--- a/m4/compiler-flags.m4
+++ b/m4/compiler-flags.m4
@@ -25,10 +25,16 @@ AC_DEFUN([gl_COMPILER_FLAGS],
AC_SUBST(COMPILER_FLAGS)
ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $1"
- AC_TRY_COMPILE(,
- [int x;],
- COMPILER_FLAGS="$COMPILER_FLAGS $1"
- AC_MSG_RESULT(yes),
- AC_MSG_RESULT(no))
- CFLAGS="$ac_save_CFLAGS"
+ AC_TRY_LINK([], [], has_option=yes, has_option=no,)
+ echo 'int x;' >conftest.c
+ $CC $CFLAGS -c conftest.c 2>conftest.err
+ ret=$?
+ if test $ret != 0 -o -s conftest.err -o $has_option = "no"; then
+ AC_MSG_RESULT(no)
+ else
+ AC_MSG_RESULT(yes)
+ COMPILER_FLAGS="$COMPILER_FLAGS $1"
+ fi
+ CFLAGS="$ac_save_CFLAGS"
+ rm -f conftest*
])