]> rtime.felk.cvut.cz Git - orte.git/blob - configure.ac
JORTE: ignore 'int-to-pointer' and 'pointer-to-int' compiler warnings
[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.56])
8
9 AC_INIT([orte],[0.3.3],[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_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 AC_CONFIG_HEADER(orte/include/orte/orte_config.h)
48 AM_INIT_AUTOMAKE(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 AM_PROG_CC_C_O
120 AC_PROG_LIBTOOL
121
122 ###############################
123 # Checks for ability to compile ORTE_IDL
124 AM_ORTE_IDL
125
126 ###############################
127 # Checks for ability to compile JORTE
128 AM_JORTE
129
130 ###############################
131 # Checks for libraries and init libtools
132 if test -z ${CONFIG_ORTE_RT} ; then
133   AC_CHECK_LIB([ws2_32], [main])
134   AC_CHECK_LIB([socket], [main])
135   AC_CHECK_LIB([nsl], [main])
136   dnl Check for pthreads
137   AC_CHECK_LIB(pthread, pthread_create, ,
138          AC_CHECK_LIB(c_r, pthread_create, ,
139               if test ${MINGW} == 'yes' ; then
140                      LIBS=$LIBS' -L$(top_srcdir)/orte/contrib/win_pthread/ -lpthread'
141                      AC_MSG_NOTICE([Using internal version of pthreads!!!])
142               else
143                      AC_MSG_ERROR([Can't compile without pthreads!!!])
144               fi       
145          )
146   )
147 fi
148
149 ###############################
150 # enable GNU source
151 AH_VERBATIM([_GNU_SOURCE],[
152 #ifndef _GNU_SOURCE
153   #define _GNU_SOURCE
154 #endif
155 ]) 
156
157 ###############################
158 # Checks for header files.
159 # user space
160 if test ${UNIX} == 'yes' -o ${WIN} == 'yes' ; then
161     AC_HEADER_STDC
162     AC_CHECK_HEADERS([\
163     arpa/inet.h fcntl.h stdio.h netdb.h stdlib.h \
164     string.h sys/ioctl.h sys/stat.h sys/time.h unistd.h pthread.h \
165     sys/types.h sys/sockio.h stdarg.h byteswap.h getopt.h \
166     ctype.h signal.h stdint.h errno.h],,,[[]])
167     AC_CHECK_HEADERS([sys/socket.h], [], [],
168           [#ifdef HAVE_SYS_TYPES_H
169              #include <sys/types.h>
170            #endif])
171     AC_CHECK_HEADERS([netinet/in.h], [], [],
172           [#ifdef HAVE_SYS_TYPES_H
173              #include <sys/types.h>
174            #endif])
175     AC_CHECK_HEADERS([net/if.h], [], [],
176           [#ifdef HAVE_SYS_TYPES_H
177              #include <sys/types.h>
178            #endif
179            #ifdef HAVE_SYS_SOCKET_H
180              #include <sys/socket.h>
181            #endif])
182 fi
183 # win32
184 if test ${WIN} == 'yes' ; then
185     AC_CHECK_HEADERS([\
186     winsock2.h ws2tcpip.h windows.h w32api/windows.h],,,[[]])
187     AC_CHECK_FUNCS([gettimeofday])
188 fi
189 # kernel
190 if test ${CONFIG_ORTE_KERNEL} == 'yes' ; then
191     AC_CHECK_HEADERS([\
192     asm/byteorder.h linux/ctype.h linux/string.h \
193     linux/module.h linux/if.h linux/socket.h \
194     linux/time.h linux/types.h],,,[[]])
195     AC_CHECK_HEADERS([linux/in.h],,,[
196     #ifdef HAVE_LINUX_SOCKET_H
197       #include <linux/socket.h>
198     #endif
199     ])
200 fi
201 # RTLinux
202 if test ${USE_RTLINUX} == 'yes' ; then
203     AC_CHECK_HEADERS([\
204     string.h pthread.h \
205     rtl.h rtl_malloc.h udp.h nic.h time.h],,,[[]])
206     AC_CHECK_HEADERS([nictab.h],,,[
207     #ifdef HAVE_UDP_H
208       #include <udp.h>
209     #endif
210     #ifdef HAVE_NIC_H
211       #include <nic.h>
212     #endif
213     ])
214     AC_CHECK_HEADERS([onetd.h],,,[
215     #ifdef HAVE_LINUX_IF_H
216       #include <linux/if.h>
217     #endif
218     #ifdef HAVE_LINUX_IN_H
219       #include <linux/in.h>
220     #endif
221     #ifdef HAVE_PTHREAD_H
222       #include <pthread.h>
223     #endif
224     ])
225 fi
226 # RTAI
227 if test ${USE_RTAI} == 'yes' ; then
228     AC_CHECK_HEADERS([\
229     rtnet.h],,,[[]])
230 fi
231
232 ###############################
233 # includes
234 INCLUDES='-I$(top_srcdir)/orte/include -I$(top_builddir)/orte/include'
235 AC_SUBST(INCLUDES)
236
237 ###############################
238 # Checks for typedefs, structures, and compiler characteristics.
239 need_endian_test=yes
240 AC_CHECK_HEADERS([endian.h sys/param.h], [], [],[])
241
242 if test "$ac_cv_header_sys_param_h" == 'yes' ; then
243     AC_MSG_CHECKING([whether BYTE_ORDER defined in sys/param.h])
244     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/param.h>], [
245                         unsigned int a=BYTE_ORDER;
246                         unsigned int b=BIG_ENDIAN;
247                         unsigned int c=LITTLE_ENDIAN;])],
248                       [AC_MSG_RESULT([yes])
249                        need_endian_test=no],[AC_MSG_RESULT([no])])
250
251     if test "$need_endian_test" == 'yes' ; then
252         AC_MSG_CHECKING([whether __BYTE_ORDER defined in sys/param.h])
253         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/param.h>], [
254                         unsigned int a=__BYTE_ORDER;
255                         unsigned int b=__BIG_ENDIAN;
256                         unsigned int c=__LITTLE_ENDIAN;])],
257                       [AC_MSG_RESULT([yes])
258                        need_endian_test=no],[AC_MSG_RESULT([no])])
259     fi
260 fi
261 if test "$ac_cv_header_endian_h" == 'yes' ; then
262     if test "$need_endian_test" == 'yes' ; then
263         AC_MSG_CHECKING([whether endian can be determined from endian.h])
264         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <endian.h>], [
265                         unsigned int a=__BYTE_ORDER;
266                         unsigned int b=__BIG_ENDIAN;
267                         unsigned int c=__LITTLE_ENDIAN;])],
268                       [AC_MSG_RESULT([yes])
269                        need_endian_test=no],[AC_MSG_RESULT([no])])
270     fi
271 fi
272
273 if test "$need_endian_test" == 'yes' ; then
274   AC_C_BIGENDIAN
275 fi
276
277 AH_BOTTOM([
278 #if defined(HAVE_ENDIAN_H) || defined(HAVE_SYS_PARAM_H)
279   #ifdef HAVE_SYS_PARAM_H
280     #include <sys/param.h>
281   #endif
282   #if defined(HAVE_ENDIAN_H) && !defined(BYTE_ORDER) && !defined(__BYTE_ORDER)
283     #include <endian.h>
284   #endif
285   #if defined(__BYTE_ORDER)
286     #if __BYTE_ORDER == __BIG_ENDIAN
287       #define WORDS_BIGENDIAN 1
288     #endif
289   #elif defined(BYTE_ORDER)
290     #if BYTE_ORDER == BIG_ENDIAN
291       #define WORDS_BIGENDIAN 1
292     #endif
293   #endif
294 #endif
295 ])
296
297 AC_C_CONST
298 AC_C_INLINE
299
300 ###############################
301 # Checks for library functions.
302 AC_PROG_GCC_TRADITIONAL
303 if test -z ${CONFIG_ORTE_RT} ; then
304 AC_CHECK_FUNCS([gethostbyname getopt_long])
305 fi
306
307 AC_CONFIG_FILES([Makefile
308                  orte/Makefile
309                  orte/liborte/Makefile
310                  orte/liborte/rtl/Makefile
311                  orte/examples/Makefile
312                  orte/examples/hello/Makefile
313                  orte/examples/multicast/Makefile
314                  orte/examples/reliable/Makefile
315                  orte/examples/ping/Makefile
316                  orte/examples/spy/Makefile
317                  orte/examples/schneider/Makefile
318                  orte/examples/mpo/Makefile
319                  orte/idl-compiler/Makefile
320                  orte/libjorte/Makefile
321                  orte/manager/Makefile])
322
323
324 AC_OUTPUT([
325 modtool
326 ])
327 chmod +x modtool
328
329 # ======================================================================
330 #               generate orte/include/orte/orte_config.h
331 # ======================================================================
332
333 AC_MSG_NOTICE([fixing orte/include/orte/orte_config.h])
334 sed -e "s/ PACKAGE/ ORTE_PACKAGE/" -e "s/ VERSION/ ORTE_VERSION/" \
335     orte/include/orte/orte_config.h >orte/include/orte/orte_config.h.new
336 if cmp -s orte/include/orte/orte_config.h.new orte/include/orte/orte_config.h; then
337         rm orte/include/orte/orte_config.h.new
338         AC_MSG_NOTICE([orte/include/orte/orte_config.h is unchanged])
339 else
340         mv orte/include/orte/orte_config.h.new orte/include/orte/orte_config.h
341 fi
342
343 echo \
344 "------------------------------------------------------------------------
345 Configuration ORTE:
346
347   Source code location:       ${srcdir}
348   Compiler:                   ${CC}
349   Compiler flags:             ${CFLAGS}
350   Host System Type:           ${host}
351   
352   See orte_config.h for future configuration information.
353   
354   Now you can run
355   make  
356   
357 ------------------------------------------------------------------------"
358