1dnl Copyright 1998-2019 Lawrence Livermore National Security, LLC and other
2dnl HYPRE Project Developers. See the top-level COPYRIGHT file for details.
3dnl
4dnl SPDX-License-Identifier: (Apache-2.0 OR MIT)
5
6dnl *********************************************************************
7dnl * File Name: configure.in
8dnl *
9dnl * This file is read when autoconf is run and the configure script is
10dnl * generated.
11dnl * Configure.in is structured as follows:
12dnl * initialization information
13dnl * determine the current architecture
14dnl * set user specified compilers and any other user specified options
15dnl *
16dnl * For the given the architecture, an optimal compiler is
17dnl * found (if not specified by the user). If the architecture is
18dnl * unknown or none of the preferred compilers are available then
19dnl * default compilers are found.
20dnl *
21dnl * For each chosen compiler, the appropriate flags are set for
22dnl * optimization, debugging, MPI and pthreading (as required) and the
23dnl * C preprocessor is checked.
24dnl *
25dnl * Finally, library flags are added and AC_SUBST is used to export
26dnl * all necessary macro values.
27dnl *********************************************************************
28
29dnl *********************************************************************
30dnl * NOTES:
31dnl *
32dnl * Several macros first check whether the compiler works, including:
33dnl * AC_CHECK_LIB, AC_CHECK_FUNC, AC_CHECK_FUNCS,
34dnl * AC_PROG_CC, AC_PROG_CPP, AC_PROG_CXX, AC_PROG_CXXCPP,
35dnl * AC_PROG_FC, AC_FC_WRAPPERS,
36dnl * AC_HYPRE_CHECK_MPI, AC_HYPRE_FIND_G2C,
37dnl * AC_HYPRE_FIND_BLAS, AC_HYPRE_FIND_LAPACK
38dnl *
39dnl * The following macros require a Fortran compiler and are protected
40dnl * below by checking the hypre_using_fortran variable:
41dnl * AC_PROG_FC, AC_FC_WRAPPERS,
42dnl * AC_HYPRE_FIND_BLAS, AC_HYPRE_FIND_LAPACK
43dnl *********************************************************************
44
45dnl *********************************************************************
46dnl * Initialization Information
47dnl * Set package information so it only has to be modified in one place
48dnl *********************************************************************
49
50m4_define([M4_HYPRE_NAME],    [hypre])
51m4_define([M4_HYPRE_VERSION], [2.23.0])
52m4_define([M4_HYPRE_NUMBER],  [22300])
53m4_define([M4_HYPRE_DATE],    [2021/10/01])
54m4_define([M4_HYPRE_TIME],    [00:00:00])
55m4_define([M4_HYPRE_BUGS],    [https://github.com/hypre-space/hypre/issues])
56m4_define([M4_HYPRE_SRCDIR],  [`pwd`])
57
58m4_include([config/hypre_blas_macros.m4])
59m4_include([config/hypre_lapack_macros.m4])
60m4_include([config/hypre_macros_misc.m4])
61
62AC_PREREQ(2.59)
63AC_REVISION($Id$)
64AC_INIT(M4_HYPRE_NAME, M4_HYPRE_VERSION)
65AC_CONFIG_HEADERS([HYPRE_config.h:config/HYPRE_config.h.in])
66AC_COPYRIGHT([Copyright 1998-2019 Lawrence Livermore National Security, LLC and other
67HYPRE Project Developers. See the top-level COPYRIGHT file for details.])
68
69AC_CONFIG_AUX_DIR(config)
70AC_CONFIG_SRCDIR([HYPRE.h])
71dnl m4_pattern_allow([AC_HYPRE_[A-Z_]+])
72
73dnl * Change default prefix from /usr/local to ./hypre
74dnl * Note that $ expansion of shell variables doesn't work with this AC macro.
75AC_PREFIX_DEFAULT([M4_HYPRE_SRCDIR/hypre])
76
77dnl *********************************************************************
78dnl * Initialize some variables
79dnl *
80dnl * For some reason, this type of variable initialization doesn't work
81dnl * if done before AC_INIT above.  To keep the release info at the top
82dnl * of the file, 'm4_define' is used to define m4 macros first.
83dnl *********************************************************************
84HYPRE_NAME="M4_HYPRE_NAME"
85HYPRE_VERSION="M4_HYPRE_VERSION"
86HYPRE_NUMBER=M4_HYPRE_NUMBER
87HYPRE_DATE="M4_HYPRE_DATE"
88HYPRE_TIME="M4_HYPRE_TIME"
89HYPRE_BUGS="M4_HYPRE_BUGS"
90HYPRE_SRCDIR="M4_HYPRE_SRCDIR"
91
92AC_DEFINE_UNQUOTED(HYPRE_RELEASE_NAME,    ["$HYPRE_NAME"],    [Release name])
93AC_DEFINE_UNQUOTED(HYPRE_RELEASE_VERSION, ["$HYPRE_VERSION"], [Release version])
94AC_DEFINE_UNQUOTED(HYPRE_RELEASE_NUMBER,  [$HYPRE_NUMBER],    [Release number])
95AC_DEFINE_UNQUOTED(HYPRE_RELEASE_DATE,    ["$HYPRE_DATE"],    [Date of release])
96AC_DEFINE_UNQUOTED(HYPRE_RELEASE_TIME,    ["$HYPRE_TIME"],    [Time of release])
97AC_DEFINE_UNQUOTED(HYPRE_RELEASE_BUGS,    ["$HYPRE_BUGS"],    [Bug reports])
98
99AC_SUBST(HYPRE_NAME)
100AC_SUBST(HYPRE_VERSION)
101AC_SUBST(HYPRE_NUMBER)
102AC_SUBST(HYPRE_DATE)
103AC_SUBST(HYPRE_TIME)
104AC_SUBST(HYPRE_BUGS)
105
106AC_SUBST(HYPRE_SRCDIR)
107
108AC_CHECK_FILE([$HYPRE_SRCDIR/../.git],
109  [develop_string=$(git -C $HYPRE_SRCDIR describe --match 'v*' --long --abbrev=9)
110   develop_lastag=$(git -C $HYPRE_SRCDIR describe --match 'v*' --abbrev=0)
111   develop_number=$(git -C $HYPRE_SRCDIR rev-list --count $develop_lastag..HEAD)
112   develop_branch=$(git -C $HYPRE_SRCDIR rev-parse --abbrev-ref HEAD)
113   AC_DEFINE_UNQUOTED(HYPRE_DEVELOP_STRING, ["$develop_string"], [Develop branch string])
114   AC_DEFINE_UNQUOTED(HYPRE_DEVELOP_NUMBER, [$develop_number],   [Develop branch commit number])
115   AS_IF([test "x$develop_branch" = "xmaster"],
116     [AC_DEFINE_UNQUOTED(HYPRE_DEVELOP_BRANCH, ["$develop_branch"], [Main development branch?])],
117     [AC_MSG_NOTICE([NOTE: On branch $develop_branch, not the main development branch])]
118   )],
119  [AC_MSG_NOTICE([NOTE: Could not find .git directory])]
120)
121
122dnl *********************************************************************
123dnl * Clear variables defined by AC_INIT to avoid name conflicts with
124dnl * other packages.
125dnl *********************************************************************
126PACKAGE_DATE=
127PACKAGE_TIME=
128PACKAGE_DATETIME=
129PACKAGE_NAME=
130PACKAGE_VERSION=
131PACKAGE_STRING=
132PACKAGE_TARNAME=
133PACKAGE_BUGREPORT=
134
135dnl *********************************************************************
136dnl * Initialize hypre variables
137dnl *********************************************************************
138hypre_user_chose_mpi=no
139hypre_user_chose_blas=no
140hypre_user_chose_lapack=no
141hypre_user_chose_raja=no
142hypre_using_raja=no
143hypre_user_chose_kokkos=no
144hypre_using_kokkos=no
145
146hypre_using_c=yes
147hypre_using_cxx=yes
148
149hypre_using_mpi=yes
150
151hypre_using_distributed_ls=yes
152
153hypre_using_superlu=no
154hypre_using_dsuperlu=no
155
156hypre_using_fei=no
157hypre_using_mli=no
158
159hypre_using_openmp=no
160hypre_using_device_openmp=no
161hypre_using_insure=no
162hypre_using_cuda=no
163hypre_using_gpu=no
164hypre_using_um=no
165hypre_gpu_mpi=no
166hypre_using_gpu_profiling=no
167hypre_using_cuda_streams=no
168hypre_using_cusparse=yes
169hypre_using_cublas=no
170hypre_using_curand=yes
171hypre_using_device_pool=no
172hypre_using_umpire=no
173hypre_using_umpire_host=no
174hypre_using_umpire_device=no
175hypre_using_umpire_um=no
176hypre_using_umpire_pinned=no
177
178hypre_using_caliper=no
179hypre_user_gave_caliper_lib=no
180hypre_user_gave_caliper_inc=no
181
182hypre_found_cuda=no
183
184hypre_using_node_aware_mpi=no
185hypre_using_memory_tracker=no
186
187
188dnl *********************************************************************
189dnl * Initialize hypre-HIP variables
190dnl *********************************************************************
191hypre_using_hip=no
192hypre_using_rocsparse=no
193hypre_using_rocblas=no
194hypre_using_rocrand=no
195
196hypre_found_hip=no
197
198
199
200dnl *********************************************************************
201dnl * Initialize flag-check variables
202dnl *********************************************************************
203hypre_blas_lib_old_style=no
204hypre_blas_lib_dir_old_style=no
205hypre_lapack_lib_old_style=no
206hypre_lapack_lib_dir_old_style=no
207
208dnl *********************************************************************
209dnl * Determine BUILD, HOST, and TARGET types
210dnl *********************************************************************
211if test "x$build_alias" = "x"
212then
213   AC_CANONICAL_BUILD
214fi
215
216if test "x$host_alias" = "x"
217then
218   AC_CANONICAL_HOST
219fi
220
221if test "x$target_alias" = "x"
222then
223   target_alias=$host_alias
224fi
225
226dnl *********************************************************************
227dnl * Define optional features
228dnl *********************************************************************
229AC_ARG_ENABLE(debug,
230AS_HELP_STRING([--enable-debug],
231               [Set compiler flags for debugging.]),
232[case "${enableval}" in
233    yes) hypre_using_debug=yes ;;
234    no)  hypre_using_debug=no ;;
235    *)   AC_MSG_ERROR([Bad value ${enableval} for --enable-debug]) ;;
236 esac],
237[hypre_using_debug=no]
238)
239
240AC_ARG_ENABLE(shared,
241AS_HELP_STRING([--enable-shared],
242               [Build shared libraries (default is NO).]),
243[case "${enableval}" in
244    yes) hypre_using_shared=yes ;;
245    no)  hypre_using_shared=no ;;
246    *)   AC_MSG_ERROR([Bad value ${enableval} for --enable-shared]) ;;
247 esac],
248[hypre_using_shared=no]
249)
250
251AC_ARG_ENABLE(mixedint,
252AS_HELP_STRING([--enable-mixedint],
253               [Use long long int for HYPRE_BigInt and int for HYPRE_Int (default is int for both). Note: This option disables Euclid, ParaSails, pilut and CGC coarsening.]),
254[case "${enableval}" in
255    yes) hypre_using_fei=no
256         hypre_using_mixedint=yes
257         hypre_using_distributed_ls=no ;;
258    no)  hypre_using_mixedint=no
259         hypre_using_distributed_ls=yes ;;
260    *)   AC_MSG_ERROR([Bad value ${enableval} for --enable-mixedint]) ;;
261 esac],
262[hypre_using_mixedint=no]
263)
264if test "$hypre_using_mixedint" = "yes"
265then
266   AC_DEFINE(HYPRE_MIXEDINT, 1, [Define to 1 if using long long int for HYPRE_BigInt])
267fi
268
269AC_ARG_ENABLE(bigint,
270AS_HELP_STRING([--enable-bigint],
271               [Use long long int for HYPRE_Int (default is NO).]),
272[case "${enableval}" in
273    yes) hypre_using_fei=no
274         hypre_using_bigint=yes ;;
275    no)  hypre_using_bigint=no ;;
276    *)   AC_MSG_ERROR([Bad value ${enableval} for --enable-bigint]) ;;
277 esac],
278[hypre_using_bigint=no]
279)
280if test "$hypre_using_bigint" = "yes"
281then
282   AC_DEFINE(HYPRE_BIGINT, 1, [Define to 1 if using long long int for HYPRE_Int and HYPRE_BigInt])
283fi
284
285AC_ARG_ENABLE(single,
286AS_HELP_STRING([--enable-single],
287               [Use single precision values (default is NO).]),
288[case "${enableval}" in
289    yes) hypre_using_fei=no
290         hypre_using_single=yes ;;
291    no)  hypre_using_single=no ;;
292    *)   AC_MSG_ERROR([Bad value ${enableval} for --enable-single]) ;;
293 esac],
294[hypre_using_single=no]
295)
296if test "$hypre_using_single" = "yes"
297then
298   AC_DEFINE(HYPRE_SINGLE, 1, [Define to 1 if using single precision values for HYPRE_Real])
299fi
300
301AC_ARG_ENABLE(longdouble,
302AS_HELP_STRING([--enable-longdouble],
303               [Use long double precision values (default is NO).]),
304[case "${enableval}" in
305    yes) hypre_using_fei=no
306         hypre_using_longdouble=yes ;;
307    no)  hypre_using_longdouble=no ;;
308    *)   AC_MSG_ERROR([Bad value ${enableval} for --enable-longdouble]) ;;
309 esac],
310[hypre_using_longdouble=no]
311)
312if test "$hypre_using_longdouble" = "yes"
313then
314   AC_DEFINE(HYPRE_LONG_DOUBLE, 1, [Define to 1 if using quad precision values for HYPRE_Real])
315fi
316
317AC_ARG_ENABLE(complex,
318AS_HELP_STRING([--enable-complex],
319               [Use complex values (default is NO).]),
320[case "${enableval}" in
321    yes) hypre_using_fei=no
322         hypre_using_complex=yes ;;
323    no)  hypre_using_complex=no ;;
324    *)   AC_MSG_ERROR([Bad value ${enableval} for --enable-complex]) ;;
325 esac],
326[hypre_using_complex=no]
327)
328if test "$hypre_using_complex" = "yes"
329then
330   AC_DEFINE(HYPRE_COMPLEX, 1, [Define to 1 if using complex values])
331fi
332
333AC_ARG_ENABLE(maxdim,
334AS_HELP_STRING([--enable-maxdim=MAXDIM],
335               [Change max dimension size to MAXDIM (default is 3).
336                Currently must be at least 3.]),
337[hypre_maxdim=${enableval}],
338[hypre_maxdim=3]
339)
340AC_DEFINE_UNQUOTED(HYPRE_MAXDIM, [$hypre_maxdim], [Define to be the max dimension size (must be at least 3)])
341
342AC_ARG_ENABLE(persistent,
343AS_HELP_STRING([--enable-persistent],
344               [Uses persistent communication (default is NO).]),
345[case "${enableval}" in
346    yes) hypre_using_persistent=yes ;;
347    no)  hypre_using_persistent=no ;;
348    *)   AC_MSG_ERROR([Bad value ${enableval} for --enable-persistent]) ;;
349 esac],
350[hypre_using_persistent=no]
351)
352if test "$hypre_using_persistent" = "yes"
353then
354   AC_DEFINE(HYPRE_USING_PERSISTENT_COMM, 1, [Define to 1 if using persistent communication])
355fi
356
357AC_ARG_ENABLE(hopscotch,
358AS_HELP_STRING([--enable-hopscotch],
359               [Uses hopscotch hashing if configured with OpenMP and
360                atomic capability available(default is NO).]),
361[case "${enableval}" in
362    yes) hypre_using_hopscotch=yes ;;
363    no)  hypre_using_hopscotch=no ;;
364    *)   AC_MSG_ERROR([Bad value ${enableval} for --enable-hopscotch]) ;;
365 esac],
366[hypre_using_hopscotch=no]
367)
368if test "$hypre_using_hopscotch" = "yes"
369then
370   AC_DEFINE(HYPRE_HOPSCOTCH, 1, [Define to 1 if hopscotch hashing])
371fi
372
373AC_ARG_ENABLE(fortran,
374AS_HELP_STRING([--enable-fortran],
375               [Require a working Fortran compiler (default is YES).]),
376[case "${enableval}" in
377    yes) hypre_using_fortran=yes ;;
378    no)  hypre_using_fortran=no ;;
379    *)   hypre_using_fortran=yes ;;
380 esac],
381[hypre_using_fortran=yes]
382)
383
384AC_ARG_ENABLE(unified-memory,
385AS_HELP_STRING([--enable-unified-memory],
386               [Use unified memory for allocating the memory (default is NO).]),
387[case "${enableval}" in
388    yes) hypre_using_um=yes ;;
389    no)  hypre_using_um=no ;;
390    *)   hypre_using_um=no ;;
391 esac],
392[hypre_using_um=no]
393)
394
395AC_ARG_ENABLE(cuda-streams,
396AS_HELP_STRING([--enable-cuda-streams],
397               [Use CUDA streams (default is YES).]),
398[case "${enableval}" in
399    yes) hypre_using_cuda_streams=yes ;;
400    no)  hypre_using_cuda_streams=no ;;
401    *)   hypre_using_cuda_streams=yes ;;
402 esac],
403[hypre_using_cuda_streams=yes]
404)
405
406AC_ARG_ENABLE(cusparse,
407AS_HELP_STRING([--enable-cusparse],
408               [Use cuSPARSE (default is YES).]),
409[case "${enableval}" in
410    yes) hypre_using_cusparse=yes ;;
411    no)  hypre_using_cusparse=no ;;
412    *)   hypre_using_cusparse=yes ;;
413 esac],
414[hypre_using_cusparse=yes]
415)
416
417AC_ARG_ENABLE(device-memory-pool,
418AS_HELP_STRING([--enable-device-memory-pool],
419               [Use device pooling allocator (default is NO).]),
420[case "${enableval}" in
421    yes) hypre_using_device_pool=yes ;;
422    no)  hypre_using_device_pool=no ;;
423    *)   hypre_using_device_pool=no ;;
424 esac],
425[hypre_using_device_pool=no]
426)
427
428AC_ARG_ENABLE(cublas,
429AS_HELP_STRING([--enable-cublas],
430               [Use cuBLAS (default is NO).]),
431[case "${enableval}" in
432    yes) hypre_using_cublas=yes ;;
433    no)  hypre_using_cublas=no ;;
434    *)   hypre_using_cublas=no ;;
435 esac],
436[hypre_using_cublas=no]
437)
438
439AC_ARG_ENABLE(curand,
440AS_HELP_STRING([--enable-curand],
441               [Use cuRAND (default is YES).]),
442[case "${enableval}" in
443    yes) hypre_using_curand=yes ;;
444    no)  hypre_using_curand=no ;;
445    *)   hypre_using_curand=yes ;;
446 esac],
447[hypre_using_curand=yes]
448)
449
450
451
452AC_ARG_ENABLE(rocsparse,
453AS_HELP_STRING([--enable-rocsparse],
454               [Use rocSPARSE (default is YES).]),
455[case "${enableval}" in
456    yes) hypre_using_rocsparse=yes ;;
457    no)  hypre_using_rocsparse=no ;;
458    *)   hypre_using_rocsparse=yes ;;
459 esac],
460[hypre_using_rocsparse=yes]
461)
462
463AC_ARG_ENABLE(rocblas,
464AS_HELP_STRING([--enable-rocblas],
465               [Use rocBLAS (default is NO).]),
466[case "${enableval}" in
467    yes) hypre_using_rocblas=yes ;;
468    no)  hypre_using_rocblas=no ;;
469    *)   hypre_using_rocblas=no ;;
470 esac],
471[hypre_using_rocblas=no]
472)
473
474AC_ARG_ENABLE(rocrand,
475AS_HELP_STRING([--enable-rocrand],
476               [Use rocRAND (default is YES).]),
477[case "${enableval}" in
478    yes) hypre_using_rocrand=yes ;;
479    no)  hypre_using_rocrand=no ;;
480    *)   hypre_using_rocrand=yes ;;
481 esac],
482[hypre_using_rocrand=yes]
483)
484
485AC_ARG_ENABLE(gpu-profiling,
486AS_HELP_STRING([--enable-gpu-profiling],
487               [Use NVTX on CUDA, rocTX on HIP (default is NO).]),
488[case "${enableval}" in
489    yes) hypre_using_gpu_profiling=yes ;;
490    no)  hypre_using_gpu_profiling=no ;;
491    *)   hypre_using_gpu_profiling=no ;;
492 esac],
493[hypre_using_gpu_profiling=no]
494)
495
496AC_ARG_ENABLE(gpu-aware-mpi,
497AS_HELP_STRING([--enable-gpu-aware-mpi],
498               [Use GPU memory aware MPI]),
499[case "${enableval}" in
500    yes) hypre_gpu_mpi=yes ;;
501    no)  hypre_gpu_mpi=no ;;
502    *)   AC_MSG_ERROR([Bad value ${enableval} for --enable-gpu-aware-mpi]) ;;
503 esac],
504[hypre_gpu_mpi=no]
505)
506
507dnl * The AC_DEFINE is below, after hypre_using_mpi is completely set
508dnl * Need to change to a new approach that always defines variable to some value
509
510dnl *********************************************************************
511dnl * Determine if user provided C compiler or flags
512dnl *********************************************************************
513if test "x$CC" = "x"
514then
515   hypre_user_chose_ccompilers=no
516else
517   hypre_user_chose_ccompilers=yes
518fi
519
520if test "x$CFLAGS" = "x"
521then
522   hypre_user_chose_cflags=no
523else
524   hypre_user_chose_cflags=yes
525fi
526
527dnl *********************************************************************
528dnl * Determine if user provided CXX compiler or flags
529dnl *********************************************************************
530if test "x$CXX" = "x"
531then
532   hypre_user_chose_cxxcompilers=no
533else
534   hypre_user_chose_cxxcompilers=yes
535fi
536
537if test "x$CXXFLAGS" = "x"
538then
539   hypre_user_chose_cxxflags=no
540else
541   hypre_user_chose_cxxflags=yes
542fi
543
544dnl *********************************************************************
545dnl * Determine if user provided CUDA compiler or flags
546dnl *********************************************************************
547AC_ARG_VAR([CUDA_HOME], [CUDA home directory])
548AC_ARG_VAR([HYPRE_CUDA_SM], [CUDA architecture])
549AC_ARG_VAR([CUCC], [CUDA compiler command])
550AC_ARG_VAR([CUFLAGS], [CUDA compiler flags])
551
552if test "x$CUCC" = "x"
553then
554   hypre_user_chose_cudacompilers=no
555else
556   hypre_user_chose_cudacompilers=yes
557fi
558
559if test "x$CUFLAGS" = "x"
560then
561   hypre_user_chose_cuflags=no
562else
563   hypre_user_chose_cuflags=yes
564fi
565
566dnl *********************************************************************
567dnl * Determine if user provided fortran compiler or flags
568dnl *********************************************************************
569if test "x$F77" != "x" && test "x$FC" = "x"
570then
571   FC="$F77"
572fi
573
574if test "x$FC" = "x"
575then
576   hypre_user_chose_fcompilers=no
577else
578   hypre_user_chose_fcompilers=yes
579fi
580
581if test "x$F77FLAGS" != "x"
582then
583   FCFLAGS="$F77FLAGS $FCFLAGS"
584fi
585
586if test "x$FFLAGS" = "x" || test "x$FCFLAGS" = "x"
587then
588   hypre_user_chose_fflags=no
589else
590   hypre_user_chose_fflags=yes
591fi
592
593dnl *********************************************************************
594dnl * Set default AR value if not defined by the user
595dnl *********************************************************************
596if test "x$AR" = "x"
597then
598   AR="ar -rcu"
599fi
600
601dnl *********************************************************************
602dnl * If the user has specified a c, c++, or fortran compiler on the
603dnl * command line, that compiler will be used.  No checks are done
604dnl * to assure this compiler is present or working.  Additionally,
605dnl * if the user indicated any MPI include, library, or directory
606dnl * to use with the chosen compiler those options are identified
607dnl * and the appropriate macros are assigned values.
608dnl *********************************************************************
609
610AC_ARG_WITH(LD,
611AS_HELP_STRING([--with-LD=ARG],
612               [Set linker to ARG.  The environment variable 'LD'
613                will be overridden.]),
614[LD=$withval]
615)
616
617AC_ARG_WITH(LDFLAGS,
618AS_HELP_STRING([--with-LDFLAGS=ARG],
619               [User can manually set linker flags. The 'LDFLAGS'
620                environment variable will be overridden.]),
621[LDFLAGS=$withval]
622)
623
624AC_ARG_WITH(extra-CFLAGS,
625AS_HELP_STRING([--with-extra-CFLAGS=ARG],
626               [Define extra C compile flag, where ARG is a space-separated
627                list (enclosed in quotes) of directories.]),
628[EXTRA_CFLAGS=$withval]
629)
630
631AC_ARG_WITH(extra-CXXFLAGS,
632AS_HELP_STRING([--with-extra-CXXFLAGS=ARG],
633               [Define extra C++ compile flag, where ARG is a space-separated
634                list (enclosed in quotes) of directories.]),
635[EXTRA_CXXFLAGS=$withval]
636)
637
638AC_ARG_WITH(extra-BUILDFLAGS,
639AS_HELP_STRING([--with-extra-BUILDFLAGS=ARG],
640               [Define extra library build flag, where ARG is a space-separated
641                list (enclosed in quotes) of directories.]),
642[EXTRA_BUILDFLAGS=$withval]
643)
644
645AC_ARG_WITH(extra-incpath,
646AS_HELP_STRING([--with-extra-incpath=PATH],
647               [Define extra include path, where PATH is a space-separated
648                list (enclosed in quotes) of directories.]),
649[CCFLAGS="${CCFLAGS} -I`echo ${withval}|sed 's/ /\ -I/g'`"]
650)
651
652AC_ARG_WITH(extra-ldpath,
653AS_HELP_STRING([--with-extra-ldpath=PATH],
654               [Define extra ld path, where PATH is a space-separated
655                list (enclosed in quotes) of directories.]),
656[LDFLAGS="-L`echo ${withval}|sed 's/ /\ -L/g'` ${LDFLAGS}"]
657)
658
659AC_ARG_WITH(insure,
660AS_HELP_STRING([--with-insure=FLAGS],
661               [FLAGS are options to pass to insure. Nothing is done
662                to verify that insure is available]),
663[case "${withval}" in
664    yes) hypre_using_insure=yes
665         hypre_using_debug=yes
666         hypre_insure_flags="" ;;
667    no)  ;;
668     *)  hypre_using_insure=yes
669         hypre_using_debug=yes
670         hypre_insure_flags="$withval" ;;
671 esac]
672)
673
674AC_ARG_WITH(strict-checking,
675AS_HELP_STRING([--with-strict-checking],
676               [Compiles without MPI ('--without-MPI') and tries to
677                find a compiler option that warns of as many non-ISO
678                features as possible.]),
679[case "${withval}" in
680 yes)
681 hypre_user_chose_ccompilers=yes
682 hypre_user_chose_cflags=yes
683 hypre_user_chose_cxxcompilers=yes
684 hypre_user_chose_cxxflags=yes
685 hypre_user_chose_fcompilers=yes
686 hypre_user_chose_fflags=yes
687 hypre_using_debug=yes
688 hypre_using_mpi=no
689
690 AC_CHECK_PROGS(CC, [gcc g++ icc icpc pgcc pgCC xlc xlC kcc KCC], [""])
691 if test "x$CC" = "x"
692 then
693    hypre_using_c=no
694    CFLAGS=""
695 elif test "x$GCC" = "xyes" || test "x$CC" = "xgcc"; then
696    FFLAGS="-g -Wall"
697    CFLAGS="-g -Wall -std=gnu99 -pedantic"
698    CXXFLAGS="-g -Wall -Wshadow -fno-implicit-templates"
699    CXXFLAGS="$CXXFLAGS -Woverloaded-virtual -ansi -pedantic"
700 elif test "x$CC" = "xicc"; then
701    FFLAGS="-g -Wall"
702    CFLAGS="-g -Xc -Wall -x c"
703    CXXFLAGS="-g -Xc -Wall -x c++"
704 elif test "x$CC" = "xpgcc"; then
705    FFLAGS="-g -Wall"
706    CFLAGS="-g -Xa -Minform,inform"
707    CXXFLAGS="-g -A --display_error_number -Minform,inform"
708 elif test "x$CC" = "xxlc"; then
709    FFLAGS="-g -Wall"
710    CFLAGS="-g -qinfo=dcl:eff:pro:rea:ret:use"
711    CXXFLAGS="-g  -qinfo=dcl:eff:obs:pro:rea:ret:use"
712 elif test "x$CC" = "xKCC" || test "x$CC" = "xkcc"; then
713    FFLAGS="-g -Wall"
714    CFLAGS="-g --c --strict --lint --display_error_number"
715    CFLAGS="$CFLAGS --diag_suppress 45,236,450,826"
716    CFLAGS="$CFLAGS,1018,1021,1022,1023,1024,1030,1041"
717    CXXFLAGS="-g --strict --lint --display_error_number"
718    CXXFLAGS="$CXXFLAGS --diag_suppress 381,450,1023,1024"
719 fi
720
721 AC_CHECK_PROGS(CXX, [g++ gcc icpc icc pgCC pgcc xlC xlc KCC kcc], [""])
722 if test "x$CXX" = "x"
723 then
724    hypre_using_cxx=no
725    CXXFLAGS=""
726 fi
727 if test "$hypre_using_fortran" = "yes"
728 then
729    AC_CHECK_PROGS(FC, [g77 ifort pgf77 xlf], [""])
730    if test "x$FC" = "x"
731    then
732       hypre_using_fortran=no
733       FFLAGS=""
734    fi
735 fi
736
737 AC_DEFINE(HYPRE_SEQUENTIAL,1,[No MPI being used])
738 ;;
739 esac]
740)
741
742dnl ***** MPI
743
744AC_ARG_WITH(MPI-include,
745AS_HELP_STRING([--with-MPI-include=DIR],
746               [User specifies that mpi.h is in DIR.  The options
747                --with-MPI-include --with-MPI-libs and
748                --with-MPI-lib-dirs must be used together.]),
749[for mpi_dir in $withval; do
750    MPIINCLUDE="$MPIINCLUDE -I$mpi_dir"
751 done;
752 hypre_user_chose_mpi=yes],
753[hypre_user_chose_mpi=no]
754)
755
756AC_ARG_WITH(MPI-libs,
757AS_HELP_STRING([--with-MPI-libs=LIBS],
758               [LIBS is space-separated list (enclosed in quotes) of library
759                names needed for MPI, e.g. "nsl socket mpi".  The options
760                --with-MPI-include --with-MPI-libs and --with-MPI-lib-dirs
761                must be used together.]),
762[for mpi_lib in $withval; do
763    MPILIBS="$MPILIBS -l$mpi_lib"
764 done;
765 hypre_user_chose_mpi=yes]
766)
767
768AC_ARG_WITH(MPI-lib-dirs,
769AS_HELP_STRING([--with-MPI-lib-dirs=DIRS],
770               [DIRS is space-separated list (enclosed in quotes) of
771                directories containing the libraries specified by
772                --with-MPI-libs, e.g "usr/lib /usr/local/mpi/lib".
773                The options --with-MPI-include --with-MPI-libs and
774                --with-MPI-lib-dirs must be used together.]),
775[for mpi_lib_dir in $withval; do
776    MPILIBDIRS="-L$mpi_lib_dir $MPILIBDIRS"
777 done;
778 hypre_user_chose_mpi=yes]
779)
780
781AC_ARG_WITH(MPI-flags,
782AS_HELP_STRING([--with-MPI-flags=FLAGS],
783               [FLAGS is a space separated list (enclosed in quotes) of
784                whatever flags other than -l and -L are needed to link
785                with MPI libraries-- Does not de-activate autosearch for
786                other MPI information. May be used with the other three
787                MPI options or alone in conjunction with the automatic MPI
788                search.]),
789[case "${withval}" in
790    yes) MPIFLAGS="" ;;
791    no)  MPIFLAGS="" ;;
792    *)   MPIFLAGS=$withval ;;
793 esac],
794[MPIFLAGS=""]
795)
796
797dnl ***** Node Aware MPI
798AC_ARG_WITH(node-aware-mpi,
799AS_HELP_STRING([--with-node-aware-mpi],
800               [Use Node Aware MPI (default is NO).]),
801[case "$withval" in
802    yes) hypre_using_node_aware_mpi=yes;;
803    no)  hypre_using_node_aware_mpi=no ;;
804    *)   hypre_using_node_aware_mpi=no ;;
805 esac],
806[hypre_using_node_aware_mpi=no]
807)
808
809AC_ARG_WITH(node-aware-mpi-include,
810AS_HELP_STRING([--with-node-aware-mpi-include=DIR],
811               [User specifies that nap_comm.hpp is in DIR.]),
812[for nap_dir in $withval; do
813    HYPRE_NAP_INCLUDE="$HYPRE_NAP_INCLUDE -I$nap_dir"
814 done;
815 hypre_using_node_aware_mpi=yes]
816)
817
818dnl ***** memory tracker
819AC_ARG_WITH(memory_tracker,
820AS_HELP_STRING([--with-memory-tracker],
821               [Use memory tracker in hypre (default is NO).]),
822[case "$withval" in
823    yes) hypre_using_memory_tracker=yes;;
824    no)  hypre_using_memory_tracker=no ;;
825    *)   hypre_using_memory_tracker=no ;;
826 esac],
827[hypre_using_memory_tracker=no]
828)
829
830dnl ***** BLAS
831
832AC_ARG_WITH(blas-lib,
833AS_HELP_STRING([--with-blas-lib=LIBS],
834               [LIBS is space-separated linkable list (enclosed in quotes) of libraries
835                needed for BLAS. OK to use -L and -l flags in the list]),
836[for blas_lib in $withval; do
837dnl    [libprefix=`echo $blas_lib | cut -c1-2`]
838dnl    if test $libprefix = "-L"
839dnl    then
840dnl       BLASLIBDIRS="$blas_lib $BLASLIBDIRS"
841dnl    else
842       BLASLIBS="$BLASLIBS $blas_lib"
843dnl    fi
844 done;
845 hypre_user_chose_blas=yes]
846)
847
848AC_ARG_WITH(blas-libs,
849AS_HELP_STRING([--with-blas-libs=LIBS],
850               [LIBS is space-separated list (enclosed in quotes) of libraries
851                needed for BLAS (base name only). The options --with-blas-libs and
852                --with-blas-lib-dirs must be used together.]),
853[for blas_lib in $withval; do
854    BLASLIBS="$BLASLIBS -l$blas_lib"
855 done;
856 hypre_user_chose_blas=yes
857 hypre_blas_lib_old_style=yes]
858)
859
860AC_ARG_WITH(blas-lib-dirs,
861AS_HELP_STRING([--with-blas-lib-dirs=DIRS],
862               [DIRS is space-separated list (enclosed in quotes) of
863                directories containing the libraries specified by
864                --with-blas-libs, e.g "usr/lib /usr/local/blas/lib".
865                The  options --with-blas-libs and --with-blas-lib-dirs
866                must be used together.]),
867[for blas_lib_dir in $withval; do
868    BLASLIBDIRS="-L$blas_lib_dir $BLASLIBDIRS"
869 done;
870 hypre_user_chose_blas=yes
871 hypre_blas_lib_dir_old_style=yes]
872)
873
874dnl ***** LAPACK
875
876AC_ARG_WITH(lapack-lib,
877AS_HELP_STRING([--with-lapack-lib=LIBS],
878               [LIBS is space-separated linkable list (enclosed in quotes) of libraries
879                needed for LAPACK. OK to use -L and -l flags in the list]),
880[for lapack_lib in $withval; do
881dnl    [libprefix=`echo $lapack_lib | cut -c1-2`]
882dnl    if test $libprefix = "-L"
883dnl    then
884dnl       LAPACKLIBDIRS="$lapack_lib $LAPACKLIBDIRS"
885dnl    else
886       LAPACKLIBS="$LAPACKLIBS $lapack_lib"
887dnl    fi
888 done;
889 hypre_user_chose_lapack=yes]
890)
891
892AC_ARG_WITH(lapack-libs,
893AS_HELP_STRING([--with-lapack-libs=LIBS],
894               [LIBS is space-separated list (enclosed in quotes) of libraries
895                needed for LAPACK (base name only). The options --with-lapack-libs and
896                --with-lapack-lib-dirs must be used together.]),
897[for lapack_lib in $withval; do
898    LAPACKLIBS="$LAPACKLIBS -l$lapack_lib"
899 done;
900 hypre_user_chose_lapack=yes
901 hypre_lapack_lib_old_style=yes]
902)
903
904AC_ARG_WITH(lapack-lib-dirs,
905AS_HELP_STRING([--with-lapack-lib-dirs=DIRS],
906               [DIRS is space-separated list (enclosed in quotes) of
907                directories containing the libraries specified by
908                --with-lapack-libs, e.g "usr/lib /usr/local/lapack/lib".
909                The options --with-lapack-libs and --with-lapack-lib-dirs
910                must be used together.]),
911[for lapack_lib_dir in $withval; do
912    LAPACKLIBDIRS="-L$lapack_lib_dir $LAPACKLIBDIRS"
913 done;
914 hypre_user_chose_lapack=yes
915 hypre_lapack_lib_dir_old_style=yes]
916)
917
918dnl * Define a generic macro to set hypre_fmangle based on withval
919AC_DEFUN([AC_HYPRE_SET_FMANGLE],
920[
921 case "$withval" in
922    no-underscores)      hypre_fmangle=1 ;;
923    one-underscore)      hypre_fmangle=2 ;;
924    two-underscores)     hypre_fmangle=3 ;;
925    caps-no-underscores) hypre_fmangle=4 ;;
926    one-before-after)    hypre_fmangle=5 ;;
927 esac
928])
929
930dnl * Define --with-fmangle
931AC_ARG_WITH(fmangle,
932AS_HELP_STRING([--with-fmangle=FMANGLE],
933               [FMANGLE contains a string indicating the type of name mangling
934                to use when calling hypre from Fortran.  It can be set to:
935                "no-underscores", "one-underscore", "two-underscores",
936                "caps-no-underscores", and "one-before-after".]),
937[hypre_fmangle=0; AC_HYPRE_SET_FMANGLE],
938[hypre_fmangle=0]
939)
940AC_DEFINE_UNQUOTED(HYPRE_FMANGLE,
941                   [$hypre_fmangle],
942[Define as follows to set the Fortran name mangling scheme:
943 0 = unspecified;
944 1 = no underscores;
945 2 = one underscore;
946 3 = two underscores;
947 4 = caps, no underscores;
948 5 = one underscore before and after])
949
950dnl * Define a generic macro to set hypre_fmangle_blaslapack based on withval
951AC_DEFUN([AC_HYPRE_SET_FMANGLE_BLAS],
952[
953 case "$withval" in
954    no-underscores)      hypre_fmangle_blas=1 ;;
955    one-underscore)      hypre_fmangle_blas=2 ;;
956    two-underscores)     hypre_fmangle_blas=3 ;;
957    caps-no-underscores) hypre_fmangle_blas=4 ;;
958    one-before-after)    hypre_fmangle_blas=5 ;;
959 esac
960])
961
962dnl * Define --with-fmangle-blas
963AC_ARG_WITH(fmangle-blas,
964AS_HELP_STRING([--with-fmangle-blas=FMANGLE],
965               [Name mangling for BLAS.  See --with-fmangle.]),
966[hypre_fmangle_blas=0; AC_HYPRE_SET_FMANGLE_BLAS],
967[hypre_fmangle_blas=0]
968)
969AC_DEFINE_UNQUOTED(HYPRE_FMANGLE_BLAS, [$hypre_fmangle_blas], [BLAS mangling])
970
971dnl * Define a generic macro to set hypre_fmangle_blaslapack based on withval
972dnl * This could use the same variable for blas, but it is redefined here for the
973dnl * rare case that blas/ lapack manglings could be different
974AC_DEFUN([AC_HYPRE_SET_FMANGLE_LAPACK],
975[
976 case "$withval" in
977    no-underscores)      hypre_fmangle_lapack=1 ;;
978    one-underscore)      hypre_fmangle_lapack=2 ;;
979    two-underscores)     hypre_fmangle_lapack=3 ;;
980    caps-no-underscores) hypre_fmangle_lapack=4 ;;
981    one-before-after)    hypre_fmangle_lapack=5 ;;
982 esac
983])
984
985dnl * Define --with-fmangle-lapack
986AC_ARG_WITH(fmangle-lapack,
987AS_HELP_STRING([--with-fmangle-lapack=FMANGLE],
988               [Name mangling for LAPACK.  See --with-fmangle.]),
989[hypre_fmangle_lapack=0; AC_HYPRE_SET_FMANGLE_LAPACK],
990[hypre_fmangle_lapack=0]
991)
992AC_DEFINE_UNQUOTED(HYPRE_FMANGLE_LAPACK, [$hypre_fmangle_lapack], [LAPACK mangling])
993
994AC_ARG_WITH(print-errors,
995AS_HELP_STRING([--with-print-errors],
996               [Print HYPRE errors.]),
997[if test "$withval" = "yes"
998 then
999    AC_DEFINE(HYPRE_PRINT_ERRORS,1,[Print HYPRE errors])
1000 fi]
1001)
1002
1003AC_ARG_WITH(timing,
1004AS_HELP_STRING([--with-timing],
1005               [Use HYPRE timing routines.]),
1006[if test "$withval" = "yes"
1007 then
1008    AC_DEFINE(HYPRE_TIMING,1,[Using HYPRE timing routines])
1009 fi]
1010)
1011
1012AC_ARG_WITH(openmp,
1013AS_HELP_STRING([--with-openmp],
1014               [Use OpenMP.  This may affect which compiler is chosen.]),
1015[case "${withval}" in
1016    yes) hypre_using_openmp=yes;;
1017    no)  hypre_using_openmp=no ;;
1018 esac],
1019[hypre_using_openmp=no]
1020)
1021
1022AC_ARG_WITH(device-openmp,
1023AS_HELP_STRING([--with-device-openmp],
1024               [Use OpenMP 4.5 Device Directives.  This may affect which compiler is chosen.]),
1025[case "${withval}" in
1026    yes) hypre_using_device_openmp=yes ;;
1027    no)  hypre_using_device_openmp=no ;;
1028 esac],
1029[hypre_using_device_openmp=no]
1030)
1031
1032dnl ***** SuperLU
1033
1034AC_ARG_WITH(superlu,
1035AS_HELP_STRING([--with-superlu],
1036               [Use external SuperLU library.]),
1037[case "${withval}" in
1038    no) hypre_using_superlu=no ;;
1039    *)  hypre_using_superlu=yes ;;
1040 esac]
1041)
1042
1043AS_IF([test "x$with_superlu" = "xyes"],
1044      [AC_DEFINE(HAVE_SUPERLU, 1, [Define to 1 if using SuperLU])],
1045      [])
1046
1047AC_ARG_WITH(superlu-include,
1048AS_HELP_STRING([--with-superlu-include=DIR],
1049               [Directory where SuperLU is installed.]),
1050[for superlu_inc_dir in $withval; do
1051    SUPERLU_INCLUDE="-I$superlu_inc_dir $SUPERLU_INCLUDE"
1052 done]
1053)
1054
1055AC_ARG_WITH(superlu-lib,
1056AS_HELP_STRING([--with-superlu-lib=LIBS],
1057               [LIBS is space-separated linkable list (enclosed in quotes) of libraries
1058                needed for SuperLU. OK to use -L and -l flags in the list]),
1059[for superlu_lib in $withval; do
1060    SUPERLU_LIBS="$SUPERLU_LIBS $superlu_lib"
1061 done]
1062)
1063
1064dnl ***** DSuperLU
1065
1066AC_ARG_WITH(dsuperlu,
1067AS_HELP_STRING([--with-dsuperlu],
1068               [Use external DSuperLU library.]),
1069[case "${withval}" in
1070    no) hypre_using_dsuperlu=no ;;
1071    *)  hypre_using_dsuperlu=yes ;;
1072 esac]
1073)
1074
1075AS_IF([test "x$with_dsuperlu" = "xyes"],
1076      [AC_DEFINE(HYPRE_USING_DSUPERLU, 1, [Define to 1 if using DSuperLU])],
1077      [])
1078
1079AC_ARG_WITH(dsuperlu-include,
1080AS_HELP_STRING([--with-dsuperlu-include=DIR],
1081               [Directory where DSuperLU is installed.]),
1082[for dsuperlu_inc_dir in $withval; do
1083    DSUPERLU_INCLUDE="-I$dsuperlu_inc_dir $DSUPERLU_INCLUDE"
1084 done]
1085)
1086
1087AC_ARG_WITH(dsuperlu-lib,
1088AS_HELP_STRING([--with-dsuperlu-lib=LIBS],
1089               [LIBS is space-separated linkable list (enclosed in quotes) of libraries
1090                needed for DSuperLU. OK to use -L and -l flags in the list]),
1091[for dsuperlu_lib in $withval; do
1092    DSUPERLU_LIBS="$DSUPERLU_LIBS $dsuperlu_lib"
1093 done]
1094)
1095
1096dnl ***** FEI
1097
1098AC_ARG_WITH(fei-inc-dir,
1099AS_HELP_STRING([--with-fei-inc-dir=DIR],
1100               [DIR is the directory containing the FEI distribution.]),
1101[HYPRE_FEI_BASE_DIR="$withval";
1102 hypre_using_fei=yes]
1103)
1104
1105dnl ***** MLI
1106
1107AC_ARG_WITH(mli,
1108AS_HELP_STRING([--with-mli],
1109               [Use MLI]),
1110[case "${withval}" in
1111    no) hypre_using_mli=no ;;
1112    *)  hypre_using_mli=yes ;;
1113 esac]
1114)
1115
1116dnl ***** MPI
1117
1118AC_ARG_WITH(MPI,
1119AS_HELP_STRING([--with-MPI],
1120               [DEFAULT: Compile with MPI.  Selecting --without-MPI
1121                may affect which compiler is chosen.]),
1122[case "$withval" in
1123    no) hypre_using_mpi=no ;;
1124    *)  hypre_using_mpi=yes ;;
1125 esac]
1126)
1127
1128dnl ***** CUDA
1129
1130AC_ARG_WITH(cuda,
1131AS_HELP_STRING([--with-cuda],
1132               [Use CUDA. Require cuda-8.0 or higher (default is NO).]),
1133[case "$withval" in
1134    yes) hypre_using_cuda=yes ;;
1135    no)  hypre_using_cuda=no ;;
1136    *)   hypre_using_cuda=no ;;
1137 esac],
1138[hypre_using_cuda=no]
1139)
1140
1141
1142dnl ***** HIP
1143AC_ARG_WITH(hip,
1144AS_HELP_STRING([--with-hip],
1145               [Use HIP for AMD GPUs. (default is NO).]),
1146[case "$withval" in
1147    yes) hypre_using_hip=yes ;;
1148    no)  hypre_using_hip=no ;;
1149    *)   hypre_using_hip=no ;;
1150 esac],
1151[hypre_using_hip=no]
1152)
1153
1154AC_ARG_WITH(cuda-home,
1155AS_HELP_STRING([--with-cuda-home=DIR],
1156               [User specifies CUDA_HOME in DIR.]),
1157[for cuda_dir in $withval; do
1158    CUDA_HOME="$cuda_dir"
1159 done;
1160 hypre_using_cuda=yes]
1161)
1162
1163AC_ARG_WITH(gpu-arch,
1164AS_HELP_STRING([--with-gpu-arch=ARG],
1165               [User specifies NVIDIA GPU architecture that the CUDA files will be compiled for in ARG, where ARG is a space-separated
1166                list (enclosed in quotes) of numbers.]),
1167[
1168 if test "x${withval}" != "x"
1169 then
1170    if test "x${HYPRE_CUDA_SM}" = "x"
1171    then
1172       HYPRE_CUDA_SM="${withval}"
1173    fi
1174 fi
1175]
1176)
1177
1178dnl ***** RAJA
1179
1180AC_ARG_WITH(raja,
1181AS_HELP_STRING([--with-raja],
1182               [Use RAJA. Require RAJA package to be compiled properly (default is NO).]),
1183[case "$withval" in
1184    yes) hypre_using_raja=yes;;
1185    no)  hypre_using_raja=no ;;
1186    *)   hypre_using_raja=no ;;
1187 esac],
1188[hypre_using_raja=no]
1189)
1190
1191AC_ARG_WITH(raja-include,
1192AS_HELP_STRING([--with-raja-include=DIR],
1193               [User specifies that RAJA/*.h is in DIR.  The options
1194                --with-raja-include --with-raja-libs and
1195                --with-raja-lib-dirs must be used together.]),
1196[for raja_dir in $withval; do
1197    HYPRE_RAJA_INCLUDE="-I$raja_dir $HYPRE_RAJA_INCLUDE"
1198 done;
1199 hypre_user_chose_raja=yes]
1200)
1201
1202AC_ARG_WITH(raja-lib,
1203AS_HELP_STRING([--with-raja-lib=LIBS],
1204               [LIBS is space-separated linkable list (enclosed in quotes) of libraries
1205                needed for RAJA. OK to use -L and -l flags in the list]),
1206[for raja_lib in $withval; do
1207       HYPRE_RAJA_LIB="$raja_lib $HYPRE_RAJA_LIB"
1208 done;
1209hypre_user_chose_raja=yes]
1210)
1211
1212AC_ARG_WITH(raja-libs,
1213AS_HELP_STRING([--with-raja-libs=LIBS],
1214               [LIBS is space-separated list (enclosed in quotes) of libraries
1215                needed for RAJA (base name only). The options --with-raja-libs and
1216                --with-raja-lib-dirs must be used together.]),
1217[for raja_lib in $withval; do
1218    HYPRE_RAJA_LIB="-l$raja_lib $HYPRE_RAJA_LIB"
1219 done;
1220hypre_user_chose_raja=yes]
1221)
1222
1223AC_ARG_WITH(raja-lib-dirs,
1224AS_HELP_STRING([--with-raja-lib-dirs=DIRS],
1225               [DIRS is space-separated list (enclosed in quotes) of
1226                directories containing the libraries specified by
1227                --with-raja-libs, e.g "usr/lib /usr/local/lib".
1228                The  options --with-raja-libs and --raja-blas-lib-dirs
1229                must be used together.]),
1230[for raja_lib_dir in $withval; do
1231    HYPRE_RAJA_LIB_DIR="-L$raja_lib_dir $HYPRE_RAJA_LIB_DIR"
1232 done;
1233 hypre_user_chose_raja=yes]
1234)
1235
1236dnl ***** Kokkos
1237
1238AC_ARG_WITH(kokkos,
1239AS_HELP_STRING([--with-kokkos],
1240               [Use Kokkos. Require kokkos package to be compiled properly(default is NO).]),
1241[case "$withval" in
1242    yes) hypre_using_kokkos=yes ;;
1243    no)  hypre_using_kokkos=no ;;
1244    *)   hypre_using_kokkos=no ;;
1245 esac],
1246[hypre_using_kokkos=no]
1247)
1248
1249AC_ARG_WITH(kokkos-include,
1250AS_HELP_STRING([--with-kokkos-include=DIR],
1251               [User specifies that KOKKOS headers is in DIR.  The options
1252                --with-kokkos-include --with-kokkos-libs and
1253                --with-kokkos-dirs must be used together.]),
1254[for kokkos_dir in $withval; do
1255HYPRE_KOKKOS_INCLUDE="-I$kokkos_dir $HYPRE_KOKKOS_INCLUDE"
1256done;
1257hypre_user_chose_kokkos=yes]
1258)
1259
1260AC_ARG_WITH(kokkos-lib,
1261AS_HELP_STRING([--with-kokkos-lib=LIBS],
1262               [LIBS is space-separated linkable list (enclosed in quotes) of libraries
1263                needed for KOKKOS. OK to use -L and -l flags in the list]),
1264[for kokkos_lib in $withval; do
1265       HYPRE_KOKKOS_LIB="$kokkos_lib $HYPRE_KOKKOS_LIB"
1266 done;
1267hypre_user_chose_kokkos=yes]
1268)
1269
1270AC_ARG_WITH(kokkos-libs,
1271AS_HELP_STRING([--with-kokkos-libs=LIBS],
1272               [LIBS is space-separated list (enclosed in quotes) of libraries
1273                needed for KOKKOS (base name only). The options --with-kokkos-libs and
1274                --with-kokkos-dirs must be used together.]),
1275[for kokkos_lib in $withval; do
1276    HYPRE_KOKKOS_LIB="-l$kokkos_lib $HYPRE_KOKKOS_LIB"
1277 done;
1278hypre_user_chose_kokkos=yes]
1279)
1280
1281AC_ARG_WITH(kokkos-lib-dirs,
1282AS_HELP_STRING([--with-kokkos-lib-dirs=DIRS],
1283               [DIRS is space-separated list (enclosed in quotes) of
1284                directories containing the libraries and
1285                Makefile.kokkos is assumed to be in DIRS/../ .
1286                The  options --with-kokkos-libs and --with-kokkos-dirs
1287                must be used together.]),
1288[for kokkos_lib_dir in $withval; do
1289    HYPRE_KOKKOS_LIB_DIR="-L$kokkos_lib_dir $HYPRE_KOKKOS_LIB_DIR"
1290 done;
1291hypre_user_chose_kokkos=yes]
1292)
1293
1294dnl **** Umpire
1295
1296AC_ARG_WITH(umpire-host,
1297AS_HELP_STRING([--with-umpire-host],
1298               [Use Umpire Allocator for host memory (default is NO).]),
1299[case "${withval}" in
1300    yes) hypre_using_umpire_host=yes ;;
1301    no)  hypre_using_umpire_host=no ;;
1302    *)   hypre_using_umpire_host=no ;;
1303 esac],
1304[hypre_using_umpire_host=no]
1305)
1306
1307AC_ARG_WITH(umpire-device,
1308AS_HELP_STRING([--with-umpire-device],
1309               [Use Umpire Allocator for device memory (default is NO).]),
1310[case "${withval}" in
1311    yes) hypre_using_umpire_device=yes ;;
1312    no)  hypre_using_umpire_device=no ;;
1313    *)   hypre_using_umpire_device=no ;;
1314 esac],
1315[hypre_using_umpire_device=no]
1316)
1317
1318AC_ARG_WITH(umpire-um,
1319AS_HELP_STRING([--with-umpire-um],
1320               [Use Umpire Allocator for unified memory (default is NO).]),
1321[case "${withval}" in
1322    yes) hypre_using_umpire_um=yes ;;
1323    no)  hypre_using_umpire_um=no ;;
1324    *)   hypre_using_umpire_um=no ;;
1325 esac],
1326[hypre_using_umpire_um=no]
1327)
1328
1329AC_ARG_WITH(umpire-pinned,
1330AS_HELP_STRING([--with-umpire-pinned],
1331               [Use Umpire Allocator for pinned memory (default is NO).]),
1332[case "${withval}" in
1333    yes) hypre_using_umpire_pinned=yes ;;
1334    no)  hypre_using_umpire_pinned=no ;;
1335    *)   hypre_using_umpire_pinned=no ;;
1336 esac],
1337[hypre_using_umpire_pinned=no]
1338)
1339
1340dnl the default setting with Umpire, for device and um
1341AC_ARG_WITH(umpire,
1342AS_HELP_STRING([--with-umpire],
1343               [Use Umpire Allocator for device and unified memory (default is NO).]),
1344[case "${withval}" in
1345    yes) hypre_using_umpire_device=yes
1346         hypre_using_umpire_um=yes ;;
1347    no) ;;
1348    *) ;;
1349 esac],
1350[]
1351)
1352
1353AC_ARG_WITH(umpire-include,
1354AS_HELP_STRING([--with-umpire-include=DIR],
1355               [User specifies that UMPIRE headers is in DIR.  The options
1356                --with-umpire-include --with-umpire-libs and
1357                --with-umpire-dirs must be used together.]),
1358[for umpire_dir in $withval; do
1359HYPRE_UMPIRE_INCLUDE="-I$umpire_dir $HYPRE_UMPIRE_INCLUDE"
1360done;
1361]
1362)
1363
1364AC_ARG_WITH(umpire-lib,
1365AS_HELP_STRING([--with-umpire-lib=LIBS],
1366               [LIBS is space-separated linkable list (enclosed in quotes) of libraries
1367                needed for UMPIRE. OK to use -L and -l flags in the list]),
1368[for umpire_lib in $withval; do
1369       HYPRE_UMPIRE_LIB="$umpire_lib $HYPRE_UMPIRE_LIB"
1370 done;
1371]
1372)
1373
1374AC_ARG_WITH(umpire-libs,
1375AS_HELP_STRING([--with-umpire-libs=LIBS],
1376               [LIBS is space-separated list (enclosed in quotes) of libraries
1377                needed for UMPIRE (base name only). The options --with-umpire-libs and
1378                --with-umpire-dirs must be used together.]),
1379[for umpire_lib in $withval; do
1380    HYPRE_UMPIRE_LIB="-l$umpire_lib $HYPRE_UMPIRE_LIB"
1381 done;
1382]
1383)
1384
1385AC_ARG_WITH(umpire-lib-dirs,
1386AS_HELP_STRING([--with-umpire-lib-dirs=DIRS],
1387               [DIRS is space-separated list (enclosed in quotes) of
1388                directories containing the libraries specified by
1389                --with-umpire-libs, e.g "usr/lib /usr/local/lib".
1390                The  options --with-umpire-libs and --with-umpire-dirs
1391                must be used together.]),
1392[for umpire_lib_dir in $withval; do
1393    HYPRE_UMPIRE_LIB_DIR="-L$umpire_lib_dir $HYPRE_UMPIRE_LIB_DIR"
1394 done;
1395]
1396)
1397
1398dnl ***** Caliper
1399
1400AC_ARG_WITH(caliper,
1401AS_HELP_STRING([--with-caliper],
1402               [Use Caliper instrumentation (default is NO).]),
1403[case "$withval" in
1404    yes) hypre_using_caliper=yes;;
1405    *)   hypre_using_caliper=no ;;
1406esac],
1407[hypre_using_caliper=no])
1408
1409AS_IF([test "x$with_caliper" = "xyes"],
1410      [AC_DEFINE(HYPRE_USING_CALIPER, 1, [Define to 1 if Caliper instrumentation is enabled])],
1411      [])
1412
1413AC_ARG_WITH(caliper-include,
1414AS_HELP_STRING([--with-caliper-include=DIR],
1415               [Directory where Caliper is installed.]),
1416[for caliper_inc_dir in $withval; do
1417    CALIPER_INCLUDE="-I$caliper_inc_dir $CALIPER_INCLUDE"
1418 done;
1419 hypre_user_gave_caliper_inc=yes]
1420)
1421
1422AC_ARG_WITH(caliper-lib,
1423AS_HELP_STRING([--with-caliper-lib=LIBS],
1424               [LIBS is space-separated linkable list (enclosed in quotes) of libraries
1425                needed for Caliper. OK to use -L and -l flags in the list]),
1426[for caliper_lib in $withval; do
1427    CALIPER_LIBS="$CALIPER_LIBS $caliper_lib"
1428 done;
1429 hypre_user_gave_caliper_lib=yes]
1430)
1431
1432dnl *********************************************************************
1433dnl * Select compilers if not already defined by command line options
1434dnl *********************************************************************
1435if test "$hypre_user_chose_ccompilers" = "no"
1436then
1437   if test "$hypre_using_mpi" = "no"
1438   then
1439      if test "$hypre_using_openmp" = "yes"
1440      then
1441         AC_CHECK_PROGS(CC, [xlc_r xlC_r xlc xlC icc icpc gcc g++ pgcc pgCC cc CC kcc KCC])
1442      else
1443         AC_CHECK_PROGS(CC, [xlc xlC icc icpc gcc g++ pgcc pgCC cc CC kcc KCC])
1444      fi
1445   else
1446      if test "$hypre_using_openmp" = "yes"
1447      then
1448         AC_CHECK_PROGS(CC, [mpxlc mpixlc_r mpixlc mpiicc mpigcc mpicc mpipgcc mpipgicc])
1449      else
1450         AC_CHECK_PROGS(CC, [mpxlc mpixlc mpiicc mpigcc mpicc mpipgcc mpipgicc])
1451      fi
1452   fi
1453
1454   if test "x$CC" = "x"
1455   then
1456      hypre_using_c=no
1457   fi
1458fi
1459
1460if test "$hypre_user_chose_cxxcompilers" = "no"
1461then
1462   if test "$hypre_using_mpi" = "no"
1463   then
1464      if test "$hypre_using_openmp" = "yes"
1465      then
1466         AC_CHECK_PROGS(CXX, [xlC_r xlc_r xlC xlc icpc icc g++ gcc pgCC pgcc pgc++ CC cc KCC kcc])
1467      else
1468         AC_CHECK_PROGS(CXX, [xlC xlc icpc icc g++ gcc pgCC pgcc pgc++ CC cc KCC kcc])
1469      fi
1470   else
1471      if test "$hypre_using_openmp" = "yes"
1472      then
1473         AC_CHECK_PROGS(CXX, [mpxlC mpixlcxx_r mpixlcxx mpixlC mpiicpc mpig++ mpic++ mpicxx mpiCC mpipgCC mpipgic++])
1474      else
1475         AC_CHECK_PROGS(CXX, [mpxlC mpixlcxx mpixlC mpiicpc mpig++ mpic++ mpicxx mpiCC mpipgCC mpipgic++])
1476      fi
1477   fi
1478
1479   if test "x$CXX" = "x"
1480   then
1481      hypre_using_cxx=no
1482   fi
1483fi
1484
1485if test "$hypre_using_fortran" = "yes" -a "$hypre_user_chose_fcompilers" = "no"
1486then
1487   if test "$hypre_using_mpi" = "no"
1488   then
1489      if test "$hypre_using_openmp" = "yes"
1490      then
1491         AC_CHECK_PROGS(FC, [xlf_r ifort gfortran g77 g95 pgf77 pgfortran f77])
1492      else
1493         AC_CHECK_PROGS(FC, [xlf ifort gfortran g77 g95 pgf77 pgfortran  f77])
1494      fi
1495   else
1496      if test "$hypre_using_openmp" = "yes"
1497      then
1498         AC_CHECK_PROGS(FC, [mpxlf mpixlf77_r mpiifort mpif77 mpipgf77 mpipgifort])
1499      else
1500         AC_CHECK_PROGS(FC, [mpxlf mpixlf77 mpiifort mpif77 mpipgf77 mpipgifort])
1501      fi
1502   fi
1503
1504   if test "x$FC" = "x"
1505   then
1506      hypre_using_fortran=no
1507   fi
1508fi
1509
1510if [test "x$hypre_using_cuda" = "xyes" && test "x$hypre_using_device_openmp" = "xyes"]
1511then
1512   AC_MSG_ERROR([--with-cuda and --with-device-openmp are mutually exclusive])
1513fi
1514
1515if [test "x$hypre_using_cuda" = "xyes" && test "x$hypre_using_hip" = "xyes"]
1516then
1517   AC_MSG_ERROR([--with-cuda and --with-hip are mutually exclusive])
1518fi
1519
1520if [test "x$hypre_using_hip" = "xyes" && test "x$hypre_using_device_openmp" = "xyes"]
1521then
1522   AC_MSG_ERROR([--with-hip and --with-device-openmp are mutually exclusive])
1523fi
1524
1525
1526if test "$hypre_user_chose_cudacompilers" = "no"
1527then
1528   if test "$hypre_using_device_openmp" = "yes"
1529   then
1530      if test "$hypre_using_mpi" = "no"
1531      then
1532         AC_CHECK_PROGS(CUCC, [xlc-gpu clang-gpu])
1533      else
1534         AC_CHECK_PROGS(CUCC, [mpixlc-gpu mpiclang-gpu])
1535      fi
1536   fi
1537
1538   if test "$hypre_using_cuda" = "yes"
1539   then
1540      AC_CHECK_PROGS(CUCC, nvcc, [""], ["${CUDA_HOME}/bin"])
1541      CUCC="\${HYPRE_CUDA_PATH}/bin/${CUCC} -ccbin=\${CXX}"
1542   fi
1543
1544   if test "$hypre_using_hip" = "yes"
1545   then
1546      AC_CHECK_PROGS(CUCC, hipcc)
1547   fi
1548fi
1549
1550dnl *********************************************************************
1551dnl * Check for general programs
1552dnl *********************************************************************
1553AC_PROG_MAKE_SET
1554AC_PROG_RANLIB
1555dnl AC_PROG_INSTALL
1556dnl AC_PROG_AWK
1557dnl AC_PROG_LN_S
1558
1559dnl *********************************************************************
1560dnl * Check for compiler related programs
1561dnl * Most of these AC_PROG_ macros check to see if the compilers works.
1562dnl *********************************************************************
1563if test "$hypre_using_c" = "yes"
1564then
1565   AC_PROG_CC
1566fi
1567
1568if test "$hypre_using_cxx" = "yes"
1569then
1570   AC_PROG_CXX
1571fi
1572
1573if test "$hypre_using_fortran" = "yes"
1574then
1575   AC_PROG_FC
1576   AC_FC_WRAPPERS
1577fi
1578
1579dnl *********************************************************************
1580dnl * For MPI, set the following:
1581dnl *********************************************************************
1582if test "$hypre_using_mpi" = "no"
1583then
1584   AC_DEFINE(HYPRE_SEQUENTIAL, 1, [Disable MPI, enable serial codes.])
1585else
1586   AC_HYPRE_CHECK_MPI([LIBS="$LIBS $MPILIBS"])
1587   AC_CHECK_FUNCS([MPI_Comm_f2c])
1588   AC_CACHE_CHECK([whether MPI_Comm_f2c is a macro],
1589     hypre_cv_func_MPI_Comm_f2c_macro,
1590     [AC_EGREP_CPP([mpi_header_defines_MPI_Comm_f2c], [
1591#include <mpi.h>
1592#ifdef MPI_Comm_f2c
1593  mpi_header_defines_MPI_Comm_f2c
1594#endif],
1595       hypre_cv_func_MPI_Comm_f2c_macro=yes,
1596       hypre_cv_func_MPI_Comm_f2c_macro=no)])
1597   if test $ac_cv_func_MPI_Comm_f2c = yes \
1598      || test $hypre_cv_func_MPI_Comm_f2c_macro = yes; then
1599     AC_DEFINE(HYPRE_HAVE_MPI_COMM_F2C,1,[Define to 1 if the routine MPI_Comm_f2c is found])
1600   fi
1601fi
1602
1603if test "$hypre_using_node_aware_mpi" = "yes"
1604then
1605   AC_DEFINE(HYPRE_USING_NODE_AWARE_MPI, 1, [Define to 1 if Node Aware MPI library is used])
1606fi
1607
1608if test "$hypre_using_memory_tracker" = "yes"
1609then
1610   AC_DEFINE(HYPRE_USING_MEMORY_TRACKER, 1, [Define to 1 if want to track memory operations in hypre])
1611fi
1612
1613dnl *********************************************************************
1614dnl * Define appropriate variables if user set blas to either essl or dxml
1615dnl *********************************************************************
1616if test "$hypre_user_chose_blas" = "yes"
1617then
1618   for blas_lib in $BLASLIBS; do
1619      if test $blas_lib = "-ldxml"
1620      then
1621         AC_DEFINE(HYPRE_USING_DXML, 1, [Using DXML for BLAS])
1622      fi
1623
1624      if test $blas_lib = "-lessl"
1625      then
1626         AC_DEFINE(HYPRE_USING_ESSL, 1, [Using ESSL for BLAS])
1627      fi
1628   done
1629fi
1630
1631dnl *********************************************************************
1632dnl * Find BLAS library if not already set by the user
1633dnl * If user specified --without-blas or a system one cannot be found,
1634dnl * default to internal HYPRE routines
1635dnl *********************************************************************
1636if test "$hypre_user_chose_blas" = "no"
1637then
1638   hypre_using_hypre_blas=yes
1639   if test "$hypre_using_fortran" = "yes"
1640   then
1641      AC_HYPRE_FIND_BLAS
1642      if test "$BLASLIBS" = "null"
1643      then
1644         AC_MSG_WARN([***************************************])
1645         AC_MSG_WARN([Cannot find BLAS library])
1646         AC_MSG_WARN([  configuring --without-blas])
1647         AC_MSG_WARN([***************************************])
1648      elif test "$BLASLIBS" != "internal"
1649      then
1650         hypre_using_hypre_blas=no
1651      fi
1652   fi
1653   if test "$hypre_using_hypre_blas" = "yes"
1654   then
1655      BLASLIBDIRS=""
1656      BLASLIBS=""
1657      AC_DEFINE(HYPRE_USING_HYPRE_BLAS, 1, [Using internal HYPRE routines])
1658   fi
1659fi
1660
1661dnl *********************************************************************
1662dnl * Define appropriate variables if user set lapack to essl
1663dnl *********************************************************************
1664if test "$hypre_user_chose_lapack" = "yes"
1665then
1666   for lapack_lib in $LAPACKLIBS; do
1667      if test $lapack_lib = "-lessl"
1668      then
1669         AC_DEFINE(HYPRE_USING_ESSL, 1, [Using ESSL for Lapack])
1670      fi
1671   done
1672fi
1673
1674dnl *********************************************************************
1675dnl * Find LAPACK library if not already set by the user
1676dnl * If user specified --without-lapack or a system one cannot be found,
1677dnl * default to internal HYPRE routines
1678dnl *********************************************************************
1679if test "$hypre_user_chose_lapack" = "no"
1680then
1681   hypre_using_hypre_lapack=yes
1682   if test "$hypre_using_fortran" = "yes"
1683   then
1684      AC_HYPRE_FIND_LAPACK
1685      if test "$LAPACKLIBS" = "null"
1686      then
1687         AC_MSG_WARN([***************************************])
1688         AC_MSG_WARN([Cannot find LAPACK library])
1689         AC_MSG_WARN([  configuring --without-lapack])
1690         AC_MSG_WARN([***************************************])
1691      elif test "$LAPACKLIBS" != "internal"
1692      then
1693         hypre_using_hypre_lapack=no
1694      fi
1695   fi
1696   if test "$hypre_using_hypre_lapack" = "yes"
1697   then
1698      LAPACKLIBDIRS=""
1699      LAPACKLIBS=""
1700      AC_DEFINE(HYPRE_USING_HYPRE_LAPACK, 1, [Using internal HYPRE routines])
1701   fi
1702fi
1703
1704dnl *********************************************************************
1705dnl * Determine if FEI and MLI are needed.
1706dnl * Note that MLI requires both FEI and SuperLU.
1707dnl *********************************************************************
1708if test "$hypre_using_fei" = "yes"
1709then
1710   HYPRE_FEI_SRC_DIR="$HYPRE_SRCDIR/FEI_mv"
1711   HYPRE_FEI_SUBDIRS="fei-hypre"
1712   HYPRE_FEI_HYPRE_FILES="$HYPRE_SRCDIR/FEI_mv/fei-hypre/*.o"
1713   HYPRE_FEI_FEMLI_FILES=
1714   if test "$hypre_using_mli" = "yes"
1715   then
1716      if test "$hypre_using_superlu" = "yes"
1717      then
1718         HYPRE_FEI_SUBDIRS="femli $HYPRE_FEI_SUBDIRS"
1719         HYPRE_FEI_FEMLI_FILES="$HYPRE_SRCDIR/FEI_mv/femli/*.o"
1720         AC_DEFINE(HAVE_MLI, 1, [Define to 1 if using MLI])
1721      fi
1722   fi
1723   AC_CHECK_LIB(stdc++, __gxx_personality_v0, LIBS="$LIBS -lstdc++")
1724else
1725   HYPRE_FEI_SRC_DIR=
1726   HYPRE_FEI_BASE_DIR=
1727   HYPRE_FEI_HYPRE_FILES=
1728   HYPRE_FEI_FEMLI_FILES=
1729fi
1730
1731dnl *********************************************************************
1732dnl * Determine if Euclid, ParaSails, and Pilut are needed
1733dnl *********************************************************************
1734if test "$hypre_using_distributed_ls" = "yes"
1735then
1736   HYPRE_DISTRIBUTED_LS_DIR="$HYPRE_SRCDIR/distributed_ls"
1737   HYPRE_EUCLID_FILES="$HYPRE_SRCDIR/distributed_ls/Euclid/*.o"
1738   HYPRE_PARASAILS_FILES="$HYPRE_SRCDIR/distributed_ls/ParaSails/*.o"
1739   HYPRE_PILUT_FILES="$HYPRE_SRCDIR/distributed_ls/pilut/*.o"
1740else
1741   HYPRE_DISTRIBUTED_LS_DIR=
1742   HYPRE_EUCLID_FILES=
1743   HYPRE_PARASAILS_FILES=
1744   HYPRE_PILUT_FILES=
1745fi
1746
1747dnl *********************************************************************
1748dnl * Set debug/optimization flags
1749dnl *********************************************************************
1750if test "$hypre_using_debug" = "yes"
1751then
1752   AC_HYPRE_DEBUG_FLAGS
1753   AC_DEFINE([HYPRE_DEBUG], 1, [Define to 1 if in debug mode])
1754else
1755   AC_HYPRE_OPTIMIZATION_FLAGS
1756fi
1757
1758CFLAGS="${CFLAGS} ${EXTRA_CFLAGS}"
1759CXXFLAGS="${CXXFLAGS} ${EXTRA_CXXFLAGS}"
1760
1761dnl *********************************************************************
1762dnl * Set large page option that is needed by all AIX platforms.
1763dnl *********************************************************************
1764hypre_platform=`uname`
1765case $hypre_platform in
1766   AIX* | aix* | Aix*) LDFLAGS="${LDFLAGS} -blpdata"
1767                       CFLAGS="${CFLAGS} -blpdata"
1768                       CXXFLAGS="${CXXFLAGS} -blpdata"
1769                       FFLAGS="${FFLAGS} -blpdata" ;;
1770esac
1771
1772dnl *********************************************************************
1773dnl * Set default link commands and suffix values
1774dnl *********************************************************************
1775dnl LINK_F77="${F77}"
1776LINK_FC='${FC}'
1777LINK_CC='${CC}'
1778LINK_CXX='${CXX}'
1779
1780HYPRE_LIBSUFFIX=".a"
1781
1782BUILD_PYTHON=0
1783PYTHON=""
1784if test "$hypre_using_python" = "yes"
1785then
1786   BUILD_PYTHON=1
1787   PYTHON="${hypre_python}"
1788fi
1789
1790BUILD_JAVA=0
1791if test "$hypre_using_java" = "yes"
1792then
1793   BUILD_JAVA=1
1794fi
1795
1796dnl *********************************************************************
1797dnl * Set INSURE options
1798dnl *********************************************************************
1799if test "$hypre_using_insure" = "yes"
1800then
1801dnl   LINK_F77="insure"
1802   LINK_FC="insure"
1803   LINK_CC="insure"
1804   LINK_CXX="insure"
1805   LDFLAGS=`mpicc -link-info | awk '{$1=""; print}'`
1806   LDFLAGS="$LDFLAGS ${hypre_insure_flags}"
1807dnl   F77="insure"
1808   FC="insure"
1809   CC="insure"
1810   CXX="insure"
1811   FFLAGS="`mpicc -link-info | awk '{$1=""; print}'` $FFLAGS"
1812   CFLAGS="`mpicc -link-info | awk '{$1=""; print}'` $CFLAGS"
1813   CXXFLAGS="`mpicc -link-info | awk '{$1=""; print}'` $CXXFLAGS"
1814fi
1815
1816dnl *********************************************************************
1817dnl * FIND libraries needed to link with hypre
1818dnl *********************************************************************
1819AC_CHECK_LIB(m, cabs, LIBS="$LIBS -lm")
1820dnl * Commenting this out because it doesn't really behave correctly.
1821dnl * This should probably be deleted altogether at some point. (RDF)
1822dnl AC_HYPRE_FIND_G2C
1823
1824dnl *********************************************************************
1825dnl * Check working user provided blas and lapack libraries
1826dnl *********************************************************************
1827 if test "$hypre_user_chose_blas" = "yes";
1828 then
1829   if test "$hypre_blas_lib_old_style" = "yes" -a "$hypre_blas_lib_dir_old_style" = "no";
1830   then
1831         AC_MSG_ERROR([*********** Unspecified BLASLIBDIRS error: ******************************
1832                       --with-blas-libs set without setting corresponding --with-blas-lib-dirs.
1833                       Please specify directory paths to preferred blas libraries.
1834                       Otherwise use --with-blas to search for library on the system.
1835                       See "configure --help" for usage details.
1836                       ********************************************************************],[9])
1837   fi
1838   if test "$hypre_blas_lib_old_style" = "no" -a "$hypre_blas_lib_dir_old_style" = "yes";
1839   then
1840         AC_MSG_ERROR([*********** Unspecified BLASLIB error: **********************************
1841                       --with-blas-lib-dirs set without setting corresponding --with-blas-libs.
1842                       Please specify base names of preferred blas libraries in the provided dir paths.
1843                       Otherwise use --with-blas to search for library on the system.
1844                       See "configure --help" for usage details.
1845                       ********************************************************************],[9])
1846   fi
1847dnl   AC_HYPRE_CHECK_USER_BLASLIBS
1848 fi
1849
1850 if test "$hypre_user_chose_lapack" = "yes";
1851 then
1852   if test "$hypre_lapack_lib_old_style" = "yes" -a "$hypre_lapack_lib_dir_old_style" = "no";
1853   then
1854         AC_MSG_ERROR([*********** Unspecified LAPACKLIBDIRS error: ******************************
1855                       --with-lapack-libs set without setting corresponding --with-lapack-lib-dirs.
1856                       Please specify directory paths to preferred lapack libraries.
1857                       Otherwise use --with-lapack to search for library on the system.
1858                       See "configure --help" for usage details.
1859                       ********************************************************************],[9])
1860   fi
1861   if test "$hypre_lapack_lib_old_style" = "no" -a "$hypre_lapack_lib_dir_old_style" = "yes";
1862   then
1863         AC_MSG_ERROR([*********** Unspecified LAPACKLIB error: **********************************
1864                       --with-lapack-lib-dirs set without setting corresponding --with-lapack-libs.
1865                       Please specify base names of preferred lapack libraries in the provided dir paths.
1866                       Otherwise use --with-lapack to search for library on the system.
1867                       See "configure --help" for usage details.
1868                       ********************************************************************],[9])
1869   fi
1870dnl   AC_HYPRE_CHECK_USER_LAPACKLIBS
1871 fi
1872
1873
1874dnl *********************************************************************
1875dnl * Set flags if needed to enable shared libraries and Python, Java
1876dnl *********************************************************************
1877if test "$hypre_using_shared" = "yes"
1878then
1879   HYPRE_LIBSUFFIX=".so"
1880   SHARED_SET_SONAME="-Wl,-soname,"
1881   SHARED_OPTIONS="-Wl,-z,defs"
1882
1883   dnl if test "$hypre_using_cuda" = "yes"
1884   dnl then
1885   dnl   SHARED_SET_SONAME="-Xlinker=-soname,"
1886   dnl   SHARED_OPTIONS="-Xlinker=-z,defs"
1887   dnl else
1888   dnl   SHARED_SET_SONAME="-Wl,-soname,"
1889   dnl   SHARED_OPTIONS="-Wl,-z,defs"
1890   dnl fi
1891
1892   SHARED_COMPILE_FLAG="-fPIC"
1893   case $hypre_platform in
1894      AIX* | aix* | Aix*) SHARED_COMPILE_FLAG="-qmkshrobj"
1895                          SHARED_BUILD_FLAG="-G"
1896dnl                          LINK_F77="${F77} -brtl"
1897                          LINK_FC='${FC} -brtl'
1898                          LINK_CC='${CC} -brtl'
1899                          LINK_CXX='${CXX} -brtl' ;;
1900      DARWIN* | darwin* | Darwin*) SHARED_BUILD_FLAG="-dynamiclib -undefined dynamic_lookup"
1901                                   HYPRE_LIBSUFFIX=".dylib"
1902                                   SHARED_SET_SONAME="-install_name @rpath/"
1903                                   SHARED_OPTIONS="-undefined error" ;;
1904                       *) SHARED_BUILD_FLAG="-shared" ;;
1905   esac
1906   SHARED_BUILD_FLAG="${SHARED_BUILD_FLAG} ${EXTRA_BUILDFLAGS}"
1907   FFLAGS="${FFLAGS} ${SHARED_COMPILE_FLAG}"
1908   CFLAGS="${CFLAGS} ${SHARED_COMPILE_FLAG}"
1909   CXXFLAGS="${CXXFLAGS} ${SHARED_COMPILE_FLAG}"
1910
1911dnl   BUILD_F77_SHARED="${F77} ${SHARED_BUILD_FLAG}"
1912   BUILD_FC_SHARED="\${FC} ${SHARED_BUILD_FLAG}"
1913   if test "$hypre_using_fei" = "yes"
1914   then
1915      BUILD_CC_SHARED="\${CXX} ${SHARED_BUILD_FLAG}"
1916   else
1917      BUILD_CC_SHARED="\${CC} ${SHARED_BUILD_FLAG}"
1918   fi
1919   BUILD_CXX_SHARED="\${CXX} ${SHARED_BUILD_FLAG}"
1920   if test "$hypre_using_cuda" == "yes" || test "$hypre_using_hip" == "yes"
1921   then
1922      dnl BUILD_CC_SHARED="\${CUCC} ${SHARED_BUILD_FLAG}"
1923      BUILD_CC_SHARED="\${CXX} ${SHARED_BUILD_FLAG}"
1924   fi
1925   dnl TODO HIP
1926fi
1927
1928
1929dnl *********************************************************************
1930dnl * Warn if caliper options are incomplete
1931dnl *********************************************************************
1932if test "$hypre_using_caliper" = "yes"
1933then
1934   if test "$hypre_user_gave_caliper_inc" != "yes"
1935   then
1936       AC_MSG_WARN([*******************************************************])
1937       AC_MSG_WARN([Configuring with --with-caliper=yes without providing])
1938       AC_MSG_WARN([--with-caliper-include=<path-to-caliper-install>.])
1939       AC_MSG_WARN([Using default user include path.])
1940       AC_MSG_WARN([NOTE: Caliper annotations may not work.])
1941       AC_MSG_WARN([*******************************************************])
1942   fi
1943   if test "$hypre_user_gave_caliper_lib" != "yes"
1944   then
1945       AC_MSG_WARN([*******************************************************])
1946       AC_MSG_WARN([Configuring with --with-caliper=yes without providing])
1947       AC_MSG_WARN([--with-caliper-lib=<path-to-caliper-lib>.])
1948       AC_MSG_WARN([Using default user library path.])
1949       AC_MSG_WARN([NOTE: Caliper annotations may not work.])
1950       AC_MSG_WARN([*******************************************************])
1951   fi
1952fi
1953
1954if [test "x$hypre_using_um" = "xyes"]
1955then
1956   if [test "x$hypre_using_cuda" != "xyes" && test "x$hypre_using_device_openmp" != "xyes" && test "x$hypre_using_hip" != "xyes"]
1957   then
1958      AC_MSG_ERROR([Asked for unified memory, but not using CUDA, HIP, or device OpenMP!])
1959   fi
1960fi dnl hypre_using_um
1961
1962dnl CUDA
1963if [test "$hypre_using_cuda" = "yes" || test "$hypre_using_device_openmp" = "yes"]
1964then
1965   AC_CHECK_HEADERS(["${CUDA_HOME}/include/cuda.h"], [hypre_found_cuda=yes; HYPRE_CUDA_PATH=${CUDA_HOME}])
1966
1967   if test "x$hypre_found_cuda" != "xyes"
1968   then
1969      AC_CHECK_HEADERS(["${CUDA_PATH}/include/cuda.h"], [hypre_found_cuda=yes; HYPRE_CUDA_PATH=${CUDA_PATH}])
1970   fi
1971
1972   if test "x$hypre_found_cuda" != "xyes"
1973   then
1974      AC_MSG_ERROR([unable to find cuda.h ... Ensure that CUDA_HOME or CUDA_PATH is set])
1975   fi
1976fi
1977
1978dnl *********************************************************************
1979dnl * Check for HIP header
1980dnl *********************************************************************
1981
1982dnl If the user has requested to use HIP, we first check the environment
1983dnl for ROCM_PATH to point at the ROCm installation. If that is not found,
1984dnl then we default to `/opt/rocm`.
1985dnl
1986dnl TODO: Add an ARG_WITH for rocm so the user can control the ROCm path
1987dnl       through the configure line
1988AS_IF([ test x"$hypre_using_hip" == x"yes" ],
1989      [ AS_IF([ test -n "$ROCM_PATH"],
1990              [ HYPRE_ROCM_PREFIX=$ROCM_PATH ],
1991              [ HYPRE_ROCM_PREFIX=/opt/rocm ])
1992
1993        AC_SUBST(HYPRE_ROCM_PREFIX)
1994        AC_CHECK_HEADERS( ["${HYPRE_ROCM_PREFIX}/include/hip/hip_common.h"],
1995                          [hypre_found_hip=yes],
1996                          [AC_MSG_ERROR([unable to find ${HYPRE_ROCM_PREFIX}/include/hip/hip_common.h ... Ensure ROCm is installed and set ROCM_PATH environment variable to ROCm installation path.])] )],
1997      [])
1998
1999
2000
2001dnl *********************************************************************
2002dnl * Set raja options
2003dnl *********************************************************************
2004if test "x$hypre_using_raja" = "xyes"
2005then
2006   AC_DEFINE(HYPRE_USING_RAJA, 1, [Define to 1 if executing on host/device with RAJA])
2007
2008   if test "$hypre_using_cuda" != "yes"
2009   then
2010      if [test "$CXX" = "mpixlC" || test "$CXX" = "xlC_r"]
2011      then
2012         CXXFLAGS="${CXXFLAGS} -+ -std=c++11"
2013      fi
2014   fi
2015
2016   dnl let CC be CXX
2017   CC=${CXX}
2018   LINK_CC=${LINK_CXX}
2019   CFLAGS=${CXXFLAGS}
2020fi
2021
2022dnl *********************************************************************
2023dnl * Set kokkos options
2024dnl *********************************************************************
2025if test "x$hypre_using_kokkos" = "xyes"
2026then
2027   AC_DEFINE(HYPRE_USING_KOKKOS, 1, [Define to 1 if executing on host/device with KOKKOS])
2028
2029   if test "$hypre_using_cuda" != "yes"
2030   then
2031      if [test "$CXX" = "mpixlC" || test "$CXX" = "xlC_r"]
2032      then
2033         CXXFLAGS="${CXXFLAGS} -+ -std=c++11"
2034      fi
2035   fi
2036
2037   dnl let CC be CXX
2038   CC=${CXX}
2039   LINK_CC=${LINK_CXX}
2040   CFLAGS=${CXXFLAGS}
2041fi
2042
2043dnl *********************************************************************
2044dnl * Set umpire options
2045dnl *********************************************************************
2046if test "x$hypre_using_umpire_host" = "xyes"
2047then
2048   hypre_using_umpire=yes
2049   AC_DEFINE(HYPRE_USING_UMPIRE_HOST, 1, [Define to 1 if using UMPIRE for host memory])
2050fi
2051
2052if test "x$hypre_using_umpire_device" = "xyes"
2053then
2054   hypre_using_umpire=yes
2055   AC_DEFINE(HYPRE_USING_UMPIRE_DEVICE, 1, [Define to 1 if using UMPIRE for device memory])
2056fi
2057
2058if test "x$hypre_using_umpire_um" = "xyes"
2059then
2060   hypre_using_umpire=yes
2061   AC_DEFINE(HYPRE_USING_UMPIRE_UM, 1, [Define to 1 if using UMPIRE for unified memory])
2062fi
2063
2064if test "x$hypre_using_umpire_pinned" = "xyes"
2065then
2066   hypre_using_umpire=yes
2067   AC_DEFINE(HYPRE_USING_UMPIRE_PINNED, 1, [Define to 1 if using UMPIRE for pinned memory])
2068fi
2069
2070if test "x$hypre_using_umpire" = "xyes"
2071then
2072   AC_DEFINE(HYPRE_USING_UMPIRE, 1, [Define to 1 if using UMPIRE])
2073fi
2074
2075dnl *********************************************************************
2076dnl * Set cuda options
2077dnl *********************************************************************
2078if test "$hypre_using_cuda" = "yes"
2079then
2080   AC_DEFINE(HYPRE_USING_GPU, 1, [Define to 1 if executing on GPU device])
2081
2082   AC_DEFINE(HYPRE_USING_CUDA, 1, [Define to 1 if executing on device with CUDA])
2083
2084   AC_DEFINE(HYPRE_USING_CUSPARSE, 1, [Define to 1 if using cuSPARSE])
2085
2086   if test "$hypre_using_gpu_profiling" = "yes"
2087   then
2088      AC_DEFINE(HYPRE_USING_NVTX, 1, [Define to 1 if using NVIDIA Tools Extension (NVTX)])
2089   fi
2090
2091   if test "$hypre_using_cusparse" = "yes"
2092   then
2093      AC_DEFINE(HYPRE_USING_CUSPARSE, 1, [Define to 1 if using cuSPARSE])
2094   fi
2095
2096   if test "$hypre_using_device_pool" = "yes"
2097   then
2098      AC_DEFINE(HYPRE_USING_DEVICE_POOL, 1, [Define to 1 if using device pooling allocator])
2099   fi
2100
2101   if test "$hypre_using_cublas" = "yes"
2102   then
2103      AC_DEFINE(HYPRE_USING_CUBLAS, 1, [Define to 1 if using cuBLAS])
2104   fi
2105
2106   if test "$hypre_using_curand" = "yes"
2107   then
2108      AC_DEFINE(HYPRE_USING_CURAND, 1, [Define to 1 if using cuRAND])
2109   fi
2110
2111   LINK_CC=${LINK_CXX}
2112   dnl LINK_CC='${CUCC}'
2113   dnl LINK_CXX='${CUCC}'
2114
2115   dnl CUDA SM
2116   if test "x$HYPRE_CUDA_SM" = "x"
2117   then
2118      HYPRE_CUDA_SM=70
2119   fi
2120
2121   HYPRE_CUDA_GENCODE=""
2122   for sm in ${HYPRE_CUDA_SM}; do
2123      HYPRE_CUDA_GENCODE="${HYPRE_CUDA_GENCODE}-gencode arch=compute_${sm},code=sm_${sm} "
2124   done
2125
2126   if test "$hypre_user_chose_cuflags" = "no"
2127   then
2128      CUFLAGS="-lineinfo -expt-extended-lambda -std=c++11 --x cu"
2129      if test "$hypre_using_debug" = "yes"
2130      then
2131         CUFLAGS="-g -O0 ${CUFLAGS}"
2132      else
2133         CUFLAGS="-O2 ${CUFLAGS}"
2134      fi
2135
2136      dnl if [test "${CXX}" = "mpixlC" || test "${CXX}" = "xlC_r" || test "${CXX}" = "xlC"]
2137      dnl then
2138      dnl   CUFLAGS="${CUFLAGS} -Xcompiler \"-Wno-deprecated-register -Wenum-compare\""
2139      dnl fi
2140
2141      CUFLAGS="${CUFLAGS} -Xcompiler \"${CXXFLAGS}\""
2142   fi
2143
2144   dnl if test "$hypre_using_shared" = "yes"
2145   dnl then
2146   dnl   CUFLAGS="${CUFLAGS} -Xcompiler ${SHARED_COMPILE_FLAG}"
2147   dnl fi
2148
2149   dnl CFLAGS=${CXXFLAGS}
2150   dnl LDFLAGS="-Xcompiler \"${LDFLAGS}\""
2151   HYPRE_CUDA_INCLUDE='-I${HYPRE_CUDA_PATH}/include'
2152   HYPRE_CUDA_LIBS='-L${HYPRE_CUDA_PATH}/lib64 -lcudart'
2153   if test "$hypre_using_gpu_profiling" = "yes"
2154   then
2155      HYPRE_CUDA_LIBS+=" -lnvToolsExt"
2156   fi
2157
2158   if test "$hypre_using_cusparse" = "yes"
2159   then
2160      HYPRE_CUDA_LIBS+=" -lcusparse"
2161   fi
2162
2163   if test "$hypre_using_cublas" = "yes"
2164   then
2165      HYPRE_CUDA_LIBS+=" -lcublas"
2166   fi
2167
2168   if test "$hypre_using_curand" = "yes"
2169   then
2170      HYPRE_CUDA_LIBS+=" -lcurand"
2171   fi
2172fi
2173
2174dnl *********************************************************************
2175dnl * Set HIP options
2176dnl *********************************************************************
2177AS_IF([test x"$hypre_using_hip" == x"yes"],
2178      [
2179        AC_DEFINE(HYPRE_USING_GPU, 1, [Define to 1 if executing on GPU device])
2180        AC_DEFINE(HYPRE_USING_HIP, 1, [HIP being used])
2181
2182        dnl hipcc is just a perl script that wraps things like detection
2183        dnl of the AMD GPU and the actual invocation of the clang compiler
2184        dnl from ROCm that supports HIP and all the command line foo needed
2185        dnl by the compiler. You can force hipcc to emit what it actually does
2186        dnl by setting HIPCC_VERBOSE=7 in your environment.
2187        dnl AC_CHECK_PROGS(HIPCC, hipcc)
2188
2189        dnl (Ab)Using CUCC when compiling HIP
2190        dnl At this time, we need the linker to be hipcc in order to link
2191        dnl in device code.
2192        LINK_CC=${LINK_CXX}
2193        dnl LINK_CC='${CUCC}'
2194        dnl LINK_CXX='${CUCC}'
2195
2196
2197        if test "x${HYPRE_CUDA_SM}" != "x"
2198        then
2199           HYPRE_CUDA_GENCODE="--amdgpu-target="
2200           for sm in ${HYPRE_CUDA_SM}; do
2201              HYPRE_CUDA_GENCODE="${HYPRE_CUDA_GENCODE}${sm},"
2202           done
2203           HYPRE_CUDA_GENCODE="`echo ${HYPRE_CUDA_GENCODE}|sed 's/,$//'`"
2204        fi
2205
2206        dnl The "-x hip" is necessary to override the detection of .c files which clang
2207        dnl interprets as C and therefore invokes the C compiler rather than the HIP part
2208        dnl of clang. Put HIPCXXFLAGS at the end so the user can override from
2209        dnl from the configure line.
2210        HIPCXXFLAGS="-x hip -std=c++14 ${HIPCXXFLAGS}"
2211
2212        dnl If not in debug mode, at least -O2, but the user can override with
2213        dnl with HIPCXXFLAGS on the configure line. If in debug mode, -O0 -Wall
2214        dnl plus flags for debugging symbols
2215        AS_IF([test x"$hypre_using_debug" == x"yes"],
2216              [HIPCXXFLAGS="-O0 -Wall -g -ggdb ${HIPCXXFLAGS}"],
2217              [HIPCXXFLAGS="-O2 ${HIPCXXFLAGS}"],)
2218
2219
2220        dnl If we're doing a shared build, we need the compile flag for it
2221        dnl Note we're not just using CXXFLAGS here because that can suck other
2222        dnl things that don't play nice, like openmp.
2223        if test "$hypre_using_shared" = "yes"
2224        then
2225           HIPCXXFLAGS="${SHARED_COMPILE_FLAG} ${HIPCXXFLAGS}"
2226        fi
2227
2228        dnl (Ab)Use CUFLAGS to capture HIP compilation flags
2229        dnl Put HIPCXXFLAGS at the end so the user can override the optimization level.
2230        if test "$hypre_user_chose_cuflags" = "no"
2231        then
2232           CUFLAGS="${HIPCPPFLAGS} ${HIPCXXFLAGS}"
2233        fi
2234
2235        dnl rocThrust depends on rocPrim so we need both for Thrust on AMD GPUs.
2236        dnl These are header-only so no linking needed.
2237        HYPRE_HIP_INCL="-I${HYPRE_ROCM_PREFIX}/rocthrust/include"
2238        HYPRE_HIP_INCL="${HYPRE_HIP_INCL} -I${HYPRE_ROCM_PREFIX}/rocprim/include"
2239
2240        dnl HIP library
2241        HYPRE_HIP_LIBS="-L${HYPRE_ROCM_PREFIX}/lib -lamdhip64"
2242
2243        dnl rocSPARSE, for things like dcsrmv on AMD GPUs
2244        AS_IF([test x"$hypre_using_rocsparse" == x"yes"],
2245              [AC_DEFINE(HYPRE_USING_ROCSPARSE, 1, [rocSPARSE being used])
2246               HYPRE_HIP_LIBS="${HYPRE_HIP_LIBS} -lrocsparse"
2247               HYPRE_HIP_INCL="${HYPRE_HIP_INCL} -I${HYPRE_ROCM_PREFIX}/rocsparse/include"
2248               ])
2249
2250        dnl Note rocSPARSE requires rocBLAS, so this is only controlling
2251        dnl whether HYPRE explicitly uses rocBLAS in other places or not.
2252        dnl So we don't need to add any extra libs or anything.
2253        AS_IF([test x"$hypre_using_rocblas" == x"yes"],
2254              [AC_DEFINE(HYPRE_USING_ROCBLAS, 1, [rocBLAS being used])
2255              HYPRE_HIP_INCL="${HYPRE_HIP_INCL} -I${HYPRE_ROCM_PREFIX}/rocblas/include"
2256              ])
2257
2258        dnl rocRAND: random number generation on AMD GPUs
2259        AS_IF([test x"$hypre_using_rocrand" == x"yes"],
2260              [AC_DEFINE(HYPRE_USING_ROCRAND, 1, [rocRAND being used])
2261               HYPRE_HIP_LIBS="${HYPRE_HIP_LIBS} -lrocrand"
2262               HYPRE_HIP_INCL="${HYPRE_HIP_INCL} -I${HYPRE_ROCM_PREFIX}/rocrand/include"
2263               ])
2264
2265        dnl rocTX tracing API
2266        AS_IF([test x"$hypre_using_gpu_profiling" == x"yes"],
2267              [AC_DEFINE(HYPRE_USING_ROCTX, 1, [Define to 1 if using AMD rocTX profiling])
2268               HYPRE_HIP_INCL="${HYPRE_HIP_INCL} -I${HYPRE_ROCM_PREFIX}/roctracer/include"
2269               HYPRE_HIP_LIBS="${HYPRE_HIP_LIBS} -lroctx64"
2270               ])
2271
2272      ]) dnl AS_IF([test x"$hypre_using_hip" == x"yes"]
2273
2274
2275
2276
2277dnl *********************************************************************
2278dnl * Set unified memory options
2279dnl *********************************************************************
2280if test "$hypre_using_um" != "yes"
2281then
2282   dnl Without UM
2283   if test "$hypre_using_cuda" = "yes"
2284   then
2285      AC_MSG_NOTICE([***********************************************************************])
2286      AC_MSG_NOTICE([Configuring with --with-cuda=yes without unified memory.])
2287      AC_MSG_NOTICE([It only works for structured solvers and selected unstructured solvers])
2288      AC_MSG_NOTICE([Use --enable-unified-memory to compile with unified memory.])
2289      AC_MSG_NOTICE([***********************************************************************])
2290   fi
2291   if test "$hypre_using_hip" = "yes"
2292   then
2293      AC_MSG_NOTICE([***********************************************************************])
2294      AC_MSG_NOTICE([Configuring with --with-hip=yes without unified memory.])
2295      AC_MSG_NOTICE([It only works for structured solvers and selected unstructured solvers])
2296      AC_MSG_NOTICE([Use --enable-unified-memory to compile with unified memory.])
2297      AC_MSG_NOTICE([***********************************************************************])
2298   fi
2299   if test "$hypre_using_device_openmp" = "yes"
2300   then
2301      AC_MSG_NOTICE([***********************************************************************])
2302      AC_MSG_NOTICE([Configuring with --with-device-openmp=yes without unified memory.])
2303      AC_MSG_NOTICE([It only works for structured solvers and selected unstructured solvers])
2304      AC_MSG_NOTICE([Use --enable-unified-memory to compile with unified memory.])
2305      AC_MSG_NOTICE([***********************************************************************])
2306   fi
2307fi
2308
2309dnl *********************************************************************
2310dnl * Set OpenMP options
2311dnl *********************************************************************
2312if test "$hypre_using_openmp" = "yes"
2313then
2314   AC_DEFINE([HYPRE_USING_OPENMP],1,[Enable OpenMP support])
2315fi
2316
2317dnl *********************************************************************
2318dnl * Set Device OpenMP options
2319dnl *********************************************************************
2320if test "$hypre_using_device_openmp" = "yes"
2321then
2322   AC_DEFINE(HYPRE_USING_CUSPARSE, 1, [Define to 1 if using cuSPARSE])
2323
2324   if test "$hypre_using_gpu_profiling" = "yes"
2325   then
2326      AC_DEFINE(HYPRE_USING_NVTX, 1, [NVTX being used])
2327   fi
2328
2329   AC_DEFINE(HYPRE_USING_DEVICE_OPENMP, 1, [Define to 1 if executing on device with OpenMP])
2330
2331   AC_DEFINE(HYPRE_USING_GPU, 1, [Define to 1 if executing on GPU device])
2332
2333   AC_DEFINE(HYPRE_DEVICE_OPENMP_ALLOC, 1, [Define to 1 if using OpenMP on device [target alloc version]])
2334
2335   dnl AC_DEFINE(HYPRE_DEVICE_OPENMP_MAPPED, 1, [Define to 1 if using OpenMP on device [target mapped version]])
2336
2337   if test "$hypre_user_chose_cuflags" = "no"
2338   then
2339      CUFLAGS=${CFLAGS}
2340
2341      if [test "$CUCC" = "clang-gpu" || test "$CUCC" = "mpiclang-gpu"]
2342      then
2343         CUFLAGS+=" -fopenmp-nonaliased-maps"
2344      fi
2345      if [test "$CUCC" = "clang++-gpu" || test "$CUCC" = "mpiclang++-gpu"]
2346      then
2347         CUFLAGS+=" -fopenmp-nonaliased-maps"
2348      fi
2349   fi
2350
2351   if test "$hypre_using_debug" = "yes"
2352   then
2353      AC_DEFINE(HYPRE_DEVICE_OPENMP_CHECK, 1, [Define to 1 if strictly checking OpenMP offload directives])
2354   fi
2355
2356   HYPRE_CUDA_INCLUDE='-I${HYPRE_CUDA_PATH}/include'
2357   HYPRE_CUDA_LIBS='-L${HYPRE_CUDA_PATH}/lib64 -lcudart -lcusparse -lcurand'
2358   if test "$hypre_using_gpu_profiling" = "yes"
2359   then
2360      HYPRE_CUDA_LIBS+=" -lnvToolsExt"
2361   fi
2362
2363   dnl let CC be CXX
2364   dnl CC=${CXX}
2365   LINK_CC='${CUCC}'
2366   LINK_CXX='${CUCC}'
2367   dnl CXXFLAGS="-x c++ ${CXXFLAGS}"
2368   dnl CFLAGS=${CXXFLAGS}
2369fi
2370
2371if [test "x$hypre_using_cuda" = "xyes" || test "x$hypre_using_device_openmp" = "xyes"]
2372then
2373   if test "x$hypre_using_cuda_streams" = "xyes"
2374   then
2375      AC_DEFINE([HYPRE_USING_CUDA_STREAMS],1,[Define to 1 if using CUDA streams])
2376   fi
2377fi
2378
2379dnl *********************************************************************
2380dnl * Set memory env
2381dnl *********************************************************************
2382if test "x$hypre_using_um" = "xyes"
2383then
2384   AC_DEFINE([HYPRE_USING_UNIFIED_MEMORY],1,[Define to 1 if using unified memory])
2385else
2386   if [test "x$hypre_using_cuda" = "xyes" || test "x$hypre_using_device_openmp" = "xyes" || test "x$hypre_using_hip" = "xyes"]
2387   then
2388      AC_DEFINE([HYPRE_USING_DEVICE_MEMORY],1,[Define to 1 if using device memory without UM])
2389   else
2390      AC_DEFINE([HYPRE_USING_HOST_MEMORY],1,[Define to 1 if using host memory only])
2391   fi
2392fi
2393
2394if test "$hypre_gpu_mpi" = "yes"
2395then
2396   AC_DEFINE([HYPRE_WITH_GPU_AWARE_MPI],1,[Define to 1 if using GPU aware MPI])
2397fi
2398
2399dnl *********************************************************************
2400dnl * Set installation directories
2401dnl *********************************************************************
2402HYPRE_INSTALLDIR="${prefix}"
2403HYPRE_LIBINSTALL="${libdir}"
2404HYPRE_INCINSTALL="${includedir}"
2405
2406dnl *********************************************************************
2407dnl * Define machine architecture
2408dnl *********************************************************************
2409AC_HYPRE_SET_ARCH
2410
2411dnl *********************************************************************
2412dnl * AC_SUBST performs the variable substitutions so they may be used in
2413dnl * the Makefile.in files. Some macros call AC_SUBST for some of these
2414dnl * variables, but it does no damage to call it again.
2415dnl *********************************************************************
2416
2417dnl *********************************************************************
2418dnl * compilers and load flags
2419dnl *********************************************************************
2420
2421AC_SUBST(CC)
2422AC_SUBST(CXX)
2423dnl AC_SUBST(F77)
2424AC_SUBST(FC)
2425AC_SUBST(CFLAGS)
2426AC_SUBST(CXXFLAGS)
2427dnl AC_SUBST(F77FLAGS)
2428AC_SUBST(FCFLAGS)
2429AC_SUBST(FFLAGS)
2430AC_SUBST(LDFLAGS)
2431
2432dnl AC_SUBST(LINK_F77)
2433AC_SUBST(LINK_FC)
2434AC_SUBST(LINK_CC)
2435AC_SUBST(LINK_CXX)
2436
2437dnl AC_SUBST(BUILD_F77_SHARED)
2438AC_SUBST(BUILD_FC_SHARED)
2439AC_SUBST(BUILD_CC_SHARED)
2440AC_SUBST(BUILD_CXX_SHARED)
2441AC_SUBST(SHARED_COMPILE_FLAG)
2442AC_SUBST(SHARED_BUILD_FLAG)
2443AC_SUBST(SHARED_SET_SONAME)
2444AC_SUBST(SHARED_OPTIONS)
2445
2446AC_SUBST(BUILD_PYTHON)
2447AC_SUBST(PYTHON)
2448
2449AC_SUBST(BUILD_JAVA)
2450
2451dnl *********************************************************************
2452dnl * Installation Directories
2453dnl *********************************************************************
2454AC_SUBST(HYPRE_INSTALLDIR)
2455AC_SUBST(HYPRE_LIBINSTALL)
2456AC_SUBST(HYPRE_INCINSTALL)
2457
2458dnl *********************************************************************
2459dnl * General purpose header files, libraries and directories
2460dnl *********************************************************************
2461AC_SUBST(LIBS)
2462AC_SUBST(FLIBS)
2463AC_SUBST(FCLIBS)
2464dnl *********************************************************************
2465dnl * suffix for hypre libraries
2466dnl *********************************************************************
2467AC_SUBST(HYPRE_LIBSUFFIX)
2468
2469dnl *********************************************************************
2470dnl * MPI-related header files and libraries and directories for
2471dnl * those libraries
2472dnl *********************************************************************
2473AC_SUBST(MPIINCLUDE)
2474AC_SUBST(MPILIBS)
2475AC_SUBST(MPILIBDIRS)
2476AC_SUBST(MPIFLAGS)
2477
2478dnl *********************************************************************
2479dnl * distributed_ls related files, libraries and directories
2480dnl *********************************************************************
2481AC_SUBST(HYPRE_DISTRIBUTED_LS_DIR)
2482AC_SUBST(HYPRE_EUCLID_FILES)
2483AC_SUBST(HYPRE_PARASAILS_FILES)
2484AC_SUBST(HYPRE_PILUT_FILES)
2485
2486dnl *********************************************************************
2487dnl * Node_Aware_MPI
2488dnl *********************************************************************
2489AC_SUBST(HYPRE_NAP_INCLUDE)
2490
2491dnl *********************************************************************
2492dnl * FEI-related files, libraries and directories
2493dnl *********************************************************************
2494AC_SUBST(HYPRE_FEI_SRC_DIR)
2495AC_SUBST(HYPRE_FEI_BASE_DIR)
2496AC_SUBST(HYPRE_FEI_SUBDIRS)
2497AC_SUBST(HYPRE_FEI_HYPRE_FILES)
2498AC_SUBST(HYPRE_FEI_FEMLI_FILES)
2499
2500dnl *********************************************************************
2501dnl * BLAS & LAPACK related information
2502dnl *********************************************************************
2503AC_SUBST(BLASLIBDIRS)
2504AC_SUBST(BLASLIBS)
2505AC_SUBST(LAPACKLIBDIRS)
2506AC_SUBST(LAPACKLIBS)
2507
2508dnl *********************************************************************
2509dnl * RAJA information
2510dnl *********************************************************************
2511AC_SUBST(HYPRE_RAJA_LIB_DIR)
2512AC_SUBST(HYPRE_RAJA_INCLUDE)
2513AC_SUBST(HYPRE_RAJA_LIB)
2514
2515dnl *********************************************************************
2516dnl * KOKKOS information
2517dnl *********************************************************************
2518AC_SUBST(HYPRE_KOKKOS_SRC_DIR)
2519AC_SUBST(HYPRE_KOKKOS_LIB_DIR)
2520AC_SUBST(HYPRE_KOKKOS_INCLUDE)
2521AC_SUBST(HYPRE_KOKKOS_LIB)
2522
2523dnl *********************************************************************
2524dnl * UMPIRE information
2525dnl *********************************************************************
2526AC_SUBST(HYPRE_UMPIRE_LIB_DIR)
2527AC_SUBST(HYPRE_UMPIRE_INCLUDE)
2528AC_SUBST(HYPRE_UMPIRE_LIB)
2529
2530dnl *********************************************************************
2531dnl * CUDA stuff
2532dnl *********************************************************************
2533AC_SUBST(CUFLAGS)
2534AC_SUBST(CUCC)
2535AC_SUBST(HYPRE_CUDA_GENCODE)
2536AC_SUBST(HYPRE_CUDA_PATH)
2537AC_SUBST(HYPRE_CUDA_INCLUDE)
2538AC_SUBST(HYPRE_CUDA_LIBS)
2539
2540dnl *********************************************************************
2541dnl * HIP stuff
2542dnl *********************************************************************
2543AC_SUBST(HYPRE_HIP_INCL)
2544AC_SUBST(HYPRE_HIP_LIBS)
2545
2546dnl *********************************************************************
2547dnl * Caliper instrumentation
2548dnl *********************************************************************
2549AC_SUBST(CALIPER_INCLUDE)
2550AC_SUBST(CALIPER_LIBS)
2551
2552dnl *********************************************************************
2553dnl * SuperLU instrumentation
2554dnl *********************************************************************
2555AC_SUBST(SUPERLU_INCLUDE)
2556AC_SUBST(SUPERLU_LIBS)
2557
2558dnl *********************************************************************
2559dnl * DSuperLU instrumentation
2560dnl *********************************************************************
2561AC_SUBST(DSUPERLU_INCLUDE)
2562AC_SUBST(DSUPERLU_LIBS)
2563
2564dnl *********************************************************************
2565dnl * ar & ranlib substitution
2566dnl *********************************************************************
2567AC_SUBST(AR)
2568AC_SUBST(RANLIB)
2569
2570dnl *********************************************************************
2571dnl * Define the files to be configured and made
2572dnl *********************************************************************
2573AC_CONFIG_FILES([config/Makefile.config])
2574
2575AC_OUTPUT()
2576