From 4d78b79477633b919c1afd864f81c8b0d3e50f14 Mon Sep 17 00:00:00 2001 From: bangerth Date: Tue, 6 Jan 2009 20:09:36 +0000 Subject: [PATCH] Add the ability to do things like 'export CXX="g++ -pg" ; ./configure', i.e. pass a program PLUS arguments through CXX. git-svn-id: https://svn.dealii.org/trunk@18101 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/aclocal.m4 | 35 +++++++++++++++++++++++++++++++++-- deal.II/configure.in | 4 ++-- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index 0be5499666..6b0114f363 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -16,8 +16,7 @@ dnl $Id$ dnl ------------------------------------------------------------- -dnl Helper macro to add libpaths to LIBS -dnl +dnl Helper macros to add libpaths to LIBS dnl dnl ------------------------------------------------------------- AC_DEFUN(DEAL_II_ADD_EXTERNAL_LIBS_AT_TAIL, dnl @@ -37,6 +36,38 @@ AC_DEFUN(DEAL_II_EXTERNAL_LIBS_RESTORE_VAL, dnl LIBS="$OLD_LIBS" ]) + + +dnl ------------------------------------------------------------- +dnl Like AC_PATH_PROG, but do not discard arguments given to the +dnl program. In other words, while +dnl AC_PATH_PROG(CXX, [g++ -pg]) +dnl results in CXX=/usr/bin/g++, the result of the current +dnl macro would be CXX="/usr/bin/g++ -pg". +dnl ------------------------------------------------------------- +AC_DEFUN(DEAL_II_PATH_PROG, dnl +[ + dnl First get at the name and arguments of the program in $2. Do + dnl so by having a loop over all components of $2 and putting the + dnl components either into $testprog or into $testargs + testprog="" + testargs="" + processingargs="no" + for i in $2 ; do + if test "$processingargs" = "no" ; then + testprog="$i" ; + processingargs="yes" ; + else + testargs="$testargs $i" ; + fi + done + + AC_PATH_PROG([$1],[$testprog]) + eval "$1=\"${$1} $testargs\"" +]) + + + dnl ------------------------------------------------------------- dnl Determine the C++ compiler in use. Return the name and possibly dnl version of this compiler in GXX_VERSION. diff --git a/deal.II/configure.in b/deal.II/configure.in index 3802d11f60..8e162ebc85 100644 --- a/deal.II/configure.in +++ b/deal.II/configure.in @@ -97,12 +97,12 @@ dnl the old value temporarily OLDCFLAGS="$CFLAGS" AC_PROG_CC CFLAGS="$OLDCFLAGS" -AC_PATH_PROG(CC,$CC) +DEAL_II_PATH_PROG(CC,$CC) OLDCXXFLAGS="$CXXFLAGS" AC_PROG_CXX CXXFLAGS="$OLDCXXFLAGS" -AC_PATH_PROG(CXX,$CXX) +DEAL_II_PATH_PROG(CXX,$CXX) dnl Next determine which C++ compiler we have here and set compilation dnl flags accordingly. Note that for historical reasons the name and -- 2.39.5