]> rtime.felk.cvut.cz Git - orte.git/blob - configure.ac
RoboDruid: improve handling of short taps
[orte.git] / configure.ac
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.69])
8
9 AC_INIT([orte],[0.3.4],[orte@rtime.felk.cvut.cz],[],[http://orte.sf.net])
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_VERSION=$ORTE_MAJOR_VERSION.$ORTE_MINOR_VERSION.$ORTE_MICRO_VERSION
18 AC_SUBST(ORTE_MAJOR_VERSION)
19 AC_SUBST(ORTE_MINOR_VERSION)
20 AC_SUBST(ORTE_MICRO_VERSION)
21 AC_SUBST(ORTE_VERSION)
22
23 # Libtool versioning (see libtool manual)
24
25 LT_CURRENT=1 # This will be part of SONAME
26 LT_REVISION=0
27 LT_AGE=0
28 AC_SUBST(LT_CURRENT)
29 AC_SUBST(LT_REVISION)
30 AC_SUBST(LT_AGE)
31 VERSION=$ORTE_VERSION
32 PACKAGE=orte
33
34 echo
35 echo "ORTE version $PACKAGE_VERSION"
36 echo "Configuring..."
37 echo
38
39 #Check for CPU / vendor / OS
40 AC_CANONICAL_HOST
41 AC_CANONICAL_TARGET
42 AC_CONFIG_HEADER(orte/include/orte/orte_config.h)
43 AM_INIT_AUTOMAKE(no-define)
44
45
46 # Activate maintainer mode
47 AM_MAINTAINER_MODE
48
49 DS_LINUX()
50
51 ###############################
52 # target
53 WIN='no'
54 MINGW='no'
55 CYGWIN='no'
56 UNIX='no'
57 case "$target" in
58   *-cygwin*)
59     CFLAGS="$CFLAGS"
60     WIN='yes'
61     CYGWIN='yes'
62     AC_DEFINE([CONFIG_ORTE_WIN],[1],[Define if is target windows])
63     AC_DEFINE([CONFIG_ORTE_CYGWIN],[1],[Define if is target CYGWIN])
64     ;;  
65   *-mingw*)
66     CFLAGS="$CFLAGS"
67     WIN='yes'
68     MINGW='yes'
69     AC_DEFINE([CONFIG_ORTE_WIN],[1],[Define if is target windows])
70     AC_DEFINE([CONFIG_ORTE_MINGW],[1],[Define if is target MINGW])
71     AC_DEFINE([HAVE_GETPOT_LONG_ORTE],[1],[Define for ORTE getopt_long self implemetation])
72     ;;
73   *)
74     # Assume a Unix.
75     if test -z "${CONFIG_ORTE_RT}" -a "${CONFIG_ORTE_KERNEL}" ; then
76       UNIX='yes'
77       AC_DEFINE([CONFIG_ORTE_UNIX],[1],[Define if is target a unix system])
78     fi
79     ;;
80 esac
81 AM_CONDITIONAL(CONFIG_ORTE_WIN, test x$WIN = xyes)
82 AM_CONDITIONAL(CONFIG_ORTE_CYGWIN, test x$CIGWIN = xyes)
83 AM_CONDITIONAL(CONFIG_ORTE_MINGW, test x$MINGW = xyes)
84 AM_CONDITIONAL(CONFIG_ORTE_UNIX, test x$UNIX = xyes)
85
86 ###############################
87 # modules
88 moduledir="\$(libdir)/modules/\$(LINUX_KERNELRELEASE)/orte"
89 modulePROGRAMS_INSTALL="\$(top_builddir)/modtool --install"
90 modulePROGRAMS_UNINSTALL="\$(top_builddir)/modtool --uninstall"
91 AC_SUBST(moduledir)
92 AC_SUBST(modulePROGRAMS_INSTALL)
93
94 ###############################
95 # CFLAGS
96 CFLAGS="$CFLAGS -Wall"
97 if test ${USE_RTLINUX} == 'yes' ; then
98   CFLAGS="$CFLAGS $RTLINUX_CFLAGS"
99   CC="$RTLINUX_CC"
100 else
101   if test ${USE_RTAI} == 'yes' ; then
102     CFLAGS="$CFLAGS $RTAI_CFLAGS $LINUX_CFLAGS"
103   else
104     if test -n "${CONFIG_ORTE_KERNEL}" ; then
105       CFLAGS="$CFLAGS $LINUX_CFLAGS"
106     fi
107   fi
108 fi
109
110 ###############################
111 # Checks for programs.
112 # Initialize libtool
113 AC_PROG_CC
114 AM_PROG_CC_C_O
115 LT_INIT([win32-dll])
116
117 ###############################
118 # Checks for ability to compile ORTE_IDL
119 AM_ORTE_IDL
120
121 ###############################
122 # Checks for ability to compile JORTE
123 AM_JORTE
124
125 ###############################
126 # Checks for libraries and init libtools
127 if test -z "${CONFIG_ORTE_RT}" ; then
128   AC_CHECK_LIB([ws2_32], [main])
129   AC_CHECK_LIB([socket], [main])
130   AC_CHECK_LIB([nsl], [main])
131   dnl Check for pthreads
132   AC_CHECK_LIB(pthread, pthread_create, ,
133          AC_CHECK_LIB(c_r, pthread_create, ,
134               if test ${MINGW} == 'yes' ; then
135                      INTERNAL_PTHREAD_LIBS=' -L$(top_srcdir)/orte/contrib/win_pthread/ -lpthread'
136                      AC_MSG_NOTICE([Using internal version of pthreads!!!])
137               else
138                      AC_MSG_ERROR([Can't compile without pthreads!!!])
139               fi       
140          )
141   )
142 fi
143
144 ###############################
145 # enable GNU source
146 AH_VERBATIM([_GNU_SOURCE],[
147 #ifndef _GNU_SOURCE
148   #define _GNU_SOURCE
149 #endif
150 ]) 
151
152 ###############################
153 # Checks for header files.
154 # user space
155 if test ${UNIX} == 'yes' -o ${WIN} == 'yes' ; then
156     AC_HEADER_STDC
157     AC_CHECK_HEADERS([\
158     arpa/inet.h fcntl.h stdio.h netdb.h stdlib.h \
159     string.h sys/ioctl.h sys/stat.h sys/time.h unistd.h pthread.h \
160     sys/types.h sys/sockio.h stdarg.h byteswap.h getopt.h \
161     ctype.h signal.h stdint.h errno.h],,,[[]])
162     AC_CHECK_HEADERS([sys/socket.h], [], [],
163           [#ifdef HAVE_SYS_TYPES_H
164              #include <sys/types.h>
165            #endif])
166     AC_CHECK_HEADERS([netinet/in.h], [], [],
167           [#ifdef HAVE_SYS_TYPES_H
168              #include <sys/types.h>
169            #endif])
170     AC_CHECK_HEADERS([net/if.h], [], [],
171           [#ifdef HAVE_SYS_TYPES_H
172              #include <sys/types.h>
173            #endif
174            #ifdef HAVE_SYS_SOCKET_H
175              #include <sys/socket.h>
176            #endif])
177 fi
178 # win32
179 if test ${WIN} == 'yes' ; then
180     AC_CHECK_HEADERS([\
181     winsock2.h ws2tcpip.h windows.h w32api/windows.h],,,[[]])
182     AC_CHECK_FUNCS([gettimeofday])
183 fi
184 # kernel
185 if test "${CONFIG_ORTE_KERNEL}" == 'yes' ; then
186     AC_CHECK_HEADERS([\
187     asm/byteorder.h linux/ctype.h linux/string.h \
188     linux/module.h linux/if.h linux/socket.h \
189     linux/time.h linux/types.h],,,[[]])
190     AC_CHECK_HEADERS([linux/in.h],,,[
191     #ifdef HAVE_LINUX_SOCKET_H
192       #include <linux/socket.h>
193     #endif
194     ])
195 fi
196 # RTLinux
197 if test ${USE_RTLINUX} == 'yes' ; then
198     AC_CHECK_HEADERS([\
199     string.h pthread.h \
200     rtl.h rtl_malloc.h udp.h nic.h time.h],,,[[]])
201     AC_CHECK_HEADERS([nictab.h],,,[
202     #ifdef HAVE_UDP_H
203       #include <udp.h>
204     #endif
205     #ifdef HAVE_NIC_H
206       #include <nic.h>
207     #endif
208     ])
209     AC_CHECK_HEADERS([onetd.h],,,[
210     #ifdef HAVE_LINUX_IF_H
211       #include <linux/if.h>
212     #endif
213     #ifdef HAVE_LINUX_IN_H
214       #include <linux/in.h>
215     #endif
216     #ifdef HAVE_PTHREAD_H
217       #include <pthread.h>
218     #endif
219     ])
220 fi
221 # RTAI
222 if test ${USE_RTAI} == 'yes' ; then
223     AC_CHECK_HEADERS([\
224     rtnet.h],,,[[]])
225 fi
226
227 ###############################
228 # includes
229 INCLUDES='-I$(top_srcdir)/orte/include -I$(top_builddir)/orte/include'
230 AC_SUBST(INCLUDES)
231
232 ###############################
233 # Checks for typedefs, structures, and compiler characteristics.
234
235 AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,[#ifdef HAVE_SYS_TYPES_H
236                    #include <sys/types.h>
237                  #endif
238                  #ifdef HAVE_SYS_SOCKET_H
239                    #include <sys/socket.h>
240                  #endif
241                  #ifdef HAVE_WINSOCK2_H
242                    #include <winsock2.h>
243                  #endif])
244
245
246 AC_CHECK_HEADERS([ifaddrs.h],,,[#ifdef HAVE_SYS_TYPES_H
247              #include <sys/types.h>
248            #endif])
249
250 ###############################
251 # Endianness support attempts to allow build with same configure
252 # for both cases on recent systems
253
254 need_endian_test=yes
255 AC_CHECK_HEADERS([endian.h sys/param.h], [], [],[])
256
257 if test "$ac_cv_header_sys_param_h" == 'yes' ; then
258     AC_MSG_CHECKING([whether BYTE_ORDER defined in sys/param.h])
259     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/param.h>], [
260                         unsigned int a=BYTE_ORDER;
261                         unsigned int b=BIG_ENDIAN;
262                         unsigned int c=LITTLE_ENDIAN;])],
263                       [AC_MSG_RESULT([yes])
264                        need_endian_test=no],[AC_MSG_RESULT([no])])
265
266     if test "$need_endian_test" == 'yes' ; then
267         AC_MSG_CHECKING([whether __BYTE_ORDER defined in sys/param.h])
268         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/param.h>], [
269                         unsigned int a=__BYTE_ORDER;
270                         unsigned int b=__BIG_ENDIAN;
271                         unsigned int c=__LITTLE_ENDIAN;])],
272                       [AC_MSG_RESULT([yes])
273                        need_endian_test=no],[AC_MSG_RESULT([no])])
274     fi
275 fi
276 if test "$ac_cv_header_endian_h" == 'yes' ; then
277     if test "$need_endian_test" == 'yes' ; then
278         AC_MSG_CHECKING([whether endian can be determined from endian.h])
279         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <endian.h>], [
280                         unsigned int a=__BYTE_ORDER;
281                         unsigned int b=__BIG_ENDIAN;
282                         unsigned int c=__LITTLE_ENDIAN;])],
283                       [AC_MSG_RESULT([yes])
284                        need_endian_test=no],[AC_MSG_RESULT([no])])
285     fi
286 fi
287
288 if test "$need_endian_test" == 'yes' ; then
289   AC_C_BIGENDIAN
290 fi
291
292 AH_BOTTOM([
293 #if defined(HAVE_ENDIAN_H) || defined(HAVE_SYS_PARAM_H)
294   #ifdef HAVE_SYS_PARAM_H
295     #include <sys/param.h>
296   #endif
297   #if defined(HAVE_ENDIAN_H) && !defined(BYTE_ORDER) && !defined(__BYTE_ORDER)
298     #include <endian.h>
299   #endif
300   #if defined(__BYTE_ORDER)
301     #if __BYTE_ORDER == __BIG_ENDIAN
302       #define WORDS_BIGENDIAN 1
303     #endif
304   #elif defined(BYTE_ORDER)
305     #if BYTE_ORDER == BIG_ENDIAN
306       #define WORDS_BIGENDIAN 1
307     #endif
308   #endif
309 #endif
310 ])
311
312 AC_C_CONST
313 AC_C_INLINE
314
315 ###############################
316 # Checks for library functions.
317 AC_PROG_GCC_TRADITIONAL
318 if test -z "${CONFIG_ORTE_RT}" ; then
319 AC_CHECK_FUNCS([gethostbyname getopt_long sigwaitinfo])
320 fi
321
322 AC_CONFIG_FILES([Makefile
323                  orte/Makefile
324                  orte/liborte/Makefile
325                  orte/liborte/rtl/Makefile
326                  orte/examples/Makefile
327                  orte/examples/hello/Makefile
328                  orte/examples/multicast/Makefile
329                  orte/examples/reliable/Makefile
330                  orte/examples/ping/Makefile
331                  orte/examples/spy/Makefile
332                  orte/examples/schneider/Makefile
333                  orte/examples/mpo/Makefile
334                  orte/idl-compiler/Makefile
335                  orte/libjorte/Makefile
336                  orte/manager/Makefile])
337
338 LIBS="$LIBS$INTERNAL_PTHREAD_LIBS"
339
340 AC_CONFIG_FILES([
341 modtool
342 ])
343 AC_OUTPUT
344 chmod +x modtool
345
346 # ======================================================================
347 #               generate orte/include/orte/orte_config.h
348 # ======================================================================
349
350 AC_MSG_NOTICE([fixing orte/include/orte/orte_config.h])
351 sed -e "s/ PACKAGE/ ORTE_PACKAGE/" -e "s/ VERSION/ ORTE_VERSION/" \
352     orte/include/orte/orte_config.h >orte/include/orte/orte_config.h.new
353 if cmp -s orte/include/orte/orte_config.h.new orte/include/orte/orte_config.h; then
354         rm orte/include/orte/orte_config.h.new
355         AC_MSG_NOTICE([orte/include/orte/orte_config.h is unchanged])
356 else
357         mv orte/include/orte/orte_config.h.new orte/include/orte/orte_config.h
358 fi
359
360 echo \
361 "------------------------------------------------------------------------
362 Configuration ORTE:
363
364   Source code location:       ${srcdir}
365   Compiler:                   ${CC}
366   Compiler flags:             ${CFLAGS}
367   Host System Type:           ${host}
368   
369   See orte_config.h for future configuration information.
370   
371   Now you can run
372   make  
373   
374 ------------------------------------------------------------------------"
375