Commit 69059cfb authored by Sam Lantinga's avatar Sam Lantinga

Fixed shared library building on MacOS X (thanks Max!)

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40388
parent fdc2447e
...@@ -1050,7 +1050,7 @@ CheckMacGL() ...@@ -1050,7 +1050,7 @@ CheckMacGL()
CFLAGS="$CFLAGS -DHAVE_OPENGL" CFLAGS="$CFLAGS -DHAVE_OPENGL"
case "$target" in case "$target" in
*-*-darwin*) *-*-darwin*)
SDL_LIBS="$SDL_LIBS -framework OpenGL -framework AGL" SYSTEM_LIBS="$SYSTEM_LIBS -framework OpenGL -framework AGL"
esac esac
fi fi
} }
...@@ -1247,7 +1247,6 @@ CheckPTHREAD() ...@@ -1247,7 +1247,6 @@ CheckPTHREAD()
;; ;;
esac esac
fi fi
AM_CONDITIONAL(USE_CLONE, test x$use_clone = xyes)
} }
dnl See if we can use GNU pth library for threads dnl See if we can use GNU pth library for threads
...@@ -1322,7 +1321,6 @@ CheckDIRECTX() ...@@ -1322,7 +1321,6 @@ CheckDIRECTX()
]) ])
AC_MSG_RESULT($use_directx) AC_MSG_RESULT($use_directx)
fi fi
AM_CONDITIONAL(USE_DIRECTX, test x$use_directx = xyes)
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/wincommon" CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/wincommon"
SYSTEM_LIBS="$SYSTEM_LIBS -luser32 -lgdi32 -lwinmm" SYSTEM_LIBS="$SYSTEM_LIBS -luser32 -lgdi32 -lwinmm"
...@@ -2344,7 +2342,7 @@ case "$target" in ...@@ -2344,7 +2342,7 @@ case "$target" in
if test x$enable_joystick = xyes; then if test x$enable_joystick = xyes; then
JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS darwin" JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS darwin"
JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS darwin/libjoystick_darwin.la" JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS darwin/libjoystick_darwin.la"
SDL_LIBS="$SDL_LIBS -framework IOKit" SYSTEM_LIBS="$SYSTEM_LIBS -framework IOKit"
fi fi
# Set up files for the cdrom library # Set up files for the cdrom library
if test x$enable_cdrom = xyes; then if test x$enable_cdrom = xyes; then
...@@ -2370,9 +2368,10 @@ case "$target" in ...@@ -2370,9 +2368,10 @@ case "$target" in
if test x$enable_timers = xyes; then if test x$enable_timers = xyes; then
COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c) COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c)
fi fi
# The MacOS X platform requires special setup # The MacOS X platform requires special setup.
SDL_CFLAGS="$SDL_CFLAGS -F/System/Library/Frameworks/Carbon.framework -F/System/Library/Frameworks/Cocoa.framework" SDL_LIBS="-lSDLmain $SDL_LIBS"
SDL_LIBS="-lSDLmain $SDL_LIBS -framework Carbon -framework Cocoa" # The Cocoa backend still needs Carbon, and the YUV code QuickTime
SYSTEM_LIBS="$SYSTEM_LIBS -framework Cocoa -framework Carbon -framework QuickTime"
;; ;;
*-*-mint*) *-*-mint*)
ARCH=mint ARCH=mint
...@@ -2451,6 +2450,10 @@ AM_CONDITIONAL(TARGET_MACOSX, test $ARCH = macosx) ...@@ -2451,6 +2450,10 @@ AM_CONDITIONAL(TARGET_MACOSX, test $ARCH = macosx)
AM_CONDITIONAL(TARGET_QNX, test $ARCH = qnx) AM_CONDITIONAL(TARGET_QNX, test $ARCH = qnx)
AM_CONDITIONAL(TARGET_MINT, test $ARCH = mint) AM_CONDITIONAL(TARGET_MINT, test $ARCH = mint)
# More automake conditionals
AM_CONDITIONAL(USE_DIRECTX, test x$use_directx = xyes)
AM_CONDITIONAL(USE_CLONE, test x$use_clone = xyes)
# Set conditional variables for shared and static library selection. # Set conditional variables for shared and static library selection.
# These are not used in any Makefile.am but in sdl-config.in. # These are not used in any Makefile.am but in sdl-config.in.
AM_CONDITIONAL([ENABLE_SHARED], [test "$enable_shared" = yes]) AM_CONDITIONAL([ENABLE_SHARED], [test "$enable_shared" = yes])
...@@ -2464,11 +2467,22 @@ fi ...@@ -2464,11 +2467,22 @@ fi
if test $ARCH = solaris; then if test $ARCH = solaris; then
SDL_RLD_FLAGS="-R\${exec_prefix}/lib" SDL_RLD_FLAGS="-R\${exec_prefix}/lib"
fi fi
if test $ARCH = openbsd -o $ARCH = bsdi; then
case "$ARCH" in
openbsd | bsdi)
SHARED_SYSTEM_LIBS="$SYSTEM_LIBS" SHARED_SYSTEM_LIBS="$SYSTEM_LIBS"
else ;;
macosx)
SHARED_SYSTEM_LIBS="-framework Cocoa"
if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
SHARED_SYSTEM_LIBS="$SHARED_SYSTEM_LIBS -framework OpenGL"
fi
;;
*)
SHARED_SYSTEM_LIBS="" SHARED_SYSTEM_LIBS=""
fi ;;
esac
STATIC_SYSTEM_LIBS="$SYSTEM_LIBS" STATIC_SYSTEM_LIBS="$SYSTEM_LIBS"
dnl Output the video drivers we use dnl Output the video drivers we use
......
...@@ -685,6 +685,11 @@ if test "$with_gcc" = yes; then ...@@ -685,6 +685,11 @@ if test "$with_gcc" = yes; then
cygwin* | mingw* | os2*) cygwin* | mingw* | os2*)
# We can build DLLs from non-PIC. # We can build DLLs from non-PIC.
;; ;;
darwin* | rhapsody*)
# PIC is the default on this platform
# Common symbols not allowed in MH_DYLIB files
pic_flag='-fno-common'
;;
amigaos*) amigaos*)
# FIXME: we need at least 68020 code to build shared libraries, but # FIXME: we need at least 68020 code to build shared libraries, but
# adding the `-m68020' flag to GCC prevents building anything better, # adding the `-m68020' flag to GCC prevents building anything better,
...@@ -1414,6 +1419,23 @@ else ...@@ -1414,6 +1419,23 @@ else
hardcode_shlibpath_var=no hardcode_shlibpath_var=no
;; ;;
darwin* | rhapsody*)
case "$host_os" in
rhapsody* | darwin1.[012])
allow_undefined_flag='-undefined suppress'
;;
*) # Darwin 1.3 on
allow_undefined_flag='-undefined error'
;;
esac
archive_cmds='$nonopt $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs $linkopts -install_name $rpath/$soname $verstring'
# We need to add '_' to the symbols in $export_symbols first
#archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols $lib'
hardcode_direct=yes
hardcode_shlibpath_var=no
whole_archive_flag_spec='-all_load $convenience'
;;
hpux9* | hpux10* | hpux11*) hpux9* | hpux10* | hpux11*)
case "$host_os" in case "$host_os" in
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' ;; 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' ;;
...@@ -1501,12 +1523,6 @@ else ...@@ -1501,12 +1523,6 @@ else
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=: hardcode_libdir_separator=:
;; ;;
rhapsody*)
archive_cmds='$CC -bundle -undefined suppress -o $lib $libobjs $deplibs $linkopts'
hardcode_libdir_flags_spec='-L$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
;;
sco3.2v5*) sco3.2v5*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
...@@ -1984,6 +2000,27 @@ freebsd*) ...@@ -1984,6 +2000,27 @@ freebsd*)
esac esac
;; ;;
darwin* | rhapsody*)
dynamic_linker="$host_os dyld"
version_type=darwin
need_lib_prefix=no
need_version=no
deplibs_check_method='file_magic Mach-O dynamically linked shared library'
file_magic_cmd='/usr/bin/file -L'
case "$host_os" in
rhapsody* | darwin1.[012])
file_magic_test_file='/System/Library/Frameworks/System.framework/System'
;;
*) # Darwin 1.3 on
file_magic_test_file='/usr/lib/libSystem.dylib'
;;
esac
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)'
soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)'
shlibpath_overrides_runpath=yes
shlibpath_var=DYLD_LIBRARY_PATH
;;
gnu*) gnu*)
version_type=linux version_type=linux
need_lib_prefix=no need_lib_prefix=no
...@@ -2141,14 +2178,6 @@ osf3* | osf4* | osf5*) ...@@ -2141,14 +2178,6 @@ osf3* | osf4* | osf5*)
sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
;; ;;
rhapsody*)
version_type=sunos
library_names_spec='${libname}.so'
soname_spec='${libname}.so'
shlibpath_var=DYLD_LIBRARY_PATH
deplibs_check_method=pass_all
;;
sco3.2v5*) sco3.2v5*)
version_type=osf version_type=osf
soname_spec='${libname}${release}.so$major' soname_spec='${libname}${release}.so$major'
......
...@@ -951,6 +951,11 @@ compiler." ...@@ -951,6 +951,11 @@ compiler."
prev= prev=
continue continue
;; ;;
framework)
deplibs="$deplibs -framework $arg"
prev=
continue
;;
release) release)
release="-$arg" release="-$arg"
prev= prev=
...@@ -1037,6 +1042,11 @@ compiler." ...@@ -1037,6 +1042,11 @@ compiler."
continue continue
;; ;;
-framework)
prev=framework
continue
;;
-L*) -L*)
dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
# We need an absolute path. # We need an absolute path.
...@@ -1768,6 +1778,16 @@ compiler." ...@@ -1768,6 +1778,16 @@ compiler."
versuffix="-$major-$age-$revision" versuffix="-$major-$age-$revision"
;; ;;
darwin)
# Like Linux, but with the current version available in
# verstring for coding it into the library header
major=.`expr $current - $age`
versuffix="$major.$age.$revision"
# Darwin ld doesn't like 0 for these options...
minor_current=`expr $current + 1`
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
;;
*) *)
$echo "$modename: unknown library version type \`$version_type'" 1>&2 $echo "$modename: unknown library version type \`$version_type'" 1>&2
echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
...@@ -1778,7 +1798,16 @@ compiler." ...@@ -1778,7 +1798,16 @@ compiler."
# Clear the version info if we defaulted, and they specified a release. # Clear the version info if we defaulted, and they specified a release.
if test -z "$vinfo" && test -n "$release"; then if test -z "$vinfo" && test -n "$release"; then
major= major=
case "$version_type" in
darwin)
# we can't check for "0.0" in archive_cmds due to quoting
# problems, so we reset it completely
verstring=""
;;
*)
verstring="0.0" verstring="0.0"
;;
esac
if test "$need_version" = no; then if test "$need_version" = no; then
versuffix= versuffix=
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment