configure.ac 3.78 KB
Newer Older
Jonathan Jenkins's avatar
Jonathan Jenkins committed
1 2 3
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

Jonathan Jenkins's avatar
Jonathan Jenkins committed
4
AC_PREREQ([2.63])
Jonathan Jenkins's avatar
Jonathan Jenkins committed
5
AC_INIT([ssg], [0.1], [],[],[]) 
Jonathan Jenkins's avatar
Jonathan Jenkins committed
6 7
AC_CONFIG_MACRO_DIR([m4])
LT_INIT
Jonathan Jenkins's avatar
Jonathan Jenkins committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

AC_CANONICAL_TARGET
AC_CANONICAL_SYSTEM
AC_CANONICAL_HOST

AM_INIT_AUTOMAKE([foreign subdir-objects -Wall])

# we should remove this soon, only needed for automake 1.10 and older
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

AC_CONFIG_SRCDIR([README.md])
AC_CONFIG_HEADERS([ssg-config.h])

# Checks for programs.
AC_PROG_CC
AC_PROG_CC_C99

dnl
dnl Add warning flags by default
dnl
CFLAGS="-Wall -Wextra $CFLAGS"
CXXFLAGS="-Wall -Wextra $CXXFLAGS"

dnl
dnl Verify pkg-config
dnl
PKG_PROG_PKG_CONFIG
PKG_CONFIG="pkg-config --static"

check_mpi=auto
AC_ARG_ENABLE([mpi],
    [--enable-mpi    Enable MPI (default: dynamic check)],
    [ case "${enableval}" in
     yes) check_mpi=yes ;;
     no)  check_mpi=no ;;
     *) AC_MSG_ERROR([bad value ${enableval} for --enable-mpi]) ;;
     esac],
    [])


check_mpi_status=fail
if test "x${check_mpi}" = xauto -o "x${check_mpi}" = xyes ; then
    AC_MSG_CHECKING([If MPI programs can be compiled])
    AC_LINK_IFELSE(
        [AC_LANG_PROGRAM([[#include<mpi.h>]], [[MPI_Init(0,0);]])],
        [AC_DEFINE([HAVE_MPI], [1], [Define to 1 if compiled with MPI support])
         AC_MSG_RESULT([yes])
         check_mpi_status=success],
        [AC_MSG_RESULT([no])])
fi

if test "x${check_mpi_status}" = xfail -a "x${check_mpi}" = xyes; then
    AC_MSG_ERROR([MPI requested but unable to be used. Did you specify an MPI compiler?])
fi

AM_CONDITIONAL([HAVE_MPI], [test "x${check_mpi_status}" = xsuccess])

Jonathan Jenkins's avatar
Jonathan Jenkins committed
65 66 67 68 69 70 71 72 73
check_margo=auto
AC_ARG_ENABLE([margo],
    [--enable-margo    Enable Margo (default: dynamic check)],
    [case "${enableval}" in
     yes) check_margo=yes ;;
     no)  check_margo=no  ;;
     *)   AC_MSG_ERROR([Invalid value ${enableval} for --enable-margo])
     esac])

74
check_progs=
Jonathan Jenkins's avatar
Jonathan Jenkins committed
75
if test "x${check_margo}" = xauto -o "x${check_margo}" = xyes ; then
Jonathan Jenkins's avatar
Jonathan Jenkins committed
76
    PKG_CHECK_MODULES([MARGO],[margo],
Jonathan Jenkins's avatar
Jonathan Jenkins committed
77
        [AC_DEFINE([HAVE_MARGO], [1], [Define to 1 if compiled with Margo support])
78
         check_progs="tests/ssg-test-margo tests/ssg-test-margo-dblgrp"
Jonathan Jenkins's avatar
Jonathan Jenkins committed
79 80 81 82 83 84 85 86 87 88
         LIBS="$MARGO_LIBS $LIBS"
         CPPFLAGS="$MARGO_CFLAGS $CPPFLAGS"
         CFLAGS="$MARGO_CFLAGS $CFLAGS"
         check_margo_status=success], [check_margo_status=fail])
fi

if test "x${check_margo_status}" = xfail -a "x${check_margo}" = xyes; then
    AC_MSG_ERROR([Margo requested but unable to be used. See config.log])
fi

89
AC_SUBST([CHECK_PROGS], [${check_progs}])
Jonathan Jenkins's avatar
Jonathan Jenkins committed
90 91
AM_CONDITIONAL([HAVE_MARGO], [test "x${check_margo_status}" = xsuccess])

92 93 94 95 96 97 98 99 100 101 102 103 104
check_swim_fd=auto
AC_ARG_ENABLE([swim-fd],
    [--enable-swim-fd   Enable SWIM failure detection (default: dynamic check)],
    [case "${enableval}" in
     yes) check_swim_fd=yes ;;
     no)  check_swim_fd=no  ;;
     *)   AC_MSG_ERROR([Invalid value ${enableval} for --enable-swim-fd])
     esac])

check_swim_fd_status=fail
if test "x${check_swim_fd}" = xauto -o "x${check_swim_fd}" = xyes ; then
    PKG_CHECK_MODULES([SWIM_FD],[swim-fd],
        [AC_DEFINE([HAVE_SWIM_FD], [1], [Defined to 1 if compiled with SWIM failure detection support])
Shane Snyder's avatar
Shane Snyder committed
105 106 107
         LIBS="$SWIM_FD_LIBS $LIBS"
         CPPFLAGS="$SWIM_FD_CFLAGS $CPPFLAGS"
         CFLAGS="$SWIM_FD_CFLAGS $CFLAGS"
108 109 110 111 112 113 114
         check_swim_fd_status=success], [check_swim_fd_status=fail])
fi

if test "x${check_swim_fd_status}" = xfail -a "x${check_swim_fd}" = xyes; then
    AC_MSG_ERROR([SWIM failure detector requested but unable to be used. See config.log])
fi

Jonathan Jenkins's avatar
Jonathan Jenkins committed
115
# mercury check goes last - libs should be linked in before margo
Jonathan Jenkins's avatar
Jonathan Jenkins committed
116
PKG_CHECK_MODULES([MERCURY],[mercury],
Jonathan Jenkins's avatar
Jonathan Jenkins committed
117 118 119 120
    [LIBS="$MERCURY_LIBS $LIBS"
     CPPFLAGS="$MERCURY_CFLAGS $CPPFLAGS"
     CFLAGS="$MERCURY_CFLAGS $CFLAGS"])

Jonathan Jenkins's avatar
Jonathan Jenkins committed
121 122
AC_CONFIG_FILES([Makefile maint/ssg.pc])
AC_OUTPUT