Added SONG_EV_SS_PRINT_WAVE_TEMPO case to MIDI song converting to
[ahxm.git] / config.sh
blobe6584ef6f789ab720224e845372253e7d9b36347
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 --prefix) PREFIX=$2 ; shift ;;
18 --prefix=*) PREFIX=`echo $1 | sed -e 's/--prefix=//'` ;;
19 esac
21 shift
22 done
24 if [ "$CONFIG_HELP" = "1" ] ; then
26 echo "Available options:"
27 echo "--prefix=PREFIX Installation prefix ($PREFIX)."
29 echo
30 echo "Environment variables:"
31 echo "CC C Compiler."
32 echo "CFLAGS Compile flags (i.e., -O3)."
33 echo "AR Archiver."
34 echo "LEX Lexer."
35 echo "YACC Parser."
37 exit 1
40 echo "Configuring..."
42 echo "/* automatically created by config.sh - do not modify */" > config.h
43 echo "# automatically created by config.sh - do not modify" > makefile.opts
44 > config.ldflags
45 > config.cflags
46 > .config.log
48 # set compiler
49 if [ "$CC" = "" ] ; then
50 CC=cc
51 # if CC is unset, try if gcc is available
52 which gcc > /dev/null
54 if [ $? = 0 ] ; then
55 CC=gcc
59 echo "CC=$CC" >> makefile.opts
61 # set cflags
62 if [ "$CFLAGS" = "" ] ; then
63 CFLAGS="-g -Wall"
66 echo "CFLAGS=$CFLAGS" >> makefile.opts
68 # Add CFLAGS to CC
69 CC="$CC $CFLAGS"
71 # set archiver
72 if [ "$AR" = "" ] ; then
73 AR=ar
76 echo "AR=$AR" >> makefile.opts
78 # set lexer
79 if [ "$LEX" = "" ] ; then
80 LEX=lex
83 echo "LEX=$LEX" >> makefile.opts
85 # set parser
86 if [ "$YACC" = "" ] ; then
87 YACC=yacc
90 echo "YACC=$YACC" >> makefile.opts
92 # add version
93 cat VERSION >> config.h
95 # add installation prefix
96 echo "#define CONFOPT_PREFIX \"$PREFIX\"" >> config.h
98 #########################################################
100 # configuration directives
102 # test for Linux OSS
103 echo -n "Testing for Linux OSS... "
104 echo "#include <linux/soundcard.h>" > .tmp.c
105 echo "int main(void) {" >> .tmp.c
106 echo "int i=open(\"/dev/dsp\",0);" >> .tmp.c
107 echo "ioctl(i,SNDCTL_DSP_SETFRAGMENT,&i);" >> .tmp.c
108 echo "return 0; } " >>.tmp.c
110 $CC .tmp.c -o .tmp.o 2> /dev/null
111 if [ $? = 0 ] ; then
112 echo "#define CONFOPT_LINUX_OSS 1" >> config.h
113 echo "OK"
114 else
115 echo "No"
118 # test for IRIX audio library
119 echo -n "Testing for IRIX audio library... "
120 echo "#include <dmedia/audio.h>" > .tmp.c
121 echo "int main(void) { alNewConfig(); return 0; }" >> .tmp.c
123 $CC .tmp.c -laudio -o .tmp.o 2> /dev/null
124 if [ $? = 0 ] ; then
125 echo "#define CONFOPT_SGI 1" >> config.h
126 echo "-laudio" >> config.ldflags
127 echo "OK"
128 else
129 echo "No"
132 # test for esound library
133 echo -n "Testing for esound development libraries... "
134 echo "#include <esd.h>" > .tmp.c
135 echo "int main(void) { return 0; }" >> .tmp.c
137 $CC -I/usr/local/include -L/usr/local/lib -lesd .tmp.c -o .tmp.o 2> /dev/null
138 if [ $? = 0 ] ; then
139 echo "#define CONFOPT_ESD 1" >> config.h
140 echo "-lesd" >> config.ldflags
141 echo "OK"
142 else
143 echo "No"
146 # test for artsc library
147 echo -n "Testing for aRts development libraries... "
148 echo "#include <artsc.h>" > .tmp.c
149 echo "int main(void) { return 0; }" >> .tmp.c
151 TMP_CFLAGS=`artsc-config --cflags 2>/dev/null`
152 TMP_LDFLAGS=`artsc-config --libs 2>/dev/null`
154 $CC $TMP_CFLAGS .tmp.c $TMP_LDFLAGS -o .tmp.o 2> /dev/null
155 if [ $? = 0 ] ; then
156 echo "#define CONFOPT_ARTS 1" >> config.h
157 echo $TMP_CFLAGS >> config.cflags
158 echo $TMP_LDFLAGS >> config.ldflags
159 echo "OK"
160 else
161 echo "No"
164 #########################################################
166 # final setup
168 echo "VERSION=$VERSION" >> makefile.opts
169 echo "PREFIX=$PREFIX" >> makefile.opts
170 echo >> makefile.opts
172 cat makefile.opts makefile.in makefile.depend > Makefile
174 #########################################################
176 # cleanup
178 rm -f .tmp.c .tmp.o
180 exit 0