blob: f487786b53c81fd8fd10ffd5a45cbd515ae05299 [file] [log] [blame]
Emeric Vigier2f625822012-08-06 11:09:52 -04001# Autojunk script for libdbus-c++
2
3AC_PREREQ(2.59)
4AC_INIT([libdbus-c++], 0.9.0, [andreas.volz@tux-style.com])
5
6AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
7AM_CONFIG_HEADER([config.h])
8AC_CONFIG_MACRO_DIR([m4])
9
10AC_CANONICAL_HOST
11
12AC_SUBST(PACKAGE_VERSION)
13
14
15# Set configuration options
16
17AC_ARG_ENABLE(ecore,
18 AS_HELP_STRING([--enable-ecore],
19 [enable ecore integration]),
20 [enable_ecore=$enableval],
21 [enable_ecore=yes]
22)
23
24AC_ARG_ENABLE(glib,
25 AS_HELP_STRING([--enable-glib],
26 [enable glib integration]),
27 [enable_glib=$enableval],
28 [enable_glib=yes]
29)
30
31AC_ARG_ENABLE(doxygen-docs,
32 AS_HELP_STRING([--enable-doxygen-docs],
33 [build DOXYGEN documentation (requires Doxygen)]),
34 [enable_doxygen_docs=$enableval],
35 [enable_doxygen_docs=no]
36)
37
38AC_ARG_ENABLE(tests,
39 AS_HELP_STRING([--enable-tests],
40 [build tests]),
41 [enable_tests=$enableval],
42 [enable_tests=yes]
43)
44
45AC_ARG_ENABLE(examples,
46 AS_HELP_STRING([--enable-examples],
47 [build examples]),
48 [enable_examples=$enableval],
49 [enable_examples=yes]
50)
51
52AC_CHECK_FUNCS(clock_gettime, [], [
53 AC_CHECK_LIB(rt, clock_gettime, [
54 AC_DEFINE(HAVE_CLOCK_GETTIME, 1)
55 RT_LIBS="-lrt"
56 ])
57])
58AC_SUBST(RT_LIBS)
59
60# Check for programs
61
62AC_LANG_CPLUSPLUS
63
64AC_PROG_CC
65AC_PROG_CXX
66
67CXX_FOR_BUILD=${CXX_FOR_BUILD-${CXX}}
68AC_SUBST(CXX_FOR_BUILD)
69
70AM_PROG_LIBTOOL
71
72PKG_PROG_PKG_CONFIG
73
74
75AC_MSG_CHECKING([whether $CXX supports symbol visibility])
76
77vtest=`$CXX --help --verbose 2>&1 | grep fvisibility`
78
79if test -n "$vtest"; then
80 AC_MSG_RESULT(yes)
81
82 AC_DEFINE(GCC_HASCLASSVISIBILITY, 1, [to enable hidden symbols])
83 CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
84else
85 AC_MSG_RESULT(no)
86fi
87
88
89# Check for dependencies
90
91DBUS_REQUIRED_VERSION=0.60
92PKG_CHECK_MODULES(dbus, [dbus-1 >= $DBUS_REQUIRED_VERSION],,
93 AC_MSG_ERROR([You need the DBus libraries (version 0.6 or better)]
94 [http://www.freedesktop.org/wiki/Software_2fdbus])
95)
96AC_SUBST(dbus_CFLAGS)
97AC_SUBST(dbus_LIBS)
98
99DBUS_API_STABLE_VERSION=1.0.0
100PKG_CHECK_EXISTS([dbus-1 < $DBUS_API_STABLE_VERSION],
101 [AC_DEFINE(DBUS_API_SUBJECT_TO_CHANGE, , [unstable DBus])]
102)
103
104DBUS_THREADS_INIT_DEFAULT_VERSION=0.93
105PKG_CHECK_EXISTS([dbus-1 >= $DBUS_THREADS_INIT_DEFAULT_VERSION],
106 [AC_DEFINE(DBUS_HAS_THREADS_INIT_DEFAULT, , [dbus_threads_init_default (needs DBus >= 0.93)])]
107)
108
109DBUS_RECURSIVE_MUTEX_VERSION=0.95
110PKG_CHECK_EXISTS([dbus-1 >= $DBUS_RECURSIVE_MUTEX_VERSION],
111 [AC_DEFINE(DBUS_HAS_RECURSIVE_MUTEX, , [DBus supports recursive mutexes (needs DBus >= 0.95)])]
112)
113
114
115if test "$enable_glib" = "yes" ; then
116PKG_CHECK_MODULES([glib], glib-2.0)
117AC_SUBST(glib_CFLAGS)
118AC_SUBST(glib_LIBS)
119AM_CONDITIONAL(ENABLE_GLIB, test 1 = 1)
120PKG_CHECK_MODULES([gtkmm], gtkmm-2.4,
121 AM_CONDITIONAL(HAVE_GTKMM, test 1 = 1),
122 AM_CONDITIONAL(HAVE_GTKMM, test 0 = 1)
123)
124AC_SUBST(gtkmm_CFLAGS)
125AC_SUBST(gtkmm_LIBS)
126else
127AM_CONDITIONAL(ENABLE_GLIB, test 0 = 1)
128AM_CONDITIONAL(HAVE_GTKMM, test 0 = 1)
129fi
130
131if test "$enable_ecore" = "yes" ; then
132PKG_CHECK_MODULES([ecore], ecore)
133AC_SUBST(ecore_CFLAGS)
134AC_SUBST(ecore_LIBS)
135AM_CONDITIONAL(ENABLE_ECORE, test 1 = 1)
136else
137AM_CONDITIONAL(ENABLE_ECORE, test 0 = 1)
138fi
139
140if test "$enable_tests" = "yes" ; then
141AM_CONDITIONAL(ENABLE_TESTS, test 1 = 1)
142else
143AM_CONDITIONAL(ENABLE_TESTS, test 0 = 1)
144fi
145
146if test "$enable_examples" = "yes" ; then
147AM_CONDITIONAL(ENABLE_EXAMPLES, test 1 = 1)
148else
149AM_CONDITIONAL(ENABLE_EXAMPLES, test 0 = 1)
150fi
151
152AC_CHECK_LIB([expat], XML_ParserCreate_MM,
153 [AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false)],
154 have_expat=false)
155
156if ! $have_expat; then
157 AC_MSG_ERROR([You need the eXpat xml parser]
158 [http://expat.sourceforge.net/])
159fi
160
161xml_CFLAGS=
162xml_LIBS=-lexpat
163
164AC_SUBST(xml_CFLAGS)
165AC_SUBST(xml_LIBS)
166
167ACX_PTHREAD
168if test x"$acx_pthread_ok" = xyes; then
169 AC_DEFINE(HAVE_PTHREAD_H, 1, [Define to enable pthread support])
170 AM_CONDITIONAL(HAVE_PTHREAD, test x"$acx_pthread_ok" = xyes)
171fi
172
173# Doxygen Documentation
174
175AC_PATH_PROG(DOXYGEN, doxygen, no)
176
177AC_MSG_CHECKING([whether to build Doxygen documentation])
178
179if test "$DOXYGEN" = "no" ; then
180 have_doxygen=no
181else
182 have_doxygen=yes
183fi
184
185if test "$enable_doxygen_docs" = "auto" ; then
186 enable_doxygen_docs=no
187
188 AC_MSG_RESULT(no)
189fi
190
191if test "$enable_doxygen_docs" = "yes" ; then
192 if test "$have_doxygen" = "no"; then
193 AC_MSG_ERROR([Building Doxygen docs explicitly required, but Doxygen not found])
194 fi
195
196 AC_MSG_RESULT(yes)
197fi
198
199AM_CONDITIONAL(DBUS_DOXYGEN_DOCS_ENABLED, test "$enable_doxygen_docs" = "yes")
200
201# For the tools/, we need libdbus-c++ for the "build" architecture as well
202
203AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = "yes")
204
205AC_ARG_WITH(build-libdbus-cxx,
206 AS_HELP_STRING([--with-build-libdbus-cxx],
207 [For cross compilation: path to libdbus-cxx which was compiled for the 'build' system.]),
208 [ BUILD_LIBDBUS_CXX_DIR=${withval} ],
209 [ BUILD_LIBDBUS_CXX_DIR="\$(top_builddir)" ]
210)
211AC_SUBST(BUILD_LIBDBUS_CXX_DIR)
212
213# Save processed files
214
215AC_OUTPUT(
216 Makefile
217 src/Makefile
218 src/integration/Makefile
219 src/integration/ecore/Makefile
220 src/integration/glib/Makefile
221 tools/Makefile
222 test/Makefile
223 test/generator/Makefile
224 test/functional/Makefile
225 test/functional/Test1/Makefile
226 data/Makefile
227 doc/Makefile
228 doc/Doxyfile
229 examples/Makefile
230 examples/properties/Makefile
231 examples/echo/Makefile
232 examples/ecore/Makefile
233 examples/hal/Makefile
234 examples/glib/Makefile
235 examples/echo_ecore/Makefile
236 dbus-c++-1.pc
237 dbus-c++-1-uninstalled.pc
238 dbus-c++-ecore-1.pc
239 dbus-c++-ecore-1-uninstalled.pc
240 dbus-c++-glib-1.pc
241 dbus-c++-glib-1-uninstalled.pc
242 libdbus-c++.spec
243)
244
245echo
246echo "Build configuration:"
247echo "--------------------"
248echo
249echo "Mainloop integration support:"
250echo "ecore ......................... $enable_ecore"
251echo "glib........................... $enable_glib"
252echo
253echo "Optional build items:"
254echo "build tests.................... $enable_tests"
255echo "build examples................. $enable_examples"
256echo "build doxygen documentation.... $enable_doxygen_docs"
257echo "Cross Compiling activated...... $cross_compiling"
258echo "PThread support found.......... $acx_pthread_ok"
259echo
260