Skip to content

Commit

Permalink
Added shared library support for MacOS X
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Oct 20, 2002
1 parent 952c53d commit 369d382
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 15 deletions.
2 changes: 2 additions & 0 deletions CHANGES
@@ -1,5 +1,7 @@

1.2.3:
Sam Lantinga - Sun Oct 20 20:55:46 PDT 2002
* Added shared library support for MacOS X
Pete Shinners - Thu Jun 20 10:05:54 PDT 2002
* The JPEG loader can now load EXIF format JPEG images
Dag-Erling Smorgrav - Thu May 2 19:09:48 PDT 2002
Expand Down
59 changes: 44 additions & 15 deletions ltconfig
Expand Up @@ -186,7 +186,7 @@ enable_shared=yes
enable_static=yes
enable_fast_install=yes
enable_dlopen=unknown
enable_win32_dll=no
enable_win32_dll=yes
ltmain=
silent=
srcdir=
Expand Down Expand Up @@ -685,6 +685,11 @@ if test "$with_gcc" = yes; then
cygwin* | mingw* | os2*)
# 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*)
# FIXME: we need at least 68020 code to build shared libraries, but
# adding the `-m68020' flag to GCC prevents building anything better,
Expand Down Expand Up @@ -1414,6 +1419,23 @@ else
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*)
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' ;;
Expand Down Expand Up @@ -1501,12 +1523,6 @@ else
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
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*)
archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts'
Expand Down Expand Up @@ -1984,6 +2000,27 @@ freebsd*)
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*)
version_type=linux
need_lib_prefix=no
Expand Down Expand Up @@ -2141,14 +2178,6 @@ osf3* | osf4* | osf5*)
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*)
version_type=osf
soname_spec='${libname}${release}.so$major'
Expand Down
29 changes: 29 additions & 0 deletions ltmain.sh
Expand Up @@ -951,6 +951,11 @@ compiler."
prev=
continue
;;
framework)
linkopts="$linkopts -framework $arg"
prev=
continue
;;
release)
release="-$arg"
prev=
Expand Down Expand Up @@ -1037,6 +1042,11 @@ compiler."
continue
;;

-framework)
prev=framework
continue
;;

-L*)
dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
# We need an absolute path.
Expand Down Expand Up @@ -1768,6 +1778,16 @@ compiler."
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 "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
Expand All @@ -1778,7 +1798,16 @@ compiler."
# Clear the version info if we defaulted, and they specified a release.
if test -z "$vinfo" && test -n "$release"; then
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"
;;
esac
if test "$need_version" = no; then
versuffix=
else
Expand Down

0 comments on commit 369d382

Please sign in to comment.