1 # Autojunk script for libdbus-c++
4 AC_INIT([libdbus-c++], 0.5.0, [shackan@gmail.com])
6 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
7 AM_CONFIG_HEADER([config.h])
11 AC_SUBST(PACKAGE_VERSION)
14 # Set configuration options
17 AS_HELP_STRING([--enable-debug],
18 [enable debugging support]),
19 [enable_debug=$enableval],
24 AS_HELP_STRING([--enable-glib],
25 [enable glib integration]),
26 [enable_glib=$enableval],
30 AC_ARG_ENABLE(doxygen-docs,
31 AS_HELP_STRING([--enable-doxygen-docs],
32 [build DOXYGEN documentation (requires Doxygen)]),
33 [enable_doxygen_docs=$enableval],
34 [enable_doxygen_docs=no]
44 CXX_FOR_BUILD=${CXX_FOR_BUILD-${CXX}}
45 AC_SUBST(CXX_FOR_BUILD)
52 AC_MSG_CHECKING([whether $CXX supports symbol visibility])
54 vtest=`$CXX --help --verbose 2>&1 | grep fvisibility`
56 if test -n "$vtest"; then
59 AC_DEFINE(GCC_HASCLASSVISIBILITY, 1, [to enable hidden symbols])
60 CXXFLAGS="-fvisibility=hidden"
66 # Check for dependencies
68 DBUS_REQUIRED_VERSION=0.60
69 PKG_CHECK_MODULES(dbus, [dbus-1 >= $DBUS_REQUIRED_VERSION],,
70 AC_MSG_ERROR([You need the DBus libraries (version 0.6 or better)]
71 [http://www.freedesktop.org/wiki/Software_2fdbus])
76 DBUS_API_STABLE_VERSION=1.0.0
77 PKG_CHECK_EXISTS([dbus-1 < $DBUS_API_STABLE_VERSION],
78 [AC_DEFINE(DBUS_API_SUBJECT_TO_CHANGE, , [unstable DBus])]
81 DBUS_THREADS_INIT_DEFAULT_VERSION=0.93
82 PKG_CHECK_EXISTS([dbus-1 >= $DBUS_THREADS_INIT_DEFAULT_VERSION],
83 [AC_DEFINE(DBUS_HAS_THREADS_INIT_DEFAULT, , [dbus_threads_init_default (needs DBus >= 0.93)])]
86 DBUS_RECURSIVE_MUTEX_VERSION=0.95
87 PKG_CHECK_EXISTS([dbus-1 >= $DBUS_RECURSIVE_MUTEX_VERSION],
88 [AC_DEFINE(DBUS_HAS_RECURSIVE_MUTEX, , [DBus supports recursive mutexes (needs DBus >= 0.95)])]
92 if test "$enable_glib" = "yes" ; then
93 PKG_CHECK_MODULES([glib], glib-2.0)
96 AM_CONDITIONAL(ENABLE_GLIB, test 1 = 1)
97 PKG_CHECK_MODULES([gtkmm], gtkmm-2.4,
98 AM_CONDITIONAL(HAVE_GTKMM, test 1 = 1),
99 AM_CONDITIONAL(HAVE_GTKMM, test 0 = 1)
101 AC_SUBST(gtkmm_CFLAGS)
104 AM_CONDITIONAL(ENABLE_GLIB, test 0 = 1)
105 AM_CONDITIONAL(HAVE_GTKMM, test 0 = 1)
108 AC_CHECK_LIB([expat], XML_ParserCreate_MM,
109 [AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false)],
112 if ! $have_expat; then
113 AC_MSG_ERROR([You need the eXpat xml parser]
114 [http://expat.sourceforge.net/])
123 AC_CHECK_LIB([pthread], pthread_create,
124 [AC_CHECK_HEADERS(pthread.h, have_pthread=true, have_pthread=false)],
127 if test "$have_pthread" = "false"; then
128 AC_MSG_ERROR([You need the POSIX Thread library (pthreads)])
131 if test "$enable_debug" = "yes" ; then
132 CXXFLAGS="$CXXFLAGS -Wall -ggdb -O0"
133 AC_DEFINE(DEBUG, 1, [Define to enable debug build])
135 CXXFLAGS="$CXXFLAGS -Wall -O3"
138 # Doxygen Documentation
140 AC_PATH_PROG(DOXYGEN, doxygen, no)
142 AC_MSG_CHECKING([whether to build Doxygen documentation])
144 if test "$DOXYGEN" = "no" ; then
150 if test "$enable_doxygen_docs" = "auto" ; then
151 enable_doxygen_docs=no
156 if test "$enable_doxygen_docs" = "yes" ; then
157 if test "$have_doxygen" = "no"; then
158 AC_MSG_ERROR([Building Doxygen docs explicitly required, but Doxygen not found])
164 AM_CONDITIONAL(DBUS_DOXYGEN_DOCS_ENABLED, test "$enable_doxygen_docs" = "yes")
166 # For the tools/, we need libdbus-c++ for the "build" architecture as well
168 AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = "yes")
170 AC_ARG_WITH(build-libdbus-cxx,
171 AS_HELP_STRING([--with-build-libdbus-cxx],
172 [For cross compilation: path to libdbus-cxx which was compiled for the 'build' system.]),
173 [ BUILD_LIBDBUS_CXX_DIR=${withval} ],
174 [ BUILD_LIBDBUS_CXX_DIR="\$(top_builddir)" ]
176 AC_SUBST(BUILD_LIBDBUS_CXX_DIR)
178 # Save processed files
188 examples/properties/Makefile
189 examples/echo/Makefile
190 examples/hal/Makefile
191 examples/glib/Makefile
192 examples/alarm/Makefile
193 examples/local/Makefile
195 dbus-c++-1-uninstalled.pc