1dnl Process this file with autoconf to produce a configure script.
2dnl
3dnl Options refactored to allow all audio input modules to be enabled/disabled
4dnl by Thomas B. "dm8tbr" Ruecker <thomas.ruecker@tieto.com>
5dnl
6AC_INIT([IceS], [2.0.3], [icecast@xiph.org])
7AC_PREREQ(2.54)
8AC_CONFIG_SRCDIR([src/ices.c])
9AC_CONFIG_MACRO_DIR([m4])
10
11AM_INIT_AUTOMAKE
12AM_CONFIG_HEADER(config.h)
13AM_MAINTAINER_MODE
14
15AC_PROG_CC
16AM_PROG_LIBTOOL
17
18dnl Set some options based on environment
19
20dnl BSD headers break when _XOPEN_SOURCE is defined but without it seems
21dnl to be fine
22if test -n "$GCC"; then
23    AC_DEFINE(_GNU_SOURCE, ,[Define if you have POSIX and GNU specifications])
24    XIPH_VAR_APPEND([XIPH_CPPFLAGS], [-ffast-math -fsigned-char])
25    XIPH_VAR_APPEND([DEBUG],[-g])
26    XIPH_VAR_APPEND([PROFILE],[-g -pg])
27else
28    case "$host" in
29        *-*-irix*)
30            XIPH_VAR_APPEND([DEBUG], [-g -signed -D_REENTRANT])
31            XIPH_VAR_APPEND([XIPH_CPPFLAGS],[-O2 -w -signed -D_REENTRANT])
32            XIPH_VAR_APPEND([PROFILE],[-p -g3 -O2 -signed -D_REENTRANT])
33            ;;
34        *-*-solaris*)
35            AC_DEFINE(__EXTENSIONS__, 1, [define to 1 to resolve header problem on solaris])
36            XIPH_VAR_APPEND([DEBUG],[-v -g -D_REENTRANT])
37            XIPH_VAR_APPEND([XIPH_CPPFLAGS],[-xO4 -fast -w -fsimple -native -xcg92 -D_REENTRANT])
38            XIPH_VAR_APPEND([PROFILE],[-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc -D_REENTRANT])
39            ;;
40        *)
41            DEBUG="-g -D_REENTRANT"
42            XIPH_CPPFLAGS="-O -D_REENTRANT"
43            PROFILE="-g -p -D_REENTRANT"
44            ;;
45    esac
46fi
47
48dnl Checks for programs.
49
50dnl Checks for libraries.
51
52dnl Checks for header files.
53AC_HEADER_STDC
54AC_HEADER_TIME
55AC_CHECK_HEADERS([stropts.h sys/timeb.h sys/select.h])
56
57dnl ================================================================
58dnl Check for OSS
59dnl ================================================================
60
61AC_ARG_ENABLE(oss,
62 	[AC_HELP_STRING([--disable-oss],
63 	[OSS support [default=autodetect]])],,
64 	enable_oss=yes)
65
66if test "x$enable_oss" = xyes ; then
67    AC_CHECK_HEADER(sys/soundcard.h, have_oss=yes, have_oss=no)
68    AC_CHECK_HEADER(machine/soundcard.h, have_oss=yes, )
69    if test "$have_oss" = yes; then
70	AC_DEFINE(HAVE_OSS,,[Define to enable OSS input module])
71    fi
72else
73    have_oss=no
74fi
75
76AM_CONDITIONAL(HAVE_OSS,test "$have_oss" = yes)
77
78
79dnl ================================================================
80dnl Check for Sun audio
81dnl ================================================================
82
83AC_C_BIGENDIAN
84AC_ARG_ENABLE(sun-audio,
85    AC_HELP_STRING([--disable-sun-audio],
86                   [Sun audio input [default=autodetect]]),
87    enable_sun="$enableval",
88    enable_sun=yes
89)
90if test x$enable_sun = xyes; then
91   AC_CHECK_HEADER(sys/audioio.h, have_sun_audio=yes, have_sun_audio=no)
92
93   if test "$have_sun_audio" = yes; then
94       AC_DEFINE(HAVE_SUN_AUDIO,,[Define to enable sun audio input module])
95   fi
96else
97    have_sun_audio=no
98fi
99
100AM_CONDITIONAL(HAVE_SUN_AUDIO,test "$have_sun_audio" = yes)
101
102dnl ================================================================
103dnl Check for ALSA audio
104dnl ================================================================
105
106AC_ARG_ENABLE(alsa,
107 	[AC_HELP_STRING([--disable-alsa],
108 	[ALSA support [default=autodetect]])],,
109 	enable_alsa=yes)
110
111if test "x$enable_alsa" = xyes ; then
112    AC_CHECK_HEADER(alsa/asoundlib.h, have_alsa=yes, have_alsa=no)
113
114    if test "$have_alsa" = yes; then
115        ALSA_LIBS="-lasound"
116	AC_DEFINE(HAVE_ALSA, ,[Define to enable ALSA input module])
117    fi
118else
119    have_alsa=no
120fi
121
122AM_CONDITIONAL(HAVE_ALSA,test "$have_alsa" = yes)
123
124dnl ================================================================
125dnl Check for RoarAudio
126dnl ================================================================
127
128AC_ARG_ENABLE(roaraudio,
129 	[AC_HELP_STRING([--disable-roaraudio],
130 	[Roaraudio support [default=autodetect]])],,
131 	enable_roaraudio=yes)
132
133if test "x$enable_roaraudio" = xyes ; then
134#    PKG_CHECK_MODULES(RoarAudio, [libroar >= 0.4.0], have_roaraudio=yes, have_roaraudio=no)
135    echo -n "checking for libroar... "
136    if roar-config --compare-versions current ge 0.4.0
137    then
138        have_roaraudio=yes
139    else
140        have_roaraudio=no
141    fi
142
143    if test "$have_roaraudio" = yes; then
144	ROARAUDIO_LIBS="`roar-config --libs`"
145	ROARAUDIO_CFLAGS="`roar-config --cflags`"
146        XIPH_VAR_APPEND([XIPH_CFLAGS], [$ROARAUDIO_CFLAGS])
147        AC_DEFINE(HAVE_ROARAUDIO, ,[Define to enable RoarAudio input module])
148        echo "ok"
149    else
150        echo "failed"
151    fi
152else
153    have_roaraudio=no
154fi
155
156AM_CONDITIONAL(HAVE_ROARAUDIO,test "$have_roaraudio" = yes)
157
158
159dnl Checks for typedefs, structures, and compiler characteristics.
160AC_C_CONST
161
162dnl Check for types
163AC_CHECK_TYPES([uint64_t],,AC_ERROR([could not find a uint64_t type]))
164
165dnl Checks for library functions.
166
167AC_CHECK_FUNCS([gettimeofday ftime])
168
169XIPH_PATH_XML
170XIPH_VAR_APPEND([XIPH_CFLAGS], [$XML_CFLAGS])
171XIPH_VAR_PREPEND([XIPH_LIBS], [$XML_LIBS])
172
173XIPH_PATH_SHOUT(, AC_MSG_ERROR([must have libshout installed!]))
174if test "$SHOUT_THREADSAFE" != "yes"
175then
176  AC_MSG_ERROR([This libshout isn't threadsafe])
177fi
178
179XIPH_VAR_APPEND([XIPH_CPPFLAGS], [$SHOUT_CPPFLAGS])
180XIPH_VAR_APPEND([XIPH_CFLAGS], [$SHOUT_CFLAGS])
181XIPH_VAR_PREPEND([XIPH_LIBS], [$SHOUT_LIBS])
182
183XIPH_PATH_VORBIS(, AC_MSG_ERROR([must have Ogg Vorbis v1.0 or above installed!]))
184XIPH_VAR_APPEND([XIPH_CPPFLAGS], [$VORBIS_CFLAGS $VORBISENC_CFLAGS])
185XIPH_VAR_PREPEND([XIPH_LIBS], [$VORBISENC_LIBS $VORBIS_LIBS])
186
187dnl Make substitutions
188
189AC_SUBST(ALSA_LIBS)
190AC_SUBST(ROARAUDIO_LIBS)
191AC_SUBST(ROARAUDIO_CFLAGS)
192AC_SUBST(XML_LIBS)
193AC_SUBST(XML_CFLAGS)
194AC_SUBST(LIBTOOL_DEPS)
195AC_SUBST(DEBUG)
196AC_SUBST(PROFILE)
197AC_SUBST(XIPH_CFLAGS)
198AC_SUBST(XIPH_CPPFLAGS)
199AC_SUBST(XIPH_LIBS)
200
201AC_OUTPUT(
202  Makefile
203  conf/Makefile
204  doc/Makefile
205  src/Makefile
206   src/common/log/Makefile
207   src/common/timing/Makefile
208   src/common/thread/Makefile
209   src/common/avl/Makefile
210)
211
212echo "
213
214                Build with alsa:           $have_alsa
215                Build with OSS:            $have_oss
216                Build with Sun audio:      $have_sun_audio
217                Build with RoarAudio:      $have_roaraudio
218
219"
220