From 5922ffcfa75a18e78c4ae75bb447b34a0d91d12b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Sun, 16 Sep 2018 18:28:16 +0200 Subject: [PATCH] Only compile getopt_long.c when needed ISO C disallows empty translation units --- Makefile.in | 2 +- configure.ac | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 6f94fb015..308fd562e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -45,7 +45,7 @@ non_3pp_sources = \ generated_sources = \ src/version.c 3pp_sources = \ - src/getopt_long.c \ + @getopt_long_c@ \ src/hashtable.c \ src/hashtable_itr.c \ src/murmurhashneutral2.c \ diff --git a/configure.ac b/configure.ac index ae2c208bc..50211d85a 100644 --- a/configure.ac +++ b/configure.ac @@ -17,6 +17,7 @@ case $host in esac AC_SUBST(extra_libs) +AC_SUBST(getopt_long_c) AC_SUBST(include_dev_mk) AC_SUBST(test_suites) AC_SUBST(disable_man) @@ -67,6 +68,10 @@ AC_CHECK_FUNCS(strtok_r) AC_CHECK_FUNCS(unsetenv) AC_CHECK_FUNCS(utimes) +if test x"$ac_cv_func_getopt_long" != x"yes"; then + getopt_long_c="src/getopt_long.c" +fi + AC_CACHE_CHECK([for compar_fn_t in stdlib.h],ccache_cv_COMPAR_FN_T, [ AC_TRY_COMPILE( [#include ], -- 2.47.2