File: 10_mpi-pkg-config.patch

package info (click to toggle)
valgrind 1%3A3.25.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 180,392 kB
  • sloc: ansic: 827,945; exp: 26,134; xml: 23,776; asm: 14,769; cpp: 9,431; makefile: 7,680; sh: 6,687; perl: 5,451; python: 1,498; javascript: 981; awk: 166; csh: 1
file content (91 lines) | stat: -rw-r--r-- 2,610 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
Description: Use pkg-config to detect MPI
Origin: vendor
Bug-Debian: http://bugs.debian.org/902297
Author: Helmut Grohne <helmut@subdivi.de>
Last-Update: 2018-11-14

--- a/configure.ac
+++ b/configure.ac
@@ -4506,6 +4506,14 @@
            [CFLAGS_MPI="-g -O -fno-omit-frame-pointer -Wall -fpic"
             LDFLAGS_MPI="-fpic -shared"])
 
+PKG_CHECK_MODULES([MPI_C],[mpi-c],[
+	CFLAGS_MPI="$CFLAGS_MPI $MPI_C_CFLAGS"
+	LDFLAGS_MPI="$LDFLAGS_MPI $MPI_C_LIBS"
+],[
+   	CFLAGS_MPI="$CFLAGS_MPI `$MPI_CC -showme:compile`"
+	LDFLAGS_MPI="$LDFLAGS_MPI `$MPI_CC -showme:link`"
+])
+
 AC_SUBST([CFLAGS_MPI])
 AC_SUBST([LDFLAGS_MPI])
 
@@ -4513,9 +4521,7 @@
 ## See if MPI_CC works for the primary target
 ##
 AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
-saved_CC=$CC
 saved_CFLAGS=$CFLAGS
-CC=$MPI_CC
 CFLAGS="$CFLAGS_MPI $mflag_primary"
 saved_LDFLAGS="$LDFLAGS"
 LDFLAGS="$LDFLAGS_MPI $mflag_primary"
@@ -4535,27 +4541,23 @@
 ac_have_mpi2_pri=no
 AC_MSG_RESULT([no])
 ])
-CC=$saved_CC
 CFLAGS=$saved_CFLAGS
 LDFLAGS="$saved_LDFLAGS"
 AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
 
 ## See if MPI_CC works for the secondary target.  Complication: what if
 ## there is no secondary target?  We need this to then fail.
-## Kludge this by making MPI_CC something which will surely fail in
+## Kludge this by making CFLAGS something which will surely fail in
 ## such a case.
 ##
 AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
-saved_CC=$CC
 saved_CFLAGS=$CFLAGS
 saved_LDFLAGS="$LDFLAGS"
 LDFLAGS="$LDFLAGS_MPI $mflag_secondary"
+CFLAGS="$CFLAGS_MPI $mflag_secondary"
 if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
-  CC="$MPI_CC this will surely fail"
-else
-  CC=$MPI_CC
+  CFLAGS="this will surely fail"
 fi
-CFLAGS="$CFLAGS_MPI $mflag_secondary"
 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
 #include <mpi.h>
 #include <stdio.h>
@@ -4572,7 +4574,6 @@
 ac_have_mpi2_sec=no
 AC_MSG_RESULT([no])
 ])
-CC=$saved_CC
 CFLAGS=$saved_CFLAGS
 LDFLAGS="$saved_LDFLAGS"
 AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
--- a/mpi/Makefile.am
+++ b/mpi/Makefile.am
@@ -1,16 +1,5 @@
 include $(top_srcdir)/Makefile.all.am
 
-# HACK WARNING: automake isn't good at supporting non-$(CC) compilers.
-# But we need to use $(MPI_CC) for the MPI stuff.  So we have this mpi stuff
-# in its own directory so we can use the following blunt instruments, which
-# override the C compiler and all the default flags.
-CC = $(MPI_CC)
-DEFS =
-DEFAULT_INCLUDES =
-CPPFLAGS =
-CFLAGS =
-LDFLAGS =
-
 EXTRA_DIST = \
 	mpiwrap_type_test.c