configure: Allow choice of backend for PDF generation.
[comedilib.git] / configure.ac
1 # libtool version: current:revision:age
2 #
3 # If the library source code has changed at all since the last update, then
4 # increment revision (`c:r:a' becomes `c:r+1:a').
5 #
6 # If any interfaces have been added, removed, or changed since the last update,
7 # increment current, and set revision to 0.
8 #
9 # If any interfaces have been added since the last public release, then
10 # increment age.
11 #
12 # If any interfaces have been removed since the last public release, then set
13 # age to 0.
14 #
15 # In summary:
16 #
17 #  If any interface has been changed or removed, `c:r:a' becomes `c+1:0:0';
18 #  else if any interface has been added, `c:r:a' becomes `c+1:0:a+1';
19 #  else, `c:r:a' becomes `c:r+1:a'.
20 #
21 m4_define([comedilib_lt_current], [10])
22 m4_define([comedilib_lt_revision], [0])
23 m4_define([comedilib_lt_age], [10])
24
25 #libscxi c:r:a
26 m4_define([scxi_lt_current], [9])
27 m4_define([scxi_lt_revision], [0])
28 m4_define([scxi_lt_age], [9])
29
30 # comedilib version: major.minor.micro
31 #
32 # Currently:
33 #  * 'major' may be incremented at the whim of the maintainers.
34 #  * 'minor' is libtool 'current' minus the value of 'current' when major
35 #    changed (comedilib_major_base_current).
36 #  * 'micro' is libtool 'revision'.
37
38 # Manually set 'comedilib_major_base_current' to new 'comedilib_lt_current'
39 # whenever 'comedilib_version_major' is incremented below.
40 m4_define([comedilib_major_base_current], [0])
41
42 m4_define([comedilib_version_major], [0])
43 m4_define([comedilib_version_minor],
44           [m4_eval(comedilib_lt_current - comedilib_major_base_current)])
45 m4_define([comedilib_version_micro], [comedilib_lt_revision])
46 m4_define([comedilib_pkg_version],
47           [comedilib_version_major.comedilib_version_minor.comedilib_version_micro])
48
49 AC_INIT([comedilib], [comedilib_pkg_version])
50 AC_CANONICAL_TARGET([])
51
52 COMEDILIB_VERSION_MAJOR=comedilib_version_major
53 COMEDILIB_VERSION_MINOR=comedilib_version_minor
54 COMEDILIB_VERSION_MICRO=comedilib_version_micro
55 AC_SUBST(COMEDILIB_VERSION_MAJOR)
56 AC_SUBST(COMEDILIB_VERSION_MINOR)
57 AC_SUBST(COMEDILIB_VERSION_MICRO)
58
59 AC_CONFIG_MACRO_DIR([m4])
60 AC_CONFIG_AUX_DIR([.])
61 #COMEDILIB_DEBUG="-Wall -Werror"
62 COMEDILIB_DEBUG="-Wall"
63 AM_INIT_AUTOMAKE([-Wall -Werror])
64
65 # AS_LIBTOOL arguments are (prefix, current, revision, age)
66 AS_LIBTOOL(COMEDILIB, comedilib_lt_current, comedilib_lt_revision, comedilib_lt_age)
67 SCXI_SO_VERSION=scxi_lt_current:scxi_lt_revision:scxi_lt_age
68 AC_SUBST(SCXI_SO_VERSION)
69
70 AM_CONFIG_HEADER(config.h)
71
72 ACLOCAL="$ACLOCAL -I m4"
73
74 AM_MAINTAINER_MODE
75
76 AC_PROG_CC
77 AM_PROG_CC_C_O
78 AC_PROG_CC_STDC
79 AC_ISC_POSIX
80 AM_PROG_LEX
81 AC_PROG_YACC
82 AC_PROG_LIBTOOL
83
84 AC_HEADER_STDC([])
85
86 AX_TLS
87
88 COMEDILIB_CFLAGS="$COMEDILIB_CFLAGS -I\$(top_srcdir)/include -I\$(top_builddir)/include $COMEDILIB_DEBUG"
89 COMEDILIB_LIBS="$COMEDILIB_LIBS \$(top_builddir)/lib/libcomedi.la -lm"
90 AC_SUBST(COMEDILIB_CFLAGS)
91 AC_SUBST(COMEDILIB_LIBS)
92
93 # autoconf backwards compatibility
94 if test "$datarootdir" = ""; then
95         datarootdir='${datadir}'
96         AC_SUBST(datarootdir)
97 fi
98
99 if test "$docdir" = ""; then
100         docdir='${datarootdir}/doc/${PACKAGE}'
101         AC_SUBST(docdir)
102 fi
103
104 if test "$htmldir" = ""; then
105         htmldir='${docdir}'
106         AC_SUBST(htmldir)
107 fi
108
109 if test "$pdfdir" = ""; then
110         pdfdir='${docdir}'
111         AC_SUBST(pdfdir)
112 fi
113
114 #swig
115 AC_PATH_PROG(SWIG, swig, "no")
116 if test "$SWIG" == "no" ; then
117         AC_MSG_WARN([swig not found, will not be able to build swig based bindings])
118 fi
119
120 #python
121 AC_ARG_ENABLE([python-binding],
122         [AS_HELP_STRING([--disable-python-binding],
123                 [Disable building of Python binding])],
124         [ENABLE_PYTHON=$enableval],[ENABLE_PYTHON="yes"])
125 if test "$ENABLE_PYTHON" == "yes" && test "$SWIG" != "no"; then
126         AM_PATH_PYTHON
127         AM_CHECK_PYTHON_HEADERS(HAVE_PYTHON=yes,[HAVE_PYTHON=no;AC_MSG_WARN([python headers not found, disabling python binding])])
128 else
129         HAVE_PYTHON="no"
130 fi
131 AM_CONDITIONAL(HAVE_PYTHON, [test "$HAVE_PYTHON" == "yes" && test "$ENABLE_PYTHON" == "yes"])
132
133 AS_COMPILER_FLAG([-fno-strict-aliasing],[PYTHON_QUIET="$PYTHON_QUIET -fno-strict-aliasing"], true )
134 AS_COMPILER_FLAG([-Wno-unused-function],[PYTHON_QUIET="$PYTHON_QUIET -Wno-unused-function"], true )
135 AC_SUBST(PYTHON_QUIET)
136
137 # ruby
138 AC_ARG_ENABLE([ruby-binding],
139         [AS_HELP_STRING([--enable-ruby-binding],
140                 [Enable building of Ruby binding])],
141         [ENABLE_RUBY=$enableval], [ENABLE_RUBY="no"])
142 if test "$ENABLE_RUBY" == "yes" && test "$SWIG" != "no"; then
143         AC_PATH_PROG(RUBY, ruby, no)
144         if test "$RUBY" != "no" ; then
145                 RUBY_INC_DIR=`$RUBY -e "require 'rbconfig'; c = ::Config::CONFIG; print c[['archdir']];"`
146                 AC_CHECK_HEADER([$RUBY_INC_DIR/ruby.h],[],[ENABLE_RUBY="no";AC_MSG_WARN([ruby.h not found, disabling Ruby binding])])
147         else
148                 AC_MSG_WARN([ruby not found, disabling ruby binding])
149                 ENABLE_RUBY="no"
150         fi
151 else
152         ENABLE_RUBY="no"
153 fi
154
155 AM_CONDITIONAL(HAVE_RUBY, [test "$ENABLE_RUBY" == "yes"])
156
157 AC_ARG_VAR(RUBY_PREFIX,[path prefix for Ruby binding])
158 AC_ARG_VAR(RUBY_SO_DIR,[path for Ruby extensions])
159 if test "$RUBY_PREFIX" != "" ; then
160         RUBY_CONFIG_OPTIONS="$RUBY_CONFIG_OPTIONS --prefix=\$(RUBY_PREFIX)"
161 fi
162 if test "$RUBY_SO_DIR" != "" ; then
163         RUBY_CONFIG_OPTIONS="$RUBY_CONFIG_OPTIONS --so-dir=\$(RUBY_SO_DIR)"
164 fi
165 AC_SUBST(RUBY_CONFIG_OPTIONS)
166
167 # scxi
168 AC_ARG_ENABLE([scxi],
169         [AS_HELP_STRING([--enable-scxi], [Enable SCXI convenience library])],
170         [ENABLE_SCXI=$enableval], [ENABLE_SCXI="no"])
171 AM_CONDITIONAL(BUILD_SCXI, [test "$ENABLE_SCXI" == "yes"])
172
173 # docbook
174 AC_ARG_ENABLE([docbook],
175         [AS_HELP_STRING([--disable-docbook], [Disable docbook])],
176         [ENABLE_DOCBOOK=$enableval],[ENABLE_DOCBOOK="yes"])
177
178 if test "$ENABLE_DOCBOOK" == "yes"; then
179         AC_PATH_PROG(XMLTO, xmlto, no)
180         if test "$XMLTO" = "no" ; then
181                 AC_MSG_WARN([xmlto not found, will not be able to rebuild documentation])
182         fi
183 else
184         XMLTO="no"
185 fi
186
187 if test "$XMLTO" != "no"; then
188         AC_ARG_WITH([pdf-backend],
189                 [AS_HELP_STRING([--with-pdf-backend=[[yes|no|dblatex|fop|default]]],
190                         [Enable or disable PDF generation with backend])],
191                 [WITH_PDF_BACKEND=$withval],[WITH_PDF_BACKEND="yes"])
192         case "$WITH_PDF_BACKEND" in
193         no)
194                 PDF_BACKEND="no"
195                 ;;
196         yes)
197                 # Prefer dblatex, then default backend.
198                 # Could use [dblatex fop] to prefer dblatex or fop.
199                 AC_CHECK_PROGS([PDF_BACKEND], [dblatex], [default])
200                 AC_MSG_NOTICE([Will use $PDF_BACKEND backend for PDF generation])
201                 ;;
202         default)
203                 # Use xmlto's default backend.
204                 PDF_BACKEND="default"
205                 ;;
206         dblatex|fop)
207                 AC_CHECK_PROG([PDF_BACKEND], [$WITH_PDF_BACKEND],
208                         [$WITH_PDF_BACKEND], [no])
209                 if test "$PDF_BACKEND" = "no"; then
210                         AC_MSG_WARN([$WITH_PDF_BACKEND not found, disabling PDF generation])
211                 fi
212                 ;;
213         *)
214                 AC_MSG_WARN([Bad --with-pdf-backend option, disabling PDF generation])
215                 PDF_BACKEND="no"
216                 ;;
217         esac
218 else
219         PDF_BACKEND="no"
220 fi
221 case $PDF_BACKEND in
222 fop|default)
223         AC_MSG_WARN([$PDF_BACKEND PDF backend might not work.  --without-pdf-backend disables PDF generation.])
224         ;;
225 esac
226 AM_CONDITIONAL(HAVE_XMLTO, [test "$XMLTO" != "no"])
227 AM_CONDITIONAL(BUILD_PDF, [test "$PDF_BACKEND" != "no"])
228 AM_CONDITIONAL(BUILD_PDF_USING_DBLATEX, [test "$PDF_BACKEND" = "dblatex"])
229 AM_CONDITIONAL(BUILD_PDF_USING_FOP, [test "$PDF_BACKEND" = "fop"])
230
231 pcmciadir="\${sysconfdir}/pcmcia"
232 AC_SUBST(pcmciadir)
233
234
235
236 # new udev hotplug
237 AC_ARG_WITH([udev-hotplug],
238         [AS_HELP_STRING([--with-udev-hotplug=[[/lib]]], [enable udev hotplug])],
239         [ENABLE_UDEVHOTPLUG=$withval], [ENABLE_UDEVHOTPLUG="no"])
240 AM_CONDITIONAL(INSTALL_UDEVHOTPLUG, [test "$ENABLE_UDEVHOTPLUG" != "no"])
241 if test "$ENABLE_UDEVHOTPLUG" != "no"; then
242         if  test "$ENABLE_UDEVHOTPLUG" == "yes"; then
243                 AC_MSG_ERROR([udev-hotplug needs a path as an argument (usually: --enable-udev-hotplug=/lib).])
244         fi
245         if test "$ENABLE_UDEVHOTPLUG" != "/lib"; then
246                 AC_MSG_WARN([Installing the udev scripts in the non-standard location: $ENABLE_UDEVHOTPLUG (should be --enable-udev-hotplug=/lib)])
247         fi
248         if test "$sysconfdir" != "/etc"; then
249                 AC_MSG_WARN([udev hotplug works only if sysconfdir is set to /etc.])
250         fi
251         udevrulesdir="$ENABLE_UDEVHOTPLUG/udev/rules.d/"
252         udevfirmwaredir="$ENABLE_UDEVHOTPLUG/firmware"
253         udevscriptsdir="$ENABLE_UDEVHOTPLUG/udev"
254         AC_SUBST(udevrulesdir)
255         AC_SUBST(udevfirmwaredir)
256         AC_SUBST(udevscriptsdir)
257 else
258         ENABLE_UDEVHOTPLUG="no"
259 fi
260
261
262 # old hotplug mechanism
263 AC_ARG_ENABLE([etc-hotplug],
264         [AS_HELP_STRING([--enable-etc-hotplug],
265                 [enable old hotplug in /etc/hotplug])],
266         [ENABLE_ETCHOTPLUG=$enableval], [ENABLE_ETCHOTPLUG="no"])
267 AM_CONDITIONAL(INSTALL_ETCHOTPLUG, [test "$ENABLE_ETCHOTPLUG" != "no"])
268
269 if test "$ENABLE_ETCHOTPLUG" != "no"; then
270 #see: http://linux-hotplug.sourceforge.net/
271 #the hotplug expects the device dependent scripts here:
272         usbhotplugdir="\${sysconfdir}/hotplug/usb"
273         AC_SUBST(usbhotplugdir)
274
275 #firmware for the hotplug script
276 #see: http://linux-hotplug.sourceforge.net/
277         usbfirmwaredir="\${datadir}/usb"
278         AC_SUBST(usbfirmwaredir)
279         if test "$sysconfdir" != "/etc"; then
280                 AC_MSG_WARN([hotplug works only if sysconfdir is set to /etc.])
281         fi
282 fi
283
284 if test "$ENABLE_ETCHOTPLUG" = "no" && test "$ENABLE_UDEVHOTPLUG" = "no" ; then
285                 AC_MSG_WARN([No hotplug mechanism will be installed. Consult ./configure --help if you want hotplug.])
286 fi
287
288 AC_CONFIG_FILES(
289 Makefile
290 comedi_config/Makefile
291 c++/Makefile
292 c++/include/Makefile
293 etc/Makefile
294 etc/pcmcia/Makefile
295 etc/hotplug/Makefile
296 etc/hotplug/usb/Makefile
297 etc/hotplug/usb/usbdux/Makefile
298 etc/hotplug/usb/usbduxfast/Makefile
299 etc/hotplug/usb/usbduxsigma/Makefile
300 etc/udev/Makefile
301 doc/Makefile
302 demo/Makefile
303 include/Makefile
304 include/comedilib_version.h
305 lib/Makefile
306 man/Makefile
307 scxi/Makefile
308 swig/Makefile
309 swig/python/Makefile
310 swig/ruby/Makefile
311 testing/Makefile
312 comedilib.spec
313 comedilib.pc
314 )
315
316 AC_OUTPUT