diff options
author | Explorer09 <explorer09@gmail.com> | 2017-02-17 23:17:23 +0800 |
---|---|---|
committer | Will Estes <westes575@gmail.com> | 2017-02-17 16:55:33 -0500 |
commit | dbb4e94dc7bacbcfd4acef4f085ef752fe1aa03f (patch) | |
tree | 8e979274b7d5064135b49414fe9d29b3e62407c6 | |
parent | c7a545ae0907c81cf52139dd391659586570f60c (diff) |
build: Let configure error if missing required functions, headers..
`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.
-rw-r--r-- | configure.ac | 21 | ||||
-rw-r--r-- | src/flexdef.h | 10 |
2 files changed, 18 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac index 36bf58e..0115064 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/src/flexdef.h b/src/flexdef.h index e5ab8e0..b3162e2 100644 --- a/src/flexdef.h +++ b/src/flexdef.h @@ -57,24 +57,22 @@ #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 _() */ |