libtool-patches
[Top][All Lists]
Advanced

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

Fixes for Darwin and Rhapsody platforms


From: Christoph Pfisterer
Subject: Fixes for Darwin and Rhapsody platforms
Date: Fri, 30 Mar 2001 10:52:19 +0200

Hi!

Here is a patch for the 1.4 branch to bring Darwin support up to speed. It is based on work by Wilfredo Sanchez and me, ported to 1.4. A list of the changes:

- Sets '-fno-common' as the PIC flag. This is not actually a PIC flag, but is neccessary to build shared libraries. PIC is the default on Darwin and Rhapsody. - Uses '-undefined suppress' instead of '-undefined warning'. The list of undefined symbols is no longer printed to stdout by the linker.
- Fixes the quoting in archive_cmds. The shell (zsh) choked on it.
- Adds flags to archive_cmds to hardcode the library name and path (-install_name) and to add version information ($verstring, see below). - Disables archive_expsym_cmds because it doesn't work without further tweaking.
- Prints "darwin1.3 dyld" instead of "darwin1.3 ld.so".
- Introduces a new version_type, "darwin". It was cloned from "linux", but puts appropriate info in $verstring to code the minor version into the library header.
- Sets the library name vars accordingly.
- Removes the postinstall_cmd - shared libraries are not required to be executable on Darwin. - Uses the '-L' flag to file, which simplifies finding a suitable library for testing. - In ltmain.in, fixes the special cases for libc / libm on Rhapsody and earlier Darwin versions. One was completely misplaced. Since version 1.3, Darwin has libc and libm (both are symlinks to libSystem :-)).

-chrisp


Changelog entry:

2001-03-30  Christoph Pfisterer  <address@hidden>

        * libtool.m4: Fixed support for Darwin and Rhapsody. Now correctly
        hardcodes the library path and adds versioning. Other small
        fixes.
        * ltmain.in: Fixed special cases for libc and libm on Rhapsody and
        Darwin. One of them was misplaced. Added version_type case for
        Rhapsody and Darwin, named "darwin".

Patch:

Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.151
diff -u -r1.151 libtool.m4
--- libtool.m4  2001/03/16 03:58:51     1.151
+++ libtool.m4  2001/03/30 08:17:15
@@ -810,6 +810,11 @@
     beos* | irix5* | irix6* | osf3* | osf4* | osf5*)
       # PIC is the default for these OSes.
       ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_cv_prog_cc_pic='-fno-common'
+      ;;
     aix*)
       # Below there is a dirty hack to force normal static linking with -ldl
       # The problem is because libdl dynamically linked with both libc and
@@ -1454,15 +1459,13 @@
     ;;

   darwin* | rhapsody*)
-    allow_undefined_flag='-undefined warning'
-    archive_cmds='$CC `if test "$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'
+    allow_undefined_flag='-undefined suppress'
+ archive_cmds='$CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs $linkopts -install_name $rpath/$soname $(test -n "$verstring" -a x$verstring != x0.0 && echo $verstring)'
+    # We need to add '_' to the symbols in $export_symbols first
+    #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
+    hardcode_direct=yes
     hardcode_shlibpath_var=no
-    whole_archive_flag_spec='-all_load'
+    whole_archive_flag_spec='-all_load $convenience'
     ;;

   freebsd1*)
@@ -1851,12 +1854,14 @@
   ;;

 darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
   need_lib_prefix=no
   need_version=no
- library_names_spec='${libname}.`if test "$module" = "yes"; then echo so; else echo dylib; fi`' + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
-  postinstall_cmds='chmod +x $lib'
   ;;

 freebsd1*)
@@ -3056,10 +3061,17 @@
   lt_cv_file_magic_cmd='$OBJDUMP -f'
   ;;

-darwin*|rhapsody*)
+darwin* | rhapsody*)
lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library'
-  lt_cv_file_magiic_cmd=/usr/bin/file
- lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1`
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  case "$host_os" in
+  rhapsody* | darwin1.[012])
+ lt_cv_file_magic_test_file='/System/Library/Frameworks/System.framework/System'
+    ;;
+  *) # Darwin 1.3 on
+    lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib'
+    ;;
+  esac
   ;;

 freebsd*)
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.246
diff -u -r1.246 ltmain.in
--- ltmain.in   2001/03/10 02:16:45     1.246
+++ ltmain.in   2001/03/30 08:17:17
@@ -1027,9 +1027,10 @@
            # These systems don't actually have c library (as such)
            continue
            ;;
-         *-*-rhapsody* | *-*-darwin*)
-           # Darwin C library is in the System framework
+         *-*-rhapsody* | *-*-darwin1.[012])
+           # Rhapsody C library is in the System framework
            deplibs="$deplibs -framework System"
+           continue
            ;;
          esac
        elif test "$arg" = "-lm"; then
@@ -1038,9 +1039,10 @@
            # These systems don't actually have math library (as such)
            continue
            ;;
-         *-*-rhapsody* | *-*-darwin*)
-           # Darwin math library is in the System framework
+         *-*-rhapsody* | *-*-darwin1.[012])
+           # Rhapsody math library is in the System framework
            deplibs="$deplibs -framework System"
+           continue
            ;;
          esac
        fi
@@ -1067,10 +1069,6 @@
          $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
          fast_install=no
          ;;
-        *-*-rhapsody* | *-*-darwin*)
-         # Darwin C library is in the System framework
-         deplibs="$deplibs -framework System"
-         ;;
        *)
          no_install=yes
          ;;
@@ -2306,6 +2304,16 @@
          versuffix="-$major"
          ;;

+       darwin)
+         # Like Linux, but with the current version available in
+         # verstring for coding it into the library header
+         major=.`expr $current - $age`
+         versuffix="$major.$age.$revision"
+         # Darwin ld doesn't like 0 for these options...
+         minor_current=`expr $current + 1`
+ verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+         ;;
+
        *)
          $echo "$modename: unknown library version type \`$version_type'" 1>&2
echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
@@ -2405,6 +2413,10 @@
          case $host in
          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
            # these systems don't actually have a c library (as such)!
+           ;;
+         *-*-rhapsody* | *-*-darwin1.[012])
+           # Rhapsody C library is in the System framework
+           deplibs="$deplibs -framework System"
            ;;
          *)
            # Add libc to deplibs on all other systems if necessary.

--
chrisp a.k.a. Christoph Pfisterer   "Any sufficiently advanced
address@hidden - http://chrisp.de      bug is indistinguishable
PGP key & geek code available        from a feature."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]