What is the correct proper way to use autoconf to enable use of asprintf and strndupa on EL5?
Currently I have this in my configure.ac:
AC_CHECK_FUNCS([asprintf strndupa],,
AC_DEFINE([_GNU_SOURCE], [], [Linux requires _GNU_SOURCE for asprintf]))
AC_CHECK_FUNCS([asprintf strndupa uname],, AC_MSG_ERROR([some needed function(s) not found]))
But autoconf is caching the test the negative test results so the second AC_CHECK_FUNCS fails.
I can exclude asprintf and strndupa from the second test, but then if defining _GNU_SOURCE doesn’t work we will not know of the failure until make fails. What is the proper way to use these new GNU extensions in autoconf?
Call the macro
AC_USE_SYSTEM_EXTENSIONSbefore doing any checks that require_GNU_SOURCE.