build-sys: add AM_PROG_AR
[profile/ivi/pulseaudio-module-murphy-ivi.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.61)
5
6 AC_INIT([pulseaudio-murphy-ivi],[PAVER],[janos.kovacs@intel.com])
7
8 AC_CONFIG_SRCDIR([murphy/module-murphy-ivi.c])
9 AC_CONFIG_HEADER([foo.h])
10 AC_CONFIG_MACRO_DIR([m4])
11 AM_INIT_AUTOMAKE([foreign 1.8.5 -Wall])
12
13
14 # this would not be really needed if everything would be as it should be
15 AS_IF([test x${exec_prefix} = xNONE], [LIBDIR=$ac_default_prefix/lib], [LIBDIR=${libdir}])
16 AC_SUBST(LIBDIR)
17
18 AC_SUBST(PA_MAJORMINOR, [PAVER])
19
20 AC_PROG_MKDIR_P
21 AC_PROG_CC
22 AC_PROG_CC_C99
23 AM_PROG_CC_C_O
24 AC_PROG_GCC_TRADITIONAL
25 AC_USE_SYSTEM_EXTENSIONS
26 AM_PROG_AR
27
28 AC_PATH_PROG([M4], [m4 gm4], [no])
29 if test "x$M4" = xno ; then
30    AC_MSG_ERROR([m4 missing])
31 fi
32
33 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
34
35 #dnl Compiler flags
36 #DESIRED_FLAGS="-Wall -W -Wextra -pedantic -pipe -Wno-long-long -Wvla -Wno-overlength-strings -Wconversion -Wundef -Wformat -Wlogical-op -Wpacked -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition -Wdeclaration-after-statement -Wfloat-equal -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-noreturn -Wshadow -Wendif-labels -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-unused-parameter -ffast-math"
37
38 #for flag in $DESIRED_FLAGS ; do
39 #  CC_CHECK_CFLAGS([$flag], [CFLAGS="$CFLAGS $flag"])
40 #done
41
42 AC_LTDL_ENABLE_INSTALL
43 AC_LIBLTDL_INSTALLABLE
44 AC_LIBTOOL_DLOPEN
45 AC_LIBTOOL_WIN32_DLL
46 AC_PROG_LIBTOOL
47 AC_SUBST(LTDLINCL)
48 AC_SUBST(LIBLTDL)
49 AC_CONFIG_SUBDIRS(libltdl)
50
51 AC_HEADER_STDC
52 AC_C_CONST
53 AC_C_BIGENDIAN
54 AC_TYPE_PID_T
55 AC_TYPE_SIZE_T
56 AC_CHECK_TYPES(ssize_t, , [AC_DEFINE([ssize_t], [signed long],
57     [Define ssize_t if it is not done by the standard libs.])])
58 AC_TYPE_OFF_T
59 AC_TYPE_SIGNAL
60 AC_TYPE_UID_T
61 AC_CHECK_DECLS(environ)
62
63 AC_DEFINE_UNQUOTED(PA_CFLAGS,"$CFLAGS", [The CFLAGS used during compilation])
64
65 PKG_CHECK_MODULES(LIBPULSE, [libpulse])
66 AC_SUBST(LIBPULSE_CFLAGS)
67 AC_SUBST(LIBPULSE_LIBS)
68
69
70 PKG_CHECK_MODULES(PULSEDEVEL, [pulseaudio-module-devel])
71 AC_SUBST(PULSEDEVEL_CFLAGS)
72 AC_SUBST(PULSEDEVEL_LIBS)
73
74 PKG_CHECK_MODULES(MURPHYCOMMON, [murphy-common])
75 AC_SUBST(MURPHYCOMMON_CFLAGS)
76 AC_SUBST(MURPHYCOMMON_LIBS)
77
78 PKG_CHECK_MODULES(LUAUTILS, [murphy-lua-utils])
79 AC_SUBST(LUAUTILS_CFLAGS)
80 AC_SUBST(LUAUTILS_LIBS)
81
82
83 PKG_CHECK_MODULES(LUA, lua >= 5.1.1)
84 AC_SUBST(LUA_CFLAGS)
85 AC_SUBST(LUA_LIBS)
86
87 PKG_CHECK_MODULES(AUL, aul, [have_aul=yes], [have_aul=no])
88 if test "$have_aul" = "no" -a "$enable_aul" = "yes"; then
89    AC_MSG_ERROR([AUL development headers not found.])
90 fi
91 AC_SUBST(AUL_CFLAGS)
92 AC_SUBST(AUL_LIBS)
93
94 AM_CONDITIONAL(HAVE_AUL,  [ test x$have_aul = "xyes" ])
95
96 # D-Bus
97 AC_ARG_WITH([dbus],
98             [ AS_HELP_STRING([--with-dbus],
99                              [Use D-Bus towards with Murphy and AudioManager])
100             ],
101             [ build_with_dbus="yes" ;
102               PKG_CHECK_MODULES(DBUS, [dbus-1])
103               AC_SUBST(DBUS_CFLAGS)
104               AC_SUBST(DBUS_LIBS)
105             ],
106             [ build_with_dbus="no" ]
107 )
108
109 AM_CONDITIONAL(BUILD_WITH_DBUS,  [ test "x$build_with_dbus" = "xyes" ])
110
111 # murphy interface
112 AC_ARG_WITH([murphyif],
113             [ AS_HELP_STRING([--with-murphyif],
114                              [Enable murphy domain-controller interface])
115             ],
116             [ build_with_murphyif="yes" ;
117               PKG_CHECK_MODULES(MURPHYIF,
118                                 [murphy-domain-controller murphy-pulse])
119               AC_SUBST(MURPHYIF_CFLAGS)
120               AC_SUBST(MURPHYIF_LIBS)
121               AC_DEFINE([WITH_MURPHYIF], 1, [Enable Murphy interface ?])
122             ],
123             [ build_with_murphyif="no" ]
124 )
125
126 AM_CONDITIONAL(BUILD_WITH_MURPHYIF,  [ test "x$build_with_murphyif" = "xyes" ])
127
128
129
130 PKG_CHECK_MODULES(MURPHYDOMCTL, [murphy-domain-controller murphy-pulse])
131 AC_SUBST(MURPHYDOMCTL_CFLAGS)
132 AC_SUBST(MURPHYDOMCTL_LIBS)
133
134
135
136
137 # module directory
138 AC_ARG_WITH([module-dir],
139             [AS_HELP_STRING([--with-module-dir], [Directory where to install the modules to (defaults to ${LIBDIR}/pulse-${PA_MAJORMINOR}/modules/])],
140             [modlibexecdir=$withval],
141             [modlibexecdir=${LIBDIR}/pulse-${PA_MAJORMINOR}/modules]
142 )
143
144 AC_SUBST(modlibexecdir)
145
146
147 # documentation
148 AC_ARG_WITH([documentation],
149             [AS_HELP_STRING([--with-documentation],
150                             [generate pdf, html and other doc files])],
151             [],
152             [with_documentation=auto]
153 )
154
155 AS_IF( [ test x$with_documentation = xno ],
156        [ has_doc_tools="no" ],
157        [ AC_PATH_TOOL([PA_DOXYGEN], doxygen)
158          AC_PATH_TOOL([PA_LYX], lyx)
159          AC_PATH_TOOL([PA_INKSCAPE], inkscape)
160          AC_PATH_TOOL([PA_PYTHON], python)
161          AC_PATH_TOOL([PA_TOUCH], touch)
162          AC_PATH_TOOL([PA_DBLATEX], dblatex)
163          AC_PATH_TOOL([PA_XMLTO], xmlto)
164
165          AS_IF( [ test x$PA_DOXYGEN = x -o x$PA_LYX = x -o \
166                        x$PA_INKSCAPE = x -o x$PA_PYTHON = x -o \
167                        x$PA_TOUCH = x],
168                 [ has_doc_tools="no";
169                   AC_MSG_WARN([Some essential doc-tool is missing]) ],
170                 [ has_doc_tools="yes";
171                   PA_DOCINIT() ]
172          ) ]
173 )
174
175 AS_IF( [ test x$has_doc_tools == "xno" -o x$PA_DBLATEX = x ],
176        [ can_make_pdfs="no";
177          AC_WARN([No PDF documentation will be generated]) ],
178        [ can_make_pdfs="yes"]
179 )
180
181 AS_IF([ test x$has_doc_tools == "xno" -o x$PA_XMLTO = x ],
182       [ can_make_html="no";
183         AC_WARN([No HTML documentation will be generated]) ],
184       [ can_make_html="yes" ]
185 )
186
187
188 AM_CONDITIONAL(BUILD_DOCUMENTATION,  [ test x$has_doc_tools = "xyes" ])
189 AM_CONDITIONAL(BUILD_PDF_DOCUMENTS,  [ test x$can_make_pdfs = "xyes" ])
190 AM_CONDITIONAL(BUILD_HTML_DOCUMENTS, [ test x$can_make_html = "xyes" ])
191
192 AC_SUBST(PA_DOCDIR, [`pwd`/doc])
193 AC_SUBST(PA_FIGDIR, [$PA_DOCDIR/common/figures])
194 AC_SUBST(PA_MAKE_DOCRULES, [$PA_DOCDIR/Makefile.rules])
195 AC_SUBST(PA_DOCSCRIPT_DIR, [$PA_DOCDIR/scripts])
196 AC_SUBST(PA_DBLYXFIX, [$PA_DOCSCRIPT_DIR/dblyxfix.py])
197 AC_SUBST(PA_DOXML2DB, [$PA_DOCSCRIPT_DIR/doxml2db.py])
198 AC_SUBST(PA_DOXYDEPS, [$PA_DOCSCRIPT_DIR/doxydeps.py])
199
200
201 # Shave by default
202 SHAVE_INIT([build-aux], [enable])
203
204 AC_CONFIG_FILES([
205         build-aux/shave
206         build-aux/shave-libtool
207         Makefile
208         murphy/Makefile
209         combine/Makefile
210         augment/Makefile
211         doc/Makefile
212         doc/murphy-audio/Makefile
213         doc/murphy-audio/db/Makefile
214 ])
215 AC_OUTPUT
216
217 echo "
218  ---{ $PACKAGE_NAME $VERSION }---
219
220     prefix:               ${prefix}
221     sysconfdir:           ${sysconfdir}
222     localstatedir:        ${localstatedir}
223     modlibexecdir:        ${modlibexecdir}
224     Compiler:             ${CC}
225     CFLAGS:               ${CFLAGS}
226     LIBDIR:               ${LIBDIR}
227     LIBPULSE_CFLAGS:      ${LIBPULSE_CFLAGS}
228     LIBPULSE_LIBS:        ${LIBPULSE_LIBS}
229     LIBPULSECORE_CFLAGS:  ${LIBPULSECORE_CFLAGS}
230     LIBPULSECORE_LIBS:    ${LIBPULSECORE_LIBS}
231     PULSEDEVEL_CFLAGS     ${PULSEDEVEL_CFLAGS}
232     PULSEDEVEL_LIBS       ${PULSEDEVEL_LIBS}
233     MAJORMINOR:           ${PA_MAJORMINOR}
234     DBUS_CFLAGS:          ${DBUS_CFLAGS}
235     DBUS_LIBS:            ${DBUS_LIBS}
236     MURPHYCOMMON_CFLAGS   ${MURPHYCOMMON_CFLAGS}
237     MURPHYCOMMON_LIBS     ${MURPHYCOMMON_LIBS}
238     LUAUTILS_CFLAGS       ${LUAUTILS_CFLAGS}
239     LUAUTILS_LIBS         ${LUAUTILS_LIBS}
240     LUAUTILS_CFLAGS       ${LUAUTILS_CFLAGS}
241     LUAUTILS_LIBS         ${LUAUTILS_LIBS}
242     LUA_CFLAGS:           ${LUA_CFLAGS}
243     LUA_LIBS:             ${LUA_LIBS}
244     AUL_CFLAGS            ${AUL_CFLAGS}
245     AUL_LIBS              ${AUL_LIBS}
246     murphyif enabled:     $build_with_murphyif
247     MURPHYIF_CFLAGS       ${MURPHYIF_CFLAGS}
248     MURPHYIF_LIBS         ${MURPHYIF_LIBS}
249 "