summaryrefslogtreecommitdiff
path: root/Objective-C
diff options
context:
space:
mode:
Diffstat (limited to 'Objective-C')
-rw-r--r--Objective-C/GNUmakefile21
-rw-r--r--Objective-C/libffi_support.h11
-rw-r--r--Objective-C/libobjcl.h10
3 files changed, 37 insertions, 5 deletions
diff --git a/Objective-C/GNUmakefile b/Objective-C/GNUmakefile
index 48a1827..c69d1d7 100644
--- a/Objective-C/GNUmakefile
+++ b/Objective-C/GNUmakefile
@@ -18,7 +18,14 @@
-include $(GNUSTEP_MAKEFILES)/common.make
include ../version.make
+-include ../config.make
+.PHONY: all clean distclean install
+
+ifeq ($(CONFIG_MAKE_INCLUDED_P),)
+all clean install:
+ @echo "Please run ./configure before running make."
+else # CONFIG_MAKE_INCLUDED_P
USE_LIBFFI = 1
LIBRARY_NAME = libobjcl
@@ -29,16 +36,21 @@ ADDITIONAL_OBJCFLAGS = -Wall -g -DVERSION=\"$(VERSION)\" -I/usr/local/include
libobjcl_OBJC_FILES = libobjcl.m objc_support.m objc-runtime-apple.m objc-runtime-gnu.m
LIBRARIES_DEPEND_UPON = $(FND_LIBS) $(GUI_LIBS) $(OBJC_LIBS) $(SYSTEM_LIBS) $(CONFIG_SYSTEM_LIBS)
+ADDITIONAL_LDFLAGS = $(LIBS)
+
ifdef USE_LIBFFI
# FIXME: For now, we statically link against libffi. We are not certain
# that this is a good idea. Linking dynamically, on the other hand, is
# hard in general (that's one of the reasons libtool exists, after all).
-ADDITIONAL_LDFLAGS = ../libffi/.libs/libffi.a
-ADDITIONAL_OBJCFLAGS += -DUSE_LIBFFI -I../libffi/include
-libobjcl_OBJC_FILES += libffi_support.m
+ADDITIONAL_OBJCFLAGS += -DUSE_LIBFFI
+ifneq ($(HAVE_ANY_FFI_H),1)
+ADDITIONAL_LDFLAGS += ../libffi/.libs/libffi.a
+ADDITIONAL_OBJCFLAGS += -I../libffi/include
FFI_DEPS += ../libffi/.libs/libffi.a
FFI_CLEAN += libffi_clean
endif
+libobjcl_OBJC_FILES += libffi_support.m
+endif
ifneq ($(COMMON_MAKE_LOADED),)
-include $(GNUSTEP_MAKEFILES)/library.make
@@ -55,6 +67,8 @@ all: obj/libobjcl.dylib
clean: $(FFI_CLEAN)
rm -f obj/libobjcl.dylib obj/libobjcl.dylib.$(VERSION) $(libobjcl_OBJ_FILES)
+distclean: clean
+
obj/libobjcl.dylib: $(FFI_DEPS) obj/libobjcl.dylib.$(VERSION)
ln -s libobjcl.dylib.$(VERSION) $@
@@ -72,3 +86,4 @@ endif
libffi_clean:
-make -C ../libffi distclean
+endif # CONFIG_MAKE_INCLUDED_P
diff --git a/Objective-C/libffi_support.h b/Objective-C/libffi_support.h
index cdf71c0..ca04c6b 100644
--- a/Objective-C/libffi_support.h
+++ b/Objective-C/libffi_support.h
@@ -1,7 +1,16 @@
#ifndef PyObjC_FFI_SUPPORT_H
#define PyObjC_FFI_SUPPORT_H
-#include "ffi.h"
+#ifdef USE_LIBFFI
+#ifdef HAVE_FFI_H
+#include <ffi.h>
+#elif HAVE_FFI_FFI_H
+#include <ffi/ffi.h>
+#else
+/* We are using our own build of libffi. */
+#include <ffi.h>
+#endif
+#endif
ffi_type*
objcl_pyobjc_signature_to_ffi_return_type (const char* argtype);
diff --git a/Objective-C/libobjcl.h b/Objective-C/libobjcl.h
index 8c557a2..e5a70f1 100644
--- a/Objective-C/libobjcl.h
+++ b/Objective-C/libobjcl.h
@@ -20,10 +20,18 @@
#import "Foundation/Foundation.h"
#include <objc/objc-api.h>
+#include "../config.h"
+
#ifdef USE_LIBFFI
+#ifdef HAVE_FFI_H
+#include <ffi.h>
+#elif HAVE_FFI_FFI_H
+#include <ffi/ffi.h>
+#else
+/* We are using our own build of libffi. */
#include <ffi.h>
#endif
-
+#endif
extern NSException *objcl_oom_exception;