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