Emeric Vigier | 2f62582 | 2012-08-06 11:09:52 -0400 | [diff] [blame] | 1 | # Autojunk script for libdbus-c++ |
| 2 | |
| 3 | AC_PREREQ(2.59) |
| 4 | AC_INIT([libdbus-c++], 0.9.0, [andreas.volz@tux-style.com]) |
| 5 | |
| 6 | AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) |
| 7 | AM_CONFIG_HEADER([config.h]) |
| 8 | AC_CONFIG_MACRO_DIR([m4]) |
| 9 | |
| 10 | AC_CANONICAL_HOST |
| 11 | |
| 12 | AC_SUBST(PACKAGE_VERSION) |
| 13 | |
| 14 | |
| 15 | # Set configuration options |
| 16 | |
| 17 | AC_ARG_ENABLE(ecore, |
| 18 | AS_HELP_STRING([--enable-ecore], |
| 19 | [enable ecore integration]), |
| 20 | [enable_ecore=$enableval], |
| 21 | [enable_ecore=yes] |
| 22 | ) |
| 23 | |
| 24 | AC_ARG_ENABLE(glib, |
| 25 | AS_HELP_STRING([--enable-glib], |
| 26 | [enable glib integration]), |
| 27 | [enable_glib=$enableval], |
| 28 | [enable_glib=yes] |
| 29 | ) |
| 30 | |
| 31 | AC_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 | |
| 38 | AC_ARG_ENABLE(tests, |
| 39 | AS_HELP_STRING([--enable-tests], |
| 40 | [build tests]), |
| 41 | [enable_tests=$enableval], |
| 42 | [enable_tests=yes] |
| 43 | ) |
| 44 | |
| 45 | AC_ARG_ENABLE(examples, |
| 46 | AS_HELP_STRING([--enable-examples], |
| 47 | [build examples]), |
| 48 | [enable_examples=$enableval], |
| 49 | [enable_examples=yes] |
| 50 | ) |
| 51 | |
| 52 | AC_CHECK_FUNCS(clock_gettime, [], [ |
| 53 | AC_CHECK_LIB(rt, clock_gettime, [ |
| 54 | AC_DEFINE(HAVE_CLOCK_GETTIME, 1) |
| 55 | RT_LIBS="-lrt" |
| 56 | ]) |
| 57 | ]) |
| 58 | AC_SUBST(RT_LIBS) |
| 59 | |
| 60 | # Check for programs |
| 61 | |
| 62 | AC_LANG_CPLUSPLUS |
| 63 | |
| 64 | AC_PROG_CC |
| 65 | AC_PROG_CXX |
| 66 | |
| 67 | CXX_FOR_BUILD=${CXX_FOR_BUILD-${CXX}} |
| 68 | AC_SUBST(CXX_FOR_BUILD) |
| 69 | |
| 70 | AM_PROG_LIBTOOL |
| 71 | |
| 72 | PKG_PROG_PKG_CONFIG |
| 73 | |
| 74 | |
| 75 | AC_MSG_CHECKING([whether $CXX supports symbol visibility]) |
| 76 | |
| 77 | vtest=`$CXX --help --verbose 2>&1 | grep fvisibility` |
| 78 | |
| 79 | if 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" |
| 84 | else |
| 85 | AC_MSG_RESULT(no) |
| 86 | fi |
| 87 | |
| 88 | |
| 89 | # Check for dependencies |
| 90 | |
| 91 | DBUS_REQUIRED_VERSION=0.60 |
| 92 | PKG_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 | ) |
| 96 | AC_SUBST(dbus_CFLAGS) |
| 97 | AC_SUBST(dbus_LIBS) |
| 98 | |
| 99 | DBUS_API_STABLE_VERSION=1.0.0 |
| 100 | PKG_CHECK_EXISTS([dbus-1 < $DBUS_API_STABLE_VERSION], |
| 101 | [AC_DEFINE(DBUS_API_SUBJECT_TO_CHANGE, , [unstable DBus])] |
| 102 | ) |
| 103 | |
| 104 | DBUS_THREADS_INIT_DEFAULT_VERSION=0.93 |
| 105 | PKG_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 | |
| 109 | DBUS_RECURSIVE_MUTEX_VERSION=0.95 |
| 110 | PKG_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 | |
| 115 | if test "$enable_glib" = "yes" ; then |
| 116 | PKG_CHECK_MODULES([glib], glib-2.0) |
| 117 | AC_SUBST(glib_CFLAGS) |
| 118 | AC_SUBST(glib_LIBS) |
| 119 | AM_CONDITIONAL(ENABLE_GLIB, test 1 = 1) |
| 120 | PKG_CHECK_MODULES([gtkmm], gtkmm-2.4, |
| 121 | AM_CONDITIONAL(HAVE_GTKMM, test 1 = 1), |
| 122 | AM_CONDITIONAL(HAVE_GTKMM, test 0 = 1) |
| 123 | ) |
| 124 | AC_SUBST(gtkmm_CFLAGS) |
| 125 | AC_SUBST(gtkmm_LIBS) |
| 126 | else |
| 127 | AM_CONDITIONAL(ENABLE_GLIB, test 0 = 1) |
| 128 | AM_CONDITIONAL(HAVE_GTKMM, test 0 = 1) |
| 129 | fi |
| 130 | |
| 131 | if test "$enable_ecore" = "yes" ; then |
| 132 | PKG_CHECK_MODULES([ecore], ecore) |
| 133 | AC_SUBST(ecore_CFLAGS) |
| 134 | AC_SUBST(ecore_LIBS) |
| 135 | AM_CONDITIONAL(ENABLE_ECORE, test 1 = 1) |
| 136 | else |
| 137 | AM_CONDITIONAL(ENABLE_ECORE, test 0 = 1) |
| 138 | fi |
| 139 | |
| 140 | if test "$enable_tests" = "yes" ; then |
| 141 | AM_CONDITIONAL(ENABLE_TESTS, test 1 = 1) |
| 142 | else |
| 143 | AM_CONDITIONAL(ENABLE_TESTS, test 0 = 1) |
| 144 | fi |
| 145 | |
| 146 | if test "$enable_examples" = "yes" ; then |
| 147 | AM_CONDITIONAL(ENABLE_EXAMPLES, test 1 = 1) |
| 148 | else |
| 149 | AM_CONDITIONAL(ENABLE_EXAMPLES, test 0 = 1) |
| 150 | fi |
| 151 | |
| 152 | AC_CHECK_LIB([expat], XML_ParserCreate_MM, |
| 153 | [AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false)], |
| 154 | have_expat=false) |
| 155 | |
| 156 | if ! $have_expat; then |
| 157 | AC_MSG_ERROR([You need the eXpat xml parser] |
| 158 | [http://expat.sourceforge.net/]) |
| 159 | fi |
| 160 | |
| 161 | xml_CFLAGS= |
| 162 | xml_LIBS=-lexpat |
| 163 | |
| 164 | AC_SUBST(xml_CFLAGS) |
| 165 | AC_SUBST(xml_LIBS) |
| 166 | |
| 167 | ACX_PTHREAD |
| 168 | if 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) |
| 171 | fi |
| 172 | |
| 173 | # Doxygen Documentation |
| 174 | |
| 175 | AC_PATH_PROG(DOXYGEN, doxygen, no) |
| 176 | |
| 177 | AC_MSG_CHECKING([whether to build Doxygen documentation]) |
| 178 | |
| 179 | if test "$DOXYGEN" = "no" ; then |
| 180 | have_doxygen=no |
| 181 | else |
| 182 | have_doxygen=yes |
| 183 | fi |
| 184 | |
| 185 | if test "$enable_doxygen_docs" = "auto" ; then |
| 186 | enable_doxygen_docs=no |
| 187 | |
| 188 | AC_MSG_RESULT(no) |
| 189 | fi |
| 190 | |
| 191 | if 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) |
| 197 | fi |
| 198 | |
| 199 | AM_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 | |
| 203 | AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = "yes") |
| 204 | |
| 205 | AC_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 | ) |
| 211 | AC_SUBST(BUILD_LIBDBUS_CXX_DIR) |
| 212 | |
| 213 | # Save processed files |
| 214 | |
| 215 | AC_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 | |
| 245 | echo |
| 246 | echo "Build configuration:" |
| 247 | echo "--------------------" |
| 248 | echo |
| 249 | echo "Mainloop integration support:" |
| 250 | echo "ecore ......................... $enable_ecore" |
| 251 | echo "glib........................... $enable_glib" |
| 252 | echo |
| 253 | echo "Optional build items:" |
| 254 | echo "build tests.................... $enable_tests" |
| 255 | echo "build examples................. $enable_examples" |
| 256 | echo "build doxygen documentation.... $enable_doxygen_docs" |
| 257 | echo "Cross Compiling activated...... $cross_compiling" |
| 258 | echo "PThread support found.......... $acx_pthread_ok" |
| 259 | echo |
| 260 | |