Initial import pulseaudio modules for mfld, which handles stream policy check on...
[adaptation/intel_mfld/pulseaudio-modules-mfld-blackbay.git] / configure.ac
1 m4_define(FULL_PAVER, esyscmd(/usr/bin/pkg-config --silence-errors --modversion pulsecore | tr -d \\n))
2 m4_define(PAVER, regexp(FULL_PAVER, [\([0123456789.]+\).*], [\1]))
3
4 AC_PREREQ(2.52)
5
6 AC_INIT([pulseaudio-modules-mfld-blackbay], [0.1])
7 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
8 AC_CONFIG_HEADERS([config.h:config.h.in])
9
10 AC_CONFIG_MACRO_DIR([m4])
11
12 # this would not be really needed if everything would be as it should be
13 AS_IF([test x${exec_prefix} = xNONE], [LIBDIR=$ac_default_prefix/lib], [LIBDIR=${libdir}])
14 AC_SUBST(LIBDIR)
15
16 AC_SUBST(PA_MAJORMINOR, [PAVER])
17
18
19 # Checks for programs.
20 AC_PROG_CC
21 AC_C_CONST
22 dnl AC_FUNC_MALLOC
23 AC_FUNC_MMAP
24 AC_FUNC_REALLOC
25 AC_FUNC_SELECT_ARGTYPES
26 AC_FUNC_STAT
27 AC_FUNC_VPRINTF
28 AC_HEADER_STDBOOL
29 AC_HEADER_STDC
30 AC_HEADER_TIME
31 AC_PROG_GCC_TRADITIONAL
32 AC_PROG_LIBTOOL
33
34 # Checks for libraries.
35 AC_CANONICAL_HOST
36 AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host", [Canonical host string.])
37
38 AC_MSG_CHECKING([target operating system])
39
40 case $host in
41         *-*-linux*)
42             AC_MSG_RESULT([linux])
43             pulse_target_os=linux
44         ;;
45         *)
46             AC_MSG_RESULT([unknown])
47             pulse_target_os=unknown
48         ;;
49 esac
50
51 # If everything else fails use libatomic_ops
52 need_libatomic_ops=yes
53
54 AC_MSG_CHECKING([whether $CC knows __sync_bool_compare_and_swap()])
55 AC_LANG_CONFTEST([int main() { int a = 4; __sync_bool_compare_and_swap(&a, 4, 5); }])
56 $CC conftest.c $CFLAGS -o conftest > /dev/null 2> /dev/null
57 ret=$?
58 rm -f conftest.o conftest
59 if test $ret -eq 0 ; then
60     AC_DEFINE([HAVE_ATOMIC_BUILTINS], 1, [Have __sync_bool_compare_and_swap() and friends.])
61     AC_MSG_RESULT([yes])
62     need_libatomic_ops=no
63 fi
64
65 AC_MSG_CHECKING([whether we need libatomic_ops])
66 if test "x$need_libatomic_ops" = "xyes"; then
67    AC_MSG_RESULT([yes])
68    AC_CHECK_HEADERS([atomic_ops.h], [], [
69    AC_MSG_ERROR([*** libatomic-ops headers not found])
70    ])
71
72    # Win32 does not need the lib and breaks horribly if we try to include it
73    if test "x$os_is_win32" != "x1" ; then
74        LIBS="$LIBS -latomic_ops"
75    fi
76 else
77    AC_MSG_RESULT([no])
78 fi
79
80 #### libtool stuff ####
81 LT_PREREQ(2.2)
82 LT_INIT([dlopen win32-dll disable-static])
83
84 dnl Unfortunately, even up to libtool 2.2.6a there is no way to know
85 dnl exactly which version of libltdl is present in the system, so we
86 dnl just assume that it's a working version as long as we have the
87 dnl library and the header files.
88 dnl
89 dnl As an extra safety device, check for lt_dladvise_init() which is
90 dnl only implemented in libtool 2.x, and refine as we go if we have
91 dnl refined requirements.
92 dnl
93 dnl Check the header files first since the system may have a
94 dnl libltdl.so for runtime, but no headers, and we want to bail out as
95 dnl soon as possible.
96 dnl
97 dnl We don't need any special variable for this though, since the user
98 dnl can give the proper place to find libltdl through the standard
99 dnl variables like LDFLAGS and CPPFLAGS.
100
101 AC_CHECK_HEADER([ltdl.h],
102     [AC_CHECK_LIB([ltdl], [lt_dladvise_init], [LIBLTDL=-lltdl], [LIBLTDL=])],
103     [LIBLTDL=])
104
105 AS_IF([test "x$LIBLTDL" = "x"],
106     [AC_MSG_ERROR([Unable to find libltdl version 2. Makes sure you have libtool 2.2 or later installed.])])
107 AC_SUBST([LIBLTDL])
108
109 PKG_CHECK_MODULES(PULSE, libpulse)
110 AC_SUBST(PULSE_CFLAGS)
111 AC_SUBST(PULSE_LIBS)
112
113 # module directory
114 AC_ARG_WITH([module-dir],
115             [AS_HELP_STRING([--with-module-dir], [Directory where to install the modules to (defaults to ${LIBDIR}/pulse-${PA_MAJORMINOR}/modules/])],
116             [modlibexecdir=$withval],
117             [modlibexecdir=${LIBDIR}/pulse-${PA_MAJORMINOR}/modules]
118 )
119 AC_SUBST(modlibexecdir)
120
121 # Checks for header files.
122 AC_HEADER_STDC
123 AC_CHECK_HEADERS([fcntl.h memory.h stdlib.h string.h sys/time.h unistd.h errno.h sys/types.h sys/stat.h])
124
125 # Checks for typedefs, structures, and compiler characteristics.
126 AC_C_CONST
127 AC_TYPE_PID_T
128 AC_TYPE_SIZE_T
129
130 # Checks for library functions.
131 AC_FUNC_ALLOCA
132 AC_FUNC_FORK
133 AC_FUNC_MALLOC
134 AC_FUNC_MEMCMP
135 AC_FUNC_SELECT_ARGTYPES
136 AC_TYPE_SIGNAL
137 AC_CHECK_FUNCS([memset select])
138 AC_CONFIG_FILES([
139 Makefile
140 ])
141 AC_OUTPUT