diff ltmain.sh @ 741:97b9c301df94

Date: Mon, 17 Nov 2003 23:12:59 +0100 From: Max Horn Subject: SDL building "the unix way" on OS X I just noticed that building current SDL CVS "the unix way" (using configure/make) is (and has been for some time, it seems) broken. That's because Sam updated to a newer libtool version, which removed my "-framework" patches. Attached is a patch which once again makes ltmain.sh aware of "-framework". Note that this is simply a backport of the corresponding changes in libtool CVS (i.e. the next libtool release will contain those same changes).
author Sam Lantinga <slouken@libsdl.org>
date Tue, 18 Nov 2003 14:25:12 +0000
parents 0f4f974d0201
children f9d0e03fc2ff
line wrap: on
line diff
--- a/ltmain.sh	Tue Nov 18 02:16:57 2003 +0000
+++ b/ltmain.sh	Tue Nov 18 14:25:12 2003 +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=
@@ -1459,6 +1472,11 @@
 	continue
 	;;
 
+      -framework)
+        prev=framework
+	continue
+	;;
+
       # Some other compiler flag.
       -* | +*)
 	# Unknown arguments in both finalize_command and compile_command need
@@ -1868,6 +1886,18 @@
 	    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)
@@ -1996,6 +2026,13 @@
 	*) . ./$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
@@ -2568,14 +2605,18 @@
 		    if test -f "$path/$depdepl" ; then
 		      depdepl="$path/$depdepl"
 		   fi
-		    newlib_search_path="$newlib_search_path $path"
-		    path=""
+		    # do not add paths which are already there
+		    case " $newlib_search_path " in
+		    *" $path "*) ;;
+		    *) newlib_search_path="$newlib_search_path $path";;
+		    esac
 		  fi
+		  path=""
 		  ;;
 		*)
 		path="-L$path"
 		;;
-		esac 
+		esac
 		
 		;;
 		  -l*)
@@ -2594,6 +2635,15 @@
 		*) continue ;;
 		esac  		  
 		;;
+
+	      *.framework)
+		case $host in
+		  *-*-darwin*)
+		    depdepl="$deplib"
+		    ;;
+		esac
+		;;
+
 	      *) continue ;;
 	      esac
 	      case " $deplibs " in
@@ -3446,6 +3496,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
@@ -4025,12 +4082,15 @@
       esac
 
       case $host in
-      *darwin*)
+      *-*-darwin*)
         # Don't allow lazy linking, it breaks C++ global constructors
         if test "$tagname" = CXX ; then
         compile_command="$compile_command ${wl}-bind_at_load"
         finalize_command="$finalize_command ${wl}-bind_at_load"
         fi
+	# Time to change all our "foo.framework" stuff back to "-framework foo"
+	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
+	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
         ;;
       esac