mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-30 16:10:44 +08:00
Added -fno-strict-aliasing to CFLAGS when the compiler supports it and autotools are in use.
This commit is contained in:
parent
9f798e2ed6
commit
a8001f03e1
19
configure.ac
19
configure.ac
@ -54,6 +54,25 @@ AC_CANONICAL_TARGET
|
||||
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
|
||||
##
|
||||
# Check to see if the compiler supports -fno-strict-aliasing and, if so,
|
||||
# add that to the C compiler flags. This is in support of https://github.com/Unidata/netcdf-c/issues/1983.
|
||||
##
|
||||
SAVE_CFLAGS="${CFLAGS}"
|
||||
AC_LANG_PUSH([C])
|
||||
CFLAGS="${CFLAGS} -fno-strict-aliasing"
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
|
||||
[int i = 0;]])],
|
||||
[have_no_strict_aliasing=yes],
|
||||
[have_no_strict_aliasing=no])
|
||||
AC_MSG_CHECKING([whether compiler supports -fno-strict-aliasing])
|
||||
AC_MSG_RESULT([$have_no_strict_aliasing])
|
||||
AC_LANG_POP([C])
|
||||
if test $have_no_strict_aliasing = no; then
|
||||
CFLAGS=$SAVE_CFLAGS
|
||||
fi
|
||||
##
|
||||
# Some files need to exist in build directories
|
||||
# that do not correspond to their source directory, or
|
||||
|
Loading…
Reference in New Issue
Block a user