mirror of
https://github.com/troglobit/editline.git
synced 2025-12-16 02:54:46 +08:00
Improve GCC warning and error triggers and also improve check of GCC version.
Configure snippets shamelessly stolen from http://www.libusb.org/browser/configure.ac
This commit is contained in:
27
configure.ac
27
configure.ac
@@ -59,5 +59,32 @@ AC_ARG_ENABLE(terminal-bell,
|
||||
[ --enable-terminal-bell Enable terminal bell on completion.],
|
||||
AC_DEFINE([CONFIG_ANNOYING_NOISE],, [Define to enable terminal bell on completion.]))
|
||||
|
||||
# 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"
|
||||
|
||||
# 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 -W -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow"
|
||||
AC_SUBST(AM_CFLAGS)
|
||||
|
||||
AC_OUTPUT(Makefile src/Makefile include/Makefile man/Makefile examples/Makefile)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user