From 4f2f73844f1d0f07f3e0fd48079d00be2733533e Mon Sep 17 00:00:00 2001 From: Andres Notzli Date: Thu, 13 Oct 2016 17:34:38 -0700 Subject: [PATCH] Fix build on macOS Sierra Before this fix, the build died with `ar: no archive members specified when linking the empty libreplacements.la.` because macOS Sierra does not require the replacements anymore. With this fix, `ffs.c` and `strtok_r.c` are always getting compiled (even when they are empty) to prevent the error. Also removed the unused `CVC4_NEEDS_REPLACEMENT_FUNCTIONS` from `configure.ac` and added an `#ifndef HAVE_FFS` to `ffs.c` for consistency with `strtok_r.c`. --- configure.ac | 10 ++++------ src/lib/ffs.c | 2 ++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 2f343368a..3d645b24e 100644 --- a/configure.ac +++ b/configure.ac @@ -1004,11 +1004,11 @@ AC_SEARCH_LIBS([clock_gettime], [rt], [Defined to 1 if clock_gettime() is supported by the platform.])], [AC_LIBOBJ([clock_gettime])]) AC_CHECK_FUNC([strtok_r], [AC_DEFINE([HAVE_STRTOK_R], [1], - [Defined to 1 if strtok_r() is supported by the platform.])], - [AC_LIBOBJ([strtok_r])]) + [Defined to 1 if strtok_r() is supported by the platform.])]) AC_CHECK_FUNC([ffs], [AC_DEFINE([HAVE_FFS], [1], - [Defined to 1 if ffs() is supported by the platform.])], - [AC_LIBOBJ([ffs])]) + [Defined to 1 if ffs() is supported by the platform.])]) + +AC_LIBOBJ([strtok_r ffs]) # Check for antlr C++ runtime (defined in config/antlr.m4) AC_LIB_ANTLR @@ -1338,8 +1338,6 @@ else AC_SUBST([CVC4_HAS_THREADS], 0) fi -AM_CONDITIONAL([CVC4_NEEDS_REPLACEMENT_FUNCTIONS], [test -n "$LIBOBJS"]) - # Final information to the user gpl=no licensewarn= diff --git a/src/lib/ffs.c b/src/lib/ffs.c index 81228be63..d42f9da94 100644 --- a/src/lib/ffs.c +++ b/src/lib/ffs.c @@ -21,6 +21,7 @@ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ +#ifndef HAVE_FFS int ffs(int i) { long mask = 0x1; @@ -35,6 +36,7 @@ int ffs(int i) { return 0; } +#endif /* ifndef HAVE_FFS */ #ifdef __cplusplus }/* extern "C" */ #endif /* __cplusplus */ -- 2.30.2