diff --git a/configure.ac b/configure.ac index a9012d40..808c949d 100644 --- a/configure.ac +++ b/configure.ac @@ -28,7 +28,9 @@ AM_PROG_CC_C_O CC_ATTRIBUTE_VISIBILITY([default], [ CC_FLAG_VISIBILITY([CFLAGS="${CFLAGS} -fvisibility=hidden"]) ]) -CC_CHECK_CFLAGS_APPEND([-fno-strict-aliasing]) +# Xlc has a flag "-f". Need to use CC_CHECK_FLAG_SUPPORTED_APPEND so +# we exclude -fno-strict-aliasing for xlc +CC_CHECK_FLAG_SUPPORTED_APPEND([-fno-strict-aliasing]) CC_CHECK_CFLAGS_APPEND([-g]) CC_CHECK_CFLAGS_APPEND([-std=gnu89]) CC_CHECK_CFLAGS_APPEND([-Wall]) diff --git a/m4/libuv-check-flags.m4 b/m4/libuv-check-flags.m4 index 9d0aad82..2a01308d 100644 --- a/m4/libuv-check-flags.m4 +++ b/m4/libuv-check-flags.m4 @@ -104,6 +104,20 @@ AC_DEFUN([CC_CHECK_LDFLAGS], [ [$2], [$3]) ]) +dnl Check if flag is supported by both compiler and linker +dnl If so, append it to AM_CFLAGS +dnl CC_CHECK_FLAG_SUPPORTED_APPEND([FLAG]) + +AC_DEFUN([CC_CHECK_FLAG_SUPPORTED_APPEND], [ + CC_CHECK_CFLAGS([$1], + [CC_CHECK_LDFLAGS([$1], + [AM_CFLAGS="$AM_CFLAGS $1"; + DEBUG_CFLAGS="$DEBUG_CFLAGS $1"; + AC_SUBST([AM_CFLAGS]) + ]) + ]) +]) + dnl define the LDFLAGS_NOUNDEFINED variable with the correct value for dnl the current linker to avoid undefined references in a shared object. AC_DEFUN([CC_NOUNDEFINED], [