Below is a patch which adds preliminary support for dyld systems
(these include OpenStep 4.2 [not explicitly supported, since I didn't
test it], Rhapsody/Mac OS X Server, and Mac OS X).

  I'm using php as a test case here, and I'm still running into a
few problems at link time.  I'm not sure whether the problem is in
(g)libtool (we have our own program named libtool in the system)
at this point; additional patches may follow.  This patch addresses
several immediate problems, though.

        -Fred


Summary:

ltconfig.in:
- Add dyld flags, etc.
  - Note that dyld distinguishes between shared libraries (eg.
    libfoo.dylib) and loadable modules (eg. foo.bundle or foo.so);
    that is, they are different file types, and are not
    interchangeable.  Hence the conditional in archive_cmds and
    library_names_spec.
  - We can (and should) put the install path to the library itself
    into the binary, and executables which link against it will
    search that path first.  But this is a path to the file itself,
    and not a search path.  Not sure yet how to work that into
    hardcode_libdir_flag_spec, so it's commented out.

ltmain.in:
- C and Math libraries are in the System framework.


Index: Commands/GNU/libtool/libtool/ltconfig.in
diff -u Commands/GNU/libtool/libtool/ltconfig.in:1.1.1.2  
Commands/GNU/libtool/libtool/ltconfig.in:1.3
--- Commands/GNU/libtool/libtool/ltconfig.in:1.1.1.2    Wed Aug  9 14:27:29 2000
+++ Commands/GNU/libtool/libtool/ltconfig.in    Mon Aug 14 18:15:06 2000
@@ -1367,6 +1367,17 @@
     hardcode_shlibpath_var=no
     ;;

+  darwin* | rhapsody*)
+    allow_undefined_flag='-undefined warning'
+    archive_cmds='$CC $(if [ "$module" = "yes" ]; then echo -bundle; else  
echo -dynamiclib; fi) -o $lib $libobjs $deplibs $linkopts'
+    archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
+    ## What we need is to hardcode the path to the library, not the search path
+    #hardcode_direct=yes
+    #hardcode_libdir_flag_spec='-install_name $libdir/$lib'
+    hardcode_shlibpath_var=no
+    whole_archive_flag_spec='-all_load'
+    ;;
+
   hpux9* | hpux10* | hpux11*)
     case "$host_os" in
     hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir  
-o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib  
|| mv $objdir/$soname $lib' ;;
@@ -1439,12 +1450,6 @@
     hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
     hardcode_libdir_separator=:
     ;;
-  rhapsody*)
-    archive_cmds='$CC -bundle -undefined suppress -o $lib $libobjs  
$deplibs $linkopts'
-    hardcode_libdir_flags_spec='-L$libdir'
-    hardcode_direct=yes
-    hardcode_shlibpath_var=no
-    ;;

   sco3.2v5*)
     archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
@@ -1915,6 +1920,18 @@
   esac
   ;;

+darwin* | rhapsody*)
+  deplibs_check_method='file_magic Mach-O dynamically linked shared library'
+  file_magic_cmd=/usr/bin/file
+  file_magic_test_file=`echo  
/System/Library/Frameworks/System.framework/Versions/*/System | head -1`
+  library_names_spec='${libname}.$(if [ "$module" = "yes" ]; then echo  
so; else echo dylib; fi)'
+  need_lib_prefix=no
+  need_version=no
+  postinstall_cmds='chmod +x $lib'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  ;;
+
 gnu*)
   version_type=linux
   need_lib_prefix=no
@@ -2051,14 +2068,6 @@
   deplibs_check_method='pass_all'
   sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc  
/usr/lib /usr/local/lib /var/shlib"
   sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
-  ;;
-
-rhapsody*)
-  version_type=sunos
-  library_names_spec='${libname}.so'
-  soname_spec='${libname}.so'
-  shlibpath_var=DYLD_LIBRARY_PATH
-  deplibs_check_method=pass_all
   ;;

 sco3.2v5*)
Index: Commands/GNU/libtool/libtool/ltmain.in
diff -u Commands/GNU/libtool/libtool/ltmain.in:1.1.1.2  
Commands/GNU/libtool/libtool/ltmain.in:1.2
--- Commands/GNU/libtool/libtool/ltmain.in:1.1.1.2      Wed Aug  9 14:27:30 2000
+++ Commands/GNU/libtool/libtool/ltmain.in      Fri Aug 11 19:55:52 2000
@@ -1079,6 +1079,10 @@
            # These systems don't actually have c library (as such)
            continue
            ;;
+         *-*-rhapsody* | *-*-darwin*)
+           # Darwin C library is in the System framework
+           deplibs="$deplibs -framework System"
+           ;;
          esac
        elif test "$arg" = "-lm"; then
          case "$host" in
@@ -1086,6 +1090,10 @@
            # These systems don't actually have math library (as such)
            continue
            ;;
+         *-*-rhapsody* | *-*-darwin*)
+           # Darwin math library is in the System framework
+           deplibs="$deplibs -framework System"
+           ;;
          esac
        fi
        deplibs="$deplibs $arg"
@@ -1795,8 +1803,8 @@
        *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
          # these systems don't actually have a c library (as such)!
          ;;
-        *-*-rhapsody*)
-         # rhapsody is a little odd...
+        *-*-rhapsody* | *-*-darwin*)
+         # Darwin C library is in the System framework
          deplibs="$deplibs -framework System"
          ;;
        *)

Wilfredo S�nchez, [EMAIL PROTECTED]
Open Source Engineering Lead
Apple Computer, Inc., Core Operating System Group
1 Infinite Loop, Cupertino, CA 94086, 408.974-5174

Reply via email to