Simplify dbus_bindings backwards compatibility glue
[dbus-python-phuang.git] / configure.ac
blobcb783e9b4060809bbfdb424029ab6ee4bec53578
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, 80)
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=no)
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   if test -z "$EPYDOC"; then
85     case "$enable_api_docs" in
86       if*possible)
87         enable_api_docs=no
88         ;;
89       *)
90         AC_MSG_ERROR([cannot compile API documentation without epydoc installed])
91         ;;
92     esac
93   fi
96 RST2HTMLFLAGS=
97 if test "${enable_html_docs}" != no; then
98   AC_CHECK_PROGS([RST2HTML], [rst2html rst2html.py], [])
99   if test -z "$RST2HTML"; then
100     case "$enable_html_docs" in
101       if*possible)
102         enable_html_docs=no
103       ;;
104       *)
105         AC_MSG_ERROR([cannot compile HTML documentation without rst2html installed])
106       ;;
107     esac
108   else
109     DBUS_PY_ADD_RST2HTMLFLAG([--generator])
110     DBUS_PY_ADD_RST2HTMLFLAG([--date])
111     DBUS_PY_ADD_RST2HTMLFLAG([--time])
112     DBUS_PY_ADD_RST2HTMLFLAG([--exit-status=2])
113     DBUS_PY_ADD_RST2HTMLFLAG([--no-raw])
114     DBUS_PY_ADD_RST2HTMLFLAG([--no-file-insertion])
115     DBUS_PY_ADD_RST2HTMLFLAG([--cloak-email-addresses])
116   fi
118 AC_SUBST([RST2HTML])
119 AC_SUBST([RST2HTMLFLAGS])
121 AM_CONDITIONAL([ENABLE_API_DOCS], [test "$enable_api_docs" != no])
122 AM_CONDITIONAL([ENABLE_DOCS], [test "$enable_html_docs" != no])
124 PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.93])
125 PKG_CHECK_MODULES(DBUS_GLIB, [dbus-glib-1 >= 0.70])
127 dnl add required cflags ...
128 JH_ADD_CFLAG([-Wall])
129 JH_ADD_CFLAG([-Wextra])
130 JH_ADD_CFLAG([-Wno-missing-field-initializers])
131 JH_ADD_CFLAG([-Wdeclaration-after-statement])
132 JH_ADD_CFLAG([-std=c9x])
133 JH_ADD_CFLAG([-fno-strict-aliasing])
135 AC_ARG_ENABLE(Werror,
136 AC_HELP_STRING([--enable-Werror],
137                [Treat warnings as errors, if the compiler supports it]),
138 enable_Werror=$enableval, enable_Werror=no)
139 if test "x$enable_Werror" = xyes; then
140   JH_ADD_CFLAG([-Werror])
143 ifelse(dbus_python_released, 1,
144     [ # version x.y.z - disable coding style checks by default
145 AC_ARG_ENABLE(coding-style-checks,
146   AC_HELP_STRING([--enable-coding-style-checks],
147                  [check coding style using grep]),
148     [ENABLE_CODING_STYLE_CHECKS=$enableval], [ENABLE_CODING_STYLE_CHECKS=no] )
149     ],
150     [ # version x.y.z.200xyyzz - enable coding style checks by default
151 AC_ARG_ENABLE(coding-style-checks,
152   AC_HELP_STRING([--disable-coding-style-checks],
153                  [don't check coding style using grep]),
154     [ENABLE_CODING_STYLE_CHECKS=$enableval], [ENABLE_CODING_STYLE_CHECKS=yes])
155     ])
157 AC_CONFIG_FILES(
158   Makefile
159   _dbus_bindings/Makefile
160   _dbus_glib_bindings/Makefile
161   dbus/Makefile
162   dbus-python.pc
163   dbus/_version.py
164   doc/tutorial.txt
165   examples/Makefile
166   m4/Makefile
167   test/Makefile
168   test/tmp-session-bus.conf
169   test/TestSuitePythonService.service
170   tools/Makefile)
171 AC_OUTPUT