Commit 2b2f61f6e6a79d46fa277965745a8cd8bb5f04bc

Xavier Claessens 2022-10-24T20:39:04

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.

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