-AC_REPLACE_FUNCS(strdup)
-dnl AC_MSG_CHECKING([for strdup])
-dnl AC_TRY_COMPILE([#include <string.h>], [strdup("");],
-dnl AC_DEFINE(HAVE_STRDUP) AC_MSG_RESULT(yes),
-dnl LIBOBJS="$LIBOBJS strdup.o" AC_MSG_RESULT(no))
-
-AC_MSG_CHECKING([for working %m in printf])
-AC_TRY_RUN([int main() { char s[100];
- sprintf(s,"%m");
- return(!(strcmp(s,"m") && strcmp(s,"%m")));
- }],AC_DEFINE(PRINTF_WORKS_PM) AC_MSG_RESULT(yes),AC_MSG_RESULT(no),AC_MSG_RESULT(avoiding))
-
-GCC_NEED_DECLARATION(gethostname, [#include <unistd.h>])
-GCC_NEED_DECLARATION(kill, [#include <sys/types.h>
-#include <signal.h>])
-GCC_NEED_DECLARATION(snprintf, [#include <stdio.h>])
-GCC_NEED_DECLARATION(vsnprintf, [#include <stdio.h>
-#include <stdarg.h>])
-GCC_NEED_DECLARATION(strdup, [#include <string.h>])
-GCC_NEED_DECLARATION(usleep, [#include <unistd.h>])
+dnl FIXME: mktime(3) missing here
+AC_REPLACE_FUNCS(strdup usleep)
+
+GCC_NEED_DECLARATION(gethostname,[
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif])
+GCC_NEED_DECLARATION(kill,[
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif])
+GCC_NEED_DECLARATION(snprintf,[
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif])
+GCC_NEED_DECLARATION(vsnprintf,[
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif])
+GCC_NEED_DECLARATION(strdup,[
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif])
+GCC_NEED_DECLARATION(usleep,[
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif])
+GCC_NEED_DECLARATION(strcasecmp,[
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif])
+GCC_NEED_DECLARATION(siginterrupt,[
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif])
+GCC_NEED_DECLARATION(popen,[
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif])
+GCC_NEED_DECLARATION(pclose,[
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif])
+GCC_NEED_DECLARATION(gettext,[
+#ifdef HAVE_LIBINTL_H
+#include <libintl.h>
+#endif])