configure: add a test for -mavx2

sets AVX2_FLAGS; currently unused

Change-Id: Ie07ee6c2fa7c1f0748430010a9f207b1723b6def
This commit is contained in:
James Zern 2014-05-21 23:17:21 -07:00
parent 176fda2650
commit fe72807112

View File

@ -31,34 +31,37 @@ AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=DIR],
[pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig']) [pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig'])
AC_SUBST([pkgconfigdir]) AC_SUBST([pkgconfigdir])
dnl === TEST_AND_ADD_CFLAGS(flag) dnl === TEST_AND_ADD_CFLAGS(var, flag)
dnl === Checks whether $CC supports 'flag' and adds it to AM_CFLAGS dnl === Checks whether $CC supports 'flag' and adds it to 'var'
dnl === on success. dnl === on success.
AC_DEFUN([TEST_AND_ADD_CFLAGS], AC_DEFUN([TEST_AND_ADD_CFLAGS],
[SAVED_CFLAGS="$CFLAGS" [SAVED_CFLAGS="$CFLAGS"
CFLAGS="-Werror $1" CFLAGS="-Werror $2"
AC_MSG_CHECKING([whether $CC supports $1]) AC_MSG_CHECKING([whether $CC supports $2])
dnl Note AC_LANG_PROGRAM([]) uses an old-style main definition. dnl Note AC_LANG_PROGRAM([]) uses an old-style main definition.
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) { return 0; }])], AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main(void) { return 0; }])],
[AC_MSG_RESULT([yes])] [AC_MSG_RESULT([yes])]
dnl Simply append the variable avoiding a dnl Simply append the variable avoiding a
dnl compatibility ifdef for AS_VAR_APPEND as this dnl compatibility ifdef for AS_VAR_APPEND as this
dnl variable shouldn't grow all that large. dnl variable shouldn't grow all that large.
[AM_CFLAGS="$AM_CFLAGS $1"], [$1="${$1} $2"],
[AC_MSG_RESULT([no])]) [AC_MSG_RESULT([no])])
CFLAGS="$SAVED_CFLAGS"]) CFLAGS="$SAVED_CFLAGS"])
TEST_AND_ADD_CFLAGS([-Wall]) TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wall])
TEST_AND_ADD_CFLAGS([-Wdeclaration-after-statement]) TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wdeclaration-after-statement])
TEST_AND_ADD_CFLAGS([-Wextra]) TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wextra])
TEST_AND_ADD_CFLAGS([-Wmissing-declarations]) TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wmissing-declarations])
TEST_AND_ADD_CFLAGS([-Wmissing-prototypes]) TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wmissing-prototypes])
TEST_AND_ADD_CFLAGS([-Wold-style-definition]) TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wold-style-definition])
TEST_AND_ADD_CFLAGS([-Wshadow]) TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wshadow])
TEST_AND_ADD_CFLAGS([-Wunused-but-set-variable]) TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wunused-but-set-variable])
TEST_AND_ADD_CFLAGS([-Wunused]) TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wunused])
TEST_AND_ADD_CFLAGS([-Wvla]) TEST_AND_ADD_CFLAGS([AM_CFLAGS], [-Wvla])
AC_SUBST([AM_CFLAGS]) AC_SUBST([AM_CFLAGS])
TEST_AND_ADD_CFLAGS([AVX2_FLAGS], [-mavx2])
AC_SUBST([AVX2_FLAGS])
dnl === CLEAR_LIBVARS([var_pfx]) dnl === CLEAR_LIBVARS([var_pfx])
dnl === Clears <var_pfx>_{INCLUDES,LIBS}. dnl === Clears <var_pfx>_{INCLUDES,LIBS}.
AC_DEFUN([CLEAR_LIBVARS], [$1_INCLUDES=""; $1_LIBS=""]) AC_DEFUN([CLEAR_LIBVARS], [$1_INCLUDES=""; $1_LIBS=""])