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 AC_CHECK_FUNCS([pthread_condattr_setclock])
147 AC_CHECK_LIB([rt], [clock_gettime])
148 AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [[#include <time.h>]])
150 ###############################
152 AH_VERBATIM([_GNU_SOURCE],[
158 ###############################
159 # Checks for header files.
161 if test ${UNIX} == 'yes' -o ${WIN} == 'yes' ; then
164 arpa/inet.h fcntl.h stdio.h netdb.h stdlib.h \
165 string.h sys/ioctl.h sys/stat.h sys/time.h unistd.h pthread.h \
166 sys/types.h sys/sockio.h stdarg.h byteswap.h getopt.h \
167 ctype.h signal.h stdint.h errno.h],,,[[]])
168 AC_CHECK_HEADERS([sys/socket.h], [], [],
169 [#ifdef HAVE_SYS_TYPES_H
170 #include <sys/types.h>
172 AC_CHECK_HEADERS([netinet/in.h], [], [],
173 [#ifdef HAVE_SYS_TYPES_H
174 #include <sys/types.h>
176 AC_CHECK_HEADERS([net/if.h], [], [],
177 [#ifdef HAVE_SYS_TYPES_H
178 #include <sys/types.h>
180 #ifdef HAVE_SYS_SOCKET_H
181 #include <sys/socket.h>
185 if test ${WIN} == 'yes' ; then
187 winsock2.h ws2tcpip.h windows.h w32api/windows.h],,,[[]])
188 AC_CHECK_FUNCS([gettimeofday])
191 if test "${CONFIG_ORTE_KERNEL}" == 'yes' ; then
193 asm/byteorder.h linux/ctype.h linux/string.h \
194 linux/module.h linux/if.h linux/socket.h \
195 linux/time.h linux/types.h],,,[[]])
196 AC_CHECK_HEADERS([linux/in.h],,,[
197 #ifdef HAVE_LINUX_SOCKET_H
198 #include <linux/socket.h>
203 if test ${USE_RTLINUX} == 'yes' ; then
206 rtl.h rtl_malloc.h udp.h nic.h time.h],,,[[]])
207 AC_CHECK_HEADERS([nictab.h],,,[
215 AC_CHECK_HEADERS([onetd.h],,,[
216 #ifdef HAVE_LINUX_IF_H
217 #include <linux/if.h>
219 #ifdef HAVE_LINUX_IN_H
220 #include <linux/in.h>
222 #ifdef HAVE_PTHREAD_H
228 if test ${USE_RTAI} == 'yes' ; then
233 ###############################
235 INCLUDES='-I$(top_srcdir)/orte/include -I$(top_builddir)/orte/include'
238 ###############################
239 # Checks for typedefs, structures, and compiler characteristics.
241 AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,[#ifdef HAVE_SYS_TYPES_H
242 #include <sys/types.h>
244 #ifdef HAVE_SYS_SOCKET_H
245 #include <sys/socket.h>
247 #ifdef HAVE_WINSOCK2_H
248 #include <winsock2.h>
252 AC_CHECK_HEADERS([ifaddrs.h],,,[#ifdef HAVE_SYS_TYPES_H
253 #include <sys/types.h>
256 ###############################
257 # Endianness support attempts to allow build with same configure
258 # for both cases on recent systems
261 AC_CHECK_HEADERS([endian.h sys/param.h], [], [],[])
263 if test "$ac_cv_header_sys_param_h" == 'yes' ; then
264 AC_MSG_CHECKING([whether BYTE_ORDER defined in sys/param.h])
265 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/param.h>], [
266 unsigned int a=BYTE_ORDER;
267 unsigned int b=BIG_ENDIAN;
268 unsigned int c=LITTLE_ENDIAN;])],
269 [AC_MSG_RESULT([yes])
270 need_endian_test=no],[AC_MSG_RESULT([no])])
272 if test "$need_endian_test" == 'yes' ; then
273 AC_MSG_CHECKING([whether __BYTE_ORDER defined in sys/param.h])
274 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/param.h>], [
275 unsigned int a=__BYTE_ORDER;
276 unsigned int b=__BIG_ENDIAN;
277 unsigned int c=__LITTLE_ENDIAN;])],
278 [AC_MSG_RESULT([yes])
279 need_endian_test=no],[AC_MSG_RESULT([no])])
282 if test "$ac_cv_header_endian_h" == 'yes' ; then
283 if test "$need_endian_test" == 'yes' ; then
284 AC_MSG_CHECKING([whether endian can be determined from endian.h])
285 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <endian.h>], [
286 unsigned int a=__BYTE_ORDER;
287 unsigned int b=__BIG_ENDIAN;
288 unsigned int c=__LITTLE_ENDIAN;])],
289 [AC_MSG_RESULT([yes])
290 need_endian_test=no],[AC_MSG_RESULT([no])])
294 if test "$need_endian_test" == 'yes' ; then
299 #if defined(HAVE_ENDIAN_H) || defined(HAVE_SYS_PARAM_H)
300 #ifdef HAVE_SYS_PARAM_H
301 #include <sys/param.h>
303 #if defined(HAVE_ENDIAN_H) && !defined(BYTE_ORDER) && !defined(__BYTE_ORDER)
306 #if defined(__BYTE_ORDER)
307 #if __BYTE_ORDER == __BIG_ENDIAN
308 #define WORDS_BIGENDIAN 1
310 #elif defined(BYTE_ORDER)
311 #if BYTE_ORDER == BIG_ENDIAN
312 #define WORDS_BIGENDIAN 1
321 ###############################
322 # Checks for library functions.
323 AC_PROG_GCC_TRADITIONAL
324 if test -z "${CONFIG_ORTE_RT}" ; then
325 AC_CHECK_FUNCS([gethostbyname getopt_long sigwaitinfo])
328 AC_CONFIG_FILES([Makefile
330 orte/liborte/Makefile
331 orte/liborte/rtl/Makefile
332 orte/examples/Makefile
333 orte/examples/hello/Makefile
334 orte/examples/multicast/Makefile
335 orte/examples/reliable/Makefile
336 orte/examples/ping/Makefile
337 orte/examples/spy/Makefile
338 orte/examples/schneider/Makefile
339 orte/examples/mpo/Makefile
340 orte/idl-compiler/Makefile
341 orte/libjorte/Makefile
342 orte/manager/Makefile])
344 LIBS="$LIBS$INTERNAL_PTHREAD_LIBS"
352 # ======================================================================
353 # generate orte/include/orte/orte_config.h
354 # ======================================================================
356 AC_MSG_NOTICE([fixing orte/include/orte/orte_config.h])
357 sed -e "s/ PACKAGE/ ORTE_PACKAGE/" -e "s/ VERSION/ ORTE_VERSION/" \
358 orte/include/orte/orte_config.h >orte/include/orte/orte_config.h.new
359 if cmp -s orte/include/orte/orte_config.h.new orte/include/orte/orte_config.h; then
360 rm orte/include/orte/orte_config.h.new
361 AC_MSG_NOTICE([orte/include/orte/orte_config.h is unchanged])
363 mv orte/include/orte/orte_config.h.new orte/include/orte/orte_config.h
367 "------------------------------------------------------------------------
370 Source code location: ${srcdir}
372 Compiler flags: ${CFLAGS}
373 Host System Type: ${host}
375 See orte_config.h for future configuration information.
380 ------------------------------------------------------------------------"