CEMI: Adapt/correct repeat to AN066
[bcusdk.git] / configure.in
blob31b9ceb940fa824ff3dd5e73b09e21b2d20d17f2
1 dnl ##    BCU SDK bcu development enviroment - autoconf & automake files
2 dnl ##    Copyright (C) 2005-2009 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
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_COMPILER_OPTION(nortti,[-fno-rtti],[-fno-rtti],CXXFLAGS="$CXXFLAGS -fno-rtti")
40 AC_COMPILER_OPTION(noexceptions,[-fno-exceptions],[-fno-exceptions],CXXFLAGS="$CXXFLAGS -fno-exceptions")
41 AC_CHECK_PTHSEM(2.0.4,yes,yes,no)
42 AC_CHECK_HEADER(argp.h,,[AC_MSG_ERROR([argp_parse not found])])
43 AC_SEARCH_LIBS(argp_parse,argp,,[AC_MSG_ERROR([argp_parse not found])])
44 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])])
45 have_source_info=no
46 have_linux_api=no
47 AC_CHECK_HEADER(linux/rtnetlink.h,[AC_DEFINE(HAVE_LINUX_NETLINK, 1,[Linux netlink layer available]) have_source_info=yes],[],[-])
48 AC_CHECK_HEADER(linux/usbdevice_fs.h,[AC_DEFINE(OS_LINUX, 1, [Linux usb available]) have_linux_api=yes; have_usb=yes],[],[-])
49 AC_CHECK_HEADER(iphlpapi.h,[AC_DEFINE(HAVE_WINDOWS_IPHELPER, 1,[Windows IPHelper available]) 
50   LIBS="-liphlpapi $LIBS"; have_source_info=yes],[],[-])
52 AC_CHECK_DECL(SA_SIZE,[AC_DEFINE(HAVE_SA_SIZE, 1,[SA_SIZE function available])],[],[#include <net/route.h>])
53 have_bsd_source_info=no
54 AC_CHECK_DECL(__FreeBSD__,[have_bsd_source_info=yes],[],[])
55 AC_CHECK_DECL(__APPLE__,[have_bsd_source_info=yes],[],[])
56 if test x$have_bsd_source_info = xyes ; then
57   AC_DEFINE(HAVE_BSD_SOURCEINFO, 1,[FreeBSD compatible sourceinfo])
58   have_source_info=yes
61 AC_CHECK_FUNCS(gethostbyname_r,,[AC_MSG_WARN([eibd client library not thread safe])])
63 AM_CONDITIONAL(LINUX_API, test x$have_linux_api = xyes)
65 AC_ARG_ENABLE(onlyeibd,
66 [  --enable-onlyeibd            build only eibd (requires no libxml and m68hc05-gnu)],
67 [case "${enableval}" in
68  yes) onlyeibd=true ;;
69   no)  onlyeibd=false ;;
70    *) AC_MSG_ERROR(bad value ${enableval} for --enable-onlyeibd) ;;
71  esac],[onlyeibd=false])
72 AM_CONDITIONAL(HAVE_ONLYEIBD, test x$onlyeibd = xtrue)
74 if test x$onlyeibd = xfalse ; then
76 AM_PATH_XML2(2.6.16,,[AC_MSG_ERROR([limxml2 not found])])
77 AC_PATH_PROG(TAS,[m68hc05-as],,[$PATH:$bindir:$prefix/bin])
78 AC_PATH_PROG(TLD,[m68hc05-ld],,[$PATH:$bindir:$prefix/bin])
79 AC_PATH_PROG(TAR,[m68hc05-ar],,[$PATH:$bindir:$prefix/bin])
80 AC_PATH_PROG(TRANLIB,[m68hc05-ranlib],,[$PATH:$bindir:$prefix/bin])
81 AC_PATH_PROG(TGCC,[m68hc05-gcc],,[$PATH:$bindir:$prefix/bin])
83 test -z "$TAS" && AC_MSG_ERROR([m68hc05-as not found])
84 test -z "$TAR" && AC_MSG_ERROR([m68hc05-ar not found])
85 test -z "$TLD" && AC_MSG_ERROR([m68hc05-ld not found])
86 test -z "$TRANLIB" && AC_MSG_ERROR([m68hc05 ranlib not found])
87 test -z "$TGCC" && AC_MSG_ERROR([m68hc05 gcc not found])
91 AC_ARG_ENABLE(ft12,
92 [  --enable-ft12                enable FT1.2 backend],
93 [case "${enableval}" in
94  yes) ft12=true ;;
95   no)  ft12=false ;;
96    *) AC_MSG_ERROR(bad value ${enableval} for --enable-ft12) ;;
97  esac],[ft12=false])
98 AM_CONDITIONAL(HAVE_FT12, test x$ft12 = xtrue)
99 if test x$ft12 = xtrue ; then
100  AC_DEFINE(HAVE_FT12, 1 , [FT1.2 enabled])
103 AC_ARG_ENABLE(pei16,
104 [  --enable-pei16       enable BCU1 kernel driver backend],
105 [case "${enableval}" in
106  yes) pei16=true ;;
107   no)  pei16=false ;;
108    *) AC_MSG_ERROR(bad value ${enableval} for --enable-pei16) ;;
109  esac],[pei16=false])
110 AM_CONDITIONAL(HAVE_PEI16, test x$pei16 = xtrue)
111 if test x$pei16 = xtrue; then
112  AC_DEFINE(HAVE_PEI16, 1 , [PEI16 enabled])
115 AC_ARG_ENABLE(tpuart,
116 [  --enable-tpuart      enable TPUART kernel driver backend (deprecated)],
117 [case "${enableval}" in
118  yes) tpuart=true ;;
119   no)  tpuart=false ;;
120    *) AC_MSG_ERROR(bad value ${enableval} for --enable-tpuart) ;;
121  esac],[tpuart=false])
122 AM_CONDITIONAL(HAVE_TPUART, test x$tpuart = xtrue)
123 if test x$tpuart = xtrue ; then
124  AC_DEFINE(HAVE_TPUART, 1 , [TPUART enabled])
127 AC_ARG_ENABLE(pei16s,
128 [  --enable-pei16s      enable BCU1 user driver backend (very experimental)],
129 [case "${enableval}" in
130  yes) pei16s=true ;;
131   no)  pei16s=false ;;
132    *) AC_MSG_ERROR(bad value ${enableval} for --enable-pei16s) ;;
133  esac],[pei16s=false])
134 AM_CONDITIONAL(HAVE_PEI16s, test x$pei16s = xtrue)
135 if test x$pei16s = xtrue ; then
136  AC_DEFINE(HAVE_PEI16s, 1 , [PEI16s enabled])
139 AC_ARG_ENABLE(tpuarts,
140 [  --enable-tpuarts     enable TPUART user driver backend],
141 [case "${enableval}" in
142  yes) tpuarts=true ;;
143   no)  tpuarts=false ;;
144    *) AC_MSG_ERROR(bad value ${enableval} for --enable-tpuarts) ;;
145  esac],[tpuarts=false])
146 AM_CONDITIONAL(HAVE_TPUARTs, test x$tpuarts = xtrue)
147 if test x$tpuarts = xtrue ; then
148  AC_DEFINE(HAVE_TPUARTs, 1 , [TPUARTs enabled])
151 AC_ARG_ENABLE(eibnetip,
152 [  --enable-eibnetip    enable EIBnet/IP routing backend],
153 [case "${enableval}" in
154  yes) eibnetip=true ;;
155   no)  eibnetip=false ;;
156    *) AC_MSG_ERROR(bad value ${enableval} for --enable-eibnetip) ;;
157  esac],[eibnetip=false])
158 AM_CONDITIONAL(HAVE_EIBNETIP, test x$eibnetip = xtrue)
159 if test x$eibnetip = xtrue ; then
160  AC_DEFINE(HAVE_EIBNETIP, 1 , [EIBnet/IP enabled])
163 AC_ARG_ENABLE(eibnetiptunnel,
164 [  --enable-eibnetiptunnel      enable EIBnet/IP tunneling backend],
165 [case "${enableval}" in
166  yes) eibnetiptunnel=true ;;
167   no)  eibnetiptunnel=false ;;
168    *) AC_MSG_ERROR(bad value ${enableval} for --enable-eibnetiptunnel) ;;
169  esac],[eibnetiptunnel=false])
170 AM_CONDITIONAL(HAVE_EIBNETIPTUNNEL, test x$eibnetiptunnel = xtrue)
171 if test x$eibnetiptunnel = xtrue ; then
172  if test x$have_source_info != xyes ; then
173   AC_MSG_ERROR(not all needed functions for EIBnet/IP tunneling backend available)
174  fi
175  AC_DEFINE(HAVE_EIBNETIPTUNNEL, 1 , [EIBnet/IP tunneling enabled])
178 AC_ARG_ENABLE(usb,
179 [  --enable-usb                 enable USB backend],
180 [case "${enableval}" in
181  yes) usb=true ;;
182   no)  usb=false ;;
183    *) AC_MSG_ERROR(bad value ${enableval} for --enable-usb) ;;
184  esac],[usb=false])
185 AM_CONDITIONAL(HAVE_USB, test x$usb = xtrue)
186 if test x$usb = xtrue ; then
187  if test x$have_usb != xyes ; then
188   AC_MSG_ERROR(not all needed functions for USB backend available)
189  fi
190  AC_DEFINE(HAVE_USB, 1 , [USB backend enabled])
193 AC_ARG_ENABLE(eibnetipserver,
194 [  --enable-eibnetipserver      enable EIBnet/IP server frontend],
195 [case "${enableval}" in
196  yes) eibnetipserver=true ;;
197   no)  eibnetipserver=false ;;
198    *) AC_MSG_ERROR(bad value ${enableval} for --enable-eibnetipserver) ;;
199  esac],[eibnetipserver=false])
200 if test x$eibnetipserver = xtrue ; then
201  if test x$have_source_info != xyes ; then
202   AC_MSG_ERROR(not all needed functions for EIBnet/IP server available)
203  fi
204  AC_DEFINE(HAVE_EIBNETIPSERVER, 1 , [EIBnet/IP server enabled])
207 AC_ARG_ENABLE(groupcache,
208 [  --enable-groupcache          enable Group Cache (default: yes)],
209 [case "${enableval}" in
210  yes) groupcache=true ;;
211   no)  groupcache=false ;;
212    *) AC_MSG_ERROR(bad value ${enableval} for --enable-groupcache) ;;
213  esac],[groupcache=true])
214 if test x$groupcache = xtrue ; then
215  AC_DEFINE(HAVE_GROUPCACHE, 1 , [Group Cache enabled])
219 AM_CONDITIONAL(HAVE_SOURCE_INFO, test x$have_source_info = xyes )
221 AC_CHECK_PROGS(INDENT, indent, no)
222 AC_CHECK_PROGS(JAR, fastjar jar, no)
223 AC_CHECK_PROGS(JAVAC, "gcj -C" javac, no)
225 AC_ARG_ENABLE(java,
226 [  --enable-java                build java client library],
227 [case "${enableval}" in
228  yes) enablejava=true ;;
229   no)  enablejava=false ;;
230    *) AC_MSG_ERROR(bad value ${enableval} for --enable-java) ;;
231  esac],[enablejava=false])
232 if test x$enablejava = xtrue ; then
233  AC_DEFINE(BUILD_JAVA, 1 , [building java client library])
235  if test x"$JAVAC" = xno ; then
236   AC_MSG_ERROR(no java compiler found)
237  fi
239  if test x"$JAR" = xno ; then
240   AC_MSG_ERROR(jar not found)
241  fi
245 AC_ARG_WITH(libstdc,
246 [  --without-libstdc    don't use function from libstdc++],
247 [case "${withval}" in
248  yes) use_libstdc=true ;;
249   no)  use_libstdc=false ;;
250    *) AC_MSG_ERROR(bad value ${withval} for --with-libstdc) ;;
251  esac],[use_libstdc=true])
252 if test x$use_libstdc = xfalse ; then
253  AC_DEFINE(USE_NOLIBSTDC, 1 , [don't use libstdc++])
254  CXX=$CC
257 AM_CONDITIONAL(BUILD_JAVA, test x$enablejava = xtrue )
259 AC_CHECK_MEMBER([struct sockaddr_in.sin_len],[AC_DEFINE(HAVE_SOCKADDR_IN_LEN,1,[Do we have sockaddr_in.sin_len?])],[],
261 #include <sys/types.h>
262 #include <sys/socket.h>
263 #include <netinet/in.h>
266 AC_CONFIG_HEADERS(config.h)
267 AC_OUTPUT(Makefile 
268 common/Makefile
269 eibd/Makefile eibd/include/Makefile  eibd/client/Makefile eibd/examples/Makefile eibd/libserver/Makefile eibd/server/Makefile eibd/backend/Makefile
270 eibd/client/def/Makefile eibd/client/c/Makefile eibd/client/java/Makefile eibd/client/php/Makefile eibd/client/cs/Makefile
271 eibd/eibnet/Makefile eibd/bcu/Makefile eibd/usb/Makefile
272 xml/Makefile xml/gui/Makefile xml/gui/examples/Makefile
273 bcu/Makefile bcu/lib/Makefile bcu/include/Makefile bcu/ldscripts/Makefile
274 bcugen/Makefile bcugen/struct/Makefile bcugen/configfile/Makefile bcugen/lib/Makefile
275 archive/Makefile build/Makefile
276 contrib/Makefile
277 debian/Makefile