http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47032
--- Comment #10 from Peter O'Gorman <pogma at gcc dot gnu.org> 2011-02-08 21:03:46 UTC --- (In reply to comment #9) > > > > AC_CHECK_LIB([m],[copysignl],[AC_DEFINE([HAVE_COPYSIGNL],[1],\ > > > > [libm includes copysignl])]) > So, for the AC_CHECK_LIB line above, what does the > AC_LINK_IFELSE patch look like. Totally untested - something like: gcc_save_LIBS="$LIBS" LIBS="$LIBS -lm" AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <math.h>],[return (int)copysignl(-1.0,1.0);])],[AC_DEFINE([HAVE_COPYSIGNL],[1],[libm includes copysignl])]) LIBS="$gcc_save_LIBS" AIX's math.h has, conditional on 128 bit longdoubles: #define copysignl(__x, __y) __copysignl128((long double) (__x), (long double) (__y)) And libm does indeed have a copysignl symbol (but it's missing __copysignl128), so AC_CHECK_LIB says "yes, libm has copysignl", because it just checks if the symbol exists in the library. #including math.h and then trying a link test should give correct results because it will fail to find __copysignl128 in libm