sed: -r is not portable
[bcusdk.git] / configure.in
blob08520f1df7a52875462fdee4bf5c82f726d3251c
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(LINUX_API, 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 have_bsd_source_info=no
53 AC_CHECK_DECL(__FreeBSD__,[have_bsd_source_info=yes],[],[])
54 AC_CHECK_DECL(__APPLE__,[have_bsd_source_info=yes],[],[])
55 if test x$have_bsd_source_info = xyes ; then
56   AC_DEFINE(HAVE_BSD_SOURCEINFO, 1,[FreeBSD compatible sourceinfo])
57   have_source_info=yes
60 AC_CHECK_FUNCS(gethostbyname_r,,[AC_MSG_WARN([eibd client library not thread safe])])
62 AM_CONDITIONAL(LINUX_API, test x$have_linux_api = xyes)
64 AC_ARG_ENABLE(onlyeibd,
65 [  --enable-onlyeibd            build only eibd (requires no libxml and m68hc05-gnu)],
66 [case "${enableval}" in
67  yes) onlyeibd=true ;;
68   no)  onlyeibd=false ;;
69    *) AC_MSG_ERROR(bad value ${enableval} for --enable-onlyeibd) ;;
70  esac],[onlyeibd=false])
71 AM_CONDITIONAL(HAVE_ONLYEIBD, test x$onlyeibd = xtrue)
73 if test x$onlyeibd = xfalse ; then
75 AM_PATH_XML2(2.6.16,,[AC_MSG_ERROR([limxml2 not found])])
76 AC_PATH_PROG(TAS,[m68hc05-as],,[$PATH:$bindir:$prefix/bin])
77 AC_PATH_PROG(TLD,[m68hc05-ld],,[$PATH:$bindir:$prefix/bin])
78 AC_PATH_PROG(TAR,[m68hc05-ar],,[$PATH:$bindir:$prefix/bin])
79 AC_PATH_PROG(TRANLIB,[m68hc05-ranlib],,[$PATH:$bindir:$prefix/bin])
80 AC_PATH_PROG(TGCC,[m68hc05-gcc],,[$PATH:$bindir:$prefix/bin])
82 test -z "$TAS" && AC_MSG_ERROR([m68hc05-as not found])
83 test -z "$TAR" && AC_MSG_ERROR([m68hc05-ar not found])
84 test -z "$TLD" && AC_MSG_ERROR([m68hc05-ld not found])
85 test -z "$TRANLIB" && AC_MSG_ERROR([m68hc05 ranlib not found])
86 test -z "$TGCC" && AC_MSG_ERROR([m68hc05 gcc not found])
90 AC_ARG_ENABLE(ft12,
91 [  --enable-ft12                enable FT1.2 backend],
92 [case "${enableval}" in
93  yes) ft12=true ;;
94   no)  ft12=false ;;
95    *) AC_MSG_ERROR(bad value ${enableval} for --enable-ft12) ;;
96  esac],[ft12=false])
97 AM_CONDITIONAL(HAVE_FT12, test x$ft12 = xtrue)
98 if test x$ft12 = xtrue ; then
99  AC_DEFINE(HAVE_FT12, 1 , [FT1.2 enabled])
102 AC_ARG_ENABLE(pei16,
103 [  --enable-pei16       enable BCU1 kernel driver backend],
104 [case "${enableval}" in
105  yes) pei16=true ;;
106   no)  pei16=false ;;
107    *) AC_MSG_ERROR(bad value ${enableval} for --enable-pei16) ;;
108  esac],[pei16=false])
109 AM_CONDITIONAL(HAVE_PEI16, test x$pei16 = xtrue)
110 if test x$pei16 = xtrue; then
111  AC_DEFINE(HAVE_PEI16, 1 , [PEI16 enabled])
114 AC_ARG_ENABLE(tpuart,
115 [  --enable-tpuart      enable TPUART kernel driver backend],
116 [case "${enableval}" in
117  yes) tpuart=true ;;
118   no)  tpuart=false ;;
119    *) AC_MSG_ERROR(bad value ${enableval} for --enable-tpuart) ;;
120  esac],[tpuart=false])
121 AM_CONDITIONAL(HAVE_TPUART, test x$tpuart = xtrue)
122 if test x$tpuart = xtrue ; then
123  AC_DEFINE(HAVE_TPUART, 1 , [TPUART enabled])
126 AC_ARG_ENABLE(pei16s,
127 [  --enable-pei16s      enable BCU1 user driver backend (very experimental)],
128 [case "${enableval}" in
129  yes) pei16s=true ;;
130   no)  pei16s=false ;;
131    *) AC_MSG_ERROR(bad value ${enableval} for --enable-pei16s) ;;
132  esac],[pei16s=false])
133 AM_CONDITIONAL(HAVE_PEI16s, test x$pei16s = xtrue)
134 if test x$pei16s = xtrue ; then
135  AC_DEFINE(HAVE_PEI16s, 1 , [PEI16s enabled])
138 AC_ARG_ENABLE(tpuarts,
139 [  --enable-tpuarts     enable TPUART user driver backend (experimental)],
140 [case "${enableval}" in
141  yes) tpuarts=true ;;
142   no)  tpuarts=false ;;
143    *) AC_MSG_ERROR(bad value ${enableval} for --enable-tpuarts) ;;
144  esac],[tpuarts=false])
145 AM_CONDITIONAL(HAVE_TPUARTs, test x$tpuarts = xtrue)
146 if test x$tpuarts = xtrue ; then
147  AC_DEFINE(HAVE_TPUARTs, 1 , [TPUARTs enabled])
150 AC_ARG_ENABLE(eibnetip,
151 [  --enable-eibnetip    enable EIBnet/IP routing backend],
152 [case "${enableval}" in
153  yes) eibnetip=true ;;
154   no)  eibnetip=false ;;
155    *) AC_MSG_ERROR(bad value ${enableval} for --enable-eibnetip) ;;
156  esac],[eibnetip=false])
157 AM_CONDITIONAL(HAVE_EIBNETIP, test x$eibnetip = xtrue)
158 if test x$eibnetip = xtrue ; then
159  AC_DEFINE(HAVE_EIBNETIP, 1 , [EIBnet/IP enabled])
162 AC_ARG_ENABLE(eibnetiptunnel,
163 [  --enable-eibnetiptunnel      enable EIBnet/IP tunneling backend],
164 [case "${enableval}" in
165  yes) eibnetiptunnel=true ;;
166   no)  eibnetiptunnel=false ;;
167    *) AC_MSG_ERROR(bad value ${enableval} for --enable-eibnetiptunnel) ;;
168  esac],[eibnetiptunnel=false])
169 AM_CONDITIONAL(HAVE_EIBNETIPTUNNEL, test x$eibnetiptunnel = xtrue)
170 if test x$eibnetiptunnel = xtrue ; then
171  if test x$have_source_info != xyes ; then
172   AC_MSG_ERROR(not all needed functions for EIBnet/IP tunneling backend available)
173  fi
174  AC_DEFINE(HAVE_EIBNETIPTUNNEL, 1 , [EIBnet/IP tunneling enabled])
177 AC_ARG_ENABLE(usb,
178 [  --enable-usb                 enable USB backend],
179 [case "${enableval}" in
180  yes) usb=true ;;
181   no)  usb=false ;;
182    *) AC_MSG_ERROR(bad value ${enableval} for --enable-usb) ;;
183  esac],[usb=false])
184 AM_CONDITIONAL(HAVE_USB, test x$usb = xtrue)
185 if test x$usb = xtrue ; then
186  if test x$have_usb != xyes ; then
187   AC_MSG_ERROR(not all needed functions for USB backend available)
188  fi
189  AC_DEFINE(HAVE_USB, 1 , [USB backend enabled])
192 AC_ARG_ENABLE(eibnetipserver,
193 [  --enable-eibnetipserver      enable EIBnet/IP server frontend],
194 [case "${enableval}" in
195  yes) eibnetipserver=true ;;
196   no)  eibnetipserver=false ;;
197    *) AC_MSG_ERROR(bad value ${enableval} for --enable-eibnetipserver) ;;
198  esac],[eibnetipserver=false])
199 if test x$eibnetipserver = xtrue ; then
200  if test x$have_source_info != xyes ; then
201   AC_MSG_ERROR(not all needed functions for EIBnet/IP server available)
202  fi
203  AC_DEFINE(HAVE_EIBNETIPSERVER, 1 , [EIBnet/IP server enabled])
206 AC_ARG_ENABLE(groupcache,
207 [  --enable-groupcache          enable Group Cache (default: yes)],
208 [case "${enableval}" in
209  yes) groupcache=true ;;
210   no)  groupcache=false ;;
211    *) AC_MSG_ERROR(bad value ${enableval} for --enable-groupcache) ;;
212  esac],[groupcache=true])
213 if test x$groupcache = xtrue ; then
214  AC_DEFINE(HAVE_GROUPCACHE, 1 , [Group Cache enabled])
218 AM_CONDITIONAL(HAVE_SOURCE_INFO, test x$have_source_info = xyes )
220 AC_CHECK_PROGS(INDENT, indent, no)
221 AC_CHECK_PROGS(JAR, fastjar jar, no)
222 AC_CHECK_PROGS(JAVAC, "gcj -C" javac, no)
224 AC_ARG_ENABLE(java,
225 [  --enable-java                build java client library],
226 [case "${enableval}" in
227  yes) enablejava=true ;;
228   no)  enablejava=false ;;
229    *) AC_MSG_ERROR(bad value ${enableval} for --enable-java) ;;
230  esac],[enablejava=false])
231 if test x$enablejava = xtrue ; then
232  AC_DEFINE(BUILD_JAVA, 1 , [building java client library])
234  if test x"$JAVAC" = xno ; then
235   AC_MSG_ERROR(no java compiler found)
236  fi
238  if test x"$JAR" = xno ; then
239   AC_MSG_ERROR(jar not found)
240  fi
244 AC_ARG_WITH(libstdc,
245 [  --without-libstdc    don't use function from libstdc++],
246 [case "${withval}" in
247  yes) use_libstdc=true ;;
248   no)  use_libstdc=false ;;
249    *) AC_MSG_ERROR(bad value ${withval} for --with-libstdc) ;;
250  esac],[use_libstdc=true])
251 if test x$use_libstdc = xfalse ; then
252  AC_DEFINE(USE_NOLIBSTDC, 1 , [don't use libstdc++])
253  CXX=$CC
256 AM_CONDITIONAL(BUILD_JAVA, test x$enablejava = xtrue )
258 AC_CHECK_MEMBER([struct sockaddr_in.sin_len],[AC_DEFINE(HAVE_SOCKADDR_IN_LEN,1,[Do we have sockaddr_in.sin_len?])],[],
260 #include <sys/types.h>
261 #include <sys/socket.h>
262 #include <netinet/in.h>
265 AC_CONFIG_HEADERS(config.h)
266 AC_OUTPUT(Makefile 
267 common/Makefile
268 eibd/Makefile eibd/include/Makefile  eibd/client/Makefile eibd/examples/Makefile eibd/libserver/Makefile eibd/server/Makefile eibd/backend/Makefile
269 eibd/client/def/Makefile eibd/client/c/Makefile eibd/client/java/Makefile eibd/client/php/Makefile eibd/client/cs/Makefile
270 eibd/eibnet/Makefile eibd/bcu/Makefile eibd/usb/Makefile
271 xml/Makefile xml/gui/Makefile xml/gui/examples/Makefile
272 bcu/Makefile bcu/lib/Makefile bcu/include/Makefile bcu/ldscripts/Makefile
273 bcugen/Makefile bcugen/struct/Makefile bcugen/configfile/Makefile bcugen/lib/Makefile
274 archive/Makefile build/Makefile
275 contrib/Makefile
276 debian/Makefile