libtool-patches
[Top][All Lists]
Advanced

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

handle the -framework flag


From: Benjamin Reed
Subject: handle the -framework flag
Date: Thu, 04 Sep 2003 10:26:11 -0400
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5b) Gecko/20030902 Thunderbird/0.2

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Attached is a patch to add support for handling frameworks on Darwin and
Mac OS X.  This is actually Peter O'Gorman's patch but he's having disk
problems at the moment so he asked me to forward this on.  =)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQE/V0uDUu+jZtP2Zf4RAtfjAJ4tQiTvH1FycSAkZgZJYOyD+q/CxACgin7i
wAnkjIyKzzrzi4E/b8oAHQU=
=Znhu
-----END PGP SIGNATURE-----
Index: ChangeLog
===================================================================
RCS file: /cvsroot/libtool/libtool/ChangeLog,v
retrieving revision 1.1256
diff -u -u -b -r1.1256 ChangeLog
--- ChangeLog   29 Aug 2003 17:07:17 -0000      1.1256
+++ ChangeLog   4 Sep 2003 14:20:29 -0000
@@ -1,3 +1,7 @@
+2003-09-04  Peter O'Gorman  <address@hidden>
+
+       * ltmain.in: Handle the -framework flag on Darwin/Mac OS X
+
 2003-08-29  Gary V. Vaughan  <address@hidden>
 
        * bootstrap: Typo.
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.341
diff -u -u -b -r1.341 ltmain.in
--- ltmain.in   31 Jul 2003 20:41:34 -0000      1.341
+++ ltmain.in   4 Sep 2003 14:20:30 -0000
@@ -1148,6 +1148,19 @@
          finalize_command="$finalize_command $qarg"
          continue
          ;;
+       framework)
+         case $host in
+           *-*-darwin*)
+             case "$deplibs " in
+               *" $qarg.framework "*) ;;
+               *)
+                 deplibs="$deplibs $qarg.framework" # this is fixed later
+                 ;;
+              esac
+         esac
+         prev=   
+         continue
+         ;;
        *)
          eval "$prev=\"\$arg\""
          prev=
@@ -1272,7 +1285,7 @@
            ;;
          *-*-rhapsody* | *-*-darwin1.[012])
            # Rhapsody C and math libraries are in the System framework
-           deplibs="$deplibs -framework System"
+           deplibs="$deplibs System.framework"
            continue
          esac
        elif test "X$arg" = "X-lc_r"; then
@@ -1459,6 +1472,11 @@
        continue
        ;;
 
+      -framework)
+       prev=framework
+       continue
+       ;;  
+
       # Some other compiler flag.
       -* | +*)
        # Unknown arguments in both finalize_command and compile_command need
@@ -1801,6 +1819,7 @@
       for deplib in $libs; do
        lib=
        found=no
+       test -z "$deplib" && continue
        case $deplib in
        -l*)
          if test "$linkmode" != lib && test "$linkmode" != prog; then
@@ -1869,11 +1888,24 @@
                  fi
                fi
                ;;
+               
              *) ;;
              esac
            fi
          fi
          ;; # -l
+       *.framework)
+         if test "$linkmode,$pass" = "prog,link"; then
+           compile_deplibs="$deplib $compile_deplibs"
+           finalize_deplibs="$deplib $finalize_deplibs"
+         else
+           deplibs="$deplib $deplibs"
+           if test "$linkmode" = lib ; then
+             newdependency_libs="$deplib $newdependency_libs"
+           fi
+         fi
+         continue
+         ;;
        -L*)
          case $linkmode in
          lib)
@@ -1969,7 +2001,7 @@
          continue
          ;;
        esac # case $deplib
-       if test "$found" = yes || test -f "$lib"; then :
+       if test "$found" = yes || test -f "$deplib"; then :
        else
          $echo "$modename: cannot find the library \`$lib'" 1>&2
          exit 1
@@ -2001,7 +2033,12 @@
        */* | *\\*) . $lib ;;
        *) . ./$lib ;;
        esac
-
+       case $host in
+       *-*-darwin*)
+         # Convert "-framework foo" to "foo.framework" in dependency_libs 
+         test -n "$dependency_libs" && dependency_libs=`$echo 
"X$dependency_libs" | $Xsed -e 's/-framework \([^ $]*\)/\1.framework/g'`
+         ;;
+       esac
        if test "$linkmode,$pass" = "lib,link" ||
           test "$linkmode,$pass" = "prog,scan" ||
           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
@@ -2092,10 +2129,17 @@
            absdir="$libdir"
          fi
        else
+         if test ! -f "$ladir/$objdir/$linklib" && test -f 
"$abs_ladir/$linklib"; then
+           dir="$ladir"
+           absdir="$abs_ladir"
+           # Remove this search path later
+           notinst_path="$notinst_path $abs_ladir"
+         else
          dir="$ladir/$objdir"
          absdir="$abs_ladir/$objdir"
          # Remove this search path later
          notinst_path="$notinst_path $abs_ladir"
+         fi
        fi # $installed = yes
        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
 
@@ -2604,6 +2648,15 @@
                *) continue ;;
                esac              
                ;;
+
+             *.framework)
+               case $host in
+                 *-*-darwin*)
+                   depdepl="$deplib"
+                   ;;
+               esac
+               ;;
+                               
              *) continue ;;
              esac
              case " $deplibs " in
@@ -2717,7 +2770,6 @@
       dlfiles="$newdlfiles"
       dlprefiles="$newdlprefiles"
     fi
-
     case $linkmode in
     oldlib)
       if test -n "$deplibs"; then
@@ -3117,7 +3169,7 @@
            ;;
          *-*-rhapsody* | *-*-darwin1.[012])
            # Rhapsody C library is in the System framework
-           deplibs="$deplibs -framework System"
+           deplibs="$deplibs System.framework"
            ;;
          *-*-netbsd*)
            # Don't link with libc until the a.out ld.so is fixed.
@@ -3410,7 +3462,7 @@
        case $host in
        *-*-rhapsody* | *-*-darwin1.[012])
          # On Rhapsody replace the C library is the System framework
-         newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework 
System /'`
+         newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / 
System.framework /'`
          ;;
        esac
 
@@ -3456,6 +3508,13 @@
            fi
          fi
        fi
+       # Time to change all our "foo.framework" stuff back to "-framework foo"
+       case $host in
+         *-*-darwin*)
+           newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ 
$]*\).framework% -framework \1%g'`
+           dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ 
$]*\).framework% -framework \1%g'`
+           ;;
+       esac  
        # Done checking deplibs!
        deplibs=$newdeplibs
       fi

reply via email to

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