From 8c8d71fed7b3532683e8b036621193e82d7476b9 Mon Sep 17 00:00:00 2001
From: Jorrit Fahlke <joe@dune-project.org>
Date: Tue, 19 Jan 2010 15:58:55 +0000
Subject: [PATCH] Move adding the MPI stuff to the ALL_PKG_* variables out of
 the DUNE_COMMON_CHECKS macro into the DUNE_MPI macro.

Also add the GL flags to the ALL_PKG_* variables.

[[Imported from SVN: r5839]]
---
 m4/dune_common.m4 | 1 -
 m4/dune_mpi.m4    | 5 +++++
 m4/opengl.m4      | 9 +++++++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/m4/dune_common.m4 b/m4/dune_common.m4
index d6e9ea3b0..7b73c716f 100644
--- a/m4/dune_common.m4
+++ b/m4/dune_common.m4
@@ -23,7 +23,6 @@ AC_DEFUN([DUNE_COMMON_CHECKS],
   AC_REQUIRE([DUNE_SET_MINIMAL_DEBUG_LEVEL])
   AC_REQUIRE([DUNE_PATH_XDR])
   AC_REQUIRE([DUNE_MPI])
-  DUNE_ADD_ALL_PKG([MPI], [$DUNEMPICPPFLAGS], [$DUNEMPILDFLAGS], [$DUNEMPILIBS])
   AC_REQUIRE([DUNE_EXPRTMPL])
   AC_REQUIRE([DUNE_DEV_MODE])
 
diff --git a/m4/dune_mpi.m4 b/m4/dune_mpi.m4
index 96128b6c0..47f5d6e3a 100644
--- a/m4/dune_mpi.m4
+++ b/m4/dune_mpi.m4
@@ -69,6 +69,9 @@ dnl -*- autoconf -*-
 #   dune_MPI_VERSION
 #   with_mpi ("no" if MPI is missing, "yes" followed by some more details if
 #             MPI is present)
+#   ALL_PKG_CPPFLAGS (adds its stuff here)
+#   ALL_PKG_LDFLAGS (adds its stuff here)
+#   ALL_PKG_LIBS (adds its stuff here)
 #
 # configure substitutions/Makefile variables
 #   MPICC
@@ -212,6 +215,8 @@ AC_DEFUN([DUNE_MPI],[
     [The MPI_CPPFLAGS configure substitute is deprecated.  Please change your Makefile.am to use DUNEMPICPPFLAGS instead.  Note that it is a good idea to change any occurance of MPI_LDFLAGS into DUNEMPILIBS and DUNEMPILDFLAGS as apropriate, since it is not possible to issue a deprecation warning in that case.])
   AC_SUBST(MPI_LDFLAGS)
 
+  DUNE_ADD_ALL_PKG([MPI], [$DUNEMPICPPFLAGS], [$DUNEMPILDFLAGS], [$DUNEMPILIBS])
+
   AM_CONDITIONAL(MPI, [test "x$with_mpi" != "xno"])
 
   DUNE_ADD_SUMMARY_ENTRY([MPI],[$with_mpi])
diff --git a/m4/opengl.m4 b/m4/opengl.m4
index 33ebac3c7..9c0134b23 100644
--- a/m4/opengl.m4
+++ b/m4/opengl.m4
@@ -1,6 +1,11 @@
+## -*- autoconf -*-
 # $Id$
 # searches for OpenGL-stuff
 
+# DUNE_PATH_OPENGL()
+#
+# Call AX_CHECK_OPENGL, but also add the discovered flags too the ALL_PKG_*
+# family and add a summary entry.  Also make sure that pthreads are supported.
 AC_DEFUN([DUNE_PATH_OPENGL],[
 dnl use test from autoconf-archive
   AC_REQUIRE([AX_CHECK_GL])
@@ -15,6 +20,10 @@ dnl use test from autoconf-archive
 
     # need pthreads-stuff in linker commandline as well
     AC_SUBST(GL_LDFLAGS, $PTHREAD_CFLAGS)
+    # GL_CFLAGS contain stuff like -pthread, which according to the gcc
+    # documentation is a flag for both the preprocessor and the linker.  So we
+    # add it to the preprocessor flags here.
+    DUNE_ADD_ALL_PKG([GL], [$GL_CFLAGS], [$GL_LDFLAGS], [$GL_LIBS])
   fi
 
   DUNE_ADD_SUMMARY_ENTRY([OpenGL],[$with_opengl])
-- 
GitLab