Follow up to r1887279: fix new APR_TRY_COMPILE_NO_WARNING.
AC_LANG_PROGRAM generates an "int main()" prototype which some compilers warn
about. Restore AC_LANG_SOURCE to manually set the correct main() but do not
#include "confdefs.h" if it is inlined already by AC_LANG_SOURCE (i.e.
check whether PACKAGE_NAME is already defined).
Github: closes
@@ -467,9 +467,16 @@ AC_DEFUN([APR_TRY_COMPILE_NO_WARNING],
CFLAGS="$CFLAGS -Werror"
fi
AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[$1]],
+ [AC_LANG_SOURCE(
+ [
+#ifndef PACKAGE_NAME
+#include "confdefs.h"
+#endif
+ ]
+ [[$1]]
+ [int main(int argc, const char *const *argv) {]
[[$2]]
+ [ return 0; }]
)], [CFLAGS=$apr_save_CFLAGS
$3], [CFLAGS=$apr_save_CFLAGS
$4])
