doc: add missing -lm option to command line for compiling tut1
[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], [2])
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.2zb, 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 AC_CONFIG_HEADERS([config.h])
91
92 ACLOCAL="$ACLOCAL -I m4"
93
94 AM_MAINTAINER_MODE
95
96 AM_PROG_AR
97 AC_PROG_CC
98 AM_PROG_CC_C_O
99 AC_PROG_CC_STDC
100 AC_ISC_POSIX
101 AM_PROG_LEX
102 AC_PROG_YACC
103 AC_PROG_LIBTOOL
104
105 AC_HEADER_STDC([])
106
107 AX_TLS
108
109 # AS_LIBTOOL arguments are (prefix, current, revision, age)
110 AS_LIBTOOL(COMEDILIB, comedilib_lt_current, comedilib_lt_revision, comedilib_lt_age)
111 SCXI_SO_VERSION=scxi_lt_current:scxi_lt_revision:scxi_lt_age
112 AC_SUBST(SCXI_SO_VERSION)
113
114 COMEDILIB_CFLAGS="$COMEDILIB_CFLAGS -I\$(top_srcdir)/include -I\$(top_builddir)/include $COMEDILIB_DEBUG"
115 COMEDILIB_LIBS="$COMEDILIB_LIBS \$(top_builddir)/lib/libcomedi.la -lm"
116 AC_SUBST(COMEDILIB_CFLAGS)
117 AC_SUBST(COMEDILIB_LIBS)
118
119 # autoconf backwards compatibility
120 if test "$datarootdir" = ""; then
121         datarootdir='${datadir}'
122         AC_SUBST(datarootdir)
123 fi
124
125 if test "$docdir" = ""; then
126         docdir='${datarootdir}/doc/${PACKAGE}'
127         AC_SUBST(docdir)
128 fi
129
130 if test "$htmldir" = ""; then
131         htmldir='${docdir}'
132         AC_SUBST(htmldir)
133 fi
134
135 if test "$pdfdir" = ""; then
136         pdfdir='${docdir}'
137         AC_SUBST(pdfdir)
138 fi
139
140 #swig
141 AC_PATH_PROG(SWIG, swig, "no")
142 if test "$SWIG" == "no" ; then
143         AC_MSG_WARN([swig not found, will not be able to build swig based bindings])
144 fi
145
146 #python
147 AC_ARG_ENABLE([python-binding],
148         [AS_HELP_STRING([--disable-python-binding],
149                 [Disable building of Python binding])],
150         [ENABLE_PYTHON=$enableval],[ENABLE_PYTHON="yes"])
151 if test "$ENABLE_PYTHON" == "yes" && test "$SWIG" != "no"; then
152         AM_PATH_PYTHON
153         AM_CHECK_PYTHON_HEADERS(HAVE_PYTHON=yes,[HAVE_PYTHON=no;AC_MSG_WARN([python headers not found, disabling python binding])])
154 else
155         HAVE_PYTHON="no"
156 fi
157 AM_CONDITIONAL(HAVE_PYTHON, [test "$HAVE_PYTHON" == "yes" && test "$ENABLE_PYTHON" == "yes"])
158
159 AS_COMPILER_FLAG([-fno-strict-aliasing],[PYTHON_QUIET="$PYTHON_QUIET -fno-strict-aliasing"], true )
160 AS_COMPILER_FLAG([-Wno-unused-function],[PYTHON_QUIET="$PYTHON_QUIET -Wno-unused-function"], true )
161 AC_SUBST(PYTHON_QUIET)
162
163 # ruby
164 AC_ARG_ENABLE([ruby-binding],
165         [AS_HELP_STRING([--enable-ruby-binding],
166                 [Enable building of Ruby binding])],
167         [ENABLE_RUBY=$enableval], [ENABLE_RUBY="no"])
168 if test "$ENABLE_RUBY" == "yes" && test "$SWIG" != "no"; then
169         AC_PATH_PROG(RUBY, ruby, no)
170         if test "$RUBY" != "no" ; then
171                 RUBY_INC_DIR=`$RUBY -e "require 'rbconfig'; c = ::Config::CONFIG; print c[['archdir']];"`
172                 AC_CHECK_HEADER([$RUBY_INC_DIR/ruby.h],[],[ENABLE_RUBY="no";AC_MSG_WARN([ruby.h not found, disabling Ruby binding])])
173         else
174                 AC_MSG_WARN([ruby not found, disabling ruby binding])
175                 ENABLE_RUBY="no"
176         fi
177 else
178         ENABLE_RUBY="no"
179 fi
180
181 AM_CONDITIONAL(HAVE_RUBY, [test "$ENABLE_RUBY" == "yes"])
182
183 AC_ARG_VAR(RUBY_PREFIX,[path prefix for Ruby binding])
184 AC_ARG_VAR(RUBY_SO_DIR,[path for Ruby extensions])
185 if test "$RUBY_PREFIX" != "" ; then
186         RUBY_CONFIG_OPTIONS="$RUBY_CONFIG_OPTIONS --prefix=\$(RUBY_PREFIX)"
187 fi
188 if test "$RUBY_SO_DIR" != "" ; then
189         RUBY_CONFIG_OPTIONS="$RUBY_CONFIG_OPTIONS --so-dir=\$(RUBY_SO_DIR)"
190 fi
191 AC_SUBST(RUBY_CONFIG_OPTIONS)
192
193 # scxi
194 AC_ARG_ENABLE([scxi],
195         [AS_HELP_STRING([--enable-scxi], [Enable SCXI convenience library])],
196         [ENABLE_SCXI=$enableval], [ENABLE_SCXI="no"])
197 AM_CONDITIONAL(BUILD_SCXI, [test "$ENABLE_SCXI" == "yes"])
198
199 # docbook
200 AC_ARG_ENABLE([docbook],
201         [AS_HELP_STRING([--disable-docbook], [Disable docbook])],
202         [ENABLE_DOCBOOK=$enableval],[ENABLE_DOCBOOK="yes"])
203
204 if test "$ENABLE_DOCBOOK" == "yes"; then
205         AC_PATH_PROG(XMLTO, xmlto, no)
206         if test "$XMLTO" = "no" ; then
207                 AC_MSG_WARN([xmlto not found, will not be able to rebuild documentation])
208         fi
209 else
210         XMLTO="no"
211 fi
212
213 if test "$XMLTO" != "no"; then
214         AC_ARG_WITH([pdf-backend],
215                 [AS_HELP_STRING([--with-pdf-backend=[[yes|no|dblatex|fop|default]]],
216                         [Enable or disable PDF generation with backend])],
217                 [WITH_PDF_BACKEND=$withval],[WITH_PDF_BACKEND="yes"])
218         case "$WITH_PDF_BACKEND" in
219         no)
220                 PDF_BACKEND="no"
221                 ;;
222         yes)
223                 # Prefer dblatex, then default backend.
224                 # Could use [dblatex fop] to prefer dblatex or fop.
225                 AC_CHECK_PROGS([PDF_BACKEND], [dblatex], [default])
226                 # The default backend is broken, so avoid it for now.
227                 if test "$PDF_BACKEND" = "default"; then
228                         AC_MSG_WARN([Default PDF backend is broken, disabling PDF generation])
229                         AC_MSG_WARN([(dblatex is recommended for PDF generation)])
230                         PDF_BACKEND="no"
231                 fi
232                 if test "$PDF_BACKEND" != "no"; then
233                         AC_MSG_NOTICE([Will use $PDF_BACKEND backend for PDF generation])
234                 fi
235                 ;;
236         default)
237                 # Use xmlto's default backend.
238                 PDF_BACKEND="default"
239                 ;;
240         dblatex|fop)
241                 AC_CHECK_PROG([PDF_BACKEND], [$WITH_PDF_BACKEND],
242                         [$WITH_PDF_BACKEND], [no])
243                 if test "$PDF_BACKEND" = "no"; then
244                         AC_MSG_WARN([$WITH_PDF_BACKEND not found, disabling PDF generation])
245                 fi
246                 ;;
247         *)
248                 AC_MSG_WARN([Bad --with-pdf-backend option, disabling PDF generation])
249                 PDF_BACKEND="no"
250                 ;;
251         esac
252 else
253         PDF_BACKEND="no"
254 fi
255 case $PDF_BACKEND in
256 fop|default)
257         AC_MSG_WARN([$PDF_BACKEND PDF backend might not work.  --without-pdf-backend disables PDF generation.])
258         ;;
259 esac
260 AM_CONDITIONAL(HAVE_XMLTO, [test "$XMLTO" != "no"])
261 AM_CONDITIONAL(BUILD_PDF, [test "$PDF_BACKEND" != "no"])
262 AM_CONDITIONAL(BUILD_PDF_USING_DBLATEX, [test "$PDF_BACKEND" = "dblatex"])
263 AM_CONDITIONAL(BUILD_PDF_USING_FOP, [test "$PDF_BACKEND" = "fop"])
264
265 pcmciadir="\${sysconfdir}/pcmcia"
266 AC_SUBST(pcmciadir)
267
268 # firmware
269 AC_ARG_ENABLE([firmware],
270         [AS_HELP_STRING([--disable-firmware], [Disable installation of firmware files])],
271         [ENABLE_FIRMWARE=$enableval],[ENABLE_FIRMWARE="yes"])
272
273 # new udev hotplug
274 AC_ARG_WITH([udev-hotplug],
275         [AS_HELP_STRING([--with-udev-hotplug=[[/lib]]], [enable udev hotplug])],
276         [ENABLE_UDEVHOTPLUG=$withval], [ENABLE_UDEVHOTPLUG="no"])
277 AM_CONDITIONAL(INSTALL_UDEVHOTPLUG, [test "$ENABLE_UDEVHOTPLUG" != "no"])
278 if test "$ENABLE_UDEVHOTPLUG" != "no"; then
279         if  test "$ENABLE_UDEVHOTPLUG" == "yes"; then
280                 AC_MSG_ERROR([udev-hotplug needs a path as an argument (usually: --enable-udev-hotplug=/lib).])
281         fi
282         if test "$ENABLE_UDEVHOTPLUG" != "/lib"; then
283                 AC_MSG_WARN([Installing the udev scripts in the non-standard location: $ENABLE_UDEVHOTPLUG (should be --enable-udev-hotplug=/lib)])
284         fi
285         udevrulesdir="$ENABLE_UDEVHOTPLUG/udev/rules.d/"
286         udevscriptsdir="$ENABLE_UDEVHOTPLUG/udev"
287         AC_SUBST(udevrulesdir)
288         AC_SUBST(udevscriptsdir)
289         if test "$ENABLE_FIRMWARE" == "yes"; then
290         udevfirmwaredir="$ENABLE_UDEVHOTPLUG/firmware"
291         AC_SUBST(udevfirmwaredir)
292         fi
293 else
294         ENABLE_UDEVHOTPLUG="no"
295 fi
296
297 if test "$ENABLE_UDEVHOTPLUG" = "no" ; then
298                 AC_MSG_WARN([No hotplug mechanism will be installed. Consult ./configure --help if you want hotplug.])
299 fi
300
301 AC_CONFIG_FILES(
302 Makefile
303 comedi_config/Makefile
304 comedi_board_info/Makefile
305 c++/Makefile
306 c++/include/Makefile
307 etc/Makefile
308 etc/pcmcia/Makefile
309 etc/hotplug/Makefile
310 etc/hotplug/usb/Makefile
311 etc/hotplug/usb/usbdux/Makefile
312 etc/hotplug/usb/usbduxfast/Makefile
313 etc/hotplug/usb/usbduxsigma/Makefile
314 etc/udev/Makefile
315 doc/Makefile
316 demo/Makefile
317 include/Makefile
318 include/comedilib_version.h
319 lib/Makefile
320 man/Makefile
321 scxi/Makefile
322 swig/Makefile
323 swig/python/Makefile
324 swig/ruby/Makefile
325 testing/Makefile
326 comedilib.spec
327 comedilib.pc
328 )
329
330 AC_OUTPUT