Small build cleanup (#743) * configure.ac: Remove some unused checks * Fix FFI_API definition When doing a static build dllimport/dllexport should be disabled. It was also using 2 different macros FFI_BUILDING_DLL and FFI_BUILDING for no reason.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
diff --git a/configure.ac b/configure.ac
index 7e8cd98..9a98343 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,10 +70,6 @@ AM_MAINTAINER_MODE
AC_CHECK_HEADERS(sys/memfd.h)
AC_CHECK_FUNCS([memfd_create])
-AC_CHECK_HEADERS(sys/mman.h)
-AC_CHECK_FUNCS([mmap mkostemp mkstemp])
-AC_FUNC_MMAP_BLACKLIST
-
dnl The -no-testsuite modules omit the test subdir.
AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite)
@@ -99,7 +95,7 @@ AC_CHECK_INCLUDES_DEFAULT
AC_PROG_EGREP
AC_CHECK_FUNCS(memcpy)
-AC_FUNC_ALLOCA
+AC_CHECK_HEADERS(alloca.h)
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(long double)
diff --git a/include/ffi.h.in b/include/ffi.h.in
index 227ac79..8467135 100644
--- a/include/ffi.h.in
+++ b/include/ffi.h.in
@@ -140,13 +140,11 @@ typedef struct _ffi_type
when using the static version of the library.
Besides, as a workaround, they can define FFI_BUILDING if they
*know* they are going to link with the static library. */
-#if defined _MSC_VER
+#if defined _MSC_VER && !defined(FFI_STATIC_BUILD)
# if defined FFI_BUILDING_DLL /* Building libffi.DLL with msvcc.sh */
# define FFI_API __declspec(dllexport)
-# elif !defined FFI_BUILDING /* Importing libffi.DLL */
+# else /* Importing libffi.DLL */
# define FFI_API __declspec(dllimport)
-# else /* Building/linking static library */
-# define FFI_API
# endif
#else
# define FFI_API