[f12e6b]: configure.in Maximize Restore History

Download this file

configure.in    520 lines (474 with data), 12.3 kB

AC_INIT(configure.in)
AC_CONFIG_AUX_DIR(config)
AC_CANONICAL_HOST

# -----------------------------------------------
# Set version
# -----------------------------------------------
version="14.0.0"
AC_MSG_CHECKING(version number)
AC_MSG_RESULT($version)
AC_SUBST(version)

extraArguments () { shift; echo $*; }

dnl -----------------------------------------------
dnl check to see if FORTRAN turned off
dnl -----------------------------------------------
fortran_enabled=1
AC_SUBST(fortran_enabled)
AC_ARG_ENABLE(fortran, --disable-fortran   turn off FORTRAN support if you have to compile,[
  if test "$enableval" = "no"; then fortran_enabled=0; fi
])

# -----------------------------------------------
# Check for C and maybe FORTRAN
# -----------------------------------------------
AC_PROG_CC
if test "$fortran_enabled" = 1; then
  AC_PROG_F77
fi
CCARGUMENTS=`extraArguments $CC`
AC_PATH_PROG(CC,$CC,$CC)
CC="$CC $CCARGUMENTS"
AC_AIX
AC_MINIX

dnl -----------------------------------------------
dnl FORTRAN can be turned off
dnl -----------------------------------------------
FDASHI_OK=0
AC_SUBST(FDASHI_OK)
if test "$fortran_enabled" = 1; then
  FFARGUMENTS=`extraArguments $F77`
  AC_PATH_PROG(F77,$F77,$F77)
  F77="$F77 $FFARGUMENTS"
  AC_F77_LIBRARY_LDFLAGS

  dnl -----------------------------------------------
  dnl Some Fortran compilers do not allow -I options
  dnl -----------------------------------------------
  AC_MSG_CHECKING(-I allowed in FORTRAN)
  cat > conftest.f <<EOF
        PROGRAM X
        STOP
        END
EOF
  if $F77 -c conftest.f -I. >/dev/null 2>&1; then
    rm -fr conftest.*
    AC_MSG_RESULT(yes)
    FDASHI_OK=1
  else
    rm -fr conftest.*
    AC_MSG_RESULT(no)
    FDASHI_OK=0
  fi
fi

# -----------------------------------------------
# We need some helper tools
# -----------------------------------------------
AC_PROG_INSTALL
AC_SUBST(AR) AC_PATH_PROG(AR,ar,ar)
AC_SUBST(DIFF) AC_PATH_PROG(DIFF,diff,diff)
AC_PROG_RANLIB AC_PATH_PROG(RANLIB,$RANLIB,$RANLIB)
AC_PROG_LN_S

# -----------------------------------------------
# Header checks...
# -----------------------------------------------
AC_CONFIG_HEADER(Include/sisalConfig.h)
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(time.h)
AC_CHECK_HEADERS(limits.h)
AC_CHECK_HEADERS(float.h)
AC_CHECK_HEADERS(fcntl.h)
AC_CHECK_HEADERS(string.h)
AC_CHECK_HEADERS(strings.h)
AC_CHECK_HEADERS(sys/types.h)
AC_CHECK_HEADERS(sys/times.h)
AC_CHECK_HEADERS(sys/resource.h)
AC_CHECK_HEADERS(sys/stat.h)
AC_CHECK_HEADERS(sys/wait.h)
AC_HEADER_TIME

# -----------------------------------------------
# Check timer possibilities
# -----------------------------------------------
AC_MSG_CHECKING(Cray high resolution timer)
AC_TRY_RUN([
  extern double TSECND();
  int main() {double x = TSECND(); return 0;}
],[
  AC_MSG_RESULT(yes)
  AC_DEFINE(HAVE_TSECND_INTRINSIC)
],[
  AC_MSG_RESULT(no)
],[
  AC_MSG_RESULT(no)
  AC_MSG_ERROR(Cannot cross compile)
])

AC_MSG_CHECKING(getrusage())
AC_TRY_RUN([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
int main() {
  struct rusage timerInfo;
  (void) getrusage(RUSAGE_SELF, &timerInfo);
  return 0;
}
],[
  AC_MSG_RESULT(yes)
  AC_DEFINE(HAVE_RUSAGE)
],[
  AC_MSG_RESULT(no)
],[
  AC_MSG_RESULT(no)
  AC_MSG_ERROR(Cannot cross compile)
])

AC_MSG_CHECKING(times())
AC_TRY_RUN([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
#else
#if HAVE_SYS_TIME_H
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
#endif
int main() {
  struct tms timerInfo;
  (void) times(&timerInfo);
  return 0;
}
],[
  AC_MSG_RESULT(yes)
  AC_DEFINE(HAVE_TIMES)
],[
  AC_MSG_RESULT(no)
],[
  AC_MSG_RESULT(no)
  AC_MSG_ERROR(Cannot cross compile)
])

dnl -----------------------------------------------
dnl We have some keywords to check for
dnl -----------------------------------------------
AC_MSG_CHECKING(register keyword)
AC_TRY_COMPILE([],[register int x;],[
  AC_MSG_RESULT(yes)
  AC_DEFINE(HAVE_REGISTER_KEYWORD)
],[
  AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(volatile keyword)
AC_TRY_COMPILE([],[volatile int x;],[
  AC_MSG_RESULT(yes)
  AC_DEFINE(HAVE_VOLATILE_KEYWORD)
],[
  AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(shared keyword)
AC_TRY_COMPILE([static shared int x],[int y=x;],[
  AC_MSG_RESULT(yes)
  AC_DEFINE(HAVE_SHARED_KEYWORD)
],[
  AC_MSG_RESULT(no)
])

dnl -----------------------------------------------
dnl Prototypes
dnl -----------------------------------------------
have_prototypes=no
AC_MSG_CHECKING(for prototypes)
AC_TRY_COMPILE([
  extern int foo(int);
],[
  return foo(10);
],[
  AC_DEFINE(HAVE_PROTOTYPES)
  have_prototypes=yes
])
AC_MSG_RESULT($have_prototypes)

dnl -----------------------------------------------
dnl const
dnl -----------------------------------------------
have_const=no
AC_MSG_CHECKING(for const)
AC_TRY_COMPILE([
],[
  const int x;
  x = 0;
],[
  AC_DEFINE(HAVE_CONST)
  have_const=yes
])
AC_MSG_RESULT($have_const)


# -----------------------------------------------
# See if we can get the clock tick
# -----------------------------------------------
sisal_clock_tick=NONE
AC_SUBST(sisal_clock_tick)

if test "$sisal_clock_tick" = "NONE"; then
AC_MSG_CHECKING(CLK_TCK from sysconf)
AC_TRY_COMPILE([
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
],[
   int x = sysconf(_SC_CLK_TCK)
],[
  AC_MSG_RESULT(yes)
  sisal_clock_tick="sysconf(_SC_CLK_TCK)"
],[
  AC_MSG_RESULT(no)
])
fi

if test "$sisal_clock_tick" = "NONE"; then
AC_MSG_CHECKING(CLOCKS_PER_SEC in time.h)
AC_TRY_COMPILE([
#ifdef HAVE_TIME_H
#include <time.h>
#endif
],[
   int x = CLOCKS_PER_SEC;
],[
  AC_MSG_RESULT(yes)
  sisal_clock_tick=CLOCKS_PER_SEC
],[
  AC_MSG_RESULT(no)
])
fi

if test "$sisal_clock_tick" = "NONE"; then
AC_MSG_CHECKING(CLK_TCK in time.h)
AC_TRY_COMPILE([
#ifdef HAVE_TIME_H
#include <time.h>
#endif
],[
   int x = CLK_TCK;
],[
  AC_MSG_RESULT(yes)
  sisal_clock_tick=CLK_TCK
],[
  AC_MSG_RESULT(no)
])
fi

if test "$sisal_clock_tick" = "NONE"; then
AC_MSG_CHECKING(CLK_TCK as a constant 60)
sisal_clock_tick=60
AC_MSG_RESULT(Who knows if this will work, but...)
fi


# -----------------------------------------------
# Check for bad behavior in compilers
# -----------------------------------------------
bad_forward=no
AC_MSG_CHECKING(for bad static forward)
AC_TRY_RUN([
struct s { int a; int b; };
static struct s foo;
int foobar() {
 static int random;
 random = (int) &foo;
 return random;
}
static struct s foo = { 1, 2 };
main() {
 exit(!((int)&foo == foobar()));
}
],[
  bad_forward=no
],[
  AC_DEFINE(BAD_STATIC_FORWARD) bad_forward=yes,
],[
  bad_forward=no
])
AC_MSG_RESULT($bad_forward)

dnl -----------------------------------------------
dnl Unaccounted for process symbols
dnl -----------------------------------------------
if test "black" = "white"; then
CACHE_LINE
MaxInt
MinInt
MaxFloat
MinFloat
MaxDouble
MinDouble
fi

dnl -----------------------------------------------
dnl Set the proper model
dnl -----------------------------------------------
model=PThreads
AC_SUBST(model)
AC_MSG_CHECKING(parallel model)
AC_ARG_WITH(model,--with-model=<parallelism model>,[
   model=$withval
])
AC_MSG_RESULT($model)

dnl -----------------------------------------------
dnl Make sure we have support the choosen model
dnl -----------------------------------------------
AC_MSG_CHECKING(if $model is supported)
if test -d Runtime/"$model"Model; then
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
  AC_MSG_ERROR(no such model $model in Runtime directory)
fi

dnl -----------------------------------------------
dnl Set compile, link flags, and max_procs
dnl -----------------------------------------------
parallel_compile=""
parallel_link=""
max_procs=1

AC_SUBST(parallel_compile)
AC_SUBST(parallel_link)
AC_SUBST(max_procs)

if test -x Runtime/"$model"Model/detect; then
  AC_MSG_CHECKING(compile flags)
  parallel_compile=`Runtime/"$model"Model/detect compile $CC $CFLAGS`
  AC_MSG_RESULT($parallel_compile)

  AC_MSG_CHECKING(link flags)
  parallel_link=`Runtime/"$model"Model/detect link $CC $CFLAGS $parallel_compile $LIBS`
  AC_MSG_RESULT($parallel_link)

  AC_MSG_CHECKING(processor count)
  max_procs=`Runtime/"$model"Model/detect processors $CC $CFLAGS $parallel_compile $LIBS $parallel_link`
  AC_MSG_RESULT($max_procs)

fi

if test "$parallel_compile" = "ERROR" || test "$parallel_link" = "ERROR"; then
  AC_MSG_WARN(Model not implemented here.  Reverting to Serial)
  model=Serial
  parallel_compile=""
  parallel_link=""
fi

dnl -----------------------------------------------
dnl Length of pathnames
dnl -----------------------------------------------
max_path_length=2048
AC_SUBST(max_path_length)
AC_MSG_CHECKING(length of a pathname)
cat > conftest.$ac_ext <<EOF
#include <unistd.h>
#include <stdio.h>
int main() {
  int pl = pathconf("/",_PC_PATH_MAX);
  printf("%d\n",pl);
  return 0;
}
EOF
if ( eval $ac_link > /dev/null 2>&1 ); then
   path_length=`conftest${ac_exeext}`
   if test "$path_length" != "0"; then
      max_path_length="$path_length";
   fi
fi
AC_MSG_RESULT($max_path_length)
rm -fr conftest.$ac_ext conftest${ac_exeext}

dnl -----------------------------------------------
dnl Help the pthreads implementation for Draft 4 vs.
dnl standard
dnl -----------------------------------------------
AC_CHECK_HEADERS(sched.h)
if test "$model" = "PThreads"; then
  saveLIBS="$LIBS"
  LIBS="$LIBS $parallel_link"
  AC_CHECK_FUNCS(sched_yield)
  LIBS="$saveLIBS"
fi

dnl -----------------------------------------------
dnl Non coherent cache issues!
dnl -----------------------------------------------
AC_MSG_CHECKING(non-coherent cache)
if test "$model" = "IBMPower4"; then
  AC_DEFINE(NON_COHERENT_CACHE)
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi

dnl -----------------------------------------------
dnl Mutable descriptors in FLI
dnl -----------------------------------------------
AC_MSG_CHECKING(support for mutable descriptors)
if test "black" = "white"; then
  AC_DEFINE(MUTABLE_DESCRIPTORS)
  AC_MSG_RESULT(yes)
else
  AC_MSG_RESULT(no)
fi

dnl -----------------------------------------------
dnl psignal
dnl -----------------------------------------------
AC_CHECK_FUNCS(psignal)

dnl -----------------------------------------------
dnl Distributed DSA (not used for a while)
dnl -----------------------------------------------
AC_ARG_ENABLE(dist-dsa, --enable-dist-dsa   Turn on the distributed memory allocation scheme (broken),[
  DIST_DSA="$enableval"
],[
  DIST_DSA="no"
])
  
AC_MSG_CHECKING(distributed dsa)
if test "$DIST_DSA" = "yes"; then
  AC_DEFINE(DIST_DSA)
fi
AC_MSG_RESULT($DIST_DSA)

dnl -----------------------------------------------
dnl Static sharing problem?
dnl -----------------------------------------------
AC_ARG_ENABLE(bad-static-sharing, --enable-bad-static-sharing  Problem with some obsolete C compilers,[
  bad_static_sharing="$enableval"
],[
  bad_static_sharing="no"
])

AC_MSG_CHECKING(static sharing problem?)
if test "$bad_static_sharing" = "yes"; then
  AC_DEFINE(NO_STATIC_SHARED)
fi
AC_MSG_RESULT($bad_static_sharing)

dnl -----------------------------------------------
dnl Build instrumented version?
dnl -----------------------------------------------
AC_ARG_ENABLE(instrumentation, --enable-instrumentation  Build instrumentation into runtime,[
  instrument_runtime="$enableval"
],[
  instrument_runtime="no"
])
AC_MSG_CHECKING(Build instrumented version?)
if test "$instrument_runtime" = "yes"; then
  AC_DEFINE(VERBOSE)
  AC_DEFINE(DEBUG_DSA)
fi
AC_MSG_RESULT($instrument_runtime)

dnl -----------------------------------------------
dnl Directory info
dnl -----------------------------------------------
top_level_directory=`pwd`
AC_SUBST(top_level_directory)

AC_OUTPUT(makefile
	Include/sisalPaths.h
	Include/sisalInfo.h
	Include/makefile.inc
	Frontend/Front1/makefile
	Backend/Library/makefile
	Backend/If1ld/makefile
	Backend/If1opt/makefile
	Backend/If2gen/makefile
	Backend/If2mem/makefile
	Backend/If2part/makefile
	Backend/If2up/makefile
	Runtime/Sharedlib/makefile
	Tools/sisalc/makefile
)