]> rtime.felk.cvut.cz Git - orte.git/blob - configure.in
ROBOT_DEMO: draw scale in HokuyoView
[orte.git] / configure.in
1 # Process this file with autoconf to produce a configure script.
2 #
3 # $Id: configure.in,v 1.15 2008/10/07 21:19:01 smolik Exp $
4
5 # autoconf requirement
6
7 AC_PREREQ([2.56])
8
9 AC_INIT([orte],[0.3.3],[petr.smolik@wo.cz])
10 AC_CONFIG_AUX_DIR(admin)
11
12 ###############################
13 # Package info
14 ORTE_MAJOR_VERSION=0
15 ORTE_MINOR_VERSION=3
16 ORTE_MICRO_VERSION=3
17 ORTE_INTERFACE_AGE=0
18 ORTE_BINARY_AGE=0
19 ORTE_VERSION=$ORTE_MAJOR_VERSION.$ORTE_MINOR_VERSION.$ORTE_MICRO_VERSION
20 AC_SUBST(ORTE_MAJOR_VERSION)
21 AC_SUBST(ORTE_MINOR_VERSION)
22 AC_SUBST(ORTE_MICRO_VERSION)
23 AC_SUBST(ORTE_VERSION)
24 AC_SUBST(ORTE_INTERFACE_AGE)
25 AC_SUBST(ORTE_BINARY_AGE)
26 #Libtool versioning
27 ORTE_MICRO_VERSION_NUM=`echo $ORTE_MICRO_VERSION | sed 's/[[a-zA-Z]]//g'`
28 LT_RELEASE=$ORTE_MAJOR_VERSION.$ORTE_MINOR_VERSION
29 LT_CURRENT=`expr $ORTE_MICRO_VERSION_NUM - $ORTE_INTERFACE_AGE`
30 LT_REVISION=$ORTE_INTERFACE_AGE
31 LT_AGE=`expr $ORTE_BINARY_AGE - $ORTE_INTERFACE_AGE`
32 AC_SUBST(LT_RELEASE)
33 AC_SUBST(LT_CURRENT)
34 AC_SUBST(LT_REVISION)
35 AC_SUBST(LT_AGE)
36 VERSION=$ORTE_VERSION
37 PACKAGE=orte
38
39 echo
40 echo "ORTE version $PACKAGE_VERSION"
41 echo "Configuring..."
42 echo
43
44 #Check for CPU / vendor / OS
45 AC_CANONICAL_HOST
46 AC_CANONICAL_TARGET
47 AM_CONFIG_HEADER(orte/include/orte/orte_config.h)
48 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
49
50
51 # Activate maintainer mode
52 AM_MAINTAINER_MODE
53
54 DS_LINUX()
55
56 ###############################
57 # target
58 WIN='no'
59 MINGW='no'
60 CYGWIN='no'
61 UNIX='no'
62 case "$target" in
63   *-cygwin*)
64     CFLAGS="$CFLAGS"
65     WIN='yes'
66     CYGWIN='yes'
67     AC_DEFINE([CONFIG_ORTE_WIN],[1],[Define if is target windows])
68     AC_DEFINE([CONFIG_ORTE_CYGWIN],[1],[Define if is target CYGWIN])
69     ;;  
70   *-mingw*)
71     CFLAGS="$CFLAGS"
72     WIN='yes'
73     MINGW='yes'
74     AC_DEFINE([CONFIG_ORTE_WIN],[1],[Define if is target windows])
75     AC_DEFINE([CONFIG_ORTE_MINGW],[1],[Define if is target MINGW])
76     AC_DEFINE([HAVE_GETPOT_LONG_ORTE],[1],[Define for ORTE getopt_long self implemetation])
77     ;;
78   *)
79     # Assume a Unix.
80     if test -z ${CONFIG_ORTE_RT} -a ${CONFIG_ORTE_KERNEL} ; then
81       UNIX='yes'
82       AC_DEFINE([CONFIG_ORTE_UNIX],[1],[Define if is target a unix system])
83     fi
84     ;;
85 esac
86 AM_CONDITIONAL(CONFIG_ORTE_WIN, test x$WIN = xyes)
87 AM_CONDITIONAL(CONFIG_ORTE_CYGWIN, test x$CIGWIN = xyes)
88 AM_CONDITIONAL(CONFIG_ORTE_MINGW, test x$MINGW = xyes)
89 AM_CONDITIONAL(CONFIG_ORTE_UNIX, test x$UNIX = xyes)
90
91 ###############################
92 # modules
93 moduledir="\$(libdir)/modules/\$(LINUX_KERNELRELEASE)/orte"
94 modulePROGRAMS_INSTALL="\$(top_builddir)/modtool --install"
95 modulePROGRAMS_UNINSTALL="\$(top_builddir)/modtool --uninstall"
96 AC_SUBST(moduledir)
97 AC_SUBST(modulePROGRAMS_INSTALL)
98
99 ###############################
100 # CFLAGS
101 CFLAGS="$CFLAGS -Wall"
102 if test ${USE_RTLINUX} == 'yes' ; then
103   CFLAGS="$CFLAGS $RTLINUX_CFLAGS"
104   CC="$RTLINUX_CC"
105 else
106   if test ${USE_RTAI} == 'yes' ; then
107     CFLAGS="$CFLAGS $RTAI_CFLAGS $LINUX_CFLAGS"
108   else
109     if test -n ${CONFIG_ORTE_KERNEL} ; then
110       CFLAGS="$CFLAGS $LINUX_CFLAGS"
111     fi
112   fi
113 fi
114
115 ###############################
116 # Checks for programs.
117 # Initialize libtool
118 AC_PROG_CC
119 AC_PROG_LIBTOOL
120
121 ###############################
122 # Checks for ability to compile ORTE_IDL
123 AM_ORTE_IDL
124
125 ###############################
126 # Checks for ability to compile JORTE
127 AM_JORTE
128
129 ###############################
130 # Checks for libraries and init libtools
131 if test -z ${CONFIG_ORTE_RT} ; then
132   AC_CHECK_LIB([ws2_32], [main])
133   AC_CHECK_LIB([socket], [main])
134   AC_CHECK_LIB([nsl], [main])
135   dnl Check for pthreads
136   AC_CHECK_LIB(pthread, pthread_create, ,
137          AC_CHECK_LIB(c_r, pthread_create, ,
138               if test ${MINGW} == 'yes' ; then
139                      LIBS=$LIBS' -L$(top_srcdir)/orte/contrib/win_pthread/ -lpthread'
140                      AC_MSG_NOTICE([Using internal version of pthreads!!!])
141               else
142                      AC_MSG_ERROR([Can't compile without pthreads!!!])
143               fi       
144          )
145   )
146 fi
147
148 ###############################
149 # enable GNU source
150 AH_VERBATIM([_GNU_SOURCE],[
151 #ifndef _GNU_SOURCE
152   #define _GNU_SOURCE
153 #endif
154 ]) 
155
156 ###############################
157 # Checks for header files.
158 # user space
159 if test ${UNIX} == 'yes' -o ${WIN} == 'yes' ; then
160     AC_HEADER_STDC
161     AC_CHECK_HEADERS([\
162     arpa/inet.h fcntl.h stdio.h netdb.h stdlib.h \
163     string.h sys/ioctl.h sys/time.h unistd.h pthread.h \
164     sys/types.h sys/sockio.h stdarg.h byteswap.h getopt.h \
165     ctype.h signal.h stdint.h errno.h],,,[[]])
166     AC_CHECK_HEADERS([sys/socket.h], [], [],
167           [#ifdef HAVE_SYS_TYPES_H
168              #include <sys/types.h>
169            #endif])
170     AC_CHECK_HEADERS([netinet/in.h], [], [],
171           [#ifdef HAVE_SYS_TYPES_H
172              #include <sys/types.h>
173            #endif])
174     AC_CHECK_HEADERS([net/if.h], [], [],
175           [#ifdef HAVE_SYS_TYPES_H
176              #include <sys/types.h>
177            #endif
178            #ifdef HAVE_SYS_SOCKET_H
179              #include <sys/socket.h>
180            #endif])
181 fi
182 # win32
183 if test ${WIN} == 'yes' ; then
184     AC_CHECK_HEADERS([\
185     winsock2.h ws2tcpip.h windows.h w32api/windows.h],,,[[]])
186 fi
187 # kernel
188 if test ${CONFIG_ORTE_KERNEL} == 'yes' ; then
189     AC_CHECK_HEADERS([\
190     asm/byteorder.h linux/ctype.h linux/string.h \
191     linux/module.h linux/if.h linux/socket.h \
192     linux/time.h linux/types.h],,,[[]])
193     AC_CHECK_HEADERS([linux/in.h],,,[
194     #ifdef HAVE_LINUX_SOCKET_H
195       #include <linux/socket.h>
196     #endif
197     ])
198 fi
199 # RTLinux
200 if test ${USE_RTLINUX} == 'yes' ; then
201     AC_CHECK_HEADERS([\
202     string.h pthread.h \
203     rtl.h rtl_malloc.h udp.h nic.h time.h],,,[[]])
204     AC_CHECK_HEADERS([nictab.h],,,[
205     #ifdef HAVE_UDP_H
206       #include <udp.h>
207     #endif
208     #ifdef HAVE_NIC_H
209       #include <nic.h>
210     #endif
211     ])
212     AC_CHECK_HEADERS([onetd.h],,,[
213     #ifdef HAVE_LINUX_IF_H
214       #include <linux/if.h>
215     #endif
216     #ifdef HAVE_LINUX_IN_H
217       #include <linux/in.h>
218     #endif
219     #ifdef HAVE_PTHREAD_H
220       #include <pthread.h>
221     #endif
222     ])
223 fi
224 # RTAI
225 if test ${USE_RTAI} == 'yes' ; then
226     AC_CHECK_HEADERS([\
227     rtnet.h],,,[[]])
228 fi
229
230 ###############################
231 # includes
232 INCLUDES='-I$(top_srcdir)/orte/include -I$(top_builddir)/orte/include'
233 AC_SUBST(INCLUDES)
234
235 ###############################
236 # Checks for typedefs, structures, and compiler characteristics.
237 AC_C_BIGENDIAN
238 AC_C_CONST
239 AC_C_INLINE
240
241 ###############################
242 # Checks for library functions.
243 AC_PROG_GCC_TRADITIONAL
244 if test -z ${CONFIG_ORTE_RT} ; then
245 AC_CHECK_FUNCS([gethostbyname getopt_long])
246 fi
247
248 AC_CONFIG_FILES([Makefile
249                  orte/Makefile
250                  orte/liborte/Makefile
251                  orte/liborte/rtl/Makefile
252                  orte/examples/Makefile
253                  orte/examples/hello/Makefile
254                  orte/examples/multicast/Makefile
255                  orte/examples/reliable/Makefile
256                  orte/examples/ping/Makefile
257                  orte/examples/spy/Makefile
258                  orte/examples/schneider/Makefile
259                  orte/examples/mpo/Makefile
260                  orte/idl-compiler/Makefile
261                  orte/libjorte/Makefile
262                  orte/manager/Makefile])
263
264
265 AC_OUTPUT([
266 modtool
267 ])
268 chmod +x modtool
269
270 # ======================================================================
271 #               generate orte/include/orte/orte_config.h
272 # ======================================================================
273
274 AC_MSG_NOTICE([creating orte/include/orte/orte_config.h])
275 sed -e "s/ PACKAGE/ ORTE_PACKAGE/" -e "s/ VERSION/ ORTE_VERSION/" \
276     orte/include/orte/orte_config.h >orte/include/orte/orte_config.h.new
277 if cmp -s orte/include/orte/orte_config.h.new orte/include/orte/orte_config.h; then
278         rm orte/include/orte/orte_config.h.new
279         AC_MSG_NOTICE([orte/include/orte/orte_config.h is unchanged])
280 else
281         mv orte/include/orte/orte_config.h.new orte/include/orte/orte_config.h
282 fi
283
284 echo \
285 "------------------------------------------------------------------------
286 Configuration ORTE:
287
288   Source code location:       ${srcdir}
289   Compiler:                   ${CC}
290   Compiler flags:             ${CFLAGS}
291   Host System Type:           ${host}
292   
293   See orte_config.h for future configuration information.
294   
295   Now you can run
296   make  
297   
298 ------------------------------------------------------------------------"
299