Merge branch 'libusb'
[bcusdk.git] / configure.in
blobf29697b741ecc5ae591a6e326fcce8d53bf7a977
1 dnl ##    BCU SDK bcu development enviroment - autoconf & automake files
2 dnl ##    Copyright (C) 2005-2011 Martin Koegler <mkoegler@auto.tuwien.ac.at>
3 dnl ##
4 dnl ##    Redistribution and use in source and binary forms, with or without
5 dnl ##    modification, are permitted provided that the following conditions
6 dnl ##    are met:
7 dnl ##    1. Redistributions of source code must retain the above copyright
8 dnl ##       notice, this list of conditions and the following disclaimer.
9 dnl ##    2. Redistributions in binary form must reproduce the above copyright
10 dnl ##       notice, this list of conditions and the following disclaimer in the
11 dnl ##       documentation and/or other materials provided with the distribution.
12 dnl ##    
13 dnl ##    THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
14 dnl ##    ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 dnl ##    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 dnl ##    ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
17 dnl ##    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 dnl ##    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 dnl ##    OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 dnl ##    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 dnl ##    LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 dnl ##    OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 dnl ##    SUCH DAMAGE.
26 AC_PREREQ(2.59)
28 AC_INIT(bcusdk, 0.0.4)
29 AM_INIT_AUTOMAKE([foreign])
31 AC_CANONICAL_HOST
32 AC_PROG_CC
33 AC_PROG_CXX
34 AC_STDC_HEADERS
35 AC_PROG_YACC
36 AC_PROG_LEX
37 AM_PROG_AS
38 AC_PROG_RANLIB
39 AC_PROG_LIBTOOL
41 GMP_PROG_CPP_FOR_BUILD
42 GMP_PROG_EXEEXT_FOR_BUILD
43 CC_FOR_BUILD_OPTS
45 AC_COMPILER_OPTION(nortti,[-fno-rtti],[-fno-rtti],CXXFLAGS="$CXXFLAGS -fno-rtti")
46 AC_COMPILER_OPTION(noexceptions,[-fno-exceptions],[-fno-exceptions],CXXFLAGS="$CXXFLAGS -fno-exceptions")
47 AC_CHECK_PTHSEM(2.0.8,yes,yes,no)
48 AC_CHECK_HEADER(argp.h,,[AC_MSG_ERROR([argp_parse not found])])
49 AC_SEARCH_LIBS(argp_parse,argp,,[AC_MSG_ERROR([argp_parse not found])])
50 AC_CHECK_HEADER(linux/serial.h,[AC_DEFINE(HAVE_LINUX_LOWLATENCY, 1 , [Linux low latency mode enabled])],[AC_MSG_WARN([No supported low latency mode found])])
51 have_source_info=no
52 have_linux_api=no
53 AC_CHECK_HEADER(linux/rtnetlink.h,[AC_DEFINE(HAVE_LINUX_NETLINK, 1,[Linux netlink layer available]) have_source_info=yes],[],[-])
54 AC_CHECK_HEADER(linux/usbdevice_fs.h,[AC_DEFINE(OS_LINUX, 1, [Linux usb available]) have_linux_api=yes; have_usb=yes],[],[-])
55 AC_CHECK_HEADER(iphlpapi.h,[AC_DEFINE(HAVE_WINDOWS_IPHELPER, 1,[Windows IPHelper available]) 
56   LIBS="-liphlpapi $LIBS"; have_source_info=yes],[],[-])
58 AC_CHECK_DECL(SA_SIZE,[AC_DEFINE(HAVE_SA_SIZE, 1,[SA_SIZE function available])],[],[#include <net/route.h>])
59 have_bsd_source_info=no
60 AC_CHECK_DECL(__FreeBSD__,[have_bsd_source_info=yes],[],[])
61 AC_CHECK_DECL(__APPLE__,[have_bsd_source_info=yes],[],[])
62 if test x$have_bsd_source_info = xyes ; then
63   AC_DEFINE(HAVE_BSD_SOURCEINFO, 1,[FreeBSD compatible sourceinfo])
64   have_source_info=yes
67 AC_CHECK_FUNCS(gethostbyname_r,,[AC_MSG_WARN([eibd client library not thread safe])])
69 AM_CONDITIONAL(LINUX_API, test x$have_linux_api = xyes)
71 AC_ARG_ENABLE(onlyeibd,
72 [  --enable-onlyeibd            build only eibd (requires no libxml and m68hc05-gnu)],
73 [case "${enableval}" in
74  yes) onlyeibd=true ;;
75   no)  onlyeibd=false ;;
76    *) AC_MSG_ERROR(bad value ${enableval} for --enable-onlyeibd) ;;
77  esac],[onlyeibd=false])
78 AM_CONDITIONAL(HAVE_ONLYEIBD, test x$onlyeibd = xtrue)
80 if test x$onlyeibd = xfalse ; then
82 AM_PATH_XML2(2.6.16,,[AC_MSG_ERROR([limxml2 not found])])
83 AC_PATH_PROG(TAS,[m68hc05-as],,[$PATH:$bindir:$prefix/bin])
84 AC_PATH_PROG(TLD,[m68hc05-ld],,[$PATH:$bindir:$prefix/bin])
85 AC_PATH_PROG(TAR,[m68hc05-ar],,[$PATH:$bindir:$prefix/bin])
86 AC_PATH_PROG(TRANLIB,[m68hc05-ranlib],,[$PATH:$bindir:$prefix/bin])
87 AC_PATH_PROG(TGCC,[m68hc05-gcc],,[$PATH:$bindir:$prefix/bin])
89 test -z "$TAS" && AC_MSG_ERROR([m68hc05-as not found])
90 test -z "$TAR" && AC_MSG_ERROR([m68hc05-ar not found])
91 test -z "$TLD" && AC_MSG_ERROR([m68hc05-ld not found])
92 test -z "$TRANLIB" && AC_MSG_ERROR([m68hc05 ranlib not found])
93 test -z "$TGCC" && AC_MSG_ERROR([m68hc05 gcc not found])
97 AC_ARG_ENABLE(ft12,
98 [  --enable-ft12                enable FT1.2 backend],
99 [case "${enableval}" in
100  yes) ft12=true ;;
101   no)  ft12=false ;;
102    *) AC_MSG_ERROR(bad value ${enableval} for --enable-ft12) ;;
103  esac],[ft12=false])
104 AM_CONDITIONAL(HAVE_FT12, test x$ft12 = xtrue)
105 if test x$ft12 = xtrue ; then
106  AC_DEFINE(HAVE_FT12, 1 , [FT1.2 enabled])
109 AC_ARG_ENABLE(pei16,
110 [  --enable-pei16       enable BCU1 kernel driver backend],
111 [case "${enableval}" in
112  yes) pei16=true ;;
113   no)  pei16=false ;;
114    *) AC_MSG_ERROR(bad value ${enableval} for --enable-pei16) ;;
115  esac],[pei16=false])
116 AM_CONDITIONAL(HAVE_PEI16, test x$pei16 = xtrue)
117 if test x$pei16 = xtrue; then
118  AC_DEFINE(HAVE_PEI16, 1 , [PEI16 enabled])
121 AC_ARG_ENABLE(tpuart,
122 [  --enable-tpuart      enable TPUART kernel driver backend (deprecated)],
123 [case "${enableval}" in
124  yes) tpuart=true ;;
125   no)  tpuart=false ;;
126    *) AC_MSG_ERROR(bad value ${enableval} for --enable-tpuart) ;;
127  esac],[tpuart=false])
128 AM_CONDITIONAL(HAVE_TPUART, test x$tpuart = xtrue)
129 if test x$tpuart = xtrue ; then
130  AC_DEFINE(HAVE_TPUART, 1 , [TPUART enabled])
133 AC_ARG_ENABLE(pei16s,
134 [  --enable-pei16s      enable BCU1 user driver backend (very experimental)],
135 [case "${enableval}" in
136  yes) pei16s=true ;;
137   no)  pei16s=false ;;
138    *) AC_MSG_ERROR(bad value ${enableval} for --enable-pei16s) ;;
139  esac],[pei16s=false])
140 AM_CONDITIONAL(HAVE_PEI16s, test x$pei16s = xtrue)
141 if test x$pei16s = xtrue ; then
142  AC_DEFINE(HAVE_PEI16s, 1 , [PEI16s enabled])
145 AC_ARG_ENABLE(tpuarts,
146 [  --enable-tpuarts     enable TPUART user driver backend],
147 [case "${enableval}" in
148  yes) tpuarts=true ;;
149   no)  tpuarts=false ;;
150    *) AC_MSG_ERROR(bad value ${enableval} for --enable-tpuarts) ;;
151  esac],[tpuarts=false])
152 AM_CONDITIONAL(HAVE_TPUARTs, test x$tpuarts = xtrue)
153 if test x$tpuarts = xtrue ; then
154  AC_DEFINE(HAVE_TPUARTs, 1 , [TPUARTs enabled])
157 AC_ARG_ENABLE(eibnetip,
158 [  --enable-eibnetip    enable EIBnet/IP routing backend],
159 [case "${enableval}" in
160  yes) eibnetip=true ;;
161   no)  eibnetip=false ;;
162    *) AC_MSG_ERROR(bad value ${enableval} for --enable-eibnetip) ;;
163  esac],[eibnetip=false])
164 AM_CONDITIONAL(HAVE_EIBNETIP, test x$eibnetip = xtrue)
165 if test x$eibnetip = xtrue ; then
166  AC_DEFINE(HAVE_EIBNETIP, 1 , [EIBnet/IP enabled])
169 AC_ARG_ENABLE(eibnetiptunnel,
170 [  --enable-eibnetiptunnel      enable EIBnet/IP tunneling backend],
171 [case "${enableval}" in
172  yes) eibnetiptunnel=true ;;
173   no)  eibnetiptunnel=false ;;
174    *) AC_MSG_ERROR(bad value ${enableval} for --enable-eibnetiptunnel) ;;
175  esac],[eibnetiptunnel=false])
176 AM_CONDITIONAL(HAVE_EIBNETIPTUNNEL, test x$eibnetiptunnel = xtrue)
177 if test x$eibnetiptunnel = xtrue ; then
178  if test x$have_source_info != xyes ; then
179   AC_MSG_ERROR(not all needed functions for EIBnet/IP tunneling backend available)
180  fi
181  AC_DEFINE(HAVE_EIBNETIPTUNNEL, 1 , [EIBnet/IP tunneling enabled])
184 AC_ARG_ENABLE(usb,
185 [  --enable-usb                 enable USB backend],
186 [case "${enableval}" in
187  yes) usb=true ;;
188   no)  usb=false ;;
189    *) AC_MSG_ERROR(bad value ${enableval} for --enable-usb) ;;
190  esac],[usb=false])
191 AM_CONDITIONAL(HAVE_USB, test x$usb = xtrue)
192 if test x$usb = xtrue ; then
193  if test x$have_usb != xyes ; then
194   AC_MSG_ERROR(not all needed functions for USB backend available)
195  fi
196  AC_DEFINE(HAVE_USB, 1 , [USB backend enabled])
199 AC_ARG_ENABLE(eibnetipserver,
200 [  --enable-eibnetipserver      enable EIBnet/IP server frontend],
201 [case "${enableval}" in
202  yes) eibnetipserver=true ;;
203   no)  eibnetipserver=false ;;
204    *) AC_MSG_ERROR(bad value ${enableval} for --enable-eibnetipserver) ;;
205  esac],[eibnetipserver=false])
206 if test x$eibnetipserver = xtrue ; then
207  if test x$have_source_info != xyes ; then
208   AC_MSG_ERROR(not all needed functions for EIBnet/IP server available)
209  fi
210  AC_DEFINE(HAVE_EIBNETIPSERVER, 1 , [EIBnet/IP server enabled])
213 AC_ARG_ENABLE(groupcache,
214 [  --enable-groupcache          enable Group Cache (default: yes)],
215 [case "${enableval}" in
216  yes) groupcache=true ;;
217   no)  groupcache=false ;;
218    *) AC_MSG_ERROR(bad value ${enableval} for --enable-groupcache) ;;
219  esac],[groupcache=true])
220 if test x$groupcache = xtrue ; then
221  AC_DEFINE(HAVE_GROUPCACHE, 1 , [Group Cache enabled])
225 AM_CONDITIONAL(HAVE_SOURCE_INFO, test x$have_source_info = xyes )
227 AC_CHECK_PROGS(INDENT, indent, no)
228 AC_CHECK_PROGS(JAR, fastjar jar, no)
229 AC_CHECK_PROGS(JAVAC, "gcj -C" javac, no)
231 AC_ARG_ENABLE(java,
232 [  --enable-java                build java client library],
233 [case "${enableval}" in
234  yes) enablejava=true ;;
235   no)  enablejava=false ;;
236    *) AC_MSG_ERROR(bad value ${enableval} for --enable-java) ;;
237  esac],[enablejava=false])
238 if test x$enablejava = xtrue ; then
239  AC_DEFINE(BUILD_JAVA, 1 , [building java client library])
241  if test x"$JAVAC" = xno ; then
242   AC_MSG_ERROR(no java compiler found)
243  fi
245  if test x"$JAR" = xno ; then
246   AC_MSG_ERROR(jar not found)
247  fi
251 AC_ARG_WITH(libstdc,
252 [  --without-libstdc    don't use function from libstdc++],
253 [case "${withval}" in
254  yes) use_libstdc=true ;;
255   no)  use_libstdc=false ;;
256    *) AC_MSG_ERROR(bad value ${withval} for --with-libstdc) ;;
257  esac],[use_libstdc=true])
258 if test x$use_libstdc = xfalse ; then
259  AC_DEFINE(USE_NOLIBSTDC, 1 , [don't use libstdc++])
260  CXX=$CC
263 AM_CONDITIONAL(BUILD_JAVA, test x$enablejava = xtrue )
265 AC_CHECK_MEMBER([struct sockaddr_in.sin_len],[AC_DEFINE(HAVE_SOCKADDR_IN_LEN,1,[Do we have sockaddr_in.sin_len?])],[],
267 #include <sys/types.h>
268 #include <sys/socket.h>
269 #include <netinet/in.h>
272 AC_CONFIG_HEADERS(config.h)
273 AC_OUTPUT(Makefile 
274 common/Makefile
275 eibd/Makefile eibd/include/Makefile  eibd/client/Makefile eibd/examples/Makefile eibd/libserver/Makefile eibd/server/Makefile eibd/backend/Makefile
276 eibd/client/def/Makefile eibd/client/c/Makefile eibd/client/java/Makefile eibd/client/php/Makefile eibd/client/cs/Makefile
277 eibd/client/perl/Makefile eibd/client/python/Makefile eibd/client/pascal/Makefile
278 eibd/eibnet/Makefile eibd/bcu/Makefile eibd/usb/Makefile
279 xml/Makefile xml/gui/Makefile xml/gui/examples/Makefile
280 bcu/Makefile bcu/lib/Makefile bcu/include/Makefile bcu/ldscripts/Makefile
281 bcugen/Makefile bcugen/struct/Makefile bcugen/configfile/Makefile bcugen/lib/Makefile
282 archive/Makefile build/Makefile
283 contrib/Makefile
284 debian/Makefile
287 AC_CONFIG_MACRO_DIR([m4])