]> granicus.if.org Git - flex/commitdiff
build: Let configure error if missing required functions, headers..
authorExplorer09 <explorer09@gmail.com>
Fri, 17 Feb 2017 15:17:23 +0000 (23:17 +0800)
committerWill Estes <westes575@gmail.com>
Fri, 17 Feb 2017 21:55:33 +0000 (16:55 -0500)
`configure` will now error if a required header or function is not
found on the system.

Also add comments on optional functions checks.

Add sys/stats.h and sys/wait.h to list of required headers in
configure.

This fixes issue #180.

configure.ac
src/flexdef.h

index 36bf58e242a43348bab8ee755e6baee82cf91f10..0115064a5a0aded314e0168efbcc746dd9639d91 100644 (file)
@@ -111,7 +111,10 @@ AC_PATH_PROG([INDENT], indent, [\${top_srcdir}/build-aux/missing indent])
 
 # checks for headers
 
-AC_CHECK_HEADERS([inttypes.h libintl.h limits.h locale.h malloc.h netinet/in.h regex.h unistd.h])
+AC_CHECK_HEADERS([regex.h sys/stat.h sys/wait.h unistd.h], [],
+  [AC_MSG_ERROR(required header not found on your system)])
+
+AC_CHECK_HEADERS([inttypes.h libintl.h limits.h locale.h malloc.h netinet/in.h])
 
 # checks for libraries
 
@@ -147,16 +150,20 @@ AC_FUNC_REALLOC
 AS_IF([test "$cross_compiling" = yes],
    AC_MSG_WARN([result $ac_cv_func_realloc_0_nonnull guessed because of cross compilation]))
 
-AC_CHECK_FUNCS(dup2 dnl
+AC_CHECK_FUNCS([dup2 dnl
 memset dnl
-pow dnl
 regcomp dnl
-setlocale dnl
 strchr dnl
 strdup dnl
-strtol)
-
-AC_CHECK_FUNCS(reallocarray)
+strtol dnl
+], [], [AC_MSG_ERROR(required library function not found on your system)])
+
+# Optional library functions
+AC_CHECK_FUNCS([dnl
+pow dnl           Used only by "examples/manual/expr"
+setlocale dnl     Needed only if NLS is enabled
+reallocarray dnl  OpenBSD function. We have replacement if not available.
+])
 
 AC_CONFIG_FILES(
 Makefile
index e5ab8e025127cbeb2b951ed262157b7d0620d186..b3162e2605adce8f8fcff0d9b7a8c41bce6b79af 100644 (file)
 #ifdef HAVE_LIMITS_H
 #include <limits.h>
 #endif
-#ifdef HAVE_UNISTD_H
+/* Required: dup() and dup2() in <unistd.h> */
 #include <unistd.h>
-#endif
 #ifdef HAVE_NETINET_IN_H
 #include <netinet/in.h>
 #endif
 #ifdef HAVE_SYS_PARAMS_H
 #include <sys/params.h>
 #endif
-#ifdef HAVE_SYS_STAT_H
+/* Required: stat() in <sys/stat.h> */
 #include <sys/stat.h>
-#endif
+/* Required: wait() in <sys/wait.h> */
 #include <sys/wait.h>
 #include <stdbool.h>
 #include <stdarg.h>
-#ifdef HAVE_REGEX_H
+/* Required: regcomp(), regexec() and regerror() in <regex.h> */
 #include <regex.h>
-#endif
 #include "flexint.h"
 
 /* We use gettext. So, when we write strings which should be translated, we mark them with _() */