Skip to content

Commit

Permalink
Link dynamic if dylib exist in /usr/lib else link static
Browse files Browse the repository at this point in the history
  • Loading branch information
wader authored and andoma committed Apr 3, 2011
1 parent 50f4504 commit 99f2905
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions configure.osx
Original file line number Diff line number Diff line change
Expand Up @@ -40,33 +40,25 @@ show_help(){
exit 1
}

# figure out what archives to link with by modifying output
# from pkg-config
# this is done because gcc (on at least osx) cant be
# forced to link some libraries static with -static using -l
# figure out what archives to link with by modifying output from pkg-config
# this is done because gcc (on at least osx) cant be forced to mix
# dynamic and static libraries using -static and -l
pkg_config_static() {
# assume all packages use the same libdir
libdir=`$PKGCONFIG --variable=libdir $1`
args=""
for arg in `$PKGCONFIG --static --libs $*` ; do
if [ \
"$arg" = "-lm" -o \
"$arg" = "-lz" -o \
"$arg" = "-lbz2" -o \
"$arg" = "-lpthread" ] \
; then
args+="$arg "
continue
fi
if [ "${arg:0:2}" != "-l" ] ; then
if [ "${arg:0:2}" != "-l" -o -e "/usr/lib/lib${arg:2}.dylib" ] ; then
# pass along non -l or existing dynamic standard libraries
args+="$arg "
else
# pass full path to static archive
args+="${arg/-l/$libdir/lib}.a "
fi
done
echo $args
}


enable libfreetype
enable glw
enable glw_frontend_cocoa
Expand Down

0 comments on commit 99f2905

Please sign in to comment.