fix handling of swig so it is run at compile time instead of when
[comedilib.git] / configure.ac
1
2 AC_INIT
3 AC_CANONICAL_TARGET([])
4
5 AC_CONFIG_AUX_DIR([.])
6 AS_VERSION(comedilib, COMEDILIB, 0, 7, 22)
7 #COMEDILIB_DEBUG="-Wall -Werror"
8 COMEDILIB_DEBUG="-Wall"
9 AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
10 AS_LIBTOOL(COMEDILIB, 0, 7, 18, yes)
11
12 AM_CONFIG_HEADER(config.h)
13
14 ACLOCAL="$ACLOCAL -I m4"
15
16 AM_MAINTAINER_MODE
17
18 AC_PROG_CC
19 AM_PROG_CC_STDC
20 AC_ISC_POSIX
21 AM_PROG_LEX
22 AC_PROG_YACC
23
24 AC_HEADER_STDC([])
25
26 COMEDILIB_CFLAGS="$COMEDILIB_CFLAGS -I\$(top_srcdir)/include $COMEDILIB_DEBUG"
27 COMEDILIB_LIBS="$COMEDILIB_LIBS \$(top_builddir)/lib/libcomedi.la -lm"
28 AC_SUBST(COMEDILIB_CFLAGS)
29 AC_SUBST(COMEDILIB_LIBS)
30
31 #swig
32 AC_PATH_PROG(SWIG, swig, "no")
33 if test "$SWIG" == "no" ; then
34         AC_MSG_WARN([swig not found, will not be able to build swig based bindings])
35 fi
36
37 #python
38 AC_ARG_ENABLE([python-binding],[  --disable-python-binding      Disable building of Python binding],
39         [ENABLE_PYTHON=$enableval],[ENABLE_PYTHON="yes"])
40 if test "$ENABLE_PYTHON" == "yes" && test "$SWIG" != "no"; then
41         AM_PATH_PYTHON
42         AM_CHECK_PYTHON_HEADERS(HAVE_PYTHON=yes,[HAVE_PYTHON=no;AC_MSG_WARN([python headers not found, disabling python binding])])
43 else
44         HAVE_PYTHON="no"
45 fi
46 AM_CONDITIONAL(HAVE_PYTHON, [test "$HAVE_PYTHON" == "yes" && test "$ENABLE_PYTHON" == "yes"])
47
48 AS_COMPILER_FLAG([-fno-strict-aliasing],[PYTHON_QUIET="$PYTHON_QUIET -fno-strict-aliasing"], true )
49 AS_COMPILER_FLAG([-Wno-unused-function],[PYTHON_QUIET="$PYTHON_QUIET -Wno-unused-function"], true )
50 AC_SUBST(PYTHON_QUIET)
51
52 # ruby
53 AC_ARG_ENABLE([ruby-binding], [  --disable-ruby-binding Disable building of Ruby binding],
54         [ENABLE_RUBY=$enableval], [ENABLE_RUBY="yes"])
55 if test "$ENABLE_RUBY" == "yes" && test "$SWIG" != "no"; then
56         AC_PATH_PROG(RUBY, ruby, no)
57         if test "$RUBY" != "no" ; then
58                 RUBY_INC_DIR=`$RUBY -e "require 'rbconfig'; c = ::Config::CONFIG; print c[['archdir']];"`
59                 AC_CHECK_HEADER([$RUBY_INC_DIR/ruby.h],[],[ENABLE_RUBY="no";AC_MSG_WARN([ruby.h not found, disabling Ruby binding])])
60         else
61                 AC_MSG_WARN([ruby not found, disabling ruby binding])
62                 ENABLE_RUBY="no"
63         fi
64 else
65         ENABLE_RUBY="no"
66 fi
67
68 AM_CONDITIONAL(HAVE_RUBY, [test "$ENABLE_RUBY" == "yes"])
69
70 AC_ARG_VAR(RUBY_PREFIX,[path prefix for Ruby binding])
71 AC_ARG_VAR(RUBY_SO_DIR,[path for Ruby extensions])
72 if test "$RUBY_PREFIX" != "" ; then
73         RUBY_CONFIG_OPTIONS="$RUBY_CONFIG_OPTIONS --prefix=\$(RUBY_PREFIX)"
74 fi
75 if test "$RUBY_SO_DIR" != "" ; then
76         RUBY_CONFIG_OPTIONS="$RUBY_CONFIG_OPTIONS --so-dir=\$(RUBY_SO_DIR)"
77 fi
78 AC_SUBST(RUBY_CONFIG_OPTIONS)
79
80 # scxi
81 AC_ARG_ENABLE([scxi], [  --enable-scxi  Enable SCXI convenience library],
82         [ENABLE_SCXI=$enableval], [ENABLE_SCXI="no"])
83 AM_CONDITIONAL(BUILD_SCXI, [test "$ENABLE_SCXI" == "yes"])
84
85 # docbook
86 AC_ARG_ENABLE([docbook-binding],[  --disable-docbook-binding        Disable docbook],[ENABLE_DOCBOOK=$enableval],[ENABLE_DOCBOOK="yes"])
87
88 if test "$ENABLE_DOCBOOK" == "yes"; then
89         AC_PATH_PROG(DOCBOOK2MAN, docbook2man, no)
90         if test "$DOCBOOK2MAN" = "no" ; then
91                 AC_MSG_WARN([docbook2man not found, will not be able to rebuild man pages])
92         fi
93 else
94         DOCBOOK2MAN="no"
95 fi
96 AM_CONDITIONAL(HAVE_DOCBOOK2MAN, [test "$DOCBOOK2MAN" != "no"])
97
98 if test "$ENABLE_DOCBOOK" == "yes"; then
99         AC_PATH_PROG(DOCBOOK2PDF, docbook2pdf, no)
100         if test "$DOCBOOK2PDF" = "no" ; then
101                 AC_MSG_WARN([docbook2pdf not found, will not be able to rebuild pdf documentation])
102         fi
103 else
104         DOCBOOK2PDF="no"
105 fi
106 AM_CONDITIONAL(HAVE_DOCBOOK2PDF, [test "$DOCBOOK2PDF" != "no"])
107
108
109 if test "$ENABLE_DOCBOOK" == "yes"; then
110         AC_PATH_PROG(DOCBOOK2HTML, docbook2html, no)
111         if test "$DOCBOOK2HTML" = "no" ; then
112                 AC_MSG_WARN([docbook2html not found, will not be able to rebuild html documentation])
113         fi
114 else
115         DOCBOOK2HTML="no"
116 fi
117 AM_CONDITIONAL(HAVE_DOCBOOK2HTML, [test "$DOCBOOK2HTML" != "no"])
118
119
120 pcmciadir="\${sysconfdir}/pcmcia"
121 AC_SUBST(pcmciadir)
122
123 #see: http://linux-hotplug.sourceforge.net/
124 #the hotplug expects the device dependent scripts here:
125 usbhotplugdir="\${sysconfdir}/hotplug/usb"
126 AC_SUBST(usbhotplugdir)
127
128 #firmware for the hotplug script
129 #see: http://linux-hotplug.sourceforge.net/
130 usbfirmwaredir="\${datadir}/usb"
131 AC_SUBST(usbfirmwaredir)
132
133 AC_CONFIG_FILES(
134 Makefile
135 comedi_calibrate/Makefile
136 comedi_config/Makefile
137 etc/Makefile
138 etc/pcmcia/Makefile
139 etc/hotplug/Makefile
140 etc/hotplug/usb/Makefile
141 etc/hotplug/usb/usbdux/Makefile
142 doc/Makefile
143 demo/Makefile
144 include/Makefile
145 lib/Makefile
146 man/Makefile
147 scxi/Makefile
148 swig/Makefile
149 swig/python/Makefile
150 swig/ruby/Makefile
151 testing/Makefile
152 comedilib.spec
153 comedilib.pc
154 )
155
156 AC_OUTPUT