Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -427,12 +427,13 @@ #if defined(__GLIBC__) || defined(__MINGW32__) || \ defined(__NEWLIB__) || defined(__MORPHOS__) egrep_cpp_yes #endif ], [ + AC_MSG_RESULT(yes) CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS" - AC_MSG_RESULT(yes) + gnu_source="yes" ], [ AC_MSG_RESULT(no) ]) case "$host_os" in @@ -1233,10 +1234,39 @@ AC_CHECK_HEADERS(fcntl.h dirent.h) AC_CHECK_FUNCS([sysconf gmtime_r localtime_r nanosleep fcntl]) AC_CHECK_HEADERS(xlocale.h) AC_CHECK_FUNCS([strtod_l strtof_l asprintf_l]) +AS_IF([test x"$gnu_source" != x"yes" -a \( \ + x"$ac_cv_func_strtod_l" = x"yes" -o x"$ac_cv_func_strtof_l" = x"yes" -o \ + x"$ac_cv_func_asprintf_l" = x"yes" \)], [ + AC_MSG_CHECKING(whether *_l functions need _GNU_SOURCE) + AC_TRY_COMPILE([ + #include + #include + + #include + #ifdef HAVE_XLOCALE_H + # include + #endif + ], [ + #ifdef HAVE_STRTOD_L + (void)strtod_l; + #endif + #ifdef HAVE_STRTOF_L + (void)strtof_l; + #endif + #ifdef HAVE_ASPRINTF_L + (void)asprintf_l; + #endif + ], [ + AC_MSG_RESULT(no) + ], [ + AC_MSG_RESULT(yes) + CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS" + ]) +]) AC_CHECK_HEADERS(sys/utsname.h) AC_CHECK_FUNCS(uname) case "$host_os" in