]> rtime.felk.cvut.cz Git - orte.git/blob - configure.in
version 0.2.2 (mac, solaris patch)
[orte.git] / configure.in
1 # Process this file with autoconf to produce a configure script.
2 #
3 # $Id: configure.in,v 1.8 2004/04/20 08:36:14 smolik Exp $
4
5 # autoconf requirement
6
7 AC_PREREQ([2.56])
8
9 AC_INIT([orte],[0.2.2],[petr.smolik@wo.cz])
10 AC_CONFIG_AUX_DIR(admin)
11
12 #Check for CPU / vendor / OS
13 AC_CANONICAL_HOST
14 AC_CANONICAL_TARGET
15 AM_CONFIG_HEADER(orte/include/config.h)
16 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
17 # Activate maintainer mode
18 AM_MAINTAINER_MODE
19
20 DS_LINUX()
21
22 ###############################
23 # Package info
24 ORTE_MAJOR_VERSION=0
25 ORTE_MINOR_VERSION=2
26 ORTE_MICRO_VERSION=2
27 ORTE_VERSION=$ORTE_MAJOR_VERSION.$ORTE_MINOR_VERSION.$ORTE_MICRO_VERSION
28 AC_SUBST(ORTE_MAJOR_VERSION)
29 AC_SUBST(ORTE_MINOR_VERSION)
30 AC_SUBST(ORTE_MICRO_VERSION)
31 AC_SUBST(ORTE_VERSION)
32
33
34 ###############################
35 # target
36 WIN='no'
37 MINGW='no'
38 CYGWIN='no'
39 UNIX='no'
40 case "$target" in
41   *-cygwin*)
42     CFLAGS="$CFLAGS"
43     WIN='yes'
44     CYGWIN='yes'
45     AC_DEFINE([CONFIG_ORTE_WIN],[1],[Define if is target windows])
46     AC_DEFINE([CONFIG_ORTE_CYGWIN],[1],[Define if is target CYGWIN])
47     ;;  
48   *-mingw*)
49     CFLAGS="$CFLAGS"
50     WIN='yes'
51     MINGW='yes'
52     AC_DEFINE([CONFIG_ORTE_WIN],[1],[Define if is target windows])
53     AC_DEFINE([CONFIG_ORTE_MINGW],[1],[Define if is target MINGW])
54     AC_DEFINE([HAVE_GETPOT_LONG_ORTE],[1],[Define for ORTE getopt_long self implemetation])
55     ;;
56   *)
57     # Assume Unix.
58     if test -z ${CONFIG_ORTE_RT} -a ${CONFIG_ORTE_KERNEL} ; then
59       UNIX='yes'
60       AC_DEFINE([CONFIG_ORTE_UNIX],[1],[Define if is target a unix system])
61     fi
62     ;;
63 esac
64 AM_CONDITIONAL(CONFIG_ORTE_WIN, test x$WIN = xyes)
65 AM_CONDITIONAL(CONFIG_ORTE_CYGWIN, test x$CIGWIN = xyes)
66 AM_CONDITIONAL(CONFIG_ORTE_MINGW, test x$MINGW = xyes)
67 AM_CONDITIONAL(CONFIG_ORTE_UNIX, test x$UNIX = xyes)
68
69 ###############################
70 # modules
71 moduledir="\$(libdir)/modules/\$(LINUX_KERNELRELEASE)/orte"
72 modulePROGRAMS_INSTALL="\$(top_builddir)/modtool --install"
73 modulePROGRAMS_UNINSTALL="\$(top_builddir)/modtool --uninstall"
74 AC_SUBST(moduledir)
75 AC_SUBST(modulePROGRAMS_INSTALL)
76
77 ###############################
78 # CFLAGS
79 CFLAGS="$CFLAGS -Wall"
80 if test ${USE_RTLINUX} == 'yes' ; then
81   CFLAGS="$CFLAGS $RTLINUX_CFLAGS"
82   CC="$RTLINUX_CC"
83 else
84   if test ${USE_RTAI} == 'yes' ; then
85     CFLAGS="$CFLAGS $RTAI_CFLAGS $LINUX_CFLAGS"
86   else
87     if test -n ${CONFIG_ORTE_KERNEL} ; then
88       CFLAGS="$CFLAGS $LINUX_CFLAGS"
89     fi
90   fi
91 fi
92
93 ###############################
94 # Checks for programs.
95 AC_PROG_CC
96 AC_PROG_RANLIB
97
98 ###############################
99 # Checks for libraries
100 if test -z ${CONFIG_ORTE_RT} ; then
101   AC_CHECK_LIB([ws2_32], [main])
102   AC_CHECK_LIB([pthread], [main])
103   AC_CHECK_LIB([socket], [main])
104   AC_CHECK_LIB([nsl], [main])
105 fi
106
107 ###############################
108 # enable GNU source
109 AH_VERBATIM([_GNU_SOURCE],[
110 #ifndef _GNU_SOURCE
111   #define _GNU_SOURCE
112 #endif
113 ]) 
114
115 ###############################
116 # Checks for header files.
117 # user space
118 if test ${UNIX} == 'yes' -o ${WIN} == 'yes' ; then
119     AC_HEADER_STDC
120     AC_CHECK_HEADERS([\
121     arpa/inet.h fcntl.h stdio.h netdb.h stdlib.h \
122     string.h sys/ioctl.h sys/time.h unistd.h pthread.h \
123     sys/types.h sys/sockio.h stdarg.h byteswap.h getopt.h \
124     ctype.h signal.h stdint.h],,,[[]])
125     AC_CHECK_HEADERS([sys/socket.h], [], [],
126           [#ifdef HAVE_SYS_TYPES_H
127              #include <sys/types.h>
128            #endif])
129     AC_CHECK_HEADERS([netinet/in.h], [], [],
130           [#ifdef HAVE_SYS_TYPES_H
131              #include <sys/types.h>
132            #endif])
133     AC_CHECK_HEADERS([net/if.h], [], [],
134           [#ifdef HAVE_SYS_TYPES_H
135              #include <sys/types.h>
136            #endif
137            #ifdef HAVE_SYS_SOCKET_H
138              #include <sys/socket.h>
139            #endif])
140 fi
141 # win32
142 if test ${WIN} == 'yes' ; then
143     AC_CHECK_HEADERS([\
144     winsock2.h ws2tcpip.h windows.h],,,[[]])
145 fi
146 # kernel
147 if test ${CONFIG_ORTE_KERNEL} == 'yes' ; then
148     AC_CHECK_HEADERS([\
149     asm/byteorder.h linux/ctype.h linux/string.h \
150     linux/module.h linux/if.h linux/socket.h \
151     linux/time.h linux/types.h],,,[[]])
152     AC_CHECK_HEADERS([linux/in.h],,,[
153     #ifdef HAVE_LINUX_SOCKET_H
154       #include <linux/socket.h>
155     #endif
156     ])
157 fi
158 # RTLinux
159 if test ${USE_RTLINUX} == 'yes' ; then
160     AC_CHECK_HEADERS([\
161     string.h pthread.h \
162     rtl.h rtl_malloc.h udp.h nic.h time.h],,,[[]])
163     AC_CHECK_HEADERS([nictab.h],,,[
164     #ifdef HAVE_UDP_H
165       #include <udp.h>
166     #endif
167     #ifdef HAVE_NIC_H
168       #include <nic.h>
169     #endif
170     ])
171 fi
172 # RTAI
173 if test ${USE_RTAI} == 'yes' ; then
174     AC_CHECK_HEADERS([\
175     rtnet.h],,,[[]])
176 fi
177
178 ###############################
179 # includes
180 INCLUDES='-I$(top_srcdir)/orte/include'
181 AC_SUBST(INCLUDES)
182
183 ###############################
184 # Checks for typedefs, structures, and compiler characteristics.
185 AC_C_BIGENDIAN
186 AC_C_CONST
187 AC_C_INLINE
188
189 ###############################
190 # Checks for library functions.
191 AC_PROG_GCC_TRADITIONAL
192 if test -z ${CONFIG_ORTE_RT} ; then
193 AC_CHECK_FUNCS([strdup gethostbyname getopt_long])
194 fi
195
196 AC_CONFIG_FILES([Makefile
197                  orte/Makefile
198                  orte/liborte/Makefile
199                  orte/liborte/rtl/Makefile
200                  orte/examples/Makefile
201                  orte/examples/hello/Makefile
202                  orte/examples/reliable/Makefile
203                  orte/examples/ping/Makefile
204                  orte/examples/spy/Makefile
205                  orte/manager/Makefile])
206
207
208 AC_OUTPUT([
209 modtool
210 ])
211 chmod +x modtool
212
213
214 # ======================================================================
215 #               generate orte/include/orte_config.h
216 # ======================================================================
217
218 AC_MSG_NOTICE([creating orte/include/orte_config.h])
219 sed -e "s/ PACKAGE/ ORTE_PACKAGE/" -e "s/ VERSION/ ORTE_VERSION/" \
220     orte/include/config.h >orte/include/orte_config.h.new
221 if cmp -s orte/include/orte_config.h.new orte/include/orte_config.h; then
222         rm orte/include/orte_config.h.new
223         AC_MSG_NOTICE([orte/include/orte_config.h is unchanged])
224 else
225         mv orte/include/orte_config.h.new orte/include/orte_config.h
226 fi
227
228 echo \
229 "------------------------------------------------------------------------
230 Configuration ORTE:
231
232   Source code location:       ${srcdir}
233   Compiler:                   ${CC}
234   Compiler flags:             ${CFLAGS}
235   Host System Type:           ${host}
236   
237   See config.h for further configuration information.
238 ------------------------------------------------------------------------"
239