Update NEWS
[dbus-python-phuang.git] / configure.ac
blobce7d41a0f52ef701559c8fe103da08bf0f43afd1
1 -*- mode: m4 -*-
2 AC_PREREQ(2.59c)
4 dnl If not 1, append datestamp to the version number
5 m4_define(dbus_python_released, 0)
6 dnl The dbus-python version number (must actually be numeric at the moment)
7 m4_define(dbus_python_major_version, 0)
8 m4_define(dbus_python_minor_version, 82)
9 m4_define(dbus_python_micro_version, 2)
11 m4_define(dbus_python_maybe_datestamp,
12           m4_esyscmd([if test x]dbus_python_released[ != x1; then date +.%Y%m%d | tr -d '\n\r'; fi]))
14 m4_define(dbus_python_version, dbus_python_major_version.dbus_python_minor_version.dbus_python_micro_version[]dbus_python_maybe_datestamp)
16 dnl versions of packages we require ...
17 dnl m4_define(glib_required_version, 2.8.0)
19 AC_INIT(dbus-python, dbus_python_version,
20         [http://bugs.freedesktop.org/enter_bug.cgi?product=dbus&component=python])
21 AC_CONFIG_MACRO_DIR([m4])
23 AC_DEFINE(DBUS_PYTHON_MAJOR_VERSION, dbus_python_major_version, [dbus-python major version])
24 AC_SUBST(DBUS_PYTHON_MAJOR_VERSION, dbus_python_major_version)
25 AC_DEFINE(DBUS_PYTHON_MINOR_VERSION, dbus_python_minor_version, [dbus-python minor version])
26 AC_SUBST(DBUS_PYTHON_MINOR_VERSION, dbus_python_minor_version)
27 AC_DEFINE(DBUS_PYTHON_MICRO_VERSION, dbus_python_micro_version, [dbus-python micro version])
28 AC_SUBST(DBUS_PYTHON_MICRO_VERSION, dbus_python_micro_version)
30 AC_CONFIG_SRCDIR([_dbus_bindings/module.c])
31 AM_CONFIG_HEADER(config.h)
33 AM_INIT_AUTOMAKE
35 AC_CANONICAL_BUILD
36 AC_CANONICAL_HOST
38 AC_DISABLE_STATIC
40 dnl XXXX hack to kill off all the libtool tags ...
41 dnl it isn't like we are using C++ or Fortran.
42 dnl (copied from libglade/configure.in)
43 m4_define([_LT_AC_TAGCONFIG],[])
45 AC_PROG_LIBTOOL
47 AM_PATH_PYTHON(2.4.0)
49 AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
51 PLATFORM=`$PYTHON -c "from distutils import util; print util.get_platform()"`
52 AC_SUBST(PLATFORM)
54 dnl Building documentation
56 AC_MSG_CHECKING([whether you want to build HTML docs])
57 AC_ARG_ENABLE(html-docs,
58 AC_HELP_STRING([--enable-html-docs], [Enable HTML documentation building (requires docutils, default: auto-detect)]), enable_html_docs=$enableval, enable_html_docs="if possible")
59 AC_MSG_RESULT([$enable_html_docs])
61 AC_MSG_CHECKING([whether you want to build API docs])
62 AC_ARG_ENABLE(api-docs,
63 AC_HELP_STRING([--enable-api-docs], [Enable API documentation building (requires epydoc 3 and docutils)]), enable_api_docs=$enableval, enable_api_docs="if possible")
64 AC_MSG_RESULT([$enable_api_docs])
67 if test "$enable_api_docs" != no || test "$enable_html_docs" != no; then
68   AM_CHECK_PYMOD([docutils], [__version__], [have_docutils=yes], [have_docutils=no])
69   if test "$have_docutils" = no; then
70     if test "$enable_api_docs" = "if possible"; then
71        enable_api_docs=no
72     fi
73     if test "$enable_html_docs" = "if possible"; then
74        enable_html_docs=no
75     fi
76     if test "$enable_api_docs" != no || test "$enable_html_docs" != no; then
77       AC_MSG_ERROR([cannot compile HTML documentation or API documentation without python-docutils installed])
78     fi
79   fi
82 if test "${enable_api_docs}" != no; then
83   AC_PATH_PROG([EPYDOC], [epydoc])
84   AC_MSG_CHECKING([epydoc 3])
85   if test -n "$EPYDOC"; then
86     EPYDOC_VERSION=`$EPYDOC --version`
87     case "$EPYDOC_VERSION" in
88       *ersion?3*)
89         AC_MSG_RESULT([yes, $EPYDOC_VERSION])
90         ;;
91       *)
92         AC_MSG_RESULT([no, $EPYDOC_VERSION])
93         EPYDOC=
94         ;;
95     esac
96   fi
97   if test -z "$EPYDOC"; then
98     case "$enable_api_docs" in
99       if*possible)
100         enable_api_docs=no
101         ;;
102       *)
103         AC_MSG_ERROR([cannot compile API documentation without epydoc 3.0beta1 or newer installed])
104         ;;
105     esac
106   fi
109 RST2HTMLFLAGS=
110 if test "${enable_html_docs}" != no; then
111   AC_CHECK_PROGS([RST2HTML], [rst2html rst2html.py], [])
112   if test -z "$RST2HTML"; then
113     case "$enable_html_docs" in
114       if*possible)
115         enable_html_docs=no
116       ;;
117       *)
118         AC_MSG_ERROR([cannot compile HTML documentation without rst2html installed])
119       ;;
120     esac
121   else
122     DBUS_PY_ADD_RST2HTMLFLAG([--generator])
123     DBUS_PY_ADD_RST2HTMLFLAG([--date])
124     DBUS_PY_ADD_RST2HTMLFLAG([--time])
125     DBUS_PY_ADD_RST2HTMLFLAG([--exit-status=2])
126     DBUS_PY_ADD_RST2HTMLFLAG([--no-raw])
127     DBUS_PY_ADD_RST2HTMLFLAG([--no-file-insertion])
128     DBUS_PY_ADD_RST2HTMLFLAG([--cloak-email-addresses])
129   fi
131 AC_SUBST([RST2HTML])
132 AC_SUBST([RST2HTMLFLAGS])
134 AM_CONDITIONAL([ENABLE_API_DOCS], [test "$enable_api_docs" != no])
135 AM_CONDITIONAL([ENABLE_DOCS], [test "$enable_html_docs" != no])
137 PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.93])
138 PKG_CHECK_MODULES(DBUS_GLIB, [dbus-glib-1 >= 0.70])
140 dnl avoid deprecated stuff if possible
141 AC_CHECK_LIB([dbus-1], [dbus_watch_get_unix_fd],
142              [AC_DEFINE([HAVE_DBUS_WATCH_GET_UNIX_FD], [],
143                         [Define if libdbus-1 has dbus_watch_get_unix_fd])],
144              [:], [$DBUS_LIBS])
146 dnl add required cflags ...
147 JH_ADD_CFLAG([-Wall])
148 JH_ADD_CFLAG([-Wextra])
149 JH_ADD_CFLAG([-Wno-missing-field-initializers])
150 JH_ADD_CFLAG([-Wdeclaration-after-statement])
151 JH_ADD_CFLAG([-std=c9x])
152 JH_ADD_CFLAG([-fno-strict-aliasing])
154 AC_ARG_ENABLE(Werror,
155 AC_HELP_STRING([--enable-Werror],
156                [Treat warnings as errors, if the compiler supports it]),
157 enable_Werror=$enableval, enable_Werror=no)
158 if test "x$enable_Werror" = xyes; then
159   JH_ADD_CFLAG([-Werror])
162 ifelse(dbus_python_released, 1,
163     [ # version x.y.z - disable coding style checks by default
164 AC_ARG_ENABLE(coding-style-checks,
165   AC_HELP_STRING([--enable-coding-style-checks],
166                  [check coding style using grep]),
167     [ENABLE_CODING_STYLE_CHECKS=$enableval], [ENABLE_CODING_STYLE_CHECKS=no] )
168     ],
169     [ # version x.y.z.200xyyzz - enable coding style checks by default
170 AC_ARG_ENABLE(coding-style-checks,
171   AC_HELP_STRING([--disable-coding-style-checks],
172                  [don't check coding style using grep]),
173     [ENABLE_CODING_STYLE_CHECKS=$enableval], [ENABLE_CODING_STYLE_CHECKS=yes])
174     ])
176 AC_CONFIG_FILES(
177   Makefile
178   _dbus_bindings/Makefile
179   _dbus_glib_bindings/Makefile
180   dbus/Makefile
181   dbus-python.pc
182   dbus/_version.py
183   examples/Makefile
184   m4/Makefile
185   test/Makefile
186   test/tmp-session-bus.conf
187   test/TestSuitePythonService.service
188   tools/Makefile)
189 AC_OUTPUT