2 # Process this file with autoconf to produce a configure script.
6 # This file is part of polypaudio.
8 # polypaudio is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU Lesser General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # polypaudio is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public License
19 # along with polypaudio; if not, write to the Free Software Foundation,
20 # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
23 AC_INIT([polypaudio],[0.8],[mzcbylcnhqvb (at) 0pointer (dot) de])
24 AC_CONFIG_SRCDIR([polyp/main.c])
25 AC_CONFIG_HEADERS([config.h])
26 AM_INIT_AUTOMAKE([foreign -Wall])
28 AC_SUBST(PA_MAJORMINOR, "$PACKAGE_VERSION")
29 AC_SUBST(PACKAGE_URL, [http://0pointer.de/lennart/projects/polypaudio/])
31 AC_SUBST(PA_API_VERSION, 8)
33 if type -p stow > /dev/null && test -d /usr/local/stow ; then
34 AC_MSG_NOTICE([*** Found /usr/local/stow: default install prefix set to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***])
35 ac_default_prefix="/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}"
38 #### Checks for programs. ####
43 AC_PROG_GCC_TRADITIONAL
46 # If using GCC specify some additional parameters
47 if test "x$GCC" = "xyes" ; then
48 CFLAGS="$CFLAGS -pipe -W -Wall -pedantic"
50 AC_LANG_CONFTEST([int main() {}])
51 $CC -c conftest.c -std=gnu9x -Wno-unused-parameter $CFLAGS > /dev/null 2> /dev/null && CFLAGS="$CFLAGS -std=gnu9x -Wno-unused-parameter"
57 AC_PATH_PROG([M4], [m4 gm4], [no])
58 if test "x$M4" = xno ; then
59 AC_MSG_ERROR([m4 missing])
65 AC_LANG_CONFTEST([int main() {}])
66 $CC -c conftest.c $CFLAGS $@ > /dev/null 2> /dev/null
72 # If using GCC specify some additional parameters
73 if test "x$GCC" = "xyes" ; then
75 DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wformat -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Winline"
77 if test "x$HAVE_NETLINK" = "xyes" ; then
78 # Test whether rtnetlink.h can be included when compiled with -std=c99
79 # some distributions (e.g. archlinux) have broken headers that dont
80 # define __u64 with -std=c99
81 AC_MSG_CHECKING([checking whether rtnetlink.h can be included with -std=c99])
84 AC_TRY_COMPILE([#include <linux/rtnetlink.h>], [],
85 use_stdc99=yes, use_stdc99=no)
87 if test x"$use_stdc99" = xyes; then
88 DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS"
96 DESIRED_FLAGS="-std=c99 $DESIRED_FLAGS"
99 for flag in $DESIRED_FLAGS ; do
100 AC_MSG_CHECKING([whether $CC accepts $flag])
101 if test_gcc_flag $flag ; then
102 CFLAGS="$CFLAGS $flag"
110 # LYNX documentation generation
112 AC_HELP_STRING(--disable-lynx,Turn off lynx usage for documentation generation),
113 [case "${enableval}" in
116 *) AC_MSG_ERROR(bad value ${enableval} for --disable-lynx) ;;
119 if test x$lynx = xyes ; then
120 AC_CHECK_PROG(have_lynx, lynx, yes, no)
122 if test x$have_lynx = xno ; then
123 AC_MSG_WARN([*** lynx not found, plain text README will not be built ***])
127 AM_CONDITIONAL([USE_LYNX], [test "x$have_lynx" = xyes])
129 #### libtool stuff ####
131 AC_LTDL_ENABLE_INSTALL
132 AC_LIBLTDL_INSTALLABLE
138 AC_CONFIG_SUBDIRS(libltdl)
140 if test "x$enable_ltdl_install" = "xno" && test "x$ac_cv_lib_ltdl_lt_dlinit" = "xno" ; then
143 *** Cannot find the libltdl development files.
144 *** Maybe you need to install the libltdl-dev package.
148 #### Determine build environment ####
154 AC_DEFINE([OS_IS_WIN32], 1, [Build target is Windows.])
159 AM_CONDITIONAL(OS_IS_WIN32, test "x$os_is_win32" = "x1")
161 ###################################
162 # Basic environment checks #
163 ###################################
165 #### Checks for header files. ####
171 AC_CHECK_HEADERS([arpa/inet.h glob.h grp.h netdb.h netinet/in.h \
172 netinet/in_systm.h netinet/ip.h netinet/tcp.h pwd.h sched.h \
173 sys/resource.h sys/select.h sys/socket.h sys/wait.h \
175 AC_CHECK_HEADERS([regex.h], [HAVE_REGEX=1], [HAVE_REGEX=0])
176 AC_CHECK_HEADERS([sys/un.h], [HAVE_AF_UNIX=1], [HAVE_AF_UNIX=0])
178 AM_CONDITIONAL(HAVE_REGEX, test "x$HAVE_REGEX" = "x1")
179 AM_CONDITIONAL(HAVE_AF_UNIX, test "x$HAVE_AF_UNIX" = "x1")
182 AC_CHECK_HEADERS([sys/poll.h])
185 AC_CHECK_HEADERS([linux/input.h], [HAVE_EVDEV=1], [HAVE_EVDEV=0])
187 AM_CONDITIONAL([HAVE_EVDEV], [test "x$HAVE_EVDEV" = "x1"])
190 AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h])
193 AC_CHECK_HEADERS([sys/ioctl.h])
195 #### Typdefs, structures, etc. ####
201 AC_CHECK_TYPES(ssize_t, , [AC_DEFINE([ssize_t], [signed long],
202 [Define ssize_t if it is not done by the standard libs.])])
207 AC_CHECK_DEFINE([SIGXCPU], [signal.h], [HAVE_SIGXCPU=1], [HAVE_SIGXCPU=0])
208 AM_CONDITIONAL(HAVE_SIGXCPU, test "x$HAVE_SIGXCPU" = "x1")
211 AC_CHECK_DEFINE([INADDR_NONE], [netinet/in.h], [],
212 [AC_DEFINE([INADDR_NONE], [0xffffffff], [Define INADDR_NONE if not found in <netinet/in.h>])])
214 #### Check for libs ####
217 AC_CHECK_LIB([m], [pow])
220 AC_CHECK_LIB([rt], [sched_setscheduler])
223 AC_CHECK_LIB([socket], [connect])
227 # This magic is needed so we do not needlessly add static libs to the win32
228 # build, disabling its ability to make dlls.
229 AC_CHECK_FUNCS([getopt_long], [], [AC_CHECK_LIB([iberty], [getopt_long])])
231 #### Check for functions ####
236 AC_FUNC_SELECT_ARGTYPES
237 AC_CHECK_FUNCS([getaddrinfo getgrgid_r getpwuid_r gettimeofday getuid \
238 inet_ntop nanosleep setpgid setsid sigaction sleep])
239 AC_CHECK_FUNCS([mkfifo], [HAVE_MKFIFO=1], [HAVE_MKFIFO=0])
241 AM_CONDITIONAL(HAVE_MKFIFO, test "x$HAVE_MKFIFO" = "x1")
244 AC_CHECK_FUNCS([readlink])
247 AC_CHECK_FUNCS([ctime_r usleep])
250 AC_CHECK_FUNCS([lstat])
254 AC_CHECK_FUNCS(setresuid)
255 AC_CHECK_FUNCS(setreuid)
257 #### POSIX threads ####
261 ###################################
262 # External libraries #
263 ###################################
265 #### X11 (optional) ####
269 # The macro tests the host, not the build target
270 if test "x$os_is_win32" != "x1" ; then
272 test "x$no_x" != "xyes" && HAVE_X11=1
276 AM_CONDITIONAL(HAVE_X11, test "x$HAVE_X11" = "x1")
277 if test "x$HAVE_X11" = "x1" ; then
278 AC_DEFINE([HAVE_X11], 1, [Have X11])
281 #### Capabilities (optional) ####
287 AC_HELP_STRING([--without-caps],[Omit support for POSIX capabilities.]))
289 if test "x${with_caps}" != "xno"; then
290 AC_CHECK_LIB(cap, cap_init, [CAP_LIBS='-lcap'], [CAP_LIBS=''])
291 AC_CHECK_HEADERS([sys/capability.h])
297 # Check for pkg-config manually first, as if its not installed the
298 # PKG_PROG_PKG_CONFIG macro won't be defined.
299 AC_CHECK_PROG(have_pkg_config, pkg-config, yes, no)
301 if test x"$have_pkg_config" = "xno"; then
302 AC_MSG_ERROR(pkg-config is required to install this program)
307 #### Sample rate conversion ####
309 PKG_CHECK_MODULES(LIBSAMPLERATE, [ samplerate >= 0.1.0 ])
310 AC_SUBST(LIBSAMPLERATE_CFLAGS)
311 AC_SUBST(LIBSAMPLERATE_LIBS)
315 PKG_CHECK_MODULES(LIBSNDFILE, [ sndfile >= 1.0.10 ])
316 AC_SUBST(LIBSNDFILE_CFLAGS)
317 AC_SUBST(LIBSNDFILE_LIBS)
319 #### OSS support (optional) ####
321 AC_CHECK_HEADERS([sys/soundcard.h], [HAVE_OSS=1], [HAVE_OSS=0])
323 AM_CONDITIONAL([HAVE_OSS], [test "x$HAVE_OSS" = x1])
325 #### ALSA support (optional) ####
327 PKG_CHECK_MODULES(ASOUNDLIB, [ alsa >= 1.0.0 ], [HAVE_ALSA=1], [HAVE_ALSA=0])
328 AC_SUBST(ASOUNDLIB_CFLAGS)
329 AC_SUBST(ASOUNDLIB_LIBS)
331 AM_CONDITIONAL([HAVE_ALSA], [test "x$HAVE_ALSA" = x1])
333 #### Solaris audio support (optional) ####
335 AC_CHECK_HEADERS([sys/audio.h], [HAVE_SOLARIS=1], [HAVE_SOLARIS=0])
336 AC_SUBST(HAVE_SOLARIS)
337 AM_CONDITIONAL([HAVE_SOLARIS], [test "x$HAVE_SOLARIS" = x1])
339 #### GLib 2 support (optional) ####
341 PKG_CHECK_MODULES(GLIB20, [ glib-2.0 >= 2.4.0 ], HAVE_GLIB20=1, HAVE_GLIB20=0)
342 AC_SUBST(GLIB20_CFLAGS)
343 AC_SUBST(GLIB20_LIBS)
344 AC_SUBST(HAVE_GLIB20)
345 AM_CONDITIONAL([HAVE_GLIB20], [test "x$HAVE_GLIB20" = x1])
347 #### GLib 1 support (optional) ####
349 PKG_CHECK_MODULES(GLIB12, [ glib >= 1.2.0 ], HAVE_GLIB12=1, HAVE_GLIB12=0)
350 AC_SUBST(GLIB12_CFLAGS)
351 AC_SUBST(GLIB12_LIBS)
352 AC_SUBST(HAVE_GLIB12)
353 AM_CONDITIONAL([HAVE_GLIB12], [test "x$HAVE_GLIB12" = x1])
355 #### Howl support (optional) ####
357 PKG_CHECK_MODULES(HOWL, [ howl >= 0.9.8 ], HAVE_HOWL=1, HAVE_HOWL=0)
358 AC_SUBST(HOWL_CFLAGS)
361 AM_CONDITIONAL([HAVE_HOWL], [test "x$HAVE_HOWL" = x1])
363 #### Async DNS support (optional) ####
365 PKG_CHECK_MODULES(LIBASYNCNS, [ libasyncns >= 0.1 ], HAVE_LIBASYNCNS=1, HAVE_LIBASYNCNS=0)
366 AC_SUBST(LIBASYNCNS_CFLAGS)
367 AC_SUBST(LIBASYNCNS_LIBS)
368 AC_SUBST(HAVE_LIBASYNCNS)
369 AM_CONDITIONAL([HAVE_LIBASYNCNS], [test "x$HAVE_LIBASYNCNS" = x1])
371 if test "x$HAVE_LIBASYNCNS" != "x0" ; then
372 AC_DEFINE([HAVE_LIBASYNCNS], 1, [Have libasyncns?])
375 #### TCP wrappers (optional) ####
378 AC_SUBST(LIBWRAP_LIBS)
380 #### LIRC support (optional) ####
383 AC_SUBST(LIRC_CFLAGS)
385 AM_CONDITIONAL([HAVE_LIRC], [test "x$HAVE_LIRC" = x1])
387 ###################################
389 ###################################
393 AC_HELP_STRING([--enable-static-bins],[Statically link executables.]),
394 [STATIC_BINS=1], [STATIC_BINS=0])
395 AM_CONDITIONAL([STATIC_BINS], [test "x$STATIC_BINS" = "x1"])
399 AC_HELP_STRING([--with-preopen-mods],[Modules to preopen in daemon (default: all).]),
400 [PREOPEN_MODS=$withval], [PREOPEN_MODS="all"])
401 AM_CONDITIONAL([PREOPEN_MODS], [test "x$PREOPEN_MODS" != "xall"])
402 if test "x$PREOPEN_MODS" != "xall" ; then
404 for mod in $PREOPEN_MODS; do
405 tmpLIBS="$tmpLIBS module-$mod.la"
407 PREOPEN_MODS="$tmpLIBS"
408 AC_SUBST(PREOPEN_MODS)
419 polyplib-glib-mainloop.pc
420 polyplib-glib12-mainloop.pc
428 polyp/polyplib-version.h