]> rtime.felk.cvut.cz Git - orte.git/blob - configure.in
MSVC htimer hack, fixed functions removeApplication, removeManager
[orte.git] / configure.in
1 # Process this file with autoconf to produce a configure script.
2 #
3 # $Id: configure.in,v 1.11 2004/09/21 21:09:33 smolik Exp $
4
5 # autoconf requirement
6
7 AC_PREREQ([2.56])
8
9 AC_INIT([orte],[0.2.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=2
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/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 AC_PROG_CC
118 AC_PROG_RANLIB
119
120 ###############################
121 # Checks for libraries and init libtools
122 if test -z ${CONFIG_ORTE_RT} ; then
123   #Initialize libtool
124   AM_PROG_LIBTOOL
125   
126   AC_CHECK_LIB([ws2_32], [main])
127   AC_CHECK_LIB([socket], [main])
128   AC_CHECK_LIB([nsl], [main])
129   dnl Check for pthreads
130   AC_CHECK_LIB(pthread, pthread_create, ,
131          AC_CHECK_LIB(c_r, pthread_create, ,
132               if test ${MINGW} == 'yes' ; then
133                      LIBS=$LIBS' $(top_srcdir)/orte/contrib/win_pthread/libpthreadGC.a'
134                      AC_MSG_NOTICE([Using internal version of pthreads!!!])
135               else
136                      AC_MSG_ERROR([Can't compile without pthreads!!!])
137               fi       
138          )
139   )
140 fi
141
142 ###############################
143 # enable GNU source
144 AH_VERBATIM([_GNU_SOURCE],[
145 #ifndef _GNU_SOURCE
146   #define _GNU_SOURCE
147 #endif
148 ]) 
149
150 ###############################
151 # Checks for header files.
152 # user space
153 if test ${UNIX} == 'yes' -o ${WIN} == 'yes' ; then
154     AC_HEADER_STDC
155     AC_CHECK_HEADERS([\
156     arpa/inet.h fcntl.h stdio.h netdb.h stdlib.h \
157     string.h sys/ioctl.h sys/time.h unistd.h pthread.h \
158     sys/types.h sys/sockio.h stdarg.h byteswap.h getopt.h \
159     ctype.h signal.h stdint.h errno.h],,,[[]])
160     AC_CHECK_HEADERS([sys/socket.h], [], [],
161           [#ifdef HAVE_SYS_TYPES_H
162              #include <sys/types.h>
163            #endif])
164     AC_CHECK_HEADERS([netinet/in.h], [], [],
165           [#ifdef HAVE_SYS_TYPES_H
166              #include <sys/types.h>
167            #endif])
168     AC_CHECK_HEADERS([net/if.h], [], [],
169           [#ifdef HAVE_SYS_TYPES_H
170              #include <sys/types.h>
171            #endif
172            #ifdef HAVE_SYS_SOCKET_H
173              #include <sys/socket.h>
174            #endif])
175 fi
176 # win32
177 if test ${WIN} == 'yes' ; then
178     AC_CHECK_HEADERS([\
179     winsock2.h ws2tcpip.h windows.h w32api/windows.h],,,[[]])
180 fi
181 # kernel
182 if test ${CONFIG_ORTE_KERNEL} == 'yes' ; then
183     AC_CHECK_HEADERS([\
184     asm/byteorder.h linux/ctype.h linux/string.h \
185     linux/module.h linux/if.h linux/socket.h \
186     linux/time.h linux/types.h],,,[[]])
187     AC_CHECK_HEADERS([linux/in.h],,,[
188     #ifdef HAVE_LINUX_SOCKET_H
189       #include <linux/socket.h>
190     #endif
191     ])
192 fi
193 # RTLinux
194 if test ${USE_RTLINUX} == 'yes' ; then
195     AC_CHECK_HEADERS([\
196     string.h pthread.h \
197     rtl.h rtl_malloc.h udp.h nic.h time.h],,,[[]])
198     AC_CHECK_HEADERS([nictab.h],,,[
199     #ifdef HAVE_UDP_H
200       #include <udp.h>
201     #endif
202     #ifdef HAVE_NIC_H
203       #include <nic.h>
204     #endif
205     ])
206 fi
207 # RTAI
208 if test ${USE_RTAI} == 'yes' ; then
209     AC_CHECK_HEADERS([\
210     rtnet.h],,,[[]])
211 fi
212
213 ###############################
214 # includes
215 INCLUDES='-I$(top_srcdir)/orte/include'
216 AC_SUBST(INCLUDES)
217
218 ###############################
219 # Checks for typedefs, structures, and compiler characteristics.
220 AC_C_BIGENDIAN
221 AC_C_CONST
222 AC_C_INLINE
223
224 ###############################
225 # Checks for library functions.
226 AC_PROG_GCC_TRADITIONAL
227 if test -z ${CONFIG_ORTE_RT} ; then
228 AC_CHECK_FUNCS([strdup gethostbyname getopt_long])
229 fi
230
231 AC_CONFIG_FILES([Makefile
232                  orte/Makefile
233                  orte/liborte/Makefile
234                  orte/liborte/rtl/Makefile
235                  orte/examples/Makefile
236                  orte/examples/hello/Makefile
237                  orte/examples/reliable/Makefile
238                  orte/examples/ping/Makefile
239                  orte/examples/spy/Makefile
240                  orte/manager/Makefile])
241
242
243 AC_OUTPUT([
244 modtool
245 ])
246 chmod +x modtool
247
248
249 # ======================================================================
250 #               generate orte/include/orte_config.h
251 # ======================================================================
252
253 AC_MSG_NOTICE([creating orte/include/orte_config.h])
254 sed -e "s/ PACKAGE/ ORTE_PACKAGE/" -e "s/ VERSION/ ORTE_VERSION/" \
255     orte/include/config.h >orte/include/orte_config.h.new
256 if cmp -s orte/include/orte_config.h.new orte/include/orte_config.h; then
257         rm orte/include/orte_config.h.new
258         AC_MSG_NOTICE([orte/include/orte_config.h is unchanged])
259 else
260         mv orte/include/orte_config.h.new orte/include/orte_config.h
261 fi
262
263 echo \
264 "------------------------------------------------------------------------
265 Configuration ORTE:
266
267   Source code location:       ${srcdir}
268   Compiler:                   ${CC}
269   Compiler flags:             ${CFLAGS}
270   Host System Type:           ${host}
271   
272   See config.h for future configuration information.
273   
274   Now you can run
275   make  
276   
277 ------------------------------------------------------------------------"
278