blob: 21bf8853a2ea86a3c5ee4b9eb53ffad979e18fec [file] [log] [blame] [raw]
# -*- shell-script -*-
#
# Copyright © 2009 CNRS
# Copyright © 2009-2010 INRIA. All rights reserved.
# Copyright © 2009, 2011 Université Bordeaux 1
# Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
#
# See COPYING in top-level directory.
#
# Additional copyrights may follow
#
# $HEADER$
#
AC_INIT([hwloc],
[m4_normalize(esyscmd([config/hwloc_get_version.sh VERSION --base]))],
[http://www.open-mpi.org/community/help/], [hwloc])
AC_PREREQ(2.63)
AC_CONFIG_AUX_DIR(./config)
# Note that this directory must *exactly* match what was specified via
# -I in ACLOCAL_AMFLAGS in the top-level Makefile.am.
AC_CONFIG_MACRO_DIR(./config)
cat <<EOF
###
### Configuring hwloc distribution tarball
### Startup tests
###
EOF
# This must be before AM_INIT_AUTOMAKE
AC_CANONICAL_TARGET
# Init automake
AM_INIT_AUTOMAKE([1.10 dist-bzip2 subdir-objects foreign tar-ustar -Wall -Werror])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# We want new Libtool. None of that old stuff. Pfft.
m4_ifdef([LT_PREREQ], [],
[m4_fatal([libtool version 2.2.6 or higher is required], [63])])
LT_PREREQ([2.2.6])
AC_LANG([C])
# Make configure depend on the VERSION file, since it's used in AC_INIT
AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/VERSION'])
# Get the version of hwloc that we are installing
AC_MSG_CHECKING([for hwloc version])
HWLOC_VERSION="`$srcdir/config/hwloc_get_version.sh $srcdir/VERSION`"
HWLOC_MAJOR_VERSION="`$srcdir/config/hwloc_get_version.sh $srcdir/VERSION --major`"
HWLOC_MINOR_VERSION="`$srcdir/config/hwloc_get_version.sh $srcdir/VERSION --minor`"
HWLOC_RELEASE_VERSION="`$srcdir/config/hwloc_get_version.sh $srcdir/VERSION --release`"
HWLOC_REPO_REV="`$srcdir/config/hwloc_get_version.sh $srcdir/VERSION --repo-rev`"
HWLOC_RELEASE_DATE="`$srcdir/config/hwloc_get_version.sh $srcdir/VERSION --release-date`"
AC_SUBST(HWLOC_VERSION)
AC_SUBST(HWLOC_SVN_R)
AC_SUBST(HWLOC_RELEASE_DATE)
AC_DEFINE_UNQUOTED([HWLOC_MAJOR_VERSION], [$HWLOC_MAJOR_VERSION],
[Major version of hwloc])
AC_DEFINE_UNQUOTED([HWLOC_MINOR_VERSION], [$HWLOC_MINOR_VERSION],
[Minor version of hwloc])
AC_DEFINE_UNQUOTED([HWLOC_RELEASE_VERSION], [$HWLOC_RELEASE_VERSION],
[Release version of hwloc])
AC_MSG_RESULT([$HWLOC_VERSION])
# Override/fixup the version numbers set by AC_INIT, since on
# developer builds, there's no good way to know what the version is
# before running configure :(. We only use the base version number
# (ie, no svn r numbers) for the version set in AC_INIT. This will
# always match reality because we add the VERSION file (the only way
# to change the major.minor.release{greek}) into the configure
# dependencies.
PACKAGE_VERSION="$HWLOC_VERSION"
PACKAGE_STRING="${PACKAGE_NAME} ${PACKAGE_VERSION}"
VERSION="${PACKAGE_VERSION}"
# For standalone configurations, we also include a .so version number.
. $srcdir/VERSION
AC_SUBST([libhwloc_so_version])
# Setup the header file
AH_TOP([/* -*- c -*-
*
* Copyright © 2009 CNRS, INRIA., Université Bordeaux 1 All rights reserved.
* Copyright © 2009 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* This file is automatically generated by configure. Edits will be lost
* the next time you run configure!
*/
#ifndef HWLOC_CONFIGURE_H
#define HWLOC_CONFIGURE_H
])
AH_BOTTOM([
#endif /* HWLOC_CONFIGURE_H */
])
# Setup C compiler
CFLAGS_save="$CFLAGS"
AC_PROG_CC
AM_PROG_CC_C_O
CFLAGS="$CFLAGS_save"
# Define hwloc's configure arguments
HWLOC_DEFINE_ARGS
# If debug mode, add -g
AS_IF([test "$hwloc_debug" = "1"],
[CFLAGS="$CFLAGS -g"])
# If the user didn't specifically ask for embedding mode, default to
# standalone mode
AS_IF([test "$enable_embedded_mode" != "yes"],
[AS_IF([test ! -d "$srcdir/doc"],
[AC_MSG_WARN([The hwloc source tree looks incomplete for a standalone])
AC_MSG_WARN([build. Perhaps this hwloc tree is intended for an embedded])
AC_MSG_WARN([build? Try using the --enable-embedded-mode switch.])
AC_MSG_ERROR([Cannot build standalone hwloc])],
[HWLOC_BUILD_STANDALONE])])
# Setup the hwloc core
HWLOC_SETUP_CORE([], [], [AC_MSG_ERROR([Cannot build hwloc core])], [1])
# Setup hwloc's docs, utils, and tests
AS_IF([test "$hwloc_mode" = "standalone"],
[HWLOC_SETUP_DOCS
HWLOC_SETUP_UTILS
HWLOC_SETUP_TESTS])
# Run the AM_CONDITIONALs
HWLOC_DO_AM_CONDITIONALS
# Set the final flags
CFLAGS="$HWLOC_EMBEDDED_CFLAGS $CFLAGS"
CPPFLAGS="$HWLOC_EMBEDDED_CPPFLAGS $CPPFLAGS"
LIBS="$HWLOC_EMBEDDED_LIBS $LIBS"
# Setup libtool, but disable C++, F77, Java and Windows Resource
# Compiler support -- we don't need that stuff.
AM_ENABLE_SHARED
AM_DISABLE_STATIC
AM_PROG_LIBTOOL([win32-dll])
LT_LANG([C])
# Party on
AC_OUTPUT