Put __comedi_errno variable into thread-local storage if the compiler
[comedilib.git] / configure.ac
1
2 AC_INIT([comedilib], [0.9.0])
3 AC_CANONICAL_TARGET([])
4
5 AC_CONFIG_MACRO_DIR([m4])
6 AC_CONFIG_AUX_DIR([.])
7 #COMEDILIB_DEBUG="-Wall -Werror"
8 COMEDILIB_DEBUG="-Wall"
9 AM_INIT_AUTOMAKE([-Wall -Werror])
10
11 # libtool version: current:revision:age
12 #
13 # If the library source code has changed at all since the last update, then
14 # increment revision (`c:r:a' becomes `c:r+1:a').
15 #
16 # If any interfaces have been added, removed, or changed since the last update,
17 # increment current, and set revision to 0.
18 #
19 # If any interfaces have been added since the last public release, then
20 # increment age.
21 #
22 # If any interfaces have been removed since the last public release, then set
23 # age to 0.
24 #
25 # AS_LIBTOOL arguments are (prefix, current, revision, age)
26 AS_LIBTOOL(COMEDILIB, 9, 0, 9)
27 #libscxi c:r:a
28 SCXI_SO_VERSION=9:0:9
29 AC_SUBST(SCXI_SO_VERSION)
30
31 AM_CONFIG_HEADER(config.h)
32
33 ACLOCAL="$ACLOCAL -I m4"
34
35 AM_MAINTAINER_MODE
36
37 AC_PROG_CC
38 AM_PROG_CC_C_O
39 AC_PROG_CC_STDC
40 AC_ISC_POSIX
41 AM_PROG_LEX
42 AC_PROG_YACC
43 AC_PROG_LIBTOOL
44
45 AC_HEADER_STDC([])
46
47 AX_TLS
48
49 COMEDILIB_CFLAGS="$COMEDILIB_CFLAGS -I\$(top_srcdir)/include $COMEDILIB_DEBUG"
50 COMEDILIB_LIBS="$COMEDILIB_LIBS \$(top_builddir)/lib/libcomedi.la -lm"
51 AC_SUBST(COMEDILIB_CFLAGS)
52 AC_SUBST(COMEDILIB_LIBS)
53
54 # autoconf backwards compatibility
55 if test "$datarootdir" = ""; then
56         datarootdir='${datadir}'
57         AC_SUBST(datarootdir)
58 fi
59
60 if test "$docdir" = ""; then
61         docdir='${datarootdir}/doc/${PACKAGE}'
62         AC_SUBST(docdir)
63 fi
64
65 if test "$htmldir" = ""; then
66         htmldir='${docdir}'
67         AC_SUBST(htmldir)
68 fi
69
70 if test "$pdfdir" = ""; then
71         pdfdir='${docdir}'
72         AC_SUBST(pdfdir)
73 fi
74
75 #swig
76 AC_PATH_PROG(SWIG, swig, "no")
77 if test "$SWIG" == "no" ; then
78         AC_MSG_WARN([swig not found, will not be able to build swig based bindings])
79 fi
80
81 #python
82 AC_ARG_ENABLE([python-binding],[  --disable-python-binding      Disable building of Python binding],
83         [ENABLE_PYTHON=$enableval],[ENABLE_PYTHON="yes"])
84 if test "$ENABLE_PYTHON" == "yes" && test "$SWIG" != "no"; then
85         AM_PATH_PYTHON
86         AM_CHECK_PYTHON_HEADERS(HAVE_PYTHON=yes,[HAVE_PYTHON=no;AC_MSG_WARN([python headers not found, disabling python binding])])
87 else
88         HAVE_PYTHON="no"
89 fi
90 AM_CONDITIONAL(HAVE_PYTHON, [test "$HAVE_PYTHON" == "yes" && test "$ENABLE_PYTHON" == "yes"])
91
92 AS_COMPILER_FLAG([-fno-strict-aliasing],[PYTHON_QUIET="$PYTHON_QUIET -fno-strict-aliasing"], true )
93 AS_COMPILER_FLAG([-Wno-unused-function],[PYTHON_QUIET="$PYTHON_QUIET -Wno-unused-function"], true )
94 AC_SUBST(PYTHON_QUIET)
95
96 # ruby
97 AC_ARG_ENABLE([ruby-binding], [  --disable-ruby-binding Disable building of Ruby binding],
98         [ENABLE_RUBY=$enableval], [ENABLE_RUBY="yes"])
99 if test "$ENABLE_RUBY" == "yes" && test "$SWIG" != "no"; then
100         AC_PATH_PROG(RUBY, ruby, no)
101         if test "$RUBY" != "no" ; then
102                 RUBY_INC_DIR=`$RUBY -e "require 'rbconfig'; c = ::Config::CONFIG; print c[['archdir']];"`
103                 AC_CHECK_HEADER([$RUBY_INC_DIR/ruby.h],[],[ENABLE_RUBY="no";AC_MSG_WARN([ruby.h not found, disabling Ruby binding])])
104         else
105                 AC_MSG_WARN([ruby not found, disabling ruby binding])
106                 ENABLE_RUBY="no"
107         fi
108 else
109         ENABLE_RUBY="no"
110 fi
111
112 AM_CONDITIONAL(HAVE_RUBY, [test "$ENABLE_RUBY" == "yes"])
113
114 AC_ARG_VAR(RUBY_PREFIX,[path prefix for Ruby binding])
115 AC_ARG_VAR(RUBY_SO_DIR,[path for Ruby extensions])
116 if test "$RUBY_PREFIX" != "" ; then
117         RUBY_CONFIG_OPTIONS="$RUBY_CONFIG_OPTIONS --prefix=\$(RUBY_PREFIX)"
118 fi
119 if test "$RUBY_SO_DIR" != "" ; then
120         RUBY_CONFIG_OPTIONS="$RUBY_CONFIG_OPTIONS --so-dir=\$(RUBY_SO_DIR)"
121 fi
122 AC_SUBST(RUBY_CONFIG_OPTIONS)
123
124 # scxi
125 AC_ARG_ENABLE([scxi], [  --enable-scxi  Enable SCXI convenience library],
126         [ENABLE_SCXI=$enableval], [ENABLE_SCXI="no"])
127 AM_CONDITIONAL(BUILD_SCXI, [test "$ENABLE_SCXI" == "yes"])
128
129 # docbook
130 AC_ARG_ENABLE([docbook],[  --disable-docbook-binding        Disable docbook],[ENABLE_DOCBOOK=$enableval],[ENABLE_DOCBOOK="yes"])
131
132 if test "$ENABLE_DOCBOOK" == "yes"; then
133         AC_PATH_PROG(XMLTO, xmlto, no)
134         if test "$XMLTO" = "no" ; then
135                 AC_MSG_WARN([xmlto not found, will not be able to rebuild documentation])
136         fi
137 else
138         XMLTO="no"
139 fi
140 AM_CONDITIONAL(HAVE_XMLTO, [test "$XMLTO" != "no"])
141
142 pcmciadir="\${sysconfdir}/pcmcia"
143 AC_SUBST(pcmciadir)
144
145
146
147 # new udev hotplug
148 AC_ARG_WITH([udev-hotplug], [  --with-udev-hotplug=[[/lib]]    enable udev hotplug],
149         [ENABLE_UDEVHOTPLUG=$withval], [ENABLE_UDEVHOTPLUG="no"])
150 AM_CONDITIONAL(INSTALL_UDEVHOTPLUG, [test "$ENABLE_UDEVHOTPLUG" != "no"])
151 if test "$ENABLE_UDEVHOTPLUG" != "no"; then
152         udevrulesdir="\${sysconfdir}/udev/rules.d/"
153         if  test "$ENABLE_UDEVHOTPLUG" == "yes"; then
154                 AC_MSG_ERROR([udev-hotplug needs a path as an argument (usually: --enable-udev-hotplug=/lib).])
155         fi
156         if test "$ENABLE_UDEVHOTPLUG" != "/lib"; then
157                 AC_MSG_WARN([Installing the udev scripts in the non-standard location: $ENABLE_UDEVHOTPLUG (should be --enable-udev-hotplug=/lib)])
158         fi
159         if test "$sysconfdir" != "/etc"; then
160                 AC_MSG_WARN([udev hotplug works only if sysconfdir is set to /etc.])
161         fi
162         udevfirmwaredir="$ENABLE_UDEVHOTPLUG/firmware"
163         udevscriptsdir="$ENABLE_UDEVHOTPLUG/udev"
164         AC_SUBST(udevrulesdir)
165         AC_SUBST(udevfirmwaredir)
166         AC_SUBST(udevscriptsdir)
167 else
168         ENABLE_UDEVHOTPLUG="no"
169 fi
170
171
172 # old hotplug mechanism
173 AC_ARG_ENABLE([etc-hotplug], [  --enable-etc-hotplug    enable old hotplug in /etc/hotplug],
174         [ENABLE_ETCHOTPLUG=$enableval], [ENABLE_ETCHOTPLUG="no"])
175 AM_CONDITIONAL(INSTALL_ETCHOTPLUG, [test "$ENABLE_ETCHOTPLUG" != "no"])
176
177 if test "$ENABLE_ETCHOTPLUG" != "no"; then
178 #see: http://linux-hotplug.sourceforge.net/
179 #the hotplug expects the device dependent scripts here:
180         usbhotplugdir="\${sysconfdir}/hotplug/usb"
181         AC_SUBST(usbhotplugdir)
182
183 #firmware for the hotplug script
184 #see: http://linux-hotplug.sourceforge.net/
185         usbfirmwaredir="\${datadir}/usb"
186         AC_SUBST(usbfirmwaredir)
187         if test "$sysconfdir" != "/etc"; then
188                 AC_MSG_WARN([hotplug works only if sysconfdir is set to /etc.])
189         fi
190 fi
191
192 if test "$ENABLE_ETCHOTPLUG" = "no" && test "$ENABLE_UDEVHOTPLUG" = "no" ; then
193                 AC_MSG_WARN([No hotplug mechanism will be installed. Consult ./configure --help if you want hotplug.])
194 fi
195
196 AC_CONFIG_FILES(
197 Makefile
198 comedi_config/Makefile
199 c++/Makefile
200 c++/include/Makefile
201 etc/Makefile
202 etc/pcmcia/Makefile
203 etc/hotplug/Makefile
204 etc/hotplug/usb/Makefile
205 etc/hotplug/usb/usbdux/Makefile
206 etc/hotplug/usb/usbduxfast/Makefile
207 etc/udev/Makefile
208 doc/Makefile
209 demo/Makefile
210 include/Makefile
211 lib/Makefile
212 man/Makefile
213 scxi/Makefile
214 swig/Makefile
215 swig/python/Makefile
216 swig/ruby/Makefile
217 testing/Makefile
218 comedilib.spec
219 comedilib.pc
220 )
221
222 AC_OUTPUT