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)
46 # Activate maintainer mode
51 ###############################
62 AC_DEFINE([CONFIG_ORTE_WIN],[1],[Define if is target windows])
63 AC_DEFINE([CONFIG_ORTE_CYGWIN],[1],[Define if is target CYGWIN])
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])
75 if test -z "${CONFIG_ORTE_RT}" -a "${CONFIG_ORTE_KERNEL}" ; then
77 AC_DEFINE([CONFIG_ORTE_UNIX],[1],[Define if is target a unix system])
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)
86 ###############################
88 moduledir="\$(libdir)/modules/\$(LINUX_KERNELRELEASE)/orte"
89 modulePROGRAMS_INSTALL="\$(top_builddir)/modtool --install"
90 modulePROGRAMS_UNINSTALL="\$(top_builddir)/modtool --uninstall"
92 AC_SUBST(modulePROGRAMS_INSTALL)
94 ###############################
96 CFLAGS="$CFLAGS -Wall"
97 if test ${USE_RTLINUX} == 'yes' ; then
98 CFLAGS="$CFLAGS $RTLINUX_CFLAGS"
101 if test ${USE_RTAI} == 'yes' ; then
102 CFLAGS="$CFLAGS $RTAI_CFLAGS $LINUX_CFLAGS"
104 if test -n "${CONFIG_ORTE_KERNEL}" ; then
105 CFLAGS="$CFLAGS $LINUX_CFLAGS"
110 ###############################
111 # Checks for programs.
117 ###############################
118 # Checks for ability to compile ORTE_IDL
121 ###############################
122 # Checks for ability to compile JORTE
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!!!])
138 AC_MSG_ERROR([Can't compile without pthreads!!!])
144 ###############################
146 AH_VERBATIM([_GNU_SOURCE],[
152 ###############################
153 # Checks for header files.
155 if test ${UNIX} == 'yes' -o ${WIN} == 'yes' ; then
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>
166 AC_CHECK_HEADERS([netinet/in.h], [], [],
167 [#ifdef HAVE_SYS_TYPES_H
168 #include <sys/types.h>
170 AC_CHECK_HEADERS([net/if.h], [], [],
171 [#ifdef HAVE_SYS_TYPES_H
172 #include <sys/types.h>
174 #ifdef HAVE_SYS_SOCKET_H
175 #include <sys/socket.h>
179 if test ${WIN} == 'yes' ; then
181 winsock2.h ws2tcpip.h windows.h w32api/windows.h],,,[[]])
182 AC_CHECK_FUNCS([gettimeofday])
185 if test "${CONFIG_ORTE_KERNEL}" == 'yes' ; then
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>
197 if test ${USE_RTLINUX} == 'yes' ; then
200 rtl.h rtl_malloc.h udp.h nic.h time.h],,,[[]])
201 AC_CHECK_HEADERS([nictab.h],,,[
209 AC_CHECK_HEADERS([onetd.h],,,[
210 #ifdef HAVE_LINUX_IF_H
211 #include <linux/if.h>
213 #ifdef HAVE_LINUX_IN_H
214 #include <linux/in.h>
216 #ifdef HAVE_PTHREAD_H
222 if test ${USE_RTAI} == 'yes' ; then
227 ###############################
229 INCLUDES='-I$(top_srcdir)/orte/include -I$(top_builddir)/orte/include'
232 ###############################
233 # Checks for typedefs, structures, and compiler characteristics.
235 AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,[#ifdef HAVE_SYS_TYPES_H
236 #include <sys/types.h>
238 #ifdef HAVE_SYS_SOCKET_H
239 #include <sys/socket.h>
241 #ifdef HAVE_WINSOCK2_H
242 #include <winsock2.h>
246 AC_CHECK_HEADERS([ifaddrs.h],,,[#ifdef HAVE_SYS_TYPES_H
247 #include <sys/types.h>
250 ###############################
251 # Endianness support attempts to allow build with same configure
252 # for both cases on recent systems
255 AC_CHECK_HEADERS([endian.h sys/param.h], [], [],[])
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])])
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])])
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])])
288 if test "$need_endian_test" == 'yes' ; then
293 #if defined(HAVE_ENDIAN_H) || defined(HAVE_SYS_PARAM_H)
294 #ifdef HAVE_SYS_PARAM_H
295 #include <sys/param.h>
297 #if defined(HAVE_ENDIAN_H) && !defined(BYTE_ORDER) && !defined(__BYTE_ORDER)
300 #if defined(__BYTE_ORDER)
301 #if __BYTE_ORDER == __BIG_ENDIAN
302 #define WORDS_BIGENDIAN 1
304 #elif defined(BYTE_ORDER)
305 #if BYTE_ORDER == BIG_ENDIAN
306 #define WORDS_BIGENDIAN 1
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])
322 AC_CONFIG_FILES([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])
338 LIBS="$LIBS$INTERNAL_PTHREAD_LIBS"
346 # ======================================================================
347 # generate orte/include/orte/orte_config.h
348 # ======================================================================
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])
357 mv orte/include/orte/orte_config.h.new orte/include/orte/orte_config.h
361 "------------------------------------------------------------------------
364 Source code location: ${srcdir}
366 Compiler flags: ${CFLAGS}
367 Host System Type: ${host}
369 See orte_config.h for future configuration information.
374 ------------------------------------------------------------------------"