3 # Configuration shell script
8 VERSION
=`cut -f2 -d\" VERSION`
10 # default installation prefix
14 while [ $# -gt 0 ] ; do
17 --help) CONFIG_HELP
=1 ;;
19 --with-pthreads) WITH_PTHREADS
=1 ;;
21 --prefix) PREFIX
=$2 ; shift ;;
22 --prefix=*) PREFIX
=`echo $1 | sed -e 's/--prefix=//'` ;;
28 if [ "$CONFIG_HELP" = "1" ] ; then
30 echo "Available options:"
31 echo "--prefix=PREFIX Installation prefix ($PREFIX)."
32 echo "--with-pthreads Activate POSIX threads support."
35 echo "Environment variables:"
37 echo "CFLAGS Compile flags (i.e., -O3)."
47 echo "/* automatically created by config.sh - do not modify */" > config.h
48 echo "# automatically created by config.sh - do not modify" > makefile.opts
54 if [ "$CC" = "" ] ; then
56 # if CC is unset, try if gcc is available
57 which gcc
> /dev
/null
2>&1
64 echo "CC=$CC" >> makefile.opts
67 if [ "$CFLAGS" = "" -a "$CC" = "gcc" ] ; then
71 echo "CFLAGS=$CFLAGS" >> makefile.opts
77 if [ "$AR" = "" ] ; then
81 echo "AR=$AR" >> makefile.opts
84 if [ "$LEX" = "" ] ; then
88 echo "LEX=$LEX" >> makefile.opts
91 if [ "$YACC" = "" ] ; then
95 echo "YACC=$YACC" >> makefile.opts
98 cat VERSION
>> config.h
100 # add installation prefix
101 echo "#define CONFOPT_PREFIX \"$PREFIX\"" >> config.h
103 #########################################################
105 # configuration directives
108 echo -n "Testing for win32... "
109 if [ "$WITHOUT_WIN32" = "1" ] ; then
110 echo "Disabled by user"
112 echo "#include <windows.h>" > .tmp.c
113 echo "#include <commctrl.h>" >> .tmp.c
114 echo "int STDCALL WinMain(HINSTANCE h, HINSTANCE p, LPSTR c, int m)" >> .tmp.c
115 echo "{ return 0; }" >> .tmp.c
117 TMP_LDFLAGS
="-lwinmm"
118 $CC .tmp.c
$TMP_LDFLAGS -o .tmp.o
2>> .config.log
121 echo "#define CONFOPT_WIN32 1" >> config.h
125 echo $TMP_LDFLAGS >> config.ldflags
132 echo -n "Testing for Linux OSS... "
133 echo "#include <linux/soundcard.h>" > .tmp.c
134 echo "int main(void) {" >> .tmp.c
135 echo "int i=open(\"/dev/dsp\",0);" >> .tmp.c
136 echo "ioctl(i,SNDCTL_DSP_SETFRAGMENT,&i);" >> .tmp.c
137 echo "return 0; } " >>.tmp.c
139 $CC .tmp.c
-o .tmp.o
2> /dev
/null
141 echo "#define CONFOPT_LINUX_OSS 1" >> config.h
147 # test for IRIX audio library
148 echo -n "Testing for IRIX audio library... "
149 echo "#include <dmedia/audio.h>" > .tmp.c
150 echo "int main(void) { alNewConfig(); return 0; }" >> .tmp.c
152 $CC .tmp.c
-laudio -o .tmp.o
2> /dev
/null
154 echo "#define CONFOPT_SGI 1" >> config.h
155 echo "-laudio" >> config.ldflags
161 # test for esound library
162 echo -n "Testing for esound development libraries... "
163 echo "#include <esd.h>" > .tmp.c
164 echo "int main(void) { return 0; }" >> .tmp.c
166 $CC -I/usr
/local
/include
-L/usr
/local
/lib
-lesd .tmp.c
-o .tmp.o
2> /dev
/null
168 echo "#define CONFOPT_ESD 1" >> config.h
169 echo "-lesd" >> config.ldflags
175 # test for artsc library
176 echo -n "Testing for aRts development libraries... "
177 echo "#include <artsc.h>" > .tmp.c
178 echo "int main(void) { arts_init(); return 0; }" >> .tmp.c
180 TMP_CFLAGS
=`artsc-config --cflags 2>/dev/null`
181 TMP_LDFLAGS
=`artsc-config --libs 2>/dev/null`
183 $CC $TMP_CFLAGS .tmp.c
$TMP_LDFLAGS -o .tmp.o
2> /dev
/null
185 echo "#define CONFOPT_ARTS 1" >> config.h
186 echo $TMP_CFLAGS >> config.cflags
187 echo $TMP_LDFLAGS >> config.ldflags
193 # test for pulseaudio libraries
194 echo -n "Testing for Pulseaudio development libraries... "
195 echo "#include <pulse/simple.h>" > .tmp.c
196 echo "#include <pulse/error.h>" >> .tmp.c
197 echo "int main(void) { return 0; }" >> .tmp.c
199 TMP_CFLAGS
=$
(pkg-config libpulse-simple
--cflags 2>/dev
/null
)
200 TMP_LDFLAGS
=$
(pkg-config libpulse-simple
--libs 2>/dev
/null
)
202 $CC $TMP_CFLAGS .tmp.c
$TMP_LDFLAGS -o .tmp.o
2> /dev
/null
204 echo "#define CONFOPT_PULSEAUDIO 1" >> config.h
205 echo $TMP_CFLAGS >> config.cflags
206 echo $TMP_LDFLAGS >> config.ldflags
212 # test for getuid() availability
213 echo -n "Testing for getuid() existence... "
214 echo "#include <unistd.h>" > .tmp.c
215 echo "#include <sys/types.h>" >> .tmp.c
216 echo "int main(void) { getuid(); return 0; }" >> .tmp.c
220 $CC $TMP_CFLAGS .tmp.c
$TMP_LDFLAGS -o .tmp.o
2> /dev
/null
224 echo "No; activating workaround"
225 echo "#define getuid() 1000" >> config.h
228 # test for number of arguments in mkdir()
229 echo -n "Testing for number of arguments in mkdir()... "
230 echo "#include <stdio.h>" > .tmp.c
231 echo "#include <string.h>" >> .tmp.c
232 echo "#include <stdlib.h>" >> .tmp.c
233 echo "#include <unistd.h>" >> .tmp.c
234 echo "#include <sys/stat.h>" >> .tmp.c
235 echo "#include <sys/types.h>" >> .tmp.c
236 echo "int main(void) { mkdir(\"testdir\"); return 0; }" >> .tmp.c
238 $CC $TMP_CFLAGS .tmp.c
$TMP_LDFLAGS -o .tmp.o
2> /dev
/null
241 echo "#define CONFOPT_MKDIR_ARGS 1" >> config.h
244 echo "#define CONFOPT_MKDIR_ARGS 2" >> config.h
247 echo -n "Testing for nanosleep() support... "
248 echo "#include <time.h>" > .tmp.c
249 echo "int main(void) { struct timespec ts; nanosleep(&ts, NULL); return 0; }" >> .tmp.c
253 $CC $TMP_CFLAGS .tmp.c
$TMP_LDFLAGS -o .tmp.o
2> /dev
/null
256 echo "#define CONFOPT_NANOSLEEP 1" >> config.h
258 echo "No; MIDI output will not be available"
263 if [ "$WITH_PTHREADS" = 1 ] ; then
264 echo "#define CONFOPT_PTHREADS 1" >> config.h
265 echo "-pthread" >> config.ldflags
269 echo -n "Testing if Grutatxt is installed... "
273 if which grutatxt
> /dev
/null
2>&1 ; then
275 echo "GRUTATXT=yes" >> makefile.opts
276 DOCS
="\$(GRUTATXT_DOCS)"
279 echo "GRUTATXT=no" >> makefile.opts
283 echo -n "Testing if mp_doccer is installed... "
284 MP_DOCCER
=$
(which mp_doccer||
which mp-doccer
)
288 if ${MP_DOCCER} --help |
grep grutatxt
> /dev
/null
; then
292 echo "MP_DOCCER=yes" >> makefile.opts
293 DOCS
="$DOCS \$(MP_DOCCER_DOCS)"
295 grep GRUTATXT
=yes makefile.opts
> /dev
/null
&& DOCS
="$DOCS \$(G_AND_MP_DOCS)"
298 echo "MP_DOCCER=no" >> makefile.opts
302 echo "MP_DOCCER=no" >> makefile.opts
305 #########################################################
309 echo "BIN=$BIN" >> makefile.opts
310 echo "DOCS=$DOCS" >> makefile.opts
311 echo "VERSION=$VERSION" >> makefile.opts
312 echo "PREFIX=$PREFIX" >> makefile.opts
313 echo >> makefile.opts
315 cat makefile.opts makefile.
in makefile.depend
> Makefile
317 #########################################################