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