Fixed bug #177
authorSam Lantinga <slouken@libsdl.org>
Fri, 24 Mar 2006 05:11:51 +0000
changeset 1611ec3466b08f17
parent 1610 a1ee5944412b
child 1612 97d0966f4bf7
Fixed bug #177
The attached patch changes configure.in to use "-framework FOO" instead of
"-Wl,-framework,FOO".

This avoid some issues with certain versions of libtool that do not handle
-framework properly.
Some versions of libtool will try to reorder the two parts of the option, or
render the 2nd part of the argument to the relative path of a non-existent
library.

Note: It is not enough if SDL uses a version of libtool that does this
correctly, because these -framework options show up in "sdl-config --libs".
Hence, some 3rd party apps which still ship with an old libtool have troubles
compiling under Mac OS X.
build-scripts/ltmain.sh
configure.in
     1.1 --- a/build-scripts/ltmain.sh	Fri Mar 24 03:49:37 2006 +0000
     1.2 +++ b/build-scripts/ltmain.sh	Fri Mar 24 05:11:51 2006 +0000
     1.3 @@ -1413,19 +1413,6 @@
     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  	shrext)
    1.21    	  shrext_cmds="$arg"
    1.22  	  prev=
    1.23 @@ -1802,11 +1789,6 @@
    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 @@ -2190,18 +2172,6 @@
    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 @@ -2347,13 +2317,6 @@
    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 @@ -2974,13 +2937,6 @@
    1.69  		  done
    1.70  		  path=""
    1.71  		  ;;
    1.72 -	      *.framework)
    1.73 -		case $host in
    1.74 -		  *-*-darwin*)
    1.75 -		    depdepl="$deplib"
    1.76 -		    ;;
    1.77 -		esac
    1.78 -		;;
    1.79  		*) continue ;;
    1.80  		esac
    1.81  		;;
    1.82 @@ -3848,13 +3804,6 @@
    1.83  	    fi
    1.84  	  fi
    1.85  	fi
    1.86 -	# Time to change all our "foo.framework" stuff back to "-framework foo"
    1.87 -	case $host in
    1.88 -	  *-*-darwin*)
    1.89 -	    newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
    1.90 -	    dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).framework%%g'`
    1.91 -	    ;;
    1.92 -	esac
    1.93  	# Done checking deplibs!
    1.94  	deplibs=$newdeplibs
    1.95        fi
    1.96 @@ -4394,15 +4343,12 @@
    1.97        esac
    1.98  
    1.99        case $host in
   1.100 -      *-*-darwin*)
   1.101 +      *darwin*)
   1.102          # Don't allow lazy linking, it breaks C++ global constructors
   1.103          if test "$tagname" = CXX ; then
   1.104          compile_command="$compile_command ${wl}-bind_at_load"
   1.105          finalize_command="$finalize_command ${wl}-bind_at_load"
   1.106          fi
   1.107 -	# Time to change all our "foo.framework" stuff back to "-framework foo"
   1.108 -	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
   1.109 -	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).framework% -framework \1%g'`
   1.110          ;;
   1.111        esac
   1.112  
     2.1 --- a/configure.in	Fri Mar 24 03:49:37 2006 +0000
     2.2 +++ b/configure.in	Fri Mar 24 05:11:51 2006 +0000
     2.3 @@ -1444,9 +1444,9 @@
     2.4          AC_DEFINE(SDL_VIDEO_OPENGL)
     2.5          case "$host" in
     2.6              *-*-darwin*)
     2.7 -                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework OpenGL"
     2.8 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
     2.9                  # The following is probably not available in Darwin:
    2.10 -                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework AGL"
    2.11 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AGL"
    2.12          esac
    2.13      fi
    2.14  }
    2.15 @@ -2342,7 +2342,7 @@
    2.16          if test x$enable_joystick = xyes; then
    2.17              AC_DEFINE(SDL_JOYSTICK_IOKIT)
    2.18              SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
    2.19 -            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework IOKit"
    2.20 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
    2.21              have_joystick=yes
    2.22          fi
    2.23          # Set up files for the cdrom library
    2.24 @@ -2368,16 +2368,16 @@
    2.25          EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
    2.26          SDL_LIBS="-lSDLmain $SDL_LIBS"
    2.27          if test x$enable_video_cocoa = xyes; then
    2.28 -            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework Cocoa"
    2.29 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
    2.30          fi
    2.31          if test x$enable_video_carbon = xyes -o x$enable_video_cocoa = xyes; then
    2.32              # The Cocoa backend still needs Carbon, and the YUV code QuickTime
    2.33 -            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework QuickTime -framework ApplicationServices"
    2.34 -            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework Carbon"
    2.35 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuickTime -Wl,-framework,ApplicationServices"
    2.36 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
    2.37          fi
    2.38          # If either the audio or CD driver is used, add the AudioUnit framework
    2.39          if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
    2.40 -            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -framework AudioToolbox -framework AudioUnit"
    2.41 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
    2.42          fi
    2.43          ;;
    2.44      *-*-mint*)
    2.45 @@ -2519,13 +2519,13 @@
    2.46  case "$ARCH" in
    2.47    macosx)
    2.48      if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
    2.49 -      SDL_LIBS="$SDL_LIBS -framework Cocoa"
    2.50 +      SDL_LIBS="$SDL_LIBS -Wl,-framework,Cocoa"
    2.51      fi
    2.52      if test x$enable_video = xyes -a x$enable_video_carbon = xyes; then
    2.53 -      SDL_LIBS="$SDL_LIBS -framework Carbon"
    2.54 +      SDL_LIBS="$SDL_LIBS -Wl,-framework,Carbon"
    2.55      fi
    2.56      if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
    2.57 -      SDL_LIBS="$SDL_LIBS -framework OpenGL"
    2.58 +      SDL_LIBS="$SDL_LIBS -Wl,-framework,OpenGL"
    2.59      fi
    2.60      # Evil hack to allow static linking on Mac OS X
    2.61      SDL_STATIC_LIBS="\${exec_prefix}/lib/libSDLmain.a \${exec_prefix}/lib/libSDL.a"