mirror of
https://github.com/ericonr/sndio.git
synced 2024-02-18 04:45:21 -06:00
166 lines
3.6 KiB
Bash
Executable File
166 lines
3.6 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
#
|
|
# display help screeen
|
|
#
|
|
help() {
|
|
cat << END
|
|
Usage: configure [options]
|
|
--prefix=DIR set install prefix to DIR [$prefix]
|
|
--bindir=DIR install executables in DIR [\$prefix/bin]
|
|
--datadir=DIR install read-only data in DIR [\$prefix/share]
|
|
--includedir=DIR install header files in DIR [\$prefix/include]
|
|
--libdir=DIR install libraries in DIR [\$prefix/lib]
|
|
--mandir=DIR install man pages in DIR [\$prefix/man]
|
|
--precision=NUMBER aucat processing precision [$precision]
|
|
--enable-alsa enable alsa backend [$alsa]
|
|
--disable-alsa disable alsa backend
|
|
--enable-sun enable sun backend [$sun]
|
|
--disable-sun disable sun backend
|
|
END
|
|
}
|
|
|
|
#
|
|
# defaults
|
|
#
|
|
prefix=/usr/local # where to install sndio
|
|
so="libsndio.so.\${MAJ}.\${MIN}" # shared libs to build
|
|
alsa=no # do we want alsa support ?
|
|
sun=no # do we want sun support ?
|
|
precision=16 # aucat arithmetic precision
|
|
unset vars # variables passed as arguments
|
|
unset bindir # path where to install binaries
|
|
unset datadir # path where to install doc
|
|
unset mandir # path where to install man pages
|
|
unset includedir # path where to install header file
|
|
unset libdir # path where to install library
|
|
unset defs # no extra #defines
|
|
unset ldadd # no extra libraries (-l options)
|
|
|
|
#
|
|
# guess OS-specific parameters
|
|
#
|
|
case `uname` in
|
|
Linux)
|
|
alsa=yes
|
|
ldadd="-lrt"
|
|
so="$so libsndio.so.\${MAJ} libsndio.so"
|
|
defs='-DCOMPAT_ISSETUGID \\\
|
|
-DCOMPAT_STRLCAT -DCOMPAT_STRLCPY -DCOMPAT_STRTONUM \\\
|
|
-DCOMPAT_LETOH -DDEV_RANDOM=\\"/dev/urandom\\"'
|
|
;;
|
|
OpenBSD)
|
|
sun=yes
|
|
defs='-DUSE_ARC4RANDOM'
|
|
;;
|
|
esac
|
|
|
|
# shell word separator (none)
|
|
IFS=''
|
|
|
|
# sed-quoted new-line
|
|
nl='\
|
|
'
|
|
|
|
for i; do
|
|
case "$i" in
|
|
--prefix=*)
|
|
prefix="${i#--prefix=}"
|
|
shift;;
|
|
--bindir=*)
|
|
bindir="${i#--bindir=}"
|
|
shift;;
|
|
--datadir=*)
|
|
datadir="${i#--datadir=}"
|
|
shift;;
|
|
--includedir=*)
|
|
includedir="${i#--includedir=}"
|
|
shift;;
|
|
--libdir=*)
|
|
libdir="${i#--libdir=}"
|
|
shift;;
|
|
--mandir=*)
|
|
mandir="${i#--mandir=}"
|
|
shift;;
|
|
--enable-alsa)
|
|
alsa=yes
|
|
shift;;
|
|
--disable-alsa)
|
|
alsa=no
|
|
shift;;
|
|
--enable-sun)
|
|
sun=yes
|
|
shift;;
|
|
--disable-sun)
|
|
sun=no
|
|
shift;;
|
|
--precision=*)
|
|
precision="${i#--precision=}"
|
|
if [ "$precision" != 16 -a "$precision" != 24 ]; then
|
|
echo "$i: only 16 and 24 are supported" >&2
|
|
exit 1
|
|
fi
|
|
shift;;
|
|
CC=*|CFLAGS=*|LDFLAGS=*)
|
|
vars="$vars$i$nl"
|
|
shift;;
|
|
*)
|
|
help
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
#
|
|
# if $xxxdir is not specified, define it to $prefix/xxx
|
|
#
|
|
bindir="${bindir:-$prefix/bin}"
|
|
datadir="${datadir:-$prefix/share}"
|
|
includedir="${includedir:-$prefix/include}"
|
|
libdir="${libdir:-$prefix/lib}"
|
|
mandir="${mandir:-$prefix/man}"
|
|
|
|
#
|
|
# if using ALSA, add corresponding parameters
|
|
#
|
|
if [ $alsa = yes ]; then
|
|
defs="$defs -DUSE_ALSA"
|
|
ldadd="$ldadd -lasound"
|
|
fi
|
|
|
|
#
|
|
# if using Sun API, add corresponding parameters
|
|
#
|
|
if [ $sun = yes ]; then
|
|
defs="$defs -DUSE_SUN"
|
|
fi
|
|
|
|
for makefile in Makefile aucat/Makefile libsndio/Makefile examples/Makefile
|
|
do
|
|
sed \
|
|
-e "s:@bindir@:$bindir:" \
|
|
-e "s:@datadir@:$datadir:" \
|
|
-e "s:@includedir@:$includedir:" \
|
|
-e "s:@libdir@:$libdir:" \
|
|
-e "s:@mandir@:$mandir:" \
|
|
-e "s:@defs@:$defs:" \
|
|
-e "s:@ldadd@:$ldadd:" \
|
|
-e "s:@so@:$so:" \
|
|
-e "s:@vars@:${vars}:" \
|
|
-e "s:@precision@:$precision:" \
|
|
< $makefile.in > $makefile
|
|
done
|
|
|
|
echo
|
|
echo "bindir................... $bindir"
|
|
echo "datadir.................. $datadir"
|
|
echo "includedir............... $includedir"
|
|
echo "libdir................... $libdir"
|
|
echo "mandir................... $mandir"
|
|
echo "precision................ $precision"
|
|
echo "alsa..................... $alsa"
|
|
echo "sun...................... $sun"
|
|
echo
|
|
echo "Do \"make && make install\" to compile and install sndio"
|
|
echo
|