+dnl Copyright (C) 2004-2007. The SimGrid team. All rights reserved.
+
+dnl This file is part of the SimGrid project. This is free software:
+dnl You can redistribute and/or modify it under the terms of the
+dnl GNU LGPL (v2.1) licence.
######################
## Setup the autotools
dnl # 1. determine possibilities
dnl #
-dnl # check for MCSC method
+dnl # check for MCSC method (ucontexts)
AC_CHECK_MCSC(mcsc=yes, mcsc=no)
dnl # check for pthread method
AC_CHECK_HEADERS([pthread.h])
AC_CHECK_LIB(pthread,pthread_create,pthread=yes, pthread=no)
+if test x$pthread = xyes ; then
+ AC_CHECK_LIB(pthread, sem_timedwait, HAVE_SEM_TIMEDWAIT=yes, HAVE_SEM_TIMEDWAIT=no)
+ if test ${HAVE_SEM_TIMEDWAIT} = yes ; then
+ AC_MSG_CHECKING(if sem_timedwait is compilable)
+ AC_TRY_COMPILE([#include <semaphore.h>],
+ [sem_t *s; const struct timespec * t; sem_timedwait(s, t);], HAVE_SEM_TIMEDWAIT=yes, HAVE_SEM_TIMEDWAIT=no)
+ if test ${HAVE_SEM_TIMEDWAIT} = yes ; then
+ AC_DEFINE([HAVE_SEM_TIMEDWAIT],1,[Define if the sem_timedwait is avaible or not (part of XPG6 standard only)])
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+ fi
+fi
+
dnl #
dnl # 2. make a general decision
dnl #
if test ".$mcsc" = .yes; then
+ # ucontext found
mcsc=yes
elif test ".$pthread" = .yes; then
+ # ucontext not found, but pthread found
pthread=yes
else
ac_header=windows.h
fi
fi
-if test "x$with_context" = "xpthreads"; then
- with_context=pthread
-fi
if test "x$with_context" = "xpthread"; then
AC_CHECK_HEADERS([pthread.h])
- AC_CHECK_LIB(pthread,pthread_create,,
- [AC_MSG_ERROR([[Cannot find pthreads (try --with-context=ucontext if you haven't already tried).]])])
+ if test x$pthread != xyes ; then
+ AC_MSG_ERROR([[Cannot find pthreads (try --with-context=ucontext if you haven't already tried).]])
+ fi
AC_DEFINE([CONTEXT_THREADS],1,[Define if xbt contexts are based on our threads implementation or not])
AC_MSG_RESULT(You have pthreads and requested for them. Fine.)
fi
# Java cruft
AC_ARG_ENABLE(java,
AS_HELP_STRING([--disable-java], [To not compile the Java bindings even if the tools are found]),
- want_java=$enableval,want_java=yes)
-if test "x$want_java" != "xyes" ; then
- AC_MSG_CHECKING(whether to compile java bindings)
- AC_MSG_RESULT(disabled by user)
+ disable_java=$enableval,disable_java=yes)
+AC_MSG_CHECKING(whether to compile java bindings)
+if test "x$disable_java" != "xyes" ; then
use_java="disabled by user"
else
AC_PATH_PROG([JAVAC], [javac], `which javac`)
AC_PATH_PROG([JAVA], [java] , `which java`)
AC_PATH_PROG([JAR], [jar] , `which jar`)
AC_CHECK_HEADERS(jni.h)
- AC_MSG_CHECKING(whether to compile java bindings)
if test -n "$JAVAC" \
&& test -n "$JAVA" \
&& test -n "$JAR" \
else
use_java="no"
fi
- AC_MSG_RESULT($use_java)
fi
+AC_MSG_RESULT($use_java)
AM_CONDITIONAL(HAVE_JAVA,test "x$use_java" = "xyes")
#####################
# examples/gras/p2p/chord/Makefile
# examples/gras/p2p/can/Makefile
-if test "x$use_java" = "xyes" ; then
AC_CONFIG_FILES([
examples/java/Makefile
examples/java/basic/Makefile
examples/java/suspend/Makefile
examples/java/ping_pong/Makefile
])
-fi
AC_CONFIG_FILES([
examples/Makefile
examples/gras/pmm/Makefile
examples/gras/all2all/Makefile
examples/amok/Makefile
- examples/amok/bandwidth/Makefile examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl
- examples/amok/saturate/Makefile examples/amok/saturate/test_sg examples/amok/saturate/test_rl
-],[
- for file in \
- \
- examples/amok/bandwidth/test_sg examples/amok/bandwidth/test_rl \
- examples/amok/saturate/test_sg examples/amok/saturate/test_rl \
- ; do \
- test -e $file && chmod +x $file; \
- done
])
AC_CONFIG_FILES([