From dbb4e94dc7bacbcfd4acef4f085ef752fe1aa03f Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Fri, 17 Feb 2017 23:17:23 +0800 Subject: 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. --- configure.ac | 21 ++++++++++++++------- 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 #endif -#ifdef HAVE_UNISTD_H +/* Required: dup() and dup2() in */ #include -#endif #ifdef HAVE_NETINET_IN_H #include #endif #ifdef HAVE_SYS_PARAMS_H #include #endif -#ifdef HAVE_SYS_STAT_H +/* Required: stat() in */ #include -#endif +/* Required: wait() in */ #include #include #include -#ifdef HAVE_REGEX_H +/* Required: regcomp(), regexec() and regerror() in */ #include -#endif #include "flexint.h" /* We use gettext. So, when we write strings which should be translated, we mark them with _() */ -- cgit v1.2.3