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