forked from jjhursey/mpir-to-pmix-guide
-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
507 lines (405 loc) · 15.1 KB
/
configure.ac
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
# -*- shell-script -*-
#
# Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2018 The University of Tennessee and The University
# of Tennessee Research Foundation. All rights
# reserved.
# Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2006-2019 Cisco Systems, Inc. All rights reserved
# Copyright (c) 2006-2008 Sun Microsystems, Inc. All rights reserved.
# Copyright (c) 2006-2017 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
# Copyright (c) 2011-2013 NVIDIA Corporation. All rights reserved.
# Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013 Mellanox Technologies, Inc.
# All rights reserved.
# Copyright (c) 2013-2020 Intel, Inc. All rights reserved.
# Copyright (c) 2014-2020 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016-2020 IBM Corporation. All rights reserved.
# Copyright (c) 2018 Amazon.com, Inc. or its affiliates.
# All Rights reserved.
# Copyright (c) 2018 FUJITSU LIMITED. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
############################################################################
# Initialization, version number, and other random setup/init stuff
############################################################################
# Load the version number code
m4_include([config/mpirshim_get_version.m4])
AC_LANG([C])
# Init autoconf
# We don't have the version number to put in here yet, and we can't
# call MPIRSHIM_GET_VERSION (etc.) before AC_INIT. So use the shell
# version
AC_INIT([mpir-shim],
[m4_normalize(esyscmd([config/mpirshim_get_version.sh VERSION --tarball]))],
[https://github.com/openpmix/mpir-shim/issues], [mpirshim])
AC_PREREQ(2.60)
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(./config)
#
# Start it up
#
MPIRSHIM_CONFIGURE_SETUP
mpirshim_show_title "Configuring MPIR-SHIM"
#
# Setup some things that must be done before AM-INIT-AUTOMAKE
#
mpirshim_show_subtitle "Startup tests"
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AC_DEFINE_UNQUOTED(MPIRSHIM_ARCH, "$target", [MPIR-SHIM architecture string])
AS_IF([test "$host" != "$target"],
[AC_MSG_WARN([Cross-compile detected])
AC_MSG_WARN([Cross-compiling is only partially supported])
AC_MSG_WARN([Proceed at your own risk!])])
# AC_USE_SYSTEM_EXTENSIONS alters CFLAGS (e.g., adds -g -O2)
MPIRSHIM_VAR_SCOPE_PUSH([CFLAGS_save])
CFLAGS_save=$CFLAGS
AC_USE_SYSTEM_EXTENSIONS
# AC_USE_SYSTEM_EXTENSIONS will modify CFLAGS if nothing was in there
# beforehand. We don't want that. So if there was nothing in
# CFLAGS, put nothing back in there.
AS_IF([test -z "$CFLAGS_save"], [CFLAGS=])
MPIRSHIM_VAR_SCOPE_POP
#
# Init automake
#
AM_INIT_AUTOMAKE([foreign dist-bzip2 subdir-objects no-define 1.13.4 tar-ustar])
# SILENT_RULES is new in AM 1.11, but we require 1.11 or higher via
# autogen. Limited testing shows that calling SILENT_RULES directly
# works in more cases than adding "silent-rules" to INIT_AUTOMAKE
# (even though they're supposed to be identical). Shrug.
AM_SILENT_RULES([yes])
# Make configure depend on the VERSION file, since it's used in AC_INIT
AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/VERSION'])
mpirshim_show_subtitle "Checking versions"
# Get the version of MPIR-SHIM that we are installing
MPIRSHIM_SAVE_VERSION([mpirshim], [MPIR-SHIM], [$srcdir/VERSION],
[src/include/version.h])
# Get shared library version numbers
. $srcdir/VERSION
AC_SUBST(libmpirshim_so_version)
#
# Get the versions of the autotools that were used to bootstrap us
# (helpful for debugging reports)
#
AC_MSG_CHECKING([for bootstrap Autoconf version])
acversion=`grep "Generated by GNU Autoconf" $0 | head -n 1 | awk '{ print $6 }'`
AC_MSG_RESULT([$acversion])
AC_MSG_CHECKING([for bootstrap Automake version])
AC_MSG_RESULT([$am__api_version])
AC_MSG_CHECKING([for boostrap Libtool version])
ltversion=`grep VERSION= $srcdir/config/ltmain.sh | head -n 1 | cut -d= -f2`
AC_MSG_RESULT([$ltversion])
# List header files to generate
AC_CONFIG_HEADERS([src/include/mpirshim_config.h])
mpirshim_show_subtitle "Initialization, setup"
MPIRSHIM_TOP_BUILDDIR="`pwd`"
AC_SUBST(MPIRSHIM_TOP_BUILDDIR)
cd "$srcdir"
MPIRSHIM_TOP_SRCDIR="`pwd`"
AC_SUBST(MPIRSHIM_TOP_SRCDIR)
cd "$MPIRSHIM_TOP_BUILDDIR"
AC_MSG_NOTICE([builddir: $MPIRSHIM_TOP_BUILDDIR])
AC_MSG_NOTICE([srcdir: $MPIRSHIM_TOP_SRCDIR])
if test "$MPIRSHIM_TOP_BUILDDIR" != "$MPIRSHIM_TOP_SRCDIR"; then
AC_MSG_NOTICE([Detected VPATH build])
fi
# Setup the top of the src/include/mpirshim_config.h file
AH_TOP([/* -*- c -*-
*
* Copyright (c) 2020 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Perforce Software, Inc. All rights reserved.
*
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
* Function: - OS, CPU and compiler dependent configuration
*/
#ifndef MPIRSHIM_CONFIG_H
#define MPIRSHIM_CONFIG_H
#include "mpirshim_config_top.h"
])
AH_BOTTOM([
#include "mpirshim_config_bottom.h"
#endif /* MPIRSHIM_CONFIG_H */
])
# Other basic setup stuff
MPIRSHIM_BASIC_SETUP
############################################################################
# Configuration options
############################################################################
#
# Is this a developer copy?
#
if test -d .git; then
MPIRSHIM_DEVEL=1
else
MPIRSHIM_DEVEL=0
fi
#
# Developer picky compiler options
#
AC_MSG_CHECKING([if want developer-level compiler pickyness])
AC_ARG_ENABLE(picky,
AC_HELP_STRING([--enable-picky],
[enable developer-level compiler pickyness when building MPIR Shim (default: disabled, unless a .git directory is found in the build tree)]))
if test "$enable_picky" = "yes"; then
AC_MSG_RESULT([yes])
WANT_PICKY_COMPILER=1
else
AC_MSG_RESULT([no])
WANT_PICKY_COMPILER=0
fi
#################### Developer default override ####################
if test "$WANT_PICKY_COMPILER" = "0" && test -z "$enable_picky" && test "$MPIRSHIM_DEVEL" = 1; then
WANT_PICKY_COMPILER=1
echo "--> developer override: enable picky compiler by default"
fi
#################### Developer default override ####################
#
# Developer debugging
#
AC_MSG_CHECKING([if want developer-level debugging code])
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],
[enable developer-level debugging code (not for general MPI users!) (default: disabled)]))
if test "$enable_debug" = "yes" || test "$MPIRSHIM_DEVEL" = "1"; then
AC_MSG_RESULT([yes])
WANT_DEBUG=1
else
AC_MSG_RESULT([no])
WANT_DEBUG=0
fi
if test "$WANT_DEBUG" = "0"; then
CFLAGS="-DNDEBUG $CFLAGS"
CXXFLAGS="-DNDEBUG $CXXFLAGS"
else
CFLAGS="-DDEBUG -g $CFLAGS"
CXXFLAGS="-DDEBUG -g $CXXFLAGS"
fi
AC_DEFINE_UNQUOTED(MPIRSHIM_ENABLE_DEBUG, $WANT_DEBUG,
[Whether we want developer-level debugging code or not])
AC_ARG_ENABLE(debug-symbols,
AC_HELP_STRING([--disable-debug-symbols],
[Disable adding compiler flags to enable debugging symbols if --enable-debug is specified. For non-debugging builds, this flag has no effect.]))
MPIRSHIM_CHECK_OS_FLAVORS
MPIRSHIM_CHECK_PMIX
############################################################################
# Libtool: part one
# (before C compiler setup)
############################################################################
#
# Part one of libtool magic. Default to: enable shared, disable static.
#
AM_ENABLE_SHARED
#AM_ENABLE_STATIC
#AM_DISABLE_STATIC
############################################################################
# Check for compilers and preprocessors
############################################################################
mpirshim_show_title "Compiler and preprocessor tests"
##################################
# C compiler characteristics
##################################
MPIRSHIM_SETUP_CC
# Do all Interix detections if necessary
MPIRSHIM_INTERIX
# Does the compiler support "ident"-like constructs?
MPIRSHIM_CHECK_IDENT([CC], [CFLAGS], [c], [C])
#
# Check for some types
#
# 'short float' support of the Intel C++ Compiler (group of C and C++
# compilers), at least versions 18.0 and 19.0, is half-baked. It can
# compile declarations of 'short float' variables and expressions of
# 'sizeof(short float)' but cannot compile casts and operations of
# 'short float' variables. In this situation, 'AC_CHECK_TYPES(short float)'
# defines 'HAVE_SHORT_FLOAT' as 1 and compilation errors occur in
# ompi/mca/op/base/op_base_functions.c. To avoid this error, check it
# using 'AC_COMPILE_IFELSE' and set Autoconf cache variables before
# 'AC_CHECK_TYPES(short float)'. This check can be removed when all
# MPIRSHIM-supported Intel C++ Compilers support 'short float' completely
# (or drop it completely).
if test "$mpirshim_cv_c_compiler_vendor" = "intel"; then
AC_MSG_CHECKING([if Intel compiler supports "short float" properly])
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([float f(short float a, short float b) { return (float)(a + b); }])],
[AC_MSG_RESULT([yes])],
[ac_cv_type_short_float="no"
ac_cv_type_short_float__Complex="no"]
AC_MSG_RESULT([no]))
fi
AC_CHECK_TYPES(int8_t)
AC_CHECK_TYPES(uint8_t)
AC_CHECK_TYPES(int16_t)
AC_CHECK_TYPES(uint16_t)
AC_CHECK_TYPES(int32_t)
AC_CHECK_TYPES(uint32_t)
AC_CHECK_TYPES(int64_t)
AC_CHECK_TYPES(uint64_t)
AC_CHECK_TYPES(int128_t)
AC_CHECK_TYPES(__int128)
AC_CHECK_TYPES(uint128_t)
AC_CHECK_TYPES(long long)
AC_CHECK_TYPES(__float128)
AC_CHECK_TYPES(short float)
AC_CHECK_TYPES(long double)
AC_CHECK_HEADERS(complex.h)
AC_CHECK_TYPES(short float _Complex)
AC_CHECK_TYPES(float _Complex)
AC_CHECK_TYPES(double _Complex)
AC_CHECK_TYPES(long double _Complex)
AC_CHECK_TYPES(intptr_t)
AC_CHECK_TYPES(uintptr_t)
AC_CHECK_TYPES(mode_t)
AC_CHECK_TYPES(ssize_t)
AC_CHECK_TYPES(ptrdiff_t)
#
# Check for type sizes
#
AC_CHECK_SIZEOF(_Bool)
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
if test "$ac_cv_type_short_float" = yes; then
AC_CHECK_SIZEOF(short float)
fi
AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(long double)
if test "$ac_cv_type___float128" = yes; then
AC_CHECK_SIZEOF(__float128)
fi
if test "$ac_cv_type_short_float__Complex" = yes; then
AC_CHECK_SIZEOF(short float _Complex)
fi
AC_CHECK_SIZEOF(float _Complex)
AC_CHECK_SIZEOF(double _Complex)
AC_CHECK_SIZEOF(long double _Complex)
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(size_t)
if test "$ac_cv_type_ssize_t" = yes ; then
AC_CHECK_SIZEOF(ssize_t)
fi
if test "$ac_cv_type_ptrdiff_t" = yes; then
AC_CHECK_SIZEOF(ptrdiff_t)
else
AC_MSG_ERROR([ptrdiff_t type is not available, this is required by C99 standard. Cannot continue])
fi
AC_CHECK_SIZEOF(wchar_t)
AC_CHECK_SIZEOF(pid_t)
# Check for type alignments
#
MPIRSHIM_C_GET_ALIGNMENT(bool, MPIRSHIM_ALIGNMENT_BOOL)
MPIRSHIM_C_GET_ALIGNMENT(int8_t, MPIRSHIM_ALIGNMENT_INT8)
MPIRSHIM_C_GET_ALIGNMENT(int16_t, MPIRSHIM_ALIGNMENT_INT16)
MPIRSHIM_C_GET_ALIGNMENT(int32_t, MPIRSHIM_ALIGNMENT_INT32)
MPIRSHIM_C_GET_ALIGNMENT(int64_t, MPIRSHIM_ALIGNMENT_INT64)
if test "$ac_cv_type_int128_t" = yes ; then
MPIRSHIM_C_GET_ALIGNMENT(int128_t, MPIRSHIM_ALIGNMENT_INT128)
fi
MPIRSHIM_C_GET_ALIGNMENT(char, MPIRSHIM_ALIGNMENT_CHAR)
MPIRSHIM_C_GET_ALIGNMENT(short, MPIRSHIM_ALIGNMENT_SHORT)
MPIRSHIM_C_GET_ALIGNMENT(wchar_t, MPIRSHIM_ALIGNMENT_WCHAR)
MPIRSHIM_C_GET_ALIGNMENT(int, MPIRSHIM_ALIGNMENT_INT)
MPIRSHIM_C_GET_ALIGNMENT(long, MPIRSHIM_ALIGNMENT_LONG)
MPIRSHIM_C_GET_ALIGNMENT(long long, MPIRSHIM_ALIGNMENT_LONG_LONG)
if test "$ac_cv_type_short_float" = yes; then
MPIRSHIM_C_GET_ALIGNMENT(short float, MPIRSHIM_ALIGNMENT_SHORT_FLOAT)
fi
MPIRSHIM_C_GET_ALIGNMENT(float, MPIRSHIM_ALIGNMENT_FLOAT)
MPIRSHIM_C_GET_ALIGNMENT(double, MPIRSHIM_ALIGNMENT_DOUBLE)
MPIRSHIM_C_GET_ALIGNMENT(long double, MPIRSHIM_ALIGNMENT_LONG_DOUBLE)
if test "$ac_cv_type___float128" = yes; then
MPIRSHIM_C_GET_ALIGNMENT(__float128, MPIRSHIM_ALIGNMENT___FLOAT128)
fi
if test "$ac_cv_type_short_float__Complex" = yes; then
MPIRSHIM_C_GET_ALIGNMENT(short float _Complex, MPIRSHIM_ALIGNMENT_SHORT_FLOAT_COMPLEX)
fi
MPIRSHIM_C_GET_ALIGNMENT(float _Complex, MPIRSHIM_ALIGNMENT_FLOAT_COMPLEX)
MPIRSHIM_C_GET_ALIGNMENT(double _Complex, MPIRSHIM_ALIGNMENT_DOUBLE_COMPLEX)
MPIRSHIM_C_GET_ALIGNMENT(long double _Complex, MPIRSHIM_ALIGNMENT_LONG_DOUBLE_COMPLEX)
MPIRSHIM_C_GET_ALIGNMENT(void *, MPIRSHIM_ALIGNMENT_VOID_P)
MPIRSHIM_C_GET_ALIGNMENT(size_t, MPIRSHIM_ALIGNMENT_SIZE_T)
#
# Check for an alternate type of C 'short float'
#
MPIRSHIM_CHECK_ALT_SHORT_FLOAT
#
# Check for other compiler characteristics
#
if test "x$CC" = "xicc"; then
MPIRSHIM_CHECK_ICC_VARARGS
fi
# Check if we support the offsetof compiler directive
MPIRSHIM_CHECK_OFFSETOF
##################################
# C/C++ compiler characteristics
##################################
MPIRSHIM_SETUP_CXX
MPIRSHIM_CHECK_VISIBILITY
LT_INIT()
LT_LANG([C])
##################################
# Only after setting up both
# C and C++ check compiler attributes.
##################################
mpirshim_show_subtitle "Compiler characteristics"
MPIRSHIM_CHECK_ATTRIBUTES
MPIRSHIM_CHECK_COMPILER_VERSION_ID
############################################################################
# final compiler config
############################################################################
mpirshim_show_subtitle "Compiler flags"
#
# This is needed for VPATH builds, so that it will -I the appropriate
# include directory. We delayed doing it until now just so that
# '-I$(top_srcdir)' doesn't show up in any of the configure output --
# purely aesthetic.
#
# Because mpirshim_config.h is created by AC_CONFIG_HEADERS, we
# don't need to -I the builddir for src/include. However, we do
# need to add it for mpirshim as it doesn't have an AC_CONFIG_HEADERS that
# will install it for us. If we VPATH building, we do need to include the
# source directories, however.
#
if test "$MPIRSHIM_TOP_BUILDDIR" != "$MPIRSHIM_TOP_SRCDIR"; then
# Note the embedded m4 directives here -- we must embed them
# rather than have successive assignments to these shell
# variables, lest the $(foo) names try to get evaluated here.
# Yuck!
CPPFLAGS='-I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/src/include -I$(top_builddir)/src/include'" $CPPFLAGS"
else
CPPFLAGS='-I$(top_srcdir) -I$(top_srcdir)/src/include'" $CPPFLAGS"
fi
#
# Delayed the substitution of CFLAGS and CXXFLAGS until now because
# they may have been modified throughout the course of this script.
#
AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
AC_CONFIG_FILES([
Makefile
src/Makefile
test/Makefile
])
mpirshim_show_title "Configuration complete"
AC_OUTPUT