Use AC_PREREQ(2.59c) to make sure we can use docdir, which is relatively new
[dbus-python-phuang.git] / configure.ac
blob25f797bfe9a22cfbb8df345d92c6cb30b5c15b26
1 -*- mode: m4 -*-
2 AC_PREREQ(2.59c)
4 dnl If not 1, append datestamp to the version number and build with -Werror
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, 80)
9 m4_define(dbus_python_micro_version, 1)
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://bugzilla.gnome.org/enter_bug.cgi?product=dbus&component=python])
22 AC_DEFINE(DBUS_PYTHON_MAJOR_VERSION, dbus_python_major_version, [dbus-python major version])
23 AC_SUBST(DBUS_PYTHON_MAJOR_VERSION, dbus_python_major_version)
24 AC_DEFINE(DBUS_PYTHON_MINOR_VERSION, dbus_python_minor_version, [dbus-python minor version])
25 AC_SUBST(DBUS_PYTHON_MINOR_VERSION, dbus_python_minor_version)
26 AC_DEFINE(DBUS_PYTHON_MICRO_VERSION, dbus_python_micro_version, [dbus-python micro version])
27 AC_SUBST(DBUS_PYTHON_MICRO_VERSION, dbus_python_micro_version)
29 AC_CONFIG_SRCDIR([_dbus_bindings/module.c])
30 AM_CONFIG_HEADER(config.h)
32 AM_INIT_AUTOMAKE
34 dnl put the ACLOCAL flags in the makefile
35 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
37 AC_CANONICAL_BUILD
38 AC_CANONICAL_HOST
40 AC_DISABLE_STATIC
42 dnl XXXX hack to kill off all the libtool tags ...
43 dnl it isn't like we are using C++ or Fortran.
44 dnl (copied from libglade/configure.in)
45 m4_define([_LT_AC_TAGCONFIG],[])
47 AC_PROG_LIBTOOL
49 AM_PATH_PYTHON(2.4.0)
51 AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
53 PLATFORM=`$PYTHON -c "from distutils import util; print util.get_platform()"`
54 AC_SUBST(PLATFORM)
56 dnl Building documentation
58 AC_MSG_CHECKING([whether you want to build HTML docs])
59 AC_ARG_ENABLE(html-docs,
60 AC_HELP_STRING([--disable-html-docs], [Disable HTML documentation building (requires docutils)]), enable_html_docs=$enableval, enable_html_docs="if possible")
61 AC_MSG_RESULT([$enable_html_docs])
63 AC_MSG_CHECKING([whether you want to build API docs])
64 AC_ARG_ENABLE(api-docs,
65 AC_HELP_STRING([--enable-api-docs], [Enable API documentation building (requires epydoc 3 and docutils)]), enable_api_docs=$enableval, enable_api_docs=no)
66 AC_MSG_RESULT([$enable_api_docs])
69 if test "$enable_api_docs" != no || test "$enable_html_docs" != no; then
70   AM_CHECK_PYMOD([docutils], [__version__], [have_docutils=yes], [have_docutils=no])
71   if test "$have_docutils" = no; then
72     if test "$enable_api_docs" = "if possible"; then
73        enable_api_docs=no
74     fi
75     if test "$enable_html_docs" = "if possible"; then
76        enable_html_docs=no
77     fi
78     if test "$enable_api_docs" != no || test "$enable_html_docs" != no; then
79       AC_MSG_ERROR([cannot compile HTML documentation or API documentation without python-docutils installed])
80     fi
81   fi
84 if test "${enable_api_docs}" != no; then
85   AC_PATH_PROG([EPYDOC], [epydoc])
86   if test -z "$EPYDOC"; then
87     case "$enable_api_docs" in
88       if*possible)
89         enable_api_docs=no
90         ;;
91       *)
92         AC_MSG_ERROR([cannot compile API documentation without epydoc installed])
93         ;;
94     esac
95   fi
98 RST2HTMLFLAGS=
99 if test "${enable_html_docs}" != no; then
100   AC_CHECK_PROGS([RST2HTML], [rst2html rst2html.py], [])
101   if test -z "$RST2HTML"; then
102     case "$enable_html_docs" in
103       if*possible)
104         enable_html_docs=no
105         ;;
106       *)
107         AC_MSG_ERROR([cannot compile HTML documentation without rst2html installed])
108         ;;
109     esac
110   else
111     DBUS_PY_ADD_RST2HTMLFLAG([--generator])
112     DBUS_PY_ADD_RST2HTMLFLAG([--date])
113     DBUS_PY_ADD_RST2HTMLFLAG([--time])
114     DBUS_PY_ADD_RST2HTMLFLAG([--exit-status=2])
115     DBUS_PY_ADD_RST2HTMLFLAG([--no-raw])
116     DBUS_PY_ADD_RST2HTMLFLAG([--no-file-insertion])
117     DBUS_PY_ADD_RST2HTMLFLAG([--cloak-email-addresses])
118   fi
120 AC_SUBST([RST2HTML])
121 AC_SUBST([RST2HTMLFLAGS])
123 AM_CONDITIONAL([ENABLE_API_DOCS], [test "$enable_api_docs" != no])
124 AM_CONDITIONAL([ENABLE_DOCS], [test "$enable_html_docs" != no])
126 PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.93])
127 PKG_CHECK_MODULES(DBUS_GLIB, [dbus-glib-1 >= 0.70])
129 dnl add required cflags ...
130 JH_ADD_CFLAG([-Wall])
131 JH_ADD_CFLAG([-Wextra])
132 JH_ADD_CFLAG([-Wno-missing-field-initializers])
133 JH_ADD_CFLAG([-Wdeclaration-after-statement])
134 JH_ADD_CFLAG([-std=c9x])
135 JH_ADD_CFLAG([-fno-strict-aliasing])
136 [if test x]dbus_python_released[ != x1; then]
137   JH_ADD_CFLAG([-Werror])
138 [fi]
140 AC_CONFIG_FILES(
141   Makefile
142   _dbus_bindings/Makefile
143   _dbus_glib_bindings/Makefile
144   dbus/Makefile
145   dbus-python.pc
146   dbus/_version.py
147   doc/tutorial.txt
148   examples/Makefile
149   test/Makefile
150   test/tmp-session-bus.conf
151   test/TestSuitePythonService.service)
152 AC_OUTPUT