summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorAlex Vatchenko <alex@fabulatech.com>2009-05-28 15:58:50 -0400
committerDaniel Drake <dsd@gentoo.org>2009-05-28 16:06:24 -0400
commitb501795985a23109f176d296e7b544b4c6354528 (patch)
treeeb141c0bdae20ea212dd19aacad88498a598820f /configure.ac
parent00bb2805e994887f0a754a825c3ce03d22393386 (diff)
downloadlibusb-b501795985a23109f176d296e7b544b4c6354528.tar.gz
pre-gcc-3.4 compatibility
The -fvisibility and -Wno-pointer-sign options are not available on old GCC versions.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac22
1 files changed, 20 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index dad73de..2617a16 100644
--- a/configure.ac
+++ b/configure.ac
@@ -71,9 +71,27 @@ 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 $inline_cflags -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration -Wno-pointer-sign -Wshadow"
+# check for -fvisibility=hidden compiler support (GCC >= 3.4)
+saved_cflags="$CFLAGS"
+CFLAGS="$CFLAGS -fvisibility=hidden"
+AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),
+ [VISIBILITY_CFLAGS="-fvisibility=hidden"
+ AC_DEFINE([API_EXPORTED], [__attribute__((visibility("default")))], [Default visibility]) ],
+ [ VISIBILITY_CFLAGS=""
+ AC_DEFINE([API_EXPORTED], [], [Default visibility]) ],
+ ])
+CFLAGS="$saved_cflags"
+
+# check for -Wno-pointer-sign compiler support (GCC >= 4)
+saved_cflags="$CFLAGS"
+CFLAGS="$CFLAGS -Wno-pointer-sign"
+AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),
+ nopointersign_cflags="-Wno-pointer-sign", nopointersign_cflags="")
+CFLAGS="$saved_cflags"
+
+AM_CFLAGS="-std=gnu99 $inline_cflags -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow"
+AC_SUBST(VISIBILITY_CFLAGS)
AC_SUBST(AM_CFLAGS)
AC_SUBST(AM_LDFLAGS)