File: configure.in

package info (click to toggle)
libmikmod 3.1.7-4
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,480 kB
  • ctags: 3,454
  • sloc: ansic: 20,073; sh: 7,226; makefile: 308
file content (479 lines) | stat: -rw-r--r-- 10,106 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
dnl Process this file with autoconf to produce a configure script.
dnl
dnl $Id: configure.in,v 1.19 1999/06/28 03:00:05 miod Exp $

AC_INIT(include/mikmod.h.in)

LIBMIKMOD_MAJOR_VERSION=3
LIBMIKMOD_MINOR_VERSION=1
LIBMIKMOD_MICRO_VERSION=7

BETA=

LIBMIKMOD_VERSION=$LIBMIKMOD_MAJOR_VERSION.$LIBMIKMOD_MINOR_VERSION.${LIBMIKMOD_MICRO_VERSION}${BETA}

AM_INIT_AUTOMAKE(libmikmod,${LIBMIKMOD_VERSION})
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE

dnl ==============================================================
dnl libmikmod specific control variables and their default values.
dnl ==============================================================

driver_af=
driver_alsa=yes
driver_esd=yes
driver_oss=yes
driver_ultra=yes
dynload=yes
debug=no
threads=yes

dnl We don't want that autoconf messes with the CFLAGS if they are not set,
dnl we'll provide better CFLAGS for gcc than it. Yet another dirty kluge...
if test -z "$CFLAGS"
then
	CFLAGS=" "
fi

dnl =========================
dnl Configure script options.
dnl =========================

AC_ARG_ENABLE(af,
[  --enable-af             include AudioFile driver [default under OSF/1]],
[if test "$enableval" = "yes"
then
  driver_af=yes
else
  driver_af=no
fi])

AC_ARG_ENABLE(alsa,
[  --enable-alsa           Linux only: include Advanced Linux Sound Architecture
                          driver [guessed]],
[if test "$enableval" = "yes"
then
  driver_alsa=yes
else
  driver_alsa=no
fi])

AC_ARG_ENABLE(esd,
[  --enable-esd            include Enlightened sound daemon driver [guessed]],
[if test "$enableval" = "yes"
then
  driver_esd=yes
else
  driver_esd=no
fi])

AC_ARG_ENABLE(oss,
[  --enable-oss            include OSS driver [guessed]],
[if test "$enableval" = "yes"
then
  driver_oss=yes
else
  driver_oss=no
fi])

AC_ARG_ENABLE(ultra,
[  --enable-ultra          include Ultra driver [guessed]],
[if test "$enableval" = "yes"
then
  driver_ultra=yes
else
  driver_ultra=no
fi])

AC_ARG_ENABLE(dl,
[  --enable-dl             load alsa,esound and ultra drivers at runtime
                          [default=yes]],
[if test "$enableval" = "yes"
then
  dynload=yes
else
  dynload=no
fi])

AC_ARG_ENABLE(debug,
[  --enable-debug          build a debug version of libmikmod [default=no]],
[if test "$enableval" = "yes"
then
  debug=yes
else
  debug=no
fi])

AC_ARG_ENABLE(threads,
[  --enable-threads        build a thread-safe version of libmikmod [default=guessed]],
[if test "$enableval" = "yes"
then
	threads=yes
else
	threads=no
fi])

dnl ====================
dnl Checks for programs.
dnl ====================

AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AM_PROG_LIBTOOL
AC_PROG_MAKE_SET
AC_PROG_RANLIB

dnl =====================
dnl Checks for libraries.
dnl =====================

dnl dl functions
if test "$dynload" = "yes"
then
	case `uname` in
		IRIX*)
dnl DL functions are part of libc under IRIX
			AC_CHECK_LIB(c,dlopen,dynload=yes,dynload=no)
			dllib=
		;;
		*)
			AC_CHECK_LIB(dl,dlopen,dynload=yes,dynload=no)
			dllib="-ldl"
		;;
	esac
fi

dnl POSIX.4 threads
if test "$threads" = "yes"
then
	AC_CHECK_LIB(pthread,pthread_create,threads=-lpthread,threads=no)
	if test "$threads" = "no"
	then
		AC_CHECK_LIB(c_r,pthread_create,threads=-lc_r,threads=no)
	fi
fi

dnl alsa - Linux only
if test "`uname`" = "Linux"
then
	AC_CHECK_LIB(asound,snd_cards,can_alsa=yes,can_alsa=no)
else
	can_alsa=no
fi

dnl esd
AM_PATH_ESD(0.2.4,can_esd=yes,can_esd=no)
dnl We also need to know if esd is compiled with alsa support
if test "$can_esd" = "yes" -a "$can_alsa" = "yes"
then
	AC_MSG_CHECKING([if esd requires alsa])

	if test -z "`esd-config --libs|grep asound`"
	then
		esd_needs_alsa=no
	else
		esd_needs_alsa=yes
	fi
	AC_MSG_RESULT($esd_needs_alsa)
else
	esd_needs_alsa=no
fi

dnl sgi audio - IRIX only
case `uname` in
	IRIX*)
		AC_CHECK_LIB(audio,ALseterrorhandler,driver_sgi=yes,driver_sgi=no)
	;;
	*)
		driver_sgi=no
	;;
esac

dnl audiofile
AC_CHECK_LIB(AF,AFOpenAudioConn,can_af=yes,can_af=no)

dnl libgus - Linux only
if test "`uname`" = "Linux"
then
	AC_CHECK_LIB(gus,gus_cards,can_ultra=yes,can_ultra=no)
else
	can_ultra=no
fi

dnl ========================
dnl Checks for header files.
dnl ========================

AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h malloc.h sys/ioctl.h unistd.h)

dnl Check if esd_close exists (means esd>=0.2.6)
if test "$can_esd" = "yes"
then
	AC_MSG_CHECKING([for esd_close in -lesd])
	oldlibs=$LIBS
	LIBS="$LIBS $ESD_LIBS"
	AC_TRY_LINK([#include <esd.h>],[void *p=esd_close;],
		has_esd_close=yes,has_esd_close=no)
	LIBS=$oldlibs
	if test "$has_esd_close" = "yes"
	then
		AC_MSG_RESULT(yes)
		AC_DEFINE(HAVE_ESD_CLOSE)
	else
		AC_MSG_RESULT(no)
	fi
fi

dnl ==============================================================
dnl Checks for typedefs, structures, and compiler characteristics.
dnl ==============================================================

AC_C_CONST
AC_TYPE_SIZE_T

dnl =============================
dnl Checks for library functions.
dnl =============================

AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_CHECK_FUNCS(setenv snprintf srandom)
AC_HEADER_EGREP(srandom,math.h,AC_DEFINE(SRANDOM_IN_MATH_H))

dnl ================
dnl Choose settings.
dnl ================

AC_DEFINE(DRV_PIPE)

dnl If we can guess the drivers needed from the system, no need to ask the user
dnl to specify it manually
case `uname` in
	AIX)
		AC_DEFINE(AIX)
		AC_DEFINE(DRV_AIX)
		DRIVER_OBJ="drv_aix.lo $DRIVER_OBJ"
	;;
	HP-UX)
		AC_DEFINE(DRV_HP)
		DRIVER_OBJ="drv_hp.lo $DRIVER_OBJ"
	;;
	IRIX*)
		if test "$driver_sgi" = "yes"
		then
			AC_DEFINE(DRV_SGI)
			DRIVER_OBJ="drv_sgi.lo $DRIVER_OBJ"
			LIBRARY_LIB="-laudio $LIBRARY_LIB"
		fi
	;;
	NetBSD|OpenBSD)
		AC_DEFINE(DRV_SUN)
		DRIVER_OBJ="drv_sun.lo $DRIVER_OBJ"
	;;
	SunOS)
		AC_DEFINE(DRV_SUN)
		DRIVER_OBJ="drv_sun.lo $DRIVER_OBJ"
		case `uname -r` in
			4*)
				AC_DEFINE(SUNOS)
			;;
			*) ;;
		esac
	;;
	OSF1)
		if test "$can_af" = "yes"
		then
			driver_af=yes
		fi
	;;
	*) ;;
esac
			
if test "$driver_af" = "yes"
then
	AC_DEFINE(DRV_AF)
	DRIVER_OBJ="drv_AF.lo $DRIVER_OBJ"
	LIBRARY_LIB="-lAF $LIBRARY_LIB"
fi

if test "$can_alsa" = "yes"
then
	if test "$driver_alsa" = "yes"
	then
 		AC_DEFINE(DRV_ALSA)
 		DRIVER_OBJ="drv_alsa.lo $DRIVER_OBJ"
		if test "$dynload" = "no"
		then
 			LIBRARY_LIB="-lasound $LIBRARY_LIB"
		fi
	else
		if test "$esd_needs_alsa" = "yes"
		then
			driver_esd=no
		fi
	fi
else
	if test "$esd_needs_alsa" = "yes"
	then
		driver_esd=no
	fi
fi

if test "$can_esd" = "yes"
then
	if test "$driver_esd" = "yes"
	then
		AC_DEFINE(DRV_ESD)
		CFLAGS="$CFLAGS $ESD_CFLAGS"
		DRIVER_OBJ="drv_esd.lo $DRIVER_OBJ"

		# Under Solaris and perhaps other systems, we have to forward esd
		# dependencies to libmikmod's dependency list.
		if test "$dynload" = "yes"
		then
			ESD_LIBS="`echo $ESD_LIBS|sed -e 's/-lesd//'|sed -e 's/-lasound//'|sed -e 's/-laudiofile//'`"
		fi
		LIBRARY_LIB="$ESD_LIBS $LIBRARY_LIB"
	fi
else
	driver_esd=no
fi

if test "$driver_oss" = "yes"
then
	AC_MSG_CHECKING([for OSS (/dev/sndstat)])
	if test -c /dev/sndstat
	then
		AC_MSG_RESULT(found)
		AC_DEFINE(DRV_OSS)
		DRIVER_OBJ="drv_oss.lo $DRIVER_OBJ"
	else
		AC_MSG_RESULT(not found)
	fi
fi

if test "$can_ultra" = "yes"
then
	if test "$driver_ultra" = "yes"
	then
		AC_DEFINE(DRV_ULTRA)
		DRIVER_OBJ="drv_ultra.lo $DRIVER_OBJ"
		if test "$dynload" = "no"
		then
			LIBRARY_LIB="-lgus $LIBRARY_LIB"
		fi
	fi
else
	driver_ultra=no
fi

if test "$debug" = "yes"
then
	AC_DEFINE(MIKMOD_DEBUG)
	CC="$CC -g"
fi

if test "$dynload" = "yes"
then
	AC_DEFINE(MIKMOD_DYNAMIC)
	if test "$esd_needs_alsa" = "yes" -a "$driver_esd" = "yes"
	then

dnl @#!$ dynloading esd requires us to define and make visible extra symbols
dnl (at least for 0.2.6 to 0.2.12)
dnl RicDude: I submitted a patch for this problem months ago. Pleaaaase
dnl take some time to include it !
		AC_MSG_CHECKING([if dynloading esd causes problems])
		oldlibs=$LIBS
		LIBS="$LIBS $ESD_LIBS"
		AC_TRY_LINK([
#include <esd.h>
extern void *handle;
],[void *p=handle;],esd_does_behave=no,esd_does_behave=yes)
		LIBS=$oldlibs
		if test "$esd_does_behave" = "no"
		then
			AC_MSG_RESULT(yes)
			AC_DEFINE(MIKMOD_DYNAMIC_ESD_NEEDS_ALSA)
			LIB_LDADD="-rdynamic"
			echo "
*** This means your version of EsounD defines some public symbols, which should
*** have been defined static. The compiled libmikmod will try to take care of
*** the problem, but you'll have to use the '-rdynamic' option when linking an
*** application which uses libmikmod with gcc. If you use another compiler, you
*** might not be able to use libmikmod's EsounD driver. In this case, consider
*** recompiling libmikmod specifying '--disable-dl' in the configure script
*** options.
" >&2
		else
			AC_MSG_RESULT(no)
		fi

	fi
	LIBRARY_LIB="$dllib $LIBRARY_LIB"
dnl RTLD_GLOBAL is not defined under every system
	AC_TRY_COMPILE([#include <dlfcn.h>],[int flag=RTLD_GLOBAL;],
		AC_DEFINE(HAVE_RTLD_GLOBAL))
fi

dnl If compiling with gcc, use adequate optimization flags
case $CC in
	*gcc*)
dnl On at least x86 platforms, gcc 2.7.2.1 and earlier won't work if -O3 (or
dnl -finline-functions) are used. Version 2.7.2.3, 2.8.x and egcs are ok.
dnl Didn't test 2.7.2.2
		case `uname -m` in
			i.86)
				CFLAGS="$CFLAGS -O2 -funroll-loops -ffast-math -fno-strength-reduce -Wall"
			;;
			*)
				CFLAGS="$CFLAGS -O2 -funroll-loops -ffast-math -Wall"
			;;
		esac
	;;
	*) ;;
esac

if test "$threads" != "no"
then
	AC_DEFINE(HAVE_PTHREAD)
	CFLAGS="$CFLAGS -D_REENTRANT"
	LIBRARY_LIB="$threads $LIBRARY_LIB"
	REENTRANT="-D_REENTRANT"
fi
AC_SUBST(REENTRANT)

dnl =================
dnl Create Makefiles.
dnl =================

AC_SUBST(DRIVER_OBJ)
AC_SUBST(LIBRARY_LIB)
AC_SUBST(PLAYER_LIB)

AC_SUBST(LIBMIKMOD_MAJOR_VERSION)
AC_SUBST(LIBMIKMOD_MINOR_VERSION)
AC_SUBST(LIBMIKMOD_MICRO_VERSION)
AC_SUBST(LIBMIKMOD_VERSION)

AC_SUBST(LIB_LDADD)

AC_OUTPUT([
libmikmod-config
Makefile
docs/Makefile
drivers/Makefile
include/Makefile
include/mikmod.h
include/mikmod_build.h:include/mikmod.h.in
libmikmod/Makefile
loaders/Makefile
mmio/Makefile
playercode/Makefile
macintosh/Makefile
os2/Makefile
win32/Makefile],[chmod +x libmikmod-config])