-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathconfigure.ac
337 lines (288 loc) · 10.3 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
#
# Copyright (c) 2013-2024 Triad National Security, LLC
# All rights reserved.
#
# This file is part of the libquo project. See the LICENSE file at the
# top-level directory of this distribution.
#
AC_PREREQ([2.71])
AC_INIT([libquo],
[1.4.1-devel],
[libquo],
[https://lanl.github.io/libquo])
AC_CONFIG_MACRO_DIR([config])
AC_CONFIG_SRCDIR([src])
AX_QUO_LIBTOOL_VERSION
################################################################################
# AC_CANONICAL_*
################################################################################
# for hwloc - must be in between AC_INIT and AM_INIT_AUTOMAKE
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
################################################################################
# Automake things
################################################################################
# note: -Wall -Werror are automake options. they are NOT compiler flags
AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign])
# Build using AM_SILENT_RULES
AM_SILENT_RULES([yes])
AC_CONFIG_HEADERS([config.h])
################################################################################
# C Language
################################################################################
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
AC_PROG_CC_C_O
AM_PROG_CC_C_O
AC_PROG_CPP
AX_PROG_MPICC
AS_IF([test "x$AX_PROG_MPICC_HAVE_MPICC" != "x1"],dnl
[AC_MSG_ERROR(
[*** CC cannot compile MPI apps. set CC to something that can \
or set CPPFLAGS and LDFLAGS appropriately. ***])])
################################################################################
# Fortran Language Support
################################################################################
AC_PROG_FC
AC_PROG_FC_C_O
AX_PROG_MPIFC
# determine whether or not we have a fortran wrapper compiler that can deal with
# mpi apps. if not disable fortran support.
AS_IF([test "x$AX_PROG_MPIFC_HAVE_MPIFC" != "x1"],dnl
[AC_MSG_WARN(
[*** FC cannot compile MPI apps. set FC to something that can \
or set FCFLAGS and LDFLAGS appropriately. ***])])
AM_CONDITIONAL(QUO_WITH_MPIFC, test "x$AX_PROG_MPIFC_HAVE_MPIFC" = "x1")
################################################################################
# Libtool things
################################################################################
AM_PROG_AR
LT_PREREQ([2.4.2])
LT_INIT
################################################################################
# C++ Language Support
################################################################################
# Delay this bit until now. There is some weird libtool linker interaction that
# I don't understand that is causing some link-time errors in our distro. This
# ordering seems to "fix" things, but I still don't understand why...
AC_PROG_CXX
AC_PROG_CXXCPP
AC_PROG_CXX_C_O
AX_PROG_MPICXX
# determine whether or not we have a C++ wrapper compiler that can deal with
# mpi apps. if not disable C++ support.
AS_IF([test "x$AX_PROG_MPICXX_HAVE_MPICXX" != "x1"],dnl
[AC_MSG_WARN(
[*** CXX cannot compile MPI apps. set CXX to something that can \
or set CPPFLAGS and LDFLAGS appropriately. ***])])
AM_CONDITIONAL(QUO_WITH_MPICXX, test "x$AX_PROG_MPICXX_HAVE_MPICXX" = "x1")
################################################################################
# Cross-process memory (xpm) support
################################################################################
AX_PKG_QUO_XPM
AM_CONDITIONAL(QUO_WITH_XPM, test "x$AX_PKG_QUO_XPM_HAVE_XPM" = "x1")
# checks for header files.
AC_CHECK_HEADERS([\
inttypes.h limits.h stdint.h stdlib.h string.h unistd.h stdbool.h time.h \
getopt.h ctype.h netdb.h sys/socket.h netinet/in.h arpa/inet.h sys/types.h \
stddef.h assert.h pthread.h sys/mman.h sys/stat.h fcntl.h syscall.h omp.h \
sched.h strings.h stdio.h errno.h math.h
])
# checks for typedefs, structures, and compiler characteristics.
AC_TYPE_PID_T
AC_TYPE_SIZE_T
# checks for library functions.
AC_CHECK_FUNCS([memset strerror strtoul mmap])
dnl check for sizeof(uintptr_t) for the Fortran interface.
dnl This sets the size of QUO_IKIND in the quof.h header that is generated.
dnl AC_COMPUTE_INT(quo_sizeof_voidptr, [sizeof(void *)])
dnl AC_SUBST(QUO_IKIND_VAL, $quo_sizeof_voidptr)
################################################################################
# pthreads stuff
################################################################################
AX_PTHREAD([], AC_MSG_ERROR([*** pthread configure failure. ***]))
# TODO
#AC_SUBST(QUO_PTHREAD_CFLAGS, $PTHREAD_CFLAGS)
#AC_SUBST(QUO_PTHREAD_LIBS, $PTHREAD_LIBS)
# Check for pthread_barrier_init. Error out if not found.
AC_SEARCH_LIBS([pthread_barrier_init], [pthread],
[],
[AC_MSG_ERROR([pthread_barrier_init() required but not found.])])
################################################################################
# OpenMP configury
################################################################################
AX_OPENMP([HAVE_OPENMP=1], [])
if test "x$HAVE_OPENMP" = "x"; then
AC_MSG_WARN([No OpenMP support. Continuing without OpenMP examples.])
else
AC_MSG_NOTICE([OpenMP support detected... Building OpenMP examples.])
AC_SUBST([OPENMP_CFLAGS])
AC_SUBST([OPENMP_CXXFLAGS])
AC_SUBST([OPENMP_FFLAGS])
fi
AM_CONDITIONAL([QUO_HAVE_OPENMP_SUPPORT],
[test "x$HAVE_OPENMP" != "x"])
################################################################################
# hwloc stuff
################################################################################
# Set some hwloc configure options
hwloc_mode=embedded
# Use hwloc's internal XML support.
enable_libxml2=no
# Disable hwloc's plugin system.
enable_plugins=no
# These are for hwloc2 only, so save now to restore later.
save_enable_static=$enable_static
save_enable_shared=$enable_shared
enable_static=yes
enable_shared=no
# Disable more things we don't need.
enable_cairo=no
enable_gl=no
enable_opencl=no
enable_cuda=no
enable_nvml=no
enable_pci=no
enable_libudev=no
enable_rocm=no
enable_rsmi=no
HWLOC_SET_SYMBOL_PREFIX(quo_internal_)
HWLOC_SETUP_CORE([src/hwloc],
[],
[AC_MSG_ERROR([*** hwloc configure failure. ***])],
[1])
HWLOC_DO_AM_CONDITIONALS
CPPFLAGS="$HWLOC_EMBEDDED_CPPFLAGS $CPPFLAGS"
LIBS="$HWLOC_EMBEDDED_LIBS $LIBS"
enable_static=$save_enable_static
enable_shared=$save_enable_shared
################################################################################
# For docs target support
################################################################################
AC_CHECK_PROGS([DOXYGEN], [doxygen])
if test "x$DOXYGEN" = "x"; then
AC_MSG_WARN([Doxygen not found. Continuing without Doxygen support])
fi
AM_CONDITIONAL([QUO_HAVE_DOXYGEN_DOCS_SUPPORT],
[test "x$DOXYGEN" != "x"])
################################################################################
# For package info (quo-info)
################################################################################
QUO_WHICH_CC=`which \`echo "$CC" | tr -s ' ' | cut -f1 -d' '\``
QUO_WHICH_FC=`which \`echo "$FC" | tr -s ' ' | cut -f1 -d' '\``
if test "x$QUO_WHICH_FC" = x; then
QUO_WHICH_FC="none"
fi
AC_ARG_VAR(USER,
[ Username used in build info (Default: `id -u -n` output)])
if test "x$USER" = x; then
USER=`id -u -n`
fi
AC_ARG_VAR(HOSTNAME,
[ Hostname used in build info (Default: `hostname` output)])
if test "x$HOSTNAME" = x; then
HOSTNAME=`hostname`
fi
AC_ARG_VAR(DATE,
[ Date used in build info (Default: `date` output)])
if test "x$DATE" = x; then
DATE=`date`
fi
AC_SUBST([CC])
AC_SUBST([QUO_WHICH_CC])
AC_SUBST([CFLAGS])
AC_SUBST([CPPFLAGS])
AC_SUBST([CXXFLAGS])
AC_SUBST([CXXCPPFLAGS])
AC_SUBST([FC])
AC_SUBST([QUO_WHICH_FC])
AC_SUBST([USER])
AC_SUBST([HOSTNAME])
AC_SUBST([DATE])
AC_SUBST([FFLAGS])
AC_SUBST([FCFLAGS])
AC_SUBST([LDFLAGS])
AC_SUBST([LIBS])
AC_CONFIG_FILES([Makefile
src/Makefile
src/fortran/Makefile
src/tools/Makefile
src/xpm/Makefile
tests/Makefile
tests/scripts/Makefile
demos/Makefile
demos/mpi-openmp/Makefile
pkgconfig/Makefile
pkgconfig/libquo.pc
docs/Makefile
docs/doxyfile])
AC_OUTPUT
# let the user know the configuration
cat << EOF
+-------------------------------------------------------------------------------
| libquo Configuration :::::::::::::::::::::::::::::::::::::::::::::::::::::::
+-------------------------------------------------------------------------------
| version : ${VERSION}
| target : ${target}
| CC : ${CC}
| CFLAGS : ${CFLAGS}
| CPP : ${CPP}
| CPPFLAGS : ${CPPFLAGS}
| LDFLAGS : ${LDFLAGS}
| LIBS : ${LIBS}
+-------------------------------------------------------------------------------
| C++ Support Configuration ::::::::::::::::::::::::::::::::::::::::::::::::::
+-------------------------------------------------------------------------------
EOF
if test "x$AX_PROG_MPICXX_HAVE_MPICXX" = "x1"; then
cat << EOF
| CXX : ${CXX}
| CXXFLAGS : ${CXXFLAGS}
EOF
else
cat << EOF
| Not Enabled
EOF
fi
cat << EOF
+-------------------------------------------------------------------------------
| Fortran Support Configuration ::::::::::::::::::::::::::::::::::::::::::::::
+-------------------------------------------------------------------------------
EOF
if test "x$AX_PROG_MPIFC_HAVE_MPIFC" = "x1"; then
cat << EOF
| FC : ${FC}
| FCFLAGS : ${FCFLAGS}
| FCLIBS : ${FCLIBS}
EOF
else
cat << EOF
| Not Enabled
EOF
fi
cat << EOF
+-------------------------------------------------------------------------------
| Other Configury ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+-------------------------------------------------------------------------------
EOF
# Doxygen configury.
printf "| Doxygen docs Target Available: %s\n" \
$( test "x$DOXYGEN" = "x" && printf "no" || printf "yes" )
printf "|\n"
# OpenMP configury.
printf "| Build OpenMP Examples: "
if test "x$HAVE_OPENMP" = "x"; then
printf "no\n"
else
printf "yes\n"
cat << EOF
| OPENMP_CFLAGS : $OPENMP_CFLAGS
| OPENMP_CXXFLAGS: $OPENMP_CXXFLAGS
| OPENMP_FFLAGS : $OPENMP_FFLAGS
EOF
fi
cat << EOF
+-------------------------------------------------------------------------------
EOF