Add tomic counter into RefPtr. (Glenn Schmottlach)
[dbus-cxx-async.git] / configure.ac
blob15fd572e4264ea06f48c520c36d32439b218d238
1 # Autojunk script for libdbus-c++
3 AC_PREREQ(2.59)
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])
9 AC_CANONICAL_HOST
11 AC_SUBST(PACKAGE_VERSION)
14 # Set configuration options
16 AC_ARG_ENABLE(debug,
17         AS_HELP_STRING([--enable-debug],
18                 [enable debugging support]),
19         [enable_debug=$enableval],
20         [enable_debug=no]
23 AC_ARG_ENABLE(glib,
24         AS_HELP_STRING([--enable-glib],
25                 [enable glib integration]),
26         [enable_glib=$enableval],
27         [enable_glib=no]
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]
37 # Check for programs
39 AC_LANG_CPLUSPLUS
41 AC_PROG_CC
42 AC_PROG_CXX
44 CXX_FOR_BUILD=${CXX_FOR_BUILD-${CXX}}
45 AC_SUBST(CXX_FOR_BUILD)
47 AM_PROG_LIBTOOL
49 PKG_PROG_PKG_CONFIG
52 AC_MSG_CHECKING([whether $CXX supports symbol visibility])
54 vtest=`$CXX --help --verbose 2>&1 | grep fvisibility`
56 if test -n "$vtest"; then
57         AC_MSG_RESULT(yes)
59         AC_DEFINE(GCC_HASCLASSVISIBILITY, 1, [to enable hidden symbols])
60         CXXFLAGS="-fvisibility=hidden"
61 else
62         AC_MSG_RESULT(no)
63 fi 
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])
73 AC_SUBST(dbus_CFLAGS)
74 AC_SUBST(dbus_LIBS)
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)
94 AC_SUBST(glib_CFLAGS)
95 AC_SUBST(glib_LIBS)
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)
102 AC_SUBST(gtkmm_LIBS)
103 else
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)],
110         have_expat=false)
112 if ! $have_expat; then
113         AC_MSG_ERROR([You need the eXpat xml parser]
114                 [http://expat.sourceforge.net/])
117 xml_CFLAGS=
118 xml_LIBS=-lexpat
120 AC_SUBST(xml_CFLAGS)
121 AC_SUBST(xml_LIBS)
123 AC_CHECK_LIB([pthread], pthread_create,
124         [AC_CHECK_HEADERS(pthread.h, have_pthread=true, have_pthread=false)],
125         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])
134 else
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
145         have_doxygen=no
146 else
147         have_doxygen=yes
150 if test "$enable_doxygen_docs" = "auto" ; then
151         enable_doxygen_docs=no
153         AC_MSG_RESULT(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])
159         fi
161         AC_MSG_RESULT(yes)
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
180 AC_OUTPUT(
181         Makefile
182         src/Makefile
183         tools/Makefile
184         data/Makefile
185         doc/Makefile
186         doc/Doxyfile
187         examples/Makefile
188         examples/properties/Makefile
189         examples/echo/Makefile
190         examples/hal/Makefile
191         examples/glib/Makefile
192         examples/alarm/Makefile
193         examples/local/Makefile
194         dbus-c++-1.pc
195         dbus-c++-1-uninstalled.pc
196         libdbus-c++.spec