Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: MacOS X again



Sorry if this turns up twice, I sent it yesterday but it never came
through.

As I mentioned before, MacOS X uses a different system for dynamic
loading inherited from NeXT. However, there is a dlcompat library which
provides all the usual dl* functions. It seems that a number of open
source programs (including libtool) use this library so I looked into
the possibility of using it. The patch below is the result. Everything
now works fine (except for the Y03 test hanging as I reported before).

I've also now corrected the chmod problem in C02 for IRIX/Darwin.

In case you're interested, some documentation on porting to MacOS X
including information on dynamic loading is available at
http://fink.sourceforge.net/doc/index.php and it can also be useful to
search the archives on the darwin dev list which is at:
http://www.darwinfo.org/devlist.php3 (I reported the chmod bug to
there).

Oliver

Index: acconfig.h
===================================================================
RCS file: /cvsroot/zsh/zsh/acconfig.h,v
retrieving revision 1.12
diff -u -r1.12 acconfig.h
--- acconfig.h	2001/06/19 06:59:24	1.12
+++ acconfig.h	2001/10/10 14:30:32
@@ -259,7 +259,7 @@
 /* Define to 1 if multiple modules defining the same symbol are OK */
 #undef DYNAMIC_NAME_CLASH_OK
 
-/* The exension used for dynamically loaded modules */
+/* The extension used for dynamically loaded modules */
 #undef DL_EXT
 
 /* Define to 1 if you want to use dynamically loaded modules */
Index: zshconfig.ac
===================================================================
RCS file: /cvsroot/zsh/zsh/zshconfig.ac,v
retrieving revision 1.19
diff -u -r1.19 zshconfig.ac
--- zshconfig.ac	2001/09/27 15:50:15	1.19
+++ zshconfig.ac	2001/10/10 14:30:33
@@ -1576,7 +1576,7 @@
   MOD_IMPORT_VARIABLE="__attribute__((__dllimport__))"
   MOD_IMPORT_FUNCTION=
 elif test "x$dynamic" = xyes; then
-  AC_CACHE_CHECK(if your system use ELF binaries,
+  AC_CACHE_CHECK(if your system uses ELF binaries,
    zsh_cv_sys_elf,
    [AC_TRY_RUN([/* Test for whether ELF binaries are produced */
 #include <fcntl.h>
@@ -1623,6 +1623,10 @@
 	esac
 	DLLDARG="${LDARG}"
       ;;
+      *darwin*)
+        DLLD="${DLLD=$CC}"
+        DLLDARG=""
+      ;;
       * )
 	DLLD="${DLLD=ld}"
 	DLLDARG=""
@@ -1630,7 +1634,10 @@
     esac
   fi
   if test -n "$GCC"; then
-    DLCFLAGS="${DLCFLAGS=-fPIC}"
+    case "$host_os" in
+      darwin*) DLCFLAGS="${DLCFLAGS=-fno-common}" ;;
+      *)       DLCFLAGS="${DLCFLAGS=-fPIC}" ;;
+    esac
   else
     case "$host_os" in
       hpux*)                 DLCFLAGS="${DLCFLAGS=+z}" ;;
@@ -1646,6 +1653,7 @@
     netbsd*)      DLLDFLAGS="${DLLDFLAGS=${DLLDARG}-x -shared --whole-archive}" ;;
     aix*)         DLLDFLAGS="${DLLDFLAGS=-G -bexpall -lc}" ;;
     solaris*|sysv4*|esix*) DLLDFLAGS="${DLLDFLAGS=-G}" ;;
+    darwin*)      DLLDFLAGS="${DLLDFLAGS=-bundle -flat_namespace -undefined suppress}" ;;
     openbsd*)
       if test $zsh_cv_sys_elf = yes; then
 	DLLDFLAGS="${DLLDFLAGS=-shared -fPIC}"
Index: Etc/MACHINES
===================================================================
RCS file: /cvsroot/zsh/zsh/Etc/MACHINES,v
retrieving revision 1.14
diff -u -r1.14 MACHINES
--- Etc/MACHINES	2001/09/27 15:50:15	1.14
+++ Etc/MACHINES	2001/10/10 14:30:34
@@ -18,7 +18,11 @@
 --------
 
 Apple: MacOS X/Darwin 1.4
-	Should build `out-of-the-box'. Dynamic loading does not work.
+	Should build `out-of-the-box'.
+
+	For dynamic loading to work, you need to use the dlcompat library.
+	It can be downloaded from:
+	    http://sourceforge.net/project/showfiles.php?group_id=17203
 
 Red Hat Inc.: Cygwin
 	Should build `out-of-the-box'.  The compilation directory should
Index: Test/C02cond.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/C02cond.ztst,v
retrieving revision 1.10
diff -u -r1.10 C02cond.ztst
--- Test/C02cond.ztst	2001/09/27 15:50:15	1.10
+++ Test/C02cond.ztst	2001/10/10 14:30:34
@@ -19,6 +19,7 @@
   chgrp $EGID modish
 
   chmod 7710 modish  # g+xs,u+s,+t
+  chmod g+s modish   # two lines combined work around chmod bugs
 
   touch unmodish
   chmod 000 unmodish

_____________________________________________________________________
This message has been checked for all known viruses by the 
MessageLabs Virus Scanning Service. For further information visit
http://www.messagelabs.com/stats.asp



Messages sorted by: Reverse Date, Date, Thread, Author