From 4482c8f39b366d63794a4fd1c9b000c94640229b Mon Sep 17 00:00:00 2001 From: Davi Reis Date: Sun, 15 May 2011 19:38:31 -0300 Subject: [PATCH] Conditional compilation of the cxxmph directory. --- Makefile.am | 4 ++-- acinclude.m4 | 8 ++++++++ configure.ac | 24 +++++++++++++++--------- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0569dc0..cdf1447 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ -SUBDIRS = src tests examples cxxmph man -EXTRA_DIST = cmph.spec configure.ac cmph.pc.in +SUBDIRS = src tests examples man $(CXXMPH) +EXTRA_DIST = cmph.spec configure.ac cmph.pc.in LGPL-2 MPL-1.1 pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = cmph.pc diff --git a/acinclude.m4 b/acinclude.m4 index f216360..b49a92b 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1,3 +1,11 @@ +AC_DEFUN([AC_ENABLE_CXXMPH], [AC_ARG_ENABLE([cxxmph], + [ --enable-cxxmph enable the c++ cxxmph library ], + [case "${enableval}" in + yes) cxxmph=true ;; + no) cxxmph=false ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-cxxmph]) ;; + esac],[cxxmph=false])]) + AC_DEFUN([AC_CHECK_SPOON], [ AC_ARG_WITH(spoon, [ --with-spoon=SPOON this is inocuous, since the truth is that there is no spoon ]) AC_MSG_CHECKING(if there is spoon) diff --git a/configure.ac b/configure.ac index 7f0e2a2..ae62410 100644 --- a/configure.ac +++ b/configure.ac @@ -1,16 +1,16 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(Makefile.am) +AC_INIT +AC_CONFIG_SRCDIR([Makefile.am]) AM_INIT_AUTOMAKE(cmph, 1.0) -AM_CONFIG_HEADER(config.h) +AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) dnl Checks for programs. AC_PROG_AWK AC_PROG_CC -AC_PROG_CXX AC_PROG_INSTALL AC_PROG_LN_S -AC_PROG_LIBTOOL +LT_INIT AC_SYS_EXTRA_LARGEFILE if test "x$ac_cv_sys_largefile_CFLAGS" = "xno" ; then ac_cv_sys_largefile_CFLAGS="" @@ -25,16 +25,22 @@ CFLAGS="$CFLAGS $ac_cv_sys_largefile_CFLAGS" LDFLAGS="$LDFLAGS $ac_cv_sys_largefile_LDFLAGS" LIBS="$LIBS $ac_cv_sys_largefile_LIBS" - dnl Checks for headers AC_CHECK_HEADERS([getopt.h math.h]) dnl Checks for libraries. -AC_CHECK_LIBM +LT_LIB_M LDFLAGS="$LIBM $LDFLAGS" -dnl Checks for library functions. +AC_PROG_CXX +AC_ENABLE_CXXMPH +if test x$cxxmph = xtrue; then + CXXFLAGS="$CXXFLAGS -std=c++0x" + AC_SUBST([CXXMPH], "cxxmph") +fi AC_CHECK_SPOON -dnl AC_OUTPUT(Makefile tests/Makefile samples/Makefile) -AC_OUTPUT(Makefile src/Makefile cxxmph/Makefile tests/Makefile examples/Makefile man/Makefile cmph.pc) +dnl AC_CONFIG_FILES([Makefile tests/Makefile samples/Makefile]) +AC_OUTPUT +AC_CONFIG_FILES([Makefile src/Makefile cxxmph/Makefile tests/Makefile examples/Makefile man/Makefile cmph.pc]) +AC_OUTPUT