Mac OS X Support : Configure and Libs Build system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

This patch add support for Mac OS X's Mach-o in configure.ac and in the library. Mach-O differentiate dynamic library that you can link to but can't lad dynamically and bundle (shared object) that you can't link to, but can load dynamically.
Please tell me if you don't like the way it is done.


Cheers,

Pierre

ChangeLog:
- Add support for Mach-O file format when building libraries

Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.165
diff -u -r1.165 configure.ac
--- configure.ac	1 Jul 2003 01:11:13 -0000	1.165
+++ configure.ac	13 Jul 2003 14:16:34 -0000
@@ -142,6 +142,8 @@
 AC_CHECK_LIB(xpg4,_xpg4_setrunelocale)
 dnl Check for -lmmap for OS/2
 AC_CHECK_LIB(mmap,mmap)
+dnl Check for -lpoll for Mac OS X/Darwin
+AC_CHECK_LIB(poll,poll)
 
 JPEGLIB=""
 AC_SUBST(JPEGLIB)
@@ -796,6 +798,7 @@
 AC_SUBST(DLLIBS,"")
 AC_SUBST(LDDLLFLAGS,"")
 AC_SUBST(LDSHARED,"")
+AC_SUBST(LDDYLIB,"")
 AC_SUBST(LIBEXT,"so")
 AC_SUBST(IMPLIBEXT,"def")
 
@@ -859,6 +862,19 @@
         then
           LDSHARED="\$(CC) -Wl,-G \$(SONAME:%=-Wl,-h,%)"
           LDDLLFLAGS="-Wl,-B,symbolic"
+        else
+          AC_CACHE_CHECK(whether we can build a Mach-O (Mac OS X/Darwin) dll, ac_cv_c_dll_macho,
+            [WINE_TRY_CFLAGS([-bundle],
+                             ac_cv_c_dll_macho="yes", ac_cv_c_dll_macho="no")])
+                             
+          if test "$ac_cv_c_dll_macho" = "yes"
+          then
+            LIBEXT="dylib"
+            LDSHARED="\$(CC) -bundle -flat_namespace -undefined suppress"
+            LDDLLFLAGS=""
+            CFLAGS="$CFLAGS -no-cpp-precomp -Dsocklen_t=u_int32_t"
+            LDDYLIB="\$(CC) -dynamiclib"
+          fi
         fi
       fi
     fi
@@ -1000,6 +1016,7 @@
 	linux/serial.h \
 	linux/ucdrom.h \
 	machine/cpu.h \
+        mach-o/loader.h \
 	netdb.h \
 	netinet/in.h \
 	netinet/in_systm.h \

Index: Make.rules.in
===================================================================
RCS file: /home/wine/wine/Make.rules.in,v
retrieving revision 1.158
diff -u -r1.158 Make.rules.in
--- Make.rules.in	13 Jun 2003 23:26:02 -0000	1.158
+++ Make.rules.in	13 Jul 2003 14:16:35 -0000
@@ -37,6 +37,7 @@
 LDSHARED  = @LDSHARED@
 DLLTOOL   = @DLLTOOL@
 DLLWRAP   = @DLLWRAP@
+LDDYLIB   = @LDDYLIB@
 AR        = @AR@ rc
 RANLIB    = @RANLIB@
 STRIP     = @STRIP@
Index: libs/Makelib.rules.in
===================================================================
RCS file: /home/wine/wine/libs/Makelib.rules.in,v
retrieving revision 1.2
diff -u -r1.2 Makelib.rules.in
--- libs/Makelib.rules.in	13 Jun 2003 23:26:02 -0000	1.2
+++ libs/Makelib.rules.in	13 Jul 2003 14:16:35 -0000
@@ -30,7 +30,13 @@
 $(LIBNAME).dll: $(OBJS) $(DEFNAME) Makefile.in
 	$(DLLWRAP) --def $(SRCDIR)/$(DEFNAME) -o $@ $(OBJS) $(EXTRALIBS)
 
-.PHONY: install-lib-so install-lib-dll install-dev-so install-dev-dll
+$(LIBNAME).$(SOVERSION).dylib: $(OBJS) Makefile.in
+	$(LDDYLIB) $(OBJS) $(EXTRALIBS) $(LDFLAGS) $(LIBS) -o $@
+
+$(LIBNAME).dylib: $(LIBNAME).$(SOVERSION).dylib
+	$(RM) $@ && $(LN_S) $(LIBNAME).so.$(SOVERSION) $@
+
+.PHONY: install-lib-so install-lib-dll install-lib-dylib install-dev-so install-dev-dll install-dev-dylib
 
 install-lib-so: $(LIBNAME).so.$(SOVERSION) dummy
 	$(MKINSTALLDIRS) $(libdir)
@@ -40,6 +46,10 @@
 	$(MKINSTALLDIRS) $(libdir)
 	$(INSTALL_DATA) $(LIBNAME).dll $(libdir)/$(LIBNAME).dll
 
+install-lib-dylib: $(LIBNAME).$(SOVERSION).dylib dummy
+	$(MKINSTALLDIRS) $(libdir)
+	$(INSTALL_PROGRAM) $(LIBNAME).$(SOVERSION).dylib $(libdir)/$(LIBNAME).$(SOVERSION).dylib
+
 install-dev-so: dummy
 	$(MKINSTALLDIRS) $(libdir)
 	cd $(libdir) && $(RM) $(LIBNAME).so && $(LN_S) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).so
@@ -48,11 +58,15 @@
 	$(MKINSTALLDIRS) $(libdir)
 	$(INSTALL_DATA) $(LIBNAME).a $(libdir)/$(LIBNAME).a
 
+install-dev-dylib: dummy
+	$(MKINSTALLDIRS) $(libdir)
+	cd $(libdir) && $(RM) $(LIBNAME).dylib && $(LN_S) $(LIBNAME).$(SOVERSION).dylib $(LIBNAME).dylib
+
 install install-lib:: $(LIBEXT:%=install-lib-%)
 install install-dev:: $(LIBEXT:%=install-dev-%)
 
 uninstall::
-	$(RM) $(libdir)/$(LIBNAME).a $(libdir)/$(LIBNAME).dll $(libdir)/$(LIBNAME).so $(libdir)/$(LIBNAME).so.$(SOVERSION)
+	$(RM) $(libdir)/$(LIBNAME).a $(libdir)/$(LIBNAME).dll $(libdir)/$(LIBNAME).so $(libdir)/$(LIBNAME).so.$(SOVERSION) $(libdir)/$(LIBNAME).dylib $(libdir)/$(LIBNAME).$(SOVERSION).dylib
 
 clean::
-	$(RM) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).dll
+	$(RM) $(LIBNAME).so.$(SOVERSION) $(LIBNAME).dll $(LIBNAME).$(SOVERSION).dylib

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux