1 # Process this file with autoconf to produce a configure script.
3 # $Id: configure.in,v 1.15 2008/10/07 21:19:01 smolik Exp $
9 AC_INIT([orte],[0.3.4],[orte@rtime.felk.cvut.cz],[],[http://orte.sf.net])
10 AC_CONFIG_AUX_DIR(admin)
12 ###############################
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)
23 # Libtool versioning (see libtool manual)
25 LT_CURRENT=1 # This will be part of SONAME
35 echo "ORTE version $PACKAGE_VERSION"
39 #Check for CPU / vendor / OS
42 AC_CONFIG_HEADER(orte/include/orte/orte_config.h)
43 AM_INIT_AUTOMAKE(no-define)
45 AC_CONFIG_MACRO_DIR([admin])
47 # Activate maintainer mode
52 ###############################
63 AC_DEFINE([CONFIG_ORTE_WIN],[1],[Define if is target windows])
64 AC_DEFINE([CONFIG_ORTE_CYGWIN],[1],[Define if is target CYGWIN])
70 AC_DEFINE([CONFIG_ORTE_WIN],[1],[Define if is target windows])
71 AC_DEFINE([CONFIG_ORTE_MINGW],[1],[Define if is target MINGW])
72 AC_DEFINE([HAVE_GETPOT_LONG_ORTE],[1],[Define for ORTE getopt_long self implemetation])
76 if test -z "${CONFIG_ORTE_RT}" -a "${CONFIG_ORTE_KERNEL}" ; then
78 AC_DEFINE([CONFIG_ORTE_UNIX],[1],[Define if is target a unix system])
82 AM_CONDITIONAL(CONFIG_ORTE_WIN, test x$WIN = xyes)
83 AM_CONDITIONAL(CONFIG_ORTE_CYGWIN, test x$CIGWIN = xyes)
84 AM_CONDITIONAL(CONFIG_ORTE_MINGW, test x$MINGW = xyes)
85 AM_CONDITIONAL(CONFIG_ORTE_UNIX, test x$UNIX = xyes)
87 ###############################
89 moduledir="\$(libdir)/modules/\$(LINUX_KERNELRELEASE)/orte"
90 modulePROGRAMS_INSTALL="\$(top_builddir)/modtool --install"
91 modulePROGRAMS_UNINSTALL="\$(top_builddir)/modtool --uninstall"
93 AC_SUBST(modulePROGRAMS_INSTALL)
95 ###############################
97 CFLAGS="$CFLAGS -Wall"
98 if test ${USE_RTLINUX} == 'yes' ; then
99 CFLAGS="$CFLAGS $RTLINUX_CFLAGS"
102 if test ${USE_RTAI} == 'yes' ; then
103 CFLAGS="$CFLAGS $RTAI_CFLAGS $LINUX_CFLAGS"
105 if test -n "${CONFIG_ORTE_KERNEL}" ; then
106 CFLAGS="$CFLAGS $LINUX_CFLAGS"
111 ###############################
112 # Checks for programs.
117 PKG_PROG_PKG_CONFIG()
119 ###############################
120 # Checks for ability to compile ORTE_IDL
123 ###############################
124 # Checks for ability to compile JORTE
127 ###############################
128 # Checks for libraries and init libtools
129 if test -z "${CONFIG_ORTE_RT}" ; then
130 AC_CHECK_LIB([ws2_32], [main])
131 AC_CHECK_LIB([socket], [main])
132 AC_CHECK_LIB([nsl], [main])
133 dnl Check for pthreads
134 AC_CHECK_LIB(pthread, pthread_create, ,
135 AC_CHECK_LIB(c_r, pthread_create, ,
136 if test ${MINGW} == 'yes' ; then
137 INTERNAL_PTHREAD_LIBS=' -L$(top_srcdir)/orte/contrib/win_pthread/ -lpthread'
138 AC_MSG_NOTICE([Using internal version of pthreads!!!])
140 AC_MSG_ERROR([Can't compile without pthreads!!!])
146 ###############################
148 AH_VERBATIM([_GNU_SOURCE],[
154 ###############################
155 # Checks for header files.
157 if test ${UNIX} == 'yes' -o ${WIN} == 'yes' ; then
160 arpa/inet.h fcntl.h stdio.h netdb.h stdlib.h \
161 string.h sys/ioctl.h sys/stat.h sys/time.h unistd.h pthread.h \
162 sys/types.h sys/sockio.h stdarg.h byteswap.h getopt.h \
163 ctype.h signal.h stdint.h errno.h],,,[[]])
164 AC_CHECK_HEADERS([sys/socket.h], [], [],
165 [#ifdef HAVE_SYS_TYPES_H
166 #include <sys/types.h>
168 AC_CHECK_HEADERS([netinet/in.h], [], [],
169 [#ifdef HAVE_SYS_TYPES_H
170 #include <sys/types.h>
172 AC_CHECK_HEADERS([net/if.h], [], [],
173 [#ifdef HAVE_SYS_TYPES_H
174 #include <sys/types.h>
176 #ifdef HAVE_SYS_SOCKET_H
177 #include <sys/socket.h>
181 if test ${WIN} == 'yes' ; then
183 winsock2.h ws2tcpip.h windows.h w32api/windows.h],,,[[]])
184 AC_CHECK_FUNCS([gettimeofday])
187 if test "${CONFIG_ORTE_KERNEL}" == 'yes' ; then
189 asm/byteorder.h linux/ctype.h linux/string.h \
190 linux/module.h linux/if.h linux/socket.h \
191 linux/time.h linux/types.h],,,[[]])
192 AC_CHECK_HEADERS([linux/in.h],,,[
193 #ifdef HAVE_LINUX_SOCKET_H
194 #include <linux/socket.h>
199 if test ${USE_RTLINUX} == 'yes' ; then
202 rtl.h rtl_malloc.h udp.h nic.h time.h],,,[[]])
203 AC_CHECK_HEADERS([nictab.h],,,[
211 AC_CHECK_HEADERS([onetd.h],,,[
212 #ifdef HAVE_LINUX_IF_H
213 #include <linux/if.h>
215 #ifdef HAVE_LINUX_IN_H
216 #include <linux/in.h>
218 #ifdef HAVE_PTHREAD_H
224 if test ${USE_RTAI} == 'yes' ; then
229 ###############################
231 INCLUDES='-I$(top_srcdir)/orte/include -I$(top_builddir)/orte/include'
234 ###############################
235 # Checks for typedefs, structures, and compiler characteristics.
237 AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,[#ifdef HAVE_SYS_TYPES_H
238 #include <sys/types.h>
240 #ifdef HAVE_SYS_SOCKET_H
241 #include <sys/socket.h>
243 #ifdef HAVE_WINSOCK2_H
244 #include <winsock2.h>
248 AC_CHECK_HEADERS([ifaddrs.h],,,[#ifdef HAVE_SYS_TYPES_H
249 #include <sys/types.h>
252 ###############################
253 # Endianness support attempts to allow build with same configure
254 # for both cases on recent systems
257 AC_CHECK_HEADERS([endian.h sys/param.h], [], [],[])
259 if test "$ac_cv_header_sys_param_h" == 'yes' ; then
260 AC_MSG_CHECKING([whether BYTE_ORDER defined in sys/param.h])
261 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/param.h>], [
262 unsigned int a=BYTE_ORDER;
263 unsigned int b=BIG_ENDIAN;
264 unsigned int c=LITTLE_ENDIAN;])],
265 [AC_MSG_RESULT([yes])
266 need_endian_test=no],[AC_MSG_RESULT([no])])
268 if test "$need_endian_test" == 'yes' ; then
269 AC_MSG_CHECKING([whether __BYTE_ORDER defined in sys/param.h])
270 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/param.h>], [
271 unsigned int a=__BYTE_ORDER;
272 unsigned int b=__BIG_ENDIAN;
273 unsigned int c=__LITTLE_ENDIAN;])],
274 [AC_MSG_RESULT([yes])
275 need_endian_test=no],[AC_MSG_RESULT([no])])
278 if test "$ac_cv_header_endian_h" == 'yes' ; then
279 if test "$need_endian_test" == 'yes' ; then
280 AC_MSG_CHECKING([whether endian can be determined from endian.h])
281 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <endian.h>], [
282 unsigned int a=__BYTE_ORDER;
283 unsigned int b=__BIG_ENDIAN;
284 unsigned int c=__LITTLE_ENDIAN;])],
285 [AC_MSG_RESULT([yes])
286 need_endian_test=no],[AC_MSG_RESULT([no])])
290 if test "$need_endian_test" == 'yes' ; then
295 #if defined(HAVE_ENDIAN_H) || defined(HAVE_SYS_PARAM_H)
296 #ifdef HAVE_SYS_PARAM_H
297 #include <sys/param.h>
299 #if defined(HAVE_ENDIAN_H) && !defined(BYTE_ORDER) && !defined(__BYTE_ORDER)
302 #if defined(__BYTE_ORDER)
303 #if __BYTE_ORDER == __BIG_ENDIAN
304 #define WORDS_BIGENDIAN 1
306 #elif defined(BYTE_ORDER)
307 #if BYTE_ORDER == BIG_ENDIAN
308 #define WORDS_BIGENDIAN 1
317 ###############################
318 # Checks for library functions.
319 AC_PROG_GCC_TRADITIONAL
320 if test -z "${CONFIG_ORTE_RT}" ; then
321 AC_CHECK_FUNCS([gethostbyname getopt_long sigwaitinfo])
324 AC_CONFIG_FILES([Makefile
326 orte/liborte/Makefile
327 orte/liborte/rtl/Makefile
328 orte/examples/Makefile
329 orte/examples/hello/Makefile
330 orte/examples/multicast/Makefile
331 orte/examples/reliable/Makefile
332 orte/examples/ping/Makefile
333 orte/examples/spy/Makefile
334 orte/examples/schneider/Makefile
335 orte/examples/mpo/Makefile
336 orte/idl-compiler/Makefile
337 orte/libjorte/Makefile
338 orte/manager/Makefile])
340 LIBS="$LIBS$INTERNAL_PTHREAD_LIBS"
348 # ======================================================================
349 # generate orte/include/orte/orte_config.h
350 # ======================================================================
352 AC_MSG_NOTICE([fixing orte/include/orte/orte_config.h])
353 sed -e "s/ PACKAGE/ ORTE_PACKAGE/" -e "s/ VERSION/ ORTE_VERSION/" \
354 orte/include/orte/orte_config.h >orte/include/orte/orte_config.h.new
355 if cmp -s orte/include/orte/orte_config.h.new orte/include/orte/orte_config.h; then
356 rm orte/include/orte/orte_config.h.new
357 AC_MSG_NOTICE([orte/include/orte/orte_config.h is unchanged])
359 mv orte/include/orte/orte_config.h.new orte/include/orte/orte_config.h
363 "------------------------------------------------------------------------
366 Source code location: ${srcdir}
368 Compiler flags: ${CFLAGS}
369 Host System Type: ${host}
371 See orte_config.h for future configuration information.
376 ------------------------------------------------------------------------"