1dnl AC_TRY_CFLAGS (CFLAGS, [ACTION-IF-WORKS], [ACTION-IF-FAILS]) 2dnl check if $CC supports a given set of cflags 3AC_DEFUN([AC_TRY_CFLAGS], 4 [AC_MSG_CHECKING([if $CC supports $1 flags]) 5 SAVE_CFLAGS="$CFLAGS" 6 CFLAGS="$1" 7 AC_TRY_COMPILE([],[],[ac_cv_try_cflags_ok=yes],[ac_cv_try_cflags_ok=no]) 8 CFLAGS="$SAVE_CFLAGS" 9 AC_MSG_RESULT([$ac_cv_try_cflags_ok]) 10 if test x"$ac_cv_try_cflags_ok" = x"yes"; then 11 ifelse([$2],[],[:],[$2]) 12 else 13 ifelse([$3],[],[:],[$3]) 14 fi]) 15 16dnl AC_C_ATTRIBUTE_ALIGNED 17dnl define ATTRIBUTE_ALIGNED_MAX to the maximum alignment if this is supported 18AC_DEFUN([AC_C_ATTRIBUTE_ALIGNED], 19 [AC_CACHE_CHECK([__attribute__ ((aligned ())) support], 20 [ac_cv_c_attribute_aligned], 21 [ac_cv_c_attribute_aligned=0 22 for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do 23 AC_TRY_COMPILE([], 24 [static char c __attribute__ ((aligned($ac_cv_c_attr_align_try))) = 0; return c;], 25 [ac_cv_c_attribute_aligned=$ac_cv_c_attr_align_try]) 26 done]) 27 if test x"$ac_cv_c_attribute_aligned" != x"0"; then 28 AC_DEFINE_UNQUOTED([ATTRIBUTE_ALIGNED_MAX], 29 [$ac_cv_c_attribute_aligned],[maximum supported data alignment]) 30 fi]) 31 32dnl @synopsis AC_C99_FUNC_LRINT 33dnl 34dnl Check whether C99's lrint function is available. 35dnl @version 1.3 Feb 12 2002 36dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com> 37dnl 38dnl Permission to use, copy, modify, distribute, and sell this file for any 39dnl purpose is hereby granted without fee, provided that the above copyright 40dnl and this permission notice appear in all copies. No representations are 41dnl made about the suitability of this software for any purpose. It is 42dnl provided "as is" without express or implied warranty. 43dnl 44AC_DEFUN([AC_C99_FUNC_LRINT], 45[AC_CACHE_CHECK(for lrint, 46 ac_cv_c99_lrint, 47[ 48lrint_save_CFLAGS=$CFLAGS 49CFLAGS="-O2 -lm" 50AC_TRY_LINK([ 51#define _ISOC9X_SOURCE 1 52#define _ISOC99_SOURCE 1 53#define __USE_ISOC99 1 54#define __USE_ISOC9X 1 55 56#include <math.h> 57], if (!lrint(3.14159)) lrint(2.7183);, ac_cv_c99_lrint=yes, ac_cv_c99_lrint=no) 58 59CFLAGS=$lrint_save_CFLAGS 60 61]) 62 63if test "$ac_cv_c99_lrint" = yes; then 64 AC_DEFINE(HAVE_LRINT, 1, 65 [Define if you have C99's lrint function.]) 66fi 67])# AC_C99_FUNC_LRINT 68dnl @synopsis AC_C99_FUNC_LRINTF 69dnl 70dnl Check whether C99's lrintf function is available. 71dnl @version 1.3 Feb 12 2002 72dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com> 73dnl 74dnl Permission to use, copy, modify, distribute, and sell this file for any 75dnl purpose is hereby granted without fee, provided that the above copyright 76dnl and this permission notice appear in all copies. No representations are 77dnl made about the suitability of this software for any purpose. It is 78dnl provided "as is" without express or implied warranty. 79dnl 80AC_DEFUN([AC_C99_FUNC_LRINTF], 81[AC_CACHE_CHECK(for lrintf, 82 ac_cv_c99_lrintf, 83[ 84lrintf_save_CFLAGS=$CFLAGS 85CFLAGS="-O2 -lm" 86AC_TRY_LINK([ 87#define _ISOC9X_SOURCE 1 88#define _ISOC99_SOURCE 1 89#define __USE_ISOC99 1 90#define __USE_ISOC9X 1 91 92#include <math.h> 93], if (!lrintf(3.14159)) lrintf(2.7183);, ac_cv_c99_lrintf=yes, ac_cv_c99_lrintf=no) 94 95CFLAGS=$lrintf_save_CFLAGS 96 97]) 98 99if test "$ac_cv_c99_lrintf" = yes; then 100 AC_DEFINE(HAVE_LRINTF, 1, 101 [Define if you have C99's lrintf function.]) 102fi 103])# AC_C99_FUNC_LRINTF 104