EOT events can't disable the instrument / track this happily, because
[ahxm.git] / config.sh
blobe9a8a88b0c5a41b0c65f81845a8bbd89981a304d
1 #!/bin/sh
3 # Configuration shell script
5 # gets program version
6 VERSION=`cut -f2 -d\" VERSION`
8 # default installation prefix
9 PREFIX=/usr/local
11 # parse arguments
12 while [ $# -gt 0 ] ; do
14 case $1 in
15 --help) CONFIG_HELP=1 ;;
17 --with-pthreads) WITH_PTHREADS=1 ;;
19 --prefix) PREFIX=$2 ; shift ;;
20 --prefix=*) PREFIX=`echo $1 | sed -e 's/--prefix=//'` ;;
21 esac
23 shift
24 done
26 if [ "$CONFIG_HELP" = "1" ] ; then
28 echo "Available options:"
29 echo "--prefix=PREFIX Installation prefix ($PREFIX)."
30 echo "--with-pthreads Activate POSIX threads support."
32 echo
33 echo "Environment variables:"
34 echo "CC C Compiler."
35 echo "CFLAGS Compile flags (i.e., -O3)."
36 echo "AR Archiver."
37 echo "LEX Lexer."
38 echo "YACC Parser."
40 exit 1
43 echo "Configuring..."
45 echo "/* automatically created by config.sh - do not modify */" > config.h
46 echo "# automatically created by config.sh - do not modify" > makefile.opts
47 > config.ldflags
48 > config.cflags
49 > .config.log
51 # set compiler
52 if [ "$CC" = "" ] ; then
53 CC=cc
54 # if CC is unset, try if gcc is available
55 which gcc > /dev/null
57 if [ $? = 0 ] ; then
58 CC=gcc
62 echo "CC=$CC" >> makefile.opts
64 # set cflags
65 if [ "$CFLAGS" = "" ] ; then
66 CFLAGS="-g -Wall"
69 echo "CFLAGS=$CFLAGS" >> makefile.opts
71 # Add CFLAGS to CC
72 CC="$CC $CFLAGS"
74 # set archiver
75 if [ "$AR" = "" ] ; then
76 AR=ar
79 echo "AR=$AR" >> makefile.opts
81 # set lexer
82 if [ "$LEX" = "" ] ; then
83 LEX=lex
86 echo "LEX=$LEX" >> makefile.opts
88 # set parser
89 if [ "$YACC" = "" ] ; then
90 YACC=yacc
93 echo "YACC=$YACC" >> makefile.opts
95 # add version
96 cat VERSION >> config.h
98 # add installation prefix
99 echo "#define CONFOPT_PREFIX \"$PREFIX\"" >> config.h
101 #########################################################
103 # configuration directives
105 # test for Linux OSS
106 echo -n "Testing for Linux OSS... "
107 echo "#include <linux/soundcard.h>" > .tmp.c
108 echo "int main(void) {" >> .tmp.c
109 echo "int i=open(\"/dev/dsp\",0);" >> .tmp.c
110 echo "ioctl(i,SNDCTL_DSP_SETFRAGMENT,&i);" >> .tmp.c
111 echo "return 0; } " >>.tmp.c
113 $CC .tmp.c -o .tmp.o 2> /dev/null
114 if [ $? = 0 ] ; then
115 echo "#define CONFOPT_LINUX_OSS 1" >> config.h
116 echo "OK"
117 else
118 echo "No"
121 # test for IRIX audio library
122 echo -n "Testing for IRIX audio library... "
123 echo "#include <dmedia/audio.h>" > .tmp.c
124 echo "int main(void) { alNewConfig(); return 0; }" >> .tmp.c
126 $CC .tmp.c -laudio -o .tmp.o 2> /dev/null
127 if [ $? = 0 ] ; then
128 echo "#define CONFOPT_SGI 1" >> config.h
129 echo "-laudio" >> config.ldflags
130 echo "OK"
131 else
132 echo "No"
135 # test for esound library
136 echo -n "Testing for esound development libraries... "
137 echo "#include <esd.h>" > .tmp.c
138 echo "int main(void) { return 0; }" >> .tmp.c
140 $CC -I/usr/local/include -L/usr/local/lib -lesd .tmp.c -o .tmp.o 2> /dev/null
141 if [ $? = 0 ] ; then
142 echo "#define CONFOPT_ESD 1" >> config.h
143 echo "-lesd" >> config.ldflags
144 echo "OK"
145 else
146 echo "No"
149 # test for artsc library
150 echo -n "Testing for aRts development libraries... "
151 echo "#include <artsc.h>" > .tmp.c
152 echo "int main(void) { return 0; }" >> .tmp.c
154 TMP_CFLAGS=`artsc-config --cflags 2>/dev/null`
155 TMP_LDFLAGS=`artsc-config --libs 2>/dev/null`
157 $CC $TMP_CFLAGS .tmp.c $TMP_LDFLAGS -o .tmp.o 2> /dev/null
158 if [ $? = 0 ] ; then
159 echo "#define CONFOPT_ARTS 1" >> config.h
160 echo $TMP_CFLAGS >> config.cflags
161 echo $TMP_LDFLAGS >> config.ldflags
162 echo "OK"
163 else
164 echo "No"
167 # pthreads support
168 if [ "$WITH_PTHREADS" = 1 ] ; then
169 echo "#define CONFOPT_PTHREADS 1" >> config.h
170 echo "-pthread" >> config.ldflags
173 #########################################################
175 # final setup
177 echo "VERSION=$VERSION" >> makefile.opts
178 echo "PREFIX=$PREFIX" >> makefile.opts
179 echo >> makefile.opts
181 cat makefile.opts makefile.in makefile.depend > Makefile
183 #########################################################
185 # cleanup
187 rm -f .tmp.c .tmp.o
189 exit 0