Only use -fgnu89-inline when supported
authorDaniel Drake <dsd@gentoo.org>
Sat, 26 Jan 2008 14:03:43 +0000 (14:03 +0000)
committerDaniel Drake <dsd@gentoo.org>
Sat, 26 Jan 2008 14:03:43 +0000 (14:03 +0000)
J F pointed out that this option only works on gcc 4.3 and newer.

configure.ac

index 191f8e9..660ca2a 100644 (file)
@@ -40,8 +40,14 @@ AC_ARG_ENABLE([examples-build], [AS_HELP_STRING([--enable-examples-build],
        [build_examples='no'])
 AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"])
 
+# Restore gnu89 inline semantics on gcc 4.3 and newer
+saved_cflags="$CFLAGS"
+CFLAGS="$CFLAGS -fgnu89-inline"
+AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]), inline_cflags="-fgnu89-inline", inline_cflags="")
+CFLAGS="$saved_cflags"
+
 AC_DEFINE([API_EXPORTED], [__attribute__((visibility("default")))], [Default visibility])
-AM_CFLAGS="-std=gnu99 -fgnu89-inline -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wno-pointer-sign -Wshadow"
+AM_CFLAGS="-std=gnu99 $inline_cflags -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wno-pointer-sign -Wshadow"
 AC_SUBST(AM_CFLAGS)
 
 AC_CONFIG_FILES([libusb-1.0.pc] [Makefile] [libusb/Makefile] [examples/Makefile])