-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use m4 macro AC_TRY_CCFLAG to detect presence of some compiler option. Use it to detect -Wjump-misses-init.
- Loading branch information
Zdenek Kabelac
committed
Oct 24, 2013
1 parent
772fa46
commit d95751c
Showing
5 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
dnl AC_GCC_VERSION | ||
dnl check for compiler version | ||
dnl sets COMPILER_VERSION and GCC_VERSION | ||
|
||
AC_DEFUN([AC_CC_VERSION], | ||
[ | ||
AC_MSG_CHECKING([C compiler version]) | ||
COMPILER_VERSION=`$CC -v 2>&1 | grep version` | ||
case "$COMPILER_VERSION" in | ||
*gcc*) | ||
dnl Ok, how to turn $3 into the real $3 | ||
GCC_VERSION=`echo $COMPILER_VERSION | \ | ||
sed -e 's/[[^ ]]*\ [[^ ]]*\ \([[^ ]]*\)\ .*/\1/'` ;; | ||
*) GCC_VERSION=unknown ;; | ||
esac | ||
AC_MSG_RESULT($GCC_VERSION) | ||
]) | ||
|
||
dnl AC_TRY_CCFLAG([CCFLAG], [VAR], [ACTION-IF-WORKS], [ACTION-IF-FAILS]) | ||
dnl check if $CC supports a given flag | ||
|
||
AC_DEFUN([AC_TRY_CCFLAG], | ||
[ | ||
AC_REQUIRE([AC_PROG_CC]) | ||
ac_save_CFLAGS=$CFLAGS | ||
CFLAGS=$1 | ||
AC_MSG_RESULT([KOUKEJ $name]) | ||
AC_CACHE_CHECK([whether $CC accepts $1 flag], [ac_cv_flag_$2], | ||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], | ||
[AS_VAR_SET([ac_cv_flag_$2], [yes])], | ||
[AS_VAR_SET([ac_cv_flag_$2], [no])])]) | ||
CFLAGS=$ac_save_CFLAGS | ||
$2=AS_VAR_GET([ac_cv_flag_$2]) | ||
if test "$2" = yes; then | ||
ifelse([$3], [], [:], [$3]) | ||
else | ||
ifelse([$4], [], [:], [$4]) | ||
fi | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,3 +169,4 @@ else | |
fi[]dnl | ||
])# PKG_CHECK_MODULES | ||
|
||
m4_include([acinclude.m4]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters