summaryrefslogtreecommitdiff
path: root/configure.in
blob: b3646150137769203bfce813c716c4036b0a715e (plain)
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
dnl Process this file with autoconf to produce a configure script.

dnl Boilerplate code.

AC_INIT(src/audiere.h)
AC_CONFIG_AUX_DIR(config)

AC_CANONICAL_SYSTEM

VERSION=1.9.4.1
PACKAGE="audiere"

AC_SUBST(VERSION)
AC_SUBST(PACKAGE)

AM_INIT_AUTOMAKE($PACKAGE, $VERSION)

dnl Checks for options.

AC_ARG_ENABLE(debug,
    AC_HELP_STRING(--enable-debug, build debug),
    CFLAGS="$CFLAGS -g"
    CXXFLAGS="$CXXFLAGS -g"
    AC_DEFINE(DEBUG))

AC_ARG_ENABLE(opt,
    AC_HELP_STRING(--enable-opt, build with optimizations),
    CFLAGS="$CFLAGS -O2"
    CXXFLAGS="$CXXFLAGS -O2")

dnl Checks for programs.

AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_MAKE_SET
AM_PROG_LIBTOOL

dnl We test with C++ libraries, so use the C++ compiler...
AC_LANG(C++)

dnl Checks for libraries.

win32=no
darwin=no
case $host in
  *cygwin*|*mingw*)
    dnl If building on Cygwin, don't let windows.h define min() or max()
    CXXFLAGS="-DWIN32_LEAN_AND_MEAN -DNOMINMAX -DADR_DECL= -DADR_CALL= $CXXFLAGS"
    win32=yes
    ;;
 *darwin*)
    AC_DEFINE(HAVE_CORE_AUDIO)
    HAVE_CORE_AUDIO=yes
    LIBS="-framework Cocoa -framework AudioUnit -framework AudioToolbox $LIBS"
    EXTRA_LIBS="-framework Cocoa -framework AudioUnit -framework AudioToolbox $EXTRA_LIBS"
    darwin=yes
    ;;
esac
AM_CONDITIONAL(HAVE_WIN32, test "x$win32" = "xyes")
AM_CONDITIONAL(HAVE_CORE_AUDIO, test "x$HAVE_CORE_AUDIO" = "xyes")

dnl If building with gcc, build with all warnings except "class has virtual
dnl functions but non-virtual destructor".
if test "x$GXX" = "xyes" ; then
   CXXFLAGS="$CXXFLAGS -Wall -Wno-non-virtual-dtor"
fi
if test "x$GCC" = "xyes" ; then
   CFLAGS="$CFLAGS -Wall -Wno-non-virtual-dtor"
fi

dnl Look for pthreads
if test "x$win32" != "xyes"; then
   AC_CHECK_LIB(pthread, pthread_create,
        LIBS="-lpthread $LIBS"
        EXTRA_LIBS="-lpthread $EXTRA_LIBS"
      ,
        AC_MSG_ERROR(could not find pthread library))
fi

dnl Look for dl
AC_CHECK_LIB(dl, dlopen,
    LIBS="-ldl $LIBS"
    EXTRA_LIBS="-ldl $EXTRA_LIBS"
    HAVE_DLFCN=true
    AC_DEFINE(HAVE_DLFCN)
  ,
    AC_MSG_WARN([libdl not found.])
    AC_MSG_WARN([Disabling external audio device support.]))
AM_CONDITIONAL(HAVE_DLFCN, test "x$HAVE_DLFCN" = "xtrue")

dnl Look for FLAC
AC_CHECK_LIB(FLAC, FLAC__seekable_stream_decoder_process_single,
    LIBS="-lFLAC -lm $LIBS"
    EXTRA_LIBS="-lFLAC -lm $EXTRA_LIBS"
    HAVE_FLAC=true
  ,
    AC_MSG_WARN([libFLAC not found.  Install FLAC from http://flac.sourceforge.net/])
    AC_MSG_WARN([Disabling FLAC support.])
    AC_DEFINE(NO_FLAC)
  ,
    -lm)
AM_CONDITIONAL(HAVE_FLAC, test "x$HAVE_FLAC" = "xtrue")

dnl Look for DUMB
AC_CHECK_LIB(dumb, duh_start_renderer,
    LIBS="-ldumb $LIBS"
    EXTRA_LIBS="-ldumb $EXTRA_LIBS"
    HAVE_DUMB=true
  ,
    AC_MSG_WARN([libdumb not found.  Install DUMB from http://dumb.sourceforge.net/])
    AC_MSG_WARN([Disabling DUMB support.])
    AC_DEFINE(NO_DUMB))
AM_CONDITIONAL(HAVE_DUMB, test "x$HAVE_DUMB" = "xtrue")

dnl Look for libcdaudio
AC_CHECK_LIB(cdaudio, cd_init_device,
    LIBS="-lcdaudio $LIBS"
    EXTRA_LIBS="-lcdaudio $EXTRA_LIBS"
    HAVE_LIBCDAUDIO=true
  ,
    AC_MSG_WARN([libcdaudio not found.  Install it from http://libcdaudio.sf.net/])
    AC_MSG_WARN([CD audio support might still be possible through another means such as winmm.]))
AM_CONDITIONAL(HAVE_LIBCDAUDIO, test "x$HAVE_LIBCDAUDIO" = "xtrue")

dnl Look for the POSIX realtime clock
AC_SEARCH_LIBS(clock_gettime, rt,
    AC_DEFINE(HAVE_CLOCK_GETTIME))

dnl Look for SGI audio
AC_CHECK_LIB(audio, alNewConfig,
    HAVE_AL=true
    AC_DEFINE(HAVE_AL)
    LIBS="-laudio $LIBS"
    EXTRA_LIBS="-laudio $EXTRA_LIBS")
AM_CONDITIONAL(HAVE_AL, test "x$HAVE_AL" = "xtrue")

dnl Look for SDL
AC_PATH_PROG(SDL_CONFIG, sdl-config, no, $PATH:/usr/local/bin)
if [[ "$SDL_CONFIG" != "no" ]] ; then
    SDLFLAGS=`$SDL_CONFIG --cflags`
    SDLLIBS=`$SDL_CONFIG --libs`
    CXXFLAGS="$SDLFLAGS $CXXFLAGS"
    LIBS="$SDLLIBS $LIBS"
    EXTRA_LIBS="$SDLLIBS $EXTRA_LIBS"
    HAVE_SDL="true"
    AC_DEFINE(HAVE_SDL)
fi

AM_CONDITIONAL(HAVE_SDL, test "x$HAVE_SDL" = "xtrue")

dnl Look for wxWindows
AC_PATH_PROG(WX_CONFIG, wx-config, no, $PATH:/usr/local/bin)
if [[ "$WX_CONFIG" = "no" ]] ; then
    AC_MSG_WARN([wxWindows not found, not building wxPlayer.
        See http://www.wxwindows.org/])
else
    old_CXXFLAGS="$CXXFLAGS"
    old_LIBS="$LIBS"
    WXFLAGS=`$WX_CONFIG --cxxflags`
    WXLIBS=`$WX_CONFIG --libs`
    CXXFLAGS="$WXFLAGS $CXXFLAGS"
    LIBS="$WXLIBS $LIBS"

    AC_MSG_CHECKING(if small wxWindows application links)
    AC_LINK_IFELSE(AC_LANG_SOURCE([
        #include <wx/wx.h>
        class App : public wxApp {
        public:
          bool OnInit() {
            return false;
          }
        };
        IMPLEMENT_APP(App)
        ])
    ,
        AC_MSG_RESULT(yes)
        HAVE_WXWINDOWS=true
        AC_DEFINE(HAVE_WXWINDOWS)
        WX_LIBS=`$WX_CONFIG --libs`
        WX_CPPFLAGS=`$WX_CONFIG --cxxflags`
        AC_SUBST(WX_LIBS)
        AC_SUBST(WX_CPPFLAGS)
    ,
        AC_MSG_RESULT(no)
        AC_MSG_WARN([wx-config found but linking with wxWindows failed.
Maybe wxWindows was compiled with another compiler?]))

    CXXFLAGS="$old_CXXFLAGS"
    LIBS="$old_LIBS"
fi

AM_CONDITIONAL(HAVE_WXWINDOWS, test "x$HAVE_WXWINDOWS" = "xtrue")

dnl Checks for header files.

AC_HEADER_STDC
AC_CHECK_HEADER(unistd.h)
AC_CHECK_HEADER(sys/soundcard.h,
    HAVE_OSS=true
    AC_DEFINE(HAVE_OSS))
AM_CONDITIONAL(HAVE_OSS, test "x$HAVE_OSS" = "xtrue")

AC_CHECK_LIB(asound, snd_pcm_open,
    HAVE_ALSA=true
    LIBS="-lasound $LIBS"
    AC_DEFINE(HAVE_ALSA))
AM_CONDITIONAL(HAVE_ALSA, test "x$HAVE_ALSA" = "xtrue")

AC_CHECK_LIB(nexus, NEXUS_Platform_Init,
    HAVE_NEXUS=true
    AC_DEFINE(HAVE_NEXUS)
    LIBS="-lnexus $LIBS"
    EXTRA_LIBS="-lnexus $EXTRA_LIBS")
AM_CONDITIONAL(HAVE_NEXUS, test "x$HAVE_NEXUS" = "xtrue")

AC_CHECK_LIB(mplayer, Music_device_open,
    HAVE_ZTE=true
    AC_DEFINE(HAVE_ZTE)
    LIBS="-lmplayer $LIBS"
    EXTRA_LIBS="-lmplayer $EXTRA_LIBS")
AM_CONDITIONAL(HAVE_ZTE, test "x$HAVE_ZTE" = "xtrue")

AC_CHECK_HEADER(vorbis/vorbisfile.h,
    HAVE_OGG=true
    LIBS="-lvorbisfile -lvorbis -logg $LIBS"
    EXTRA_LIBS="-lvorbisfile -lvorbis -logg $EXTRA_LIBS"
  ,
    AC_MSG_WARN([Could not find vorbisfile header.  You do not appear to have libvorbis installed.
Get libvorbis from http://www.vorbis.com/])
    AC_MSG_WARN([Disabling Ogg Vorbis support.])
    AC_DEFINE(NO_OGG))
AM_CONDITIONAL(HAVE_OGG, test "x$HAVE_OGG" = "xtrue")

AC_CHECK_HEADER(speex.h,
    HAVE_SPEEX=true
    LIBS="-lspeex $LIBS"
    EXTRA_LIBS="-lspeex $EXTRA_LIBS"
  ,
    AC_MSG_WARN([Could not find speex header.  You do not appear to have libspeex installed.
Get libspeex from http://www.speex.org/])
    AC_MSG_WARN([Disabling speex support.])
    AC_DEFINE(NO_SPEEX))
AM_CONDITIONAL(HAVE_SPEEX, test "x$HAVE_SPEEX" = "xtrue")

AC_CHECK_HEADER(dsound.h,
    HAVE_DSOUND=true
    AC_DEFINE(HAVE_DSOUND)
    LIBS="-ldsound -lole32 -lrpcrt4 $LIBS"
    EXTRA_LIBS="-ldsound -lole32 -lrpcrt4 $EXTRA_LIBS")
AM_CONDITIONAL(HAVE_DSOUND, test "x$HAVE_DSOUND" = "xtrue")

AC_CHECK_HEADER(mmsystem.h,
    HAVE_WINMM=true
    AC_DEFINE(HAVE_WINMM)
    LIBS="-lwinmm $LIBS"
    EXTRA_LIBS="-lwinmm $EXTRA_LIBS"
  ,,
    [#include <windows.h>])
AM_CONDITIONAL(HAVE_WINMM, test "x$HAVE_WINMM" = "xtrue")

dnl Checks for typedefs, structures, and compiler characteristics.

AC_C_BIGENDIAN

dnl Output makefiles.

AC_SUBST(WORDS_BIGENDIAN)
AC_SUBST(EXTRA_LIBS)
AC_OUTPUT(
        audiere-config
	Makefile
	doc/Makefile
        examples/Makefile
        examples/simple/Makefile
        examples/wxPlayer/Makefile
        src/Makefile
        src/mpaudec/Makefile
        test/Makefile
        test/buffer/Makefile
	test/callback/Makefile
        test/device/Makefile
	test/formats/Makefile
        test/interactive/Makefile
        test/performance/Makefile,
    [chmod a+x audiere-config])