From d653a419a1cd4b886a62a300681283d218064865 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 18 Nov 2003 14:25:12 +0000 Subject: [PATCH] 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). --- ltmain.sh | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 4 deletions(-) diff --git a/ltmain.sh b/ltmain.sh index 07e2b7ce8..bf8c83a1c 100644 --- a/ltmain.sh +++ b/ltmain.sh @@ -1148,6 +1148,19 @@ EOF 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 @@ EOF continue ;; + -framework) + prev=framework + continue + ;; + # Some other compiler flag. -* | +*) # Unknown arguments in both finalize_command and compile_command need @@ -1868,6 +1886,18 @@ EOF 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 @@ EOF *) . ./$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 @@ EOF 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 @@ EOF *) continue ;; esac ;; + + *.framework) + case $host in + *-*-darwin*) + depdepl="$deplib" + ;; + esac + ;; + *) continue ;; esac case " $deplibs " in @@ -3446,6 +3496,13 @@ EOF 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 @@ EOF 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