Add option to build for i386 architecture on x64 Intel Macs

closes #26
closes #27
pull/28/head
Nikki McCavee 2014-01-02 04:11:04 +04:00 committed by rofl0r
parent 44150485cb
commit e2af2f2bd7
1 changed files with 22 additions and 10 deletions

32
configure vendored
View File

@ -2,6 +2,18 @@
prefix=/usr/local
ismac() {
uname -s | grep Darwin >/dev/null
}
isx86_64() {
uname -m | grep -i X86_64 >/dev/null
}
isbsd() {
uname -s | grep BSD >/dev/null
}
usage() {
echo "supported arguments"
echo "--prefix=/path default: $prefix"
@ -10,6 +22,7 @@ usage() {
echo "--libdir=/path default: $prefix/lib"
echo "--includedir=/path default: $prefix/include"
echo "--sysconfdir=/path default: $prefix/etc"
ismac && isx86_64 && echo "--fat-binary : build for both i386 and x86_64 architectures on 64-bit Macs"
echo "--help : show this text"
exit 1
}
@ -21,6 +34,8 @@ spliteq() {
# or echo "$arg" | sed 's/[^=]*=//'
}
fat_binary=
parsearg() {
case "$1" in
--prefix=*) prefix=`spliteq $1`;;
@ -29,18 +44,11 @@ parsearg() {
--libdir=*) libdir=`spliteq $1`;;
--includedir=*) includedir=`spliteq $1`;;
--sysconfdir=*) sysconfdir=`spliteq $1`;;
--fat-binary) fat_binary=1;;
--help) usage;;
esac
}
ismac() {
uname -s | grep Darwin >/dev/null
}
isbsd() {
uname -s | grep BSD >/dev/null
}
while true ; do
case $1 in
-*) parsearg "$1"; shift;;
@ -85,6 +93,11 @@ if ismac ; then
echo NO_AS_NEEDED=>>config.mak
echo LDSO_SUFFIX=dylib>>config.mak
echo MAC_CFLAGS+=-DIS_MAC=1>>config.mak
if isx86_64 && [ "$fat_binary" = 1 ] ; then
echo "Configuring a fat binary for i386 and x86_64"
echo MAC_CFLAGS+=-arch i386 -arch x86_64>>config.mak
echo LDFLAGS+=-arch i386 -arch x86_64>>config.mak
fi
echo LD_SET_SONAME=-Wl,-install_name,>>config.mak
echo INSTALL_FLAGS=-m>>config.mak
elif isbsd ; then
@ -93,5 +106,4 @@ elif isbsd ; then
echo INSTALL_FLAGS=-m>>config.mak
fi
echo done, now run make \&\& make install
echo "Done, now run make && make install"