2011-09-11 14:45:40 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
prefix=/usr/local
|
|
|
|
|
|
|
|
spliteq() {
|
|
|
|
arg=$1
|
|
|
|
echo "${arg#*=}"
|
|
|
|
#alternatives echo "$arg" | cut -d= -f2-
|
|
|
|
# or echo "$arg" | sed 's/[^=]*=//'
|
|
|
|
}
|
|
|
|
|
|
|
|
parsearg() {
|
|
|
|
case "$1" in
|
|
|
|
--prefix=*) prefix=$(spliteq "$1");;
|
|
|
|
--exec_prefix=*) exec_prefix=`spliteq $1`;;
|
|
|
|
--bindir=*) bindir=`spliteq $1`;;
|
|
|
|
--libdir=*) libdir=`spliteq $1`;;
|
|
|
|
--includedir=*) includedir=`spliteq $1`;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2012-01-27 19:21:06 +00:00
|
|
|
ismac() {
|
|
|
|
uname -s | grep Darwin
|
|
|
|
}
|
|
|
|
|
2011-09-11 14:45:40 +00:00
|
|
|
while true ; do
|
|
|
|
case $1 in
|
|
|
|
-*) parsearg "$1"; shift;;
|
|
|
|
*) break ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ ! $exec_prefix ] ; then
|
|
|
|
exec_prefix=$prefix
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! $libdir ] ; then
|
|
|
|
libdir=$prefix/lib
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! $includedir ] ; then
|
|
|
|
includedir=$prefix/include
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! $bindir ] ; then
|
|
|
|
bindir=$exec_prefix/bin
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! $CC ] ; then
|
|
|
|
CC=cc
|
|
|
|
fi
|
|
|
|
|
2012-01-24 06:29:04 +00:00
|
|
|
echo CC?=$CC>config.mak
|
|
|
|
[ -z "$CPPFLAGS" ] || echo CPPFLAGS?=$CPPFLAGS>>config.mak
|
|
|
|
[ -z "$CFLAGS" ] || echo USER_CFLAGS?=$CFLAGS>>config.mak
|
2011-09-11 14:45:40 +00:00
|
|
|
echo prefix=$prefix>>config.mak
|
|
|
|
echo exec_prefix=$exec_prefix>>config.mak
|
|
|
|
echo bindir=$bindir>>config.mak
|
|
|
|
echo libdir=$libdir>>config.mak
|
|
|
|
echo includedir=$includedir>>config.mak
|
2012-01-27 19:21:06 +00:00
|
|
|
if ismac ; then
|
|
|
|
echo LDSO_SUFFIX=dylib>>config.mak
|
|
|
|
fi
|
2011-09-11 14:45:40 +00:00
|
|
|
|
|
|
|
echo done, now run make \&\& make install
|
|
|
|
|