configure: better CFLAGS checking
needed for compatibility with older gcc. Also, threw in some warnings for things I find offensive (declaration-after-statement, shadow) git-svn-id: https://svn.musicpd.org/mpd/trunk@7299 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
dd20681daa
commit
4e4441fd32
12
configure.ac
12
configure.ac
@ -10,6 +10,7 @@ AC_SUBST(MPD_CFLAGS)
|
|||||||
AC_SUBST(MP4FF_LIB)
|
AC_SUBST(MP4FF_LIB)
|
||||||
AC_SUBST(MP4FF_SUBDIR)
|
AC_SUBST(MP4FF_SUBDIR)
|
||||||
|
|
||||||
|
AC_LANG(C)
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AM_PROG_CC_C_O
|
AM_PROG_CC_C_O
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
@ -21,8 +22,15 @@ AC_DEFINE(PROTOCOL_VERSION, "0.14.0", [The mpd protocol version])
|
|||||||
|
|
||||||
MPD_LIBS=""
|
MPD_LIBS=""
|
||||||
MPD_CFLAGS=""
|
MPD_CFLAGS=""
|
||||||
if test x$GCC = xyes; then
|
if test x$GCC = xyes
|
||||||
MPD_CFLAGS="-Wall -Wextra -Wno-unused-parameter -Wno-deprecated-declarations -Wmissing-prototypes"
|
then
|
||||||
|
MPD_CHECK_FLAG([-Wall])
|
||||||
|
MPD_CHECK_FLAG([-Wextra])
|
||||||
|
MPD_CHECK_FLAG([-Wno-unused-parameter])
|
||||||
|
MPD_CHECK_FLAG([-Wno-deprecated-declarations])
|
||||||
|
MPD_CHECK_FLAG([-Wmissing-prototypes])
|
||||||
|
MPD_CHECK_FLAG([-Wdeclaration-after-statement])
|
||||||
|
MPD_CHECK_FLAG([-Wshadow])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$prefix" || test "x$prefix" = xNONE; then
|
if test -z "$prefix" || test "x$prefix" = xNONE; then
|
||||||
|
18
m4/mpd_check_cflag.m4
Normal file
18
m4/mpd_check_cflag.m4
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
AC_DEFUN([MPD_CHECK_FLAG],[
|
||||||
|
var=`echo "$1" | tr "-" "_"`
|
||||||
|
AC_CACHE_CHECK([whether the C compiler accepts $1],
|
||||||
|
[mpd_check_cflag_$var],[
|
||||||
|
save_CFLAGS="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS $1"
|
||||||
|
AC_COMPILE_IFELSE([
|
||||||
|
int main(void) { return 0; }
|
||||||
|
], [ eval "mpd_check_cflag_$var=yes"
|
||||||
|
], [ eval "mpd_check_cflag_$var=no" ])
|
||||||
|
CFLAGS="$save_CFLAGS"
|
||||||
|
])
|
||||||
|
if eval "test x`echo '$mpd_check_cflag_'$var` = xyes"
|
||||||
|
then
|
||||||
|
MPD_CFLAGS="$MPD_CFLAGS $1"
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
])
|
Loading…
Reference in New Issue
Block a user