Codebase list libepsilon / scrub-obsolete/main configure.in
scrub-obsolete/main

Tree @scrub-obsolete/main (Download .tar.gz)

configure.in @scrub-obsolete/mainraw · history · blame

dnl
dnl $Id: configure.in,v 1.32 2011/05/27 10:47:34 simakov Exp $
dnl

AC_INIT(configure.in)

AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(epsilon, 0.9.2)

AC_LANG_C
AC_PROG_CC
AC_SYS_LARGEFILE

dnl Library code modified:              REVISION++
dnl Interfaces changed/added/removed:   CURRENT++ REVISION=0
dnl Interfaces added:                   AGE++
dnl Interfaces removed:                 AGE=0
LT_CURRENT=1
LT_REVISION=0
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
AM_PROG_LIBTOOL

dnl
dnl Check for POPT library
dnl

AC_CHECK_HEADER([popt.h], [have_popt_h=yes],)
AC_CHECK_LIB([popt], [poptGetContext], [have_popt_lib=yes], ,)

if test x$have_popt_h = xyes -a x$have_popt_lib = xyes ; then
    LIBS="$LIBS -lpopt"
else
    AC_MSG_ERROR([
=================================================
Configure script failed to find popt library!
You can download it from ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.1.x/
=================================================])
fi

dnl
dnl POSIX threads support
dnl

AH_TEMPLATE([ENABLE_PTHREADS], [Define to 1 to enable POSIX threads support])

AC_ARG_ENABLE(
    pthreads,
    AC_HELP_STRING([--enable-pthreads], [Enable POSIX threads support [[default=no]]]),
    [
        if test x$enableval = xyes ; then
            AC_CHECK_HEADER([pthread.h], [have_pthread_h=yes],)
            AC_CHECK_LIB([pthread], [pthread_create], [have_pthread_lib=yes], ,)

            if test x$have_pthread_h = xyes -a x$have_pthread_lib = xyes ; then
                LIBS="$LIBS -lpthread"
                AC_DEFINE([ENABLE_PTHREADS], [1],)
            else
                AC_MSG_ERROR([
=================================================
Configure script failed to find pthread library!
Try `--disable-pthreads' option.
=================================================])
            fi
        fi
    ],
)

dnl
dnl Default number of threads
dnl

AC_ARG_WITH(def-threads,
    AC_HELP_STRING([--with-def-threads=N], [Default number of threads]),
    [
	CFLAGS="$CFLAGS -DDEF_N_THREADS=$withval"
	AC_MSG_CHECKING(default number of threads)
	AC_MSG_RESULT($withval)
    ]
)

dnl
dnl Maximal number of threads
dnl

AC_ARG_WITH(max-threads,
    AC_HELP_STRING([--with-max-threads=N], [Maximal number of threads]),
    [
	CFLAGS="$CFLAGS -DMAX_N_THREADS=$withval"
	AC_MSG_CHECKING(maximal number of threads)
	AC_MSG_RESULT($withval)
    ]
)

dnl
dnl Cluster mode
dnl

AH_TEMPLATE([ENABLE_CLUSTER], [Define to 1 to enable cluster mode])

AC_ARG_ENABLE(
    cluster,
    AC_HELP_STRING([--enable-cluster], [Enable cluster mode [[default=no]]]),
    [
        if test x$enableval = xyes ; then
            AC_CHECK_HEADERS([sys/types.h sys/socket.h sys/wait.h netinet/in.h arpa/inet.h syslog.h signal.h fcntl.h unistd.h], [],
                AC_MSG_ERROR([
=================================================
Configure script failed to enable cluster mode!
Try `--disable-cluster' option.
=================================================]))
            AC_CHECK_FUNCS([socket setsockopt bind listen accept fork setsid waitpid sigaction flock], [],
                AC_MSG_ERROR([
=================================================
Configure script failed to enable cluster mode!
Try `--disable-cluster' option.
=================================================]))
            AC_CHECK_HEADER([pthread.h], [have_pthread_h=yes],)
            AC_CHECK_LIB([pthread], [pthread_create], [have_pthread_lib=yes], ,)

            if test x$have_pthread_h = xyes -a x$have_pthread_lib = xyes ; then
                LIBS="$LIBS -lpthread"
                AC_DEFINE([ENABLE_PTHREADS], [1],)
            else
                AC_MSG_ERROR([
=================================================
Configure script failed to enable cluster mode!
Try `--disable-cluster' option.
=================================================])
            fi

            AC_DEFINE([ENABLE_CLUSTER], [1],)
        fi
    ],
)

dnl
dnl MPI support
dnl

AH_TEMPLATE([ENABLE_MPI], [Define to 1 to enable MPI support])

AC_ARG_ENABLE(
    mpi,
    AC_HELP_STRING([--enable-mpi], [Enable MPI support [[default=no]]]),
    [
        if test x$enableval = xyes ; then
            AC_CHECK_HEADER([mpi.h], [have_mpi_h=yes],)

            if test x$have_mpi_h = xyes ; then
                AC_DEFINE([ENABLE_MPI], [1],)
            else
                AC_MSG_ERROR([
=================================================
Configure script failed to find MPI library!
Try `--disable-mpi' option.
=================================================])
            fi
        fi
    ],
)

dnl
dnl Enable set validation
dnl

AH_TEMPLATE([ENABLE_SET_VALIDATION], [Define to 1 to enable set validation])

AC_ARG_ENABLE(
    set-validation,
    AC_HELP_STRING([--enable-set-validation], [Enable set validation [[default=no]]]),
    [
        if test x$enableval = xyes ; then
            AC_DEFINE([ENABLE_SET_VALIDATION], [1],)
        fi
    ],
)

AC_OUTPUT(
    Makefile
    src/Makefile
    filters/Makefile
    tools/Makefile
    lib/Makefile
    man/Makefile
    tests/lib/EPSILON/Makefile
    tests/lib/Test/PBM/Makefile
    tests/lib/Test/Makefile
    tests/lib/Makefile
    tests/t/Makefile
    tests/Makefile
    tests/build/Makefile
    tests/images/Makefile
)

dnl
dnl Output current VERSION into separate header file.
dnl This is a workaround for platforms that have no
dnl autotools support.
dnl

echo "#define VERSION \"$VERSION\"" > src/epsilon_version.h