configure.in
5617e011
 dnl
867598f3
 dnl Configuration things for preprocessCore
5617e011
 dnl
 
 
 AC_INIT("DESCRIPTION")
 
 dnl
 dnl Are things (still) the same ?
 dnl (taken from the 'writing R extensions manual')
 
 dnl Now find the compiler and compiler flags to use
 : ${R_HOME=`R RHOME`}
 if test -z "${R_HOME}"; then
        echo "could not determine R_HOME"
        exit 1
 fi
 CC=`"${R_HOME}/bin/R" CMD config CC`
 CPP=`"${R_HOME}/bin/R" CMD config CPP`
 CFLAGS=`"${R_HOME}/bin/R" CMD config CFLAGS`
 CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
 AC_PROG_CC
 AC_PROG_CPP
 
 
867598f3
 AC_LANG(C)
5617e011
 
 # Checks for libraries.
 use_pthreads=no
 AC_SEARCH_LIBS([pthread_create], [pthread],
   [use_pthreads=yes])
 
 # Checks for header files.
 AC_HEADER_STDC
 AC_CHECK_HEADERS([stdlib.h])
 
 if test "x${have_pthreads}" = xyes; then
   AC_CHECK_HEADERS([pthread.h], [],
     [use_pthreads=no])
 fi
 
 
 AC_MSG_CHECKING([if PTHREAD_STACK_MIN is defined])
867598f3
 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
5617e011
 	#include <pthread.h>
 	#include <limits.h>
 
       int main () {size_t stacksize = PTHREAD_STACK_MIN + 0x4000;
 }     	  
867598f3
     ])],[use_pthread_stack_min=yes], [use_pthread_stack_min=no])
5617e011
 AC_MSG_RESULT($use_pthread_stack_min)
 
 if test "x$use_pthread_stack_min" = xno; then
 	use_pthreads=no
 fi
 
 
d8604282
 
 
867598f3
 AC_ARG_ENABLE([threading],
 	AS_HELP_STRING([--disable-threading],[Disable threading]))
5617e011
 
 
d8604282
 
867598f3
 AS_IF([test "x$enable_threading" != "xno" ],[
 	    if test "x${use_pthreads}" = "xno"; then
 	       AC_MSG_NOTICE(------------------------------------------)
 	       AC_MSG_NOTICE( Unable to find pthreads on this system.  )
 	       AC_MSG_NOTICE( Building a single-threaded version.      )
 	       AC_MSG_NOTICE(------------------------------------------)
 	    fi
 
 
 	    if test "x${use_pthreads}" = "xyes"; then
   	       AC_MSG_NOTICE(Enabling threading for preprocessCore)
   	       AC_DEFINE(USE_PTHREADS, 1)
 	    fi
 	    ],
 	    [
5fb88bba
 	    AC_MSG_NOTICE(Disabling threading for preprocessCore)
867598f3
 	    ])
 
5617e011
 
 
 
 
 AC_OUTPUT(src/Makevars)