Date: Mon, 17 Nov 2003 23:12:59 +0100
authorSam Lantinga <slouken@libsdl.org>
Tue, 18 Nov 2003 14:25:12 +0000
changeset 74197b9c301df94
parent 740 e70f80e98f60
child 742 528a52626680
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
     1.1 --- a/ltmain.sh	Tue Nov 18 02:16:57 2003 +0000
     1.2 +++ b/ltmain.sh	Tue Nov 18 14:25:12 2003 +0000
     1.3 @@ -1148,6 +1148,19 @@
     1.4  	  finalize_command="$finalize_command $qarg"
     1.5  	  continue
     1.6  	  ;;
     1.7 +	framework)
     1.8 +	  case $host in
     1.9 +	    *-*-darwin*)
    1.10 +	      case "$deplibs " in
    1.11 +	        *" $qarg.framework "*) ;;
    1.12 +		*) deplibs="$deplibs $qarg.framework" # this is fixed later
    1.13 +		   ;;
    1.14 +              esac
    1.15 +              ;;
    1.16 +   	  esac
    1.17 +	  prev=
    1.18 +	  continue
    1.19 +	  ;;
    1.20  	*)
    1.21  	  eval "$prev=\"\$arg\""
    1.22  	  prev=
    1.23 @@ -1459,6 +1472,11 @@
    1.24  	continue
    1.25  	;;
    1.26  
    1.27 +      -framework)
    1.28 +        prev=framework
    1.29 +	continue
    1.30 +	;;
    1.31 +
    1.32        # Some other compiler flag.
    1.33        -* | +*)
    1.34  	# Unknown arguments in both finalize_command and compile_command need
    1.35 @@ -1868,6 +1886,18 @@
    1.36  	    fi
    1.37  	  fi
    1.38  	  ;; # -l
    1.39 +	*.framework)
    1.40 +	  if test "$linkmode,$pass" = "prog,link"; then
    1.41 +	    compile_deplibs="$deplib $compile_deplibs"
    1.42 +	    finalize_deplibs="$deplib $finalize_deplibs"
    1.43 +	  else
    1.44 +	    deplibs="$deplib $deplibs"
    1.45 +	    if test "$linkmode" = lib ; then
    1.46 +	      newdependency_libs="$deplib $newdependency_libs"
    1.47 +	    fi
    1.48 +	  fi
    1.49 +	  continue
    1.50 +	  ;;
    1.51  	-L*)
    1.52  	  case $linkmode in
    1.53  	  lib)
    1.54 @@ -1996,6 +2026,13 @@
    1.55  	*) . ./$lib ;;
    1.56  	esac
    1.57  
    1.58 +	case $host in
    1.59 +	*-*-darwin*)
    1.60 +	  # Convert "-framework foo" to "foo.framework" in dependency_libs
    1.61 +	  test -n "$dependency_libs" && dependency_libs=`$echo "X$dependency_libs" | $Xsed -e 's/-framework \([^ $]*\)/\1.framework/g'`
    1.62 +	  ;;
    1.63 +	esac
    1.64 +
    1.65  	if test "$linkmode,$pass" = "lib,link" ||
    1.66  	   test "$linkmode,$pass" = "prog,scan" ||
    1.67  	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
    1.68 @@ -2568,14 +2605,18 @@
    1.69  		    if test -f "$path/$depdepl" ; then
    1.70  		      depdepl="$path/$depdepl"
    1.71  		   fi
    1.72 -		    newlib_search_path="$newlib_search_path $path"
    1.73 -		    path=""
    1.74 +		    # do not add paths which are already there
    1.75 +		    case " $newlib_search_path " in
    1.76 +		    *" $path "*) ;;
    1.77 +		    *) newlib_search_path="$newlib_search_path $path";;
    1.78 +		    esac
    1.79  		  fi
    1.80 +		  path=""
    1.81  		  ;;
    1.82  		*)
    1.83  		path="-L$path"
    1.84  		;;
    1.85 -		esac 
    1.86 +		esac
    1.87  		
    1.88  		;;
    1.89  		  -l*)
    1.90 @@ -2594,6 +2635,15 @@
    1.91  		*) continue ;;
    1.92  		esac  		  
    1.93  		;;
    1.94 +
    1.95 +	      *.framework)
    1.96 +		case $host in
    1.97 +		  *-*-darwin*)
    1.98 +		    depdepl="$deplib"
    1.99 +		    ;;
   1.100 +		esac
   1.101 +		;;
   1.102 +
   1.103  	      *) continue ;;
   1.104  	      esac
   1.105  	      case " $deplibs " in
   1.106 @@ -3446,6 +3496,13 @@
   1.107  	    fi
   1.108  	  fi
   1.109  	fi
   1.110 +	# Time to change all our "foo.framework" stuff back to "-framework foo"
   1.111 +	case $host in
   1.112 +	  *-*-darwin*)
   1.113 +	    newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
   1.114 +	    dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
   1.115 +	    ;;
   1.116 +	esac
   1.117  	# Done checking deplibs!
   1.118  	deplibs=$newdeplibs
   1.119        fi
   1.120 @@ -4025,12 +4082,15 @@
   1.121        esac
   1.122  
   1.123        case $host in
   1.124 -      *darwin*)
   1.125 +      *-*-darwin*)
   1.126          # Don't allow lazy linking, it breaks C++ global constructors
   1.127          if test "$tagname" = CXX ; then
   1.128          compile_command="$compile_command ${wl}-bind_at_load"
   1.129          finalize_command="$finalize_command ${wl}-bind_at_load"
   1.130          fi
   1.131 +	# Time to change all our "foo.framework" stuff back to "-framework foo"
   1.132 +	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
   1.133 +	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
   1.134          ;;
   1.135        esac
   1.136