Fixed shared library building on MacOS X (thanks Max!)
authorSam Lantinga <slouken@libsdl.org>
Sat, 01 Jun 2002 18:48:13 +0000
changeset 387469d5c0da01d
parent 386 2c5d4c22a2ac
child 388 4e9044b378fd
Fixed shared library building on MacOS X (thanks Max!)
configure.in
ltconfig
ltmain.sh
     1.1 --- a/configure.in	Sat Jun 01 18:43:51 2002 +0000
     1.2 +++ b/configure.in	Sat Jun 01 18:48:13 2002 +0000
     1.3 @@ -1050,7 +1050,7 @@
     1.4          CFLAGS="$CFLAGS -DHAVE_OPENGL"
     1.5          case "$target" in
     1.6              *-*-darwin*)
     1.7 -                SDL_LIBS="$SDL_LIBS -framework OpenGL -framework AGL"
     1.8 +                SYSTEM_LIBS="$SYSTEM_LIBS -framework OpenGL -framework AGL"
     1.9          esac
    1.10      fi
    1.11  }
    1.12 @@ -1247,7 +1247,6 @@
    1.13                  ;;
    1.14          esac
    1.15      fi
    1.16 -    AM_CONDITIONAL(USE_CLONE, test x$use_clone = xyes)
    1.17  }
    1.18  
    1.19  dnl See if we can use GNU pth library for threads
    1.20 @@ -1322,7 +1321,6 @@
    1.21          ])
    1.22          AC_MSG_RESULT($use_directx)
    1.23      fi
    1.24 -    AM_CONDITIONAL(USE_DIRECTX, test x$use_directx = xyes)
    1.25  
    1.26      CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/wincommon"
    1.27      SYSTEM_LIBS="$SYSTEM_LIBS -luser32 -lgdi32 -lwinmm"
    1.28 @@ -2344,7 +2342,7 @@
    1.29          if test x$enable_joystick = xyes; then
    1.30              JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS darwin"
    1.31              JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS darwin/libjoystick_darwin.la"
    1.32 -            SDL_LIBS="$SDL_LIBS -framework IOKit"
    1.33 +            SYSTEM_LIBS="$SYSTEM_LIBS -framework IOKit"
    1.34          fi
    1.35          # Set up files for the cdrom library
    1.36          if test x$enable_cdrom = xyes; then
    1.37 @@ -2370,9 +2368,10 @@
    1.38          if test x$enable_timers = xyes; then
    1.39              COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
    1.40          fi
    1.41 -        # The MacOS X platform requires special setup
    1.42 -        SDL_CFLAGS="$SDL_CFLAGS -F/System/Library/Frameworks/Carbon.framework -F/System/Library/Frameworks/Cocoa.framework"
    1.43 -        SDL_LIBS="-lSDLmain $SDL_LIBS -framework Carbon -framework Cocoa"
    1.44 +        # The MacOS X platform requires special setup.
    1.45 +        SDL_LIBS="-lSDLmain $SDL_LIBS"
    1.46 +        # The Cocoa backend still needs Carbon, and the YUV code QuickTime
    1.47 +        SYSTEM_LIBS="$SYSTEM_LIBS -framework Cocoa -framework Carbon -framework QuickTime"
    1.48          ;;
    1.49      *-*-mint*)
    1.50          ARCH=mint
    1.51 @@ -2451,6 +2450,10 @@
    1.52  AM_CONDITIONAL(TARGET_QNX, test $ARCH = qnx)
    1.53  AM_CONDITIONAL(TARGET_MINT, test $ARCH = mint)
    1.54  
    1.55 +# More automake conditionals
    1.56 +AM_CONDITIONAL(USE_DIRECTX, test x$use_directx = xyes)
    1.57 +AM_CONDITIONAL(USE_CLONE, test x$use_clone = xyes)
    1.58 +
    1.59  # Set conditional variables for shared and static library selection.
    1.60  # These are not used in any Makefile.am but in sdl-config.in.
    1.61  AM_CONDITIONAL([ENABLE_SHARED], [test "$enable_shared" = yes])
    1.62 @@ -2464,11 +2467,22 @@
    1.63  if test $ARCH = solaris; then
    1.64    SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
    1.65  fi
    1.66 -if test $ARCH = openbsd -o $ARCH = bsdi; then
    1.67 +
    1.68 +case "$ARCH" in
    1.69 +  openbsd | bsdi)
    1.70      SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
    1.71 -else
    1.72 +    ;;
    1.73 +  macosx)
    1.74 +    SHARED_SYSTEM_LIBS="-framework Cocoa"
    1.75 +    if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
    1.76 +      SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework OpenGL"
    1.77 +    fi
    1.78 +    ;;
    1.79 +  *)
    1.80      SHARED_SYSTEM_LIBS=""
    1.81 -fi
    1.82 +    ;;
    1.83 +esac
    1.84 +
    1.85  STATIC_SYSTEM_LIBS="$SYSTEM_LIBS"
    1.86  
    1.87  dnl Output the video drivers we use
     2.1 --- a/ltconfig	Sat Jun 01 18:43:51 2002 +0000
     2.2 +++ b/ltconfig	Sat Jun 01 18:48:13 2002 +0000
     2.3 @@ -685,6 +685,11 @@
     2.4    cygwin* | mingw* | os2*)
     2.5      # We can build DLLs from non-PIC.
     2.6      ;;
     2.7 +  darwin* | rhapsody*)
     2.8 +    # PIC is the default on this platform
     2.9 +    # Common symbols not allowed in MH_DYLIB files
    2.10 +    pic_flag='-fno-common'
    2.11 +    ;;
    2.12    amigaos*)
    2.13      # FIXME: we need at least 68020 code to build shared libraries, but
    2.14      # adding the `-m68020' flag to GCC prevents building anything better,
    2.15 @@ -1414,6 +1419,23 @@
    2.16      hardcode_shlibpath_var=no
    2.17      ;;
    2.18  
    2.19 +  darwin* | rhapsody*)
    2.20 +    case "$host_os" in
    2.21 +    rhapsody* | darwin1.[012])
    2.22 +      allow_undefined_flag='-undefined suppress'
    2.23 +      ;;
    2.24 +    *) # Darwin 1.3 on
    2.25 +      allow_undefined_flag='-undefined error'
    2.26 +      ;;
    2.27 +    esac
    2.28 +    archive_cmds='$nonopt $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs $linkopts -install_name $rpath/$soname $verstring'
    2.29 +    # We need to add '_' to the symbols in $export_symbols first
    2.30 +    #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols $lib'
    2.31 +    hardcode_direct=yes
    2.32 +    hardcode_shlibpath_var=no
    2.33 +    whole_archive_flag_spec='-all_load $convenience'
    2.34 +    ;;
    2.35 +
    2.36    hpux9* | hpux10* | hpux11*)
    2.37      case "$host_os" in
    2.38      hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;;
    2.39 @@ -1501,12 +1523,6 @@
    2.40      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
    2.41      hardcode_libdir_separator=:
    2.42      ;;
    2.43 -  rhapsody*)
    2.44 -    archive_cmds='$CC -bundle -undefined suppress -o $lib $libobjs $deplibs $linkopts'
    2.45 -    hardcode_libdir_flags_spec='-L$libdir'
    2.46 -    hardcode_direct=yes
    2.47 -    hardcode_shlibpath_var=no
    2.48 -    ;;
    2.49                                         
    2.50    sco3.2v5*)
    2.51      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
    2.52 @@ -1984,6 +2000,27 @@
    2.53    esac
    2.54    ;;
    2.55  
    2.56 +darwin* | rhapsody*)
    2.57 +  dynamic_linker="$host_os dyld"
    2.58 +  version_type=darwin
    2.59 +  need_lib_prefix=no
    2.60 +  need_version=no
    2.61 +  deplibs_check_method='file_magic Mach-O dynamically linked shared library'
    2.62 +  file_magic_cmd='/usr/bin/file -L'
    2.63 +  case "$host_os" in
    2.64 +  rhapsody* | darwin1.[012])
    2.65 +    file_magic_test_file='/System/Library/Frameworks/System.framework/System'
    2.66 +    ;;
    2.67 +  *) # Darwin 1.3 on
    2.68 +    file_magic_test_file='/usr/lib/libSystem.dylib'
    2.69 +    ;;
    2.70 +  esac
    2.71 +  library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)'
    2.72 +  soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)'
    2.73 +  shlibpath_overrides_runpath=yes
    2.74 +  shlibpath_var=DYLD_LIBRARY_PATH
    2.75 +  ;;
    2.76 +
    2.77  gnu*)
    2.78    version_type=linux
    2.79    need_lib_prefix=no
    2.80 @@ -2141,14 +2178,6 @@
    2.81    sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
    2.82    ;;
    2.83  
    2.84 -rhapsody*)
    2.85 -  version_type=sunos
    2.86 -  library_names_spec='${libname}.so'
    2.87 -  soname_spec='${libname}.so'
    2.88 -  shlibpath_var=DYLD_LIBRARY_PATH
    2.89 -  deplibs_check_method=pass_all
    2.90 -  ;;
    2.91 -
    2.92  sco3.2v5*)
    2.93    version_type=osf
    2.94    soname_spec='${libname}${release}.so$major'
     3.1 --- a/ltmain.sh	Sat Jun 01 18:43:51 2002 +0000
     3.2 +++ b/ltmain.sh	Sat Jun 01 18:48:13 2002 +0000
     3.3 @@ -951,6 +951,11 @@
     3.4  	  prev=
     3.5  	  continue
     3.6  	  ;;
     3.7 +	framework)
     3.8 +	  deplibs="$deplibs -framework $arg"
     3.9 +	  prev=
    3.10 +	  continue
    3.11 +	  ;;
    3.12  	release)
    3.13  	  release="-$arg"
    3.14  	  prev=
    3.15 @@ -1037,6 +1042,11 @@
    3.16  	continue
    3.17  	;;
    3.18  
    3.19 +      -framework)
    3.20 +	prev=framework
    3.21 +	continue
    3.22 +	;;
    3.23 +
    3.24        -L*)
    3.25  	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
    3.26  	# We need an absolute path.
    3.27 @@ -1768,6 +1778,16 @@
    3.28  	  versuffix="-$major-$age-$revision"
    3.29  	  ;;
    3.30  
    3.31 +	darwin)
    3.32 +	  # Like Linux, but with the current version available in
    3.33 +	  # verstring for coding it into the library header
    3.34 +	  major=.`expr $current - $age`
    3.35 +	  versuffix="$major.$age.$revision"
    3.36 +	  # Darwin ld doesn't like 0 for these options...
    3.37 +	  minor_current=`expr $current + 1`
    3.38 +	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
    3.39 +	  ;;
    3.40 +
    3.41  	*)
    3.42  	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
    3.43  	  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
    3.44 @@ -1778,7 +1798,16 @@
    3.45  	# Clear the version info if we defaulted, and they specified a release.
    3.46  	if test -z "$vinfo" && test -n "$release"; then
    3.47  	  major=
    3.48 +	  case "$version_type" in
    3.49 +	  darwin)
    3.50 +	    # we can't check for "0.0" in archive_cmds due to quoting
    3.51 +	    # problems, so we reset it completely
    3.52 +	    verstring=""
    3.53 +	    ;;
    3.54 +	  *)
    3.55  	  verstring="0.0"
    3.56 +	    ;;
    3.57 +	  esac
    3.58  	  if test "$need_version" = no; then
    3.59  	    versuffix=
    3.60  	  else