Skip to content

Commit fc6328f

Browse files
committed
build: Improve handling of compiler version string
Stop saving the build compiler name and version string during configure and move that detection to build time. Expanding out the version string in particular was causing escaping issues that will not exist when the string is only expanded at use. We need to check the compiler id and version integers during configure, so that we can define them in mpi.h to compare against the running compiler at application (not OMPI) build time, but the strings were not being used in those situations. Signed-off-by: Brian Barrett <bbarrett@amazon.com>
1 parent 0811c16 commit fc6328f

File tree

3 files changed

+5
-68
lines changed

3 files changed

+5
-68
lines changed

config/opal_check_compiler_version.m4

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ dnl
2222
AC_DEFUN([OPAL_CHECK_COMPILER_VERSION_ID],
2323
[
2424
OPAL_CHECK_COMPILER(FAMILYID)
25-
OPAL_CHECK_COMPILER_STRINGIFY(FAMILYNAME)
2625
OPAL_CHECK_COMPILER(VERSION)
27-
OPAL_CHECK_COMPILER_STRING(VERSION_STR)
2826
])dnl
2927

3028

@@ -57,64 +55,3 @@ AC_DEFUN([OPAL_CHECK_COMPILER], [
5755
AC_DEFINE_UNQUOTED([OPAL_BUILD_PLATFORM_COMPILER_$1], [$opal_cv_compiler_$1],
5856
[The compiler $lower which OMPI was built with])
5957
])dnl
60-
61-
AC_DEFUN([OPAL_CHECK_COMPILER_STRING], [
62-
AS_LITERAL_IF([$1], [],
63-
[m4_fatal([OPAL_CHECK_COMPILER_STRING argument must be a literal])])
64-
lower=m4_tolower([$1])
65-
AC_CACHE_CHECK([for compiler $lower], [opal_cv_compiler_$1],
66-
[
67-
CPPFLAGS_orig=$CPPFLAGS
68-
CPPFLAGS="-I${OPAL_TOP_SRCDIR}/opal/include $CPPFLAGS"
69-
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
70-
#include <stdio.h>
71-
#include <stdlib.h>
72-
#include "opal/opal_portable_platform.h"
73-
]],[[
74-
FILE * f;
75-
f=fopen("conftestval", "w");
76-
if (!f) exit(1);
77-
fprintf (f, "%s", PLATFORM_COMPILER_$1);
78-
]])], [
79-
opal_cv_compiler_$1=`cat conftestval`
80-
], [
81-
opal_cv_compiler_$1=UNKNOWN
82-
], [
83-
opal_cv_compiler_$1=UNKNOWN
84-
])
85-
CPPFLAGS=$CPPFLAGS_orig
86-
])
87-
AC_DEFINE_UNQUOTED([OPAL_BUILD_PLATFORM_COMPILER_$1], [$opal_cv_compiler_$1],
88-
[The compiler $lower which OMPI was built with])
89-
])dnl
90-
91-
92-
AC_DEFUN([OPAL_CHECK_COMPILER_STRINGIFY], [
93-
AS_LITERAL_IF([$1], [],
94-
[m4_fatal([OPAL_CHECK_COMPILER_STRINGIFY argument must be a literal])])
95-
lower=m4_tolower([$1])
96-
AC_CACHE_CHECK([for compiler $lower], [opal_cv_compiler_$1],
97-
[
98-
CPPFLAGS_orig=$CPPFLAGS
99-
CPPFLAGS="-I${OPAL_TOP_SRCDIR}/opal/include $CPPFLAGS"
100-
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
101-
#include <stdio.h>
102-
#include <stdlib.h>
103-
#include "opal/opal_portable_platform.h"
104-
]],[[
105-
FILE * f;
106-
f=fopen("conftestval", "w");
107-
if (!f) exit(1);
108-
fprintf (f, "%s", PLATFORM_STRINGIFY(PLATFORM_COMPILER_$1));
109-
]])], [
110-
opal_cv_compiler_$1=`cat conftestval`
111-
], [
112-
opal_cv_compiler_$1=UNKNOWN
113-
], [
114-
opal_cv_compiler_$1=UNKNOWN
115-
])
116-
CPPFLAGS=$CPPFLAGS_orig
117-
])
118-
AC_DEFINE_UNQUOTED([OPAL_BUILD_PLATFORM_COMPILER_$1], [$opal_cv_compiler_$1],
119-
[The compiler $lower which OMPI was built with])
120-
])dnl

ompi/tools/ompi_info/param.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@
4040

4141
#include MCA_timer_IMPLEMENTATION_HEADER
4242
#include "opal/include/opal/version.h"
43+
#include "opal/opal_portable_platform.h"
4344
#include "opal/class/opal_value_array.h"
4445
#include "opal/class/opal_pointer_array.h"
4546
#include "opal/util/printf.h"
4647
#include "opal/memoryhooks/memory.h"
4748
#include "opal/runtime/opal_info_support.h"
4849

4950
#include "ompi/tools/ompi_info/ompi_info.h"
50-
#include "ompi/include/mpi_portable_platform.h"
5151

5252

5353
const char *ompi_info_deprecated_value = "deprecated-ompi-info-value";
@@ -336,9 +336,9 @@ void ompi_info_do_config(bool want_all)
336336
opal_info_out("C compiler absolute", "compiler:c:absolute",
337337
OPAL_CC_ABSOLUTE);
338338
opal_info_out("C compiler family name", "compiler:c:familyname",
339-
PLATFORM_STRINGIFY(OPAL_BUILD_PLATFORM_COMPILER_FAMILYNAME));
339+
PLATFORM_STRINGIFY(PLATFORM_COMPILER_FAMILYNAME));
340340
opal_info_out("C compiler version", "compiler:c:version",
341-
PLATFORM_STRINGIFY(OPAL_BUILD_PLATFORM_COMPILER_VERSION_STR));
341+
PLATFORM_COMPILER_VERSION_STR);
342342

343343
if (want_all) {
344344
opal_info_out_int("C char size", "compiler:c:sizeof:char", sizeof(char));

oshmem/tools/oshmem_info/param.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ void oshmem_info_do_config(bool want_all)
147147
opal_info_out("C compiler absolute", "compiler:c:absolute",
148148
OPAL_CC_ABSOLUTE);
149149
opal_info_out("C compiler family name", "compiler:c:familyname",
150-
PLATFORM_STRINGIFY(OPAL_BUILD_PLATFORM_COMPILER_FAMILYNAME));
150+
PLATFORM_STRINGIFY(PLATFORM_COMPILER_FAMILYNAME));
151151
opal_info_out("C compiler version", "compiler:c:version",
152-
PLATFORM_STRINGIFY(OPAL_BUILD_PLATFORM_COMPILER_VERSION_STR));
152+
PLATFORM_COMPILER_VERSION_STR);
153153

154154
if (want_all) {
155155
opal_info_out_int("C char size", "compiler:c:sizeof:char", sizeof(char));

0 commit comments

Comments
 (0)