# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ([2.67]) AC_INIT([codes-base], [0.2], [http://trac.mcs.anl.gov/projects/codes/newticket],[],[http://trac.mcs.anl.gov/projects/codes/wiki]) AC_CANONICAL_TARGET AC_CANONICAL_SYSTEM AC_CANONICAL_HOST AM_INIT_AUTOMAKE([foreign subdir-objects -Wall]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_CONFIG_SRCDIR([README.txt]) AC_CONFIG_HEADERS([codes_base_config.h]) AX_PROG_BISON([],[AC_MSG_WARN([Could not find bison])]) AX_PROG_FLEX([],[AC_MSG_WARN([Could not find flex])]) AC_SUBST([BISON]) AC_SUBST([FLEX]) # Checks for programs. AC_PROG_CC AM_PROG_CC_C_O AC_PROG_CXX AC_PROG_CXXCPP AC_PROG_RANLIB AC_REQUIRE_CPP # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([stdlib.h string.h unistd.h execinfo.h pthread.h malloc.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE AC_TYPE_INT8_T AC_TYPE_INT16_T AC_TYPE_INT32_T AC_TYPE_INT64_T AC_TYPE_UINT8_T AC_TYPE_UINT16_T AC_TYPE_UINT32_T AC_TYPE_UINT64_T AC_TYPE_SIZE_T AC_TYPE_SSIZE_T # Checks for library functions. AC_CHECK_FUNCS([memset]) AC_CHECK_LIB([pthread],[pthread_create],,[AC_MSG_ERROR([Could not find pthread_create!])]) AC_CHECK_LIB([m],[sqrt],,[AC_MSG_ERROR([Could not find sqrt!])]) AX_PROG_BISON_CLFEATURES([],[AC_MSG_WARN([Could not find bison])], [bison_ok="yes"], [bison_ok="no"]) AC_SUBST([bison_ok]) dnl Check to see if CC is an MPI compiler AC_MSG_CHECKING(whether the mpicc compiler works) AC_TRY_COMPILE([#include ], [int ret = MPI_Init(0, (void*)0)], AC_MSG_RESULT(yes), AC_MSG_RESULT(no) AC_MSG_ERROR(CC doesn't appear to be a valid MPI compiler. See INSTALL document or try adding CC=mpicc to your configure command line.) ) # # clear ROSS options # ROSS_CFLAGS="" ROSS_CPPFLAGS="" ROSS_LDFLAGS="" ROSS_LIBS="" ENABLE_ROSS=0 AC_ARG_WITH([ross],[AS_HELP_STRING([--with-ross@<:@=DIR@:>@], [location of ROSS installation])]) # # if we have ROSS, add ROSS flags # if test "x${with_ross}" != "x" ; then ORIG_LDFLAGS="${LDFLAGS}" ORIG_CPPFLAGS="${CPPFLAGS}" ORIG_LIBS="${LIBS}" ORIG_CFLAGS="${CFLAGS}" checkpath="${with_ross}/bin" ROSS_CONFIG="" AC_CHECK_PROGS(ROSS_CONFIG, [ross-config], [NOT_FOUND], [$checkpath]) if test "${ROSS_CONFIG}" = "NOT_FOUND" ; then AC_MSG_ERROR(ROSS not found at: $with_ross) fi if test "${ROSS_CONFIG}x" != "x" ; then LDFLAGS=`${with_ross}/bin/ross-config --ldflags` CFLAGS=`${with_ross}/bin/ross-config --cflags` CPPFLAGS=`${with_ross}/bin/ross-config --cflags` LIBS=`${with_ross}/bin/ross-config --libs` ENABLE_ROSS=1 AC_CHECK_LIB([ROSS],[tw_init],,[ENABLE_ROSS=;]) if test -z "$ENABLE_ROSS" ; then ENABLE_ROSS=0 AC_MSG_ERROR([Could not find usable ROSS library]) fi ENABLE_ROSS=1 # # TODO this is weird... need to add -c back to CPPFLAGS or CHECK_HEADERS # tries to compile an exe using a c file that includes ross.h and no # main() # CPPFLAGS_2="${CPPFLAGS}" CPPFLAGS="-c ${CPPFLAGS}" AC_CHECK_HEADERS([ross.h], [], [ENABLE_ROSS=;]) if test -z "$ENABLE_ROSS" ; then ENABLE_ROSS=0 AC_MSG_ERROR([Could not find usable ross.h]) else CPPFLAGS="${CPPFLAGS_2}" checkpath="$PATH" AC_SUBST([ROSS_LDFLAGS],["${LDFLAGS}"]) AC_SUBST([ROSS_CFLAGS],["${CFLAGS}"]) AC_SUBST([ROSS_CPPFLAGS],["${CPPFLAGS}"]) AC_SUBST([ROSS_LIBS],["${LIBS}"]) fi CFLAGS="${ORIG_CFLAGS}" CPPFLAGS="${ORIG_CPPFLAGS}" LDFLAGS="${ORIG_LDFLAGS}" LIBS="${ORIG_LIBS}" AC_DEFINE([HAVE_ROSS],[1],[If ROSS is supported on target build platform]) fi else ENABLE_ROSS=0 AC_MSG_ERROR([Could not find usable ROSS installation, try --with-ross=DIR]) fi # put include files in a codes/ subdir includedir="${includedir}/codes" # # To reactivate rewriting of the codesparser.y file, # uncomment next line. # # NOTE: this will force the latest bison for building, # even when building from a dist. # # dnl AC_CONFIG_FILES([src/iokernellang/codesparser.y]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT