-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1285 lines (1078 loc) · 38.3 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Process this file with autoconf to produce a configure script
#-------------------------------------------------------------------------------
# This file is part of Code_Saturne, a general-purpose CFD tool.
#
# Copyright (C) 1998-2021 EDF S.A.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA 02110-1301, USA.
#-------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Initialization
#------------------------------------------------------------------------------
m4_define([cs_licence_c_comment],
[/*
This file is part of Code_Saturne, a general-purpose CFD tool.
Copyright (C) 1998-2021 EDF S.A.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/])
# Note: proper determination of the version string requires the NEWS file
# to be maintained properly (as it should be anyways).
m4_define([cs_version_string],
[m4_normalize(esyscmd([build-aux/cs_version.py]))])
AC_INIT([code_saturne],[cs_version_string],[saturne-support@edf.fr],[],[https://code-saturne.org])
AC_CONFIG_SRCDIR([src/apps/cs_solver.c])
# Use the config directory for libtool stuff ...
AC_CONFIG_AUX_DIR(build-aux)
AC_CONFIG_MACRO_DIR(m4)
AC_CANONICAL_TARGET
AC_CONFIG_HEADERS([cs_config.h])
# Initialize automake with the following options:
# - foreign, so as to handle the absence of ChangeLog (automatically generated)
# - tar-pax, so as to handle long lines (> 99 characters) in tar archives
# Warnings can be activated at bootstrap with 'autoreconf -vi --warnings=all'
AM_INIT_AUTOMAKE([foreign tar-pax subdir-objects])
# Enable maintainer mode by default for a developer checkout
AS_IF([test -d ${srcdir}/.git],
[AM_MAINTAINER_MODE([enable])],
[AM_MAINTAINER_MODE([disable])])
# Enable silent rules with "./configure --enable-silent-rules" or "make V=0"
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
#------------------------------------------------------------------------------
# Checks for programs.
#------------------------------------------------------------------------------
AC_ARG_WITH(shell-env,
[AS_HELP_STRING([--with-shell-env],
[source given or detected shell environment])],
[if test "x$with_shell_env" = "x"; then
shell_env=auto
elif test -f "$with_shell_env"; then
shell_env="$with_shell_env"
fi],
[shell_env=no]
)
AC_SUBST(shell_env)
AM_CONDITIONAL(HAVE_SHELL_LAUNCHER, [test "${shell_env}" != no])
# Check for environment modules
#------------------------------
CS_AC_TEST_ENV_MODULES
CS_AC_SALOME_ENV
# Check for C and Fortran compilers
#----------------------------------
user_CPPFLAGS=$CPPFLAGS
user_CFLAGS=$CFLAGS
user_CFLAGS_HOT=$CFLAGS_HOT
user_CXXFLAGS=$CXXFLAGS
user_FCFLAGS=$FCFLAGS
user_FCFLAGS_HOT=$FCFLAGS_HOT
user_LDFLAGS=$LDFLAGS
user_LIBS=$LIBS
user_CS_LD=$CS_LD
AC_PROG_CC
AC_PROG_CXX
AC_PROG_FC
AC_PROG_INSTALL
AC_PROG_LN_S
AM_PROG_CC_C_O
AC_PROG_SED
if test "x$CC" = "x" ; then
AC_MSG_FAILURE([cannot find C compiler])
fi
if test "x$FC" = "x" ; then
AC_MSG_FAILURE([cannot find Fortran compiler])
fi
# Needed to use Microsoft archiver lib.exe
# It copies the ar-lib script, similar to the compile script
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
# Debug or production compilation mode (debug by default) ?
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug], [enable debugging (reduces optimization)])],
[
case "${enableval}" in
yes) debug=yes ;;
no) debug=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-debug]) ;;
esac
],
[ debug=no ]
)
AC_SUBST(debug)
AC_ARG_ENABLE(profile,
[AS_HELP_STRING([--enable-profile], [enable profiling])],
[
case "${enableval}" in
yes) profile=yes ;;
no) profile=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-profile]) ;;
esac
],
[ profile=no ]
)
AC_SUBST(profile)
# Optionally deactivate automatic determination of flags on known systems
AC_ARG_ENABLE(auto-flags,
[AS_HELP_STRING([--disable-auto-flags], [do not define *FLAGS on known systems])],
[
case "${enableval}" in
yes) auto_flags=yes ;;
no) auto_flags=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-auto-flags]) ;;
esac
],
[ auto_flags=yes ]
)
# Optionnaly install the code with relocatable features
AC_ARG_ENABLE(relocatable,
[AS_HELP_STRING([--enable-relocatable], [enable relocatable installation])],
[
case "${enableval}" in
yes) relocatable=yes ;;
no) relocatable=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-relocatable]) ;;
esac
],
[ relocatable=no ]
)
AC_SUBST(relocatable)
AM_CONDITIONAL(HAVE_RELOCATABLE, [test "${relocatable}" = yes])
if test "${relocatable}" = yes ; then
AC_DEFINE([HAVE_RELOCATABLE], 1, [Relocatable installation])
fi
# Default compiler options (may be modified
# by defining CFLAGS in the environment)
#------------------------------------------
if test "x$auto_flags" = "xyes" ; then
# Source associated recommended compiler options
if test -f "$srcdir/config/cs_auto_flags.sh" ; then
AC_MSG_NOTICE([sourcing config/cs_auto_flags.sh (test for known compilers)])
. "$srcdir/config/cs_auto_flags.sh"
else
AC_MSG_WARN([config/cs_auto_flags.sh default configuration file not found])
fi
# Default flags
CPPFLAGS="$cppflags_default $user_CPPFLAGS"
CFLAGS="$cflags_default $user_CFLAGS"
CXXFLAGS="$cxxflags_default $user_CXXFLAGS"
CXXFLAGS_STD="$cxxflags_default_std"
FCFLAGS="$fcflags_default $user_FCFLAGS"
LDFLAGS="$ldflags_default $user_LDFLAGS"
LIBS="$libs_default $user_LIBS"
LDRPATH="$ldflags_rpath"
if test "x$debug" = xyes; then
# Debug flags
CFLAGS_DBG="$cflags_default_dbg"
CXXFLAGS_DBG="$cxxflags_default_dbg"
FCFLAGS_DBG="$fcflags_default_dbg"
# Add debug flags for linker
LDFLAGS="$LDFLAGS $ldflags_default_dbg"
else
# Normal optimization flags
CFLAGS_OPT="$cflags_default_opt"
CXXFLAGS_OPT="$cxxflags_default_opt"
FCFLAGS_OPT="$fcflags_default_opt"
# Hot optimization flags
CFLAGS_HOT="$cflags_default_hot $user_CFLAGS_HOT"
CXXFLAGS_HOT="$cxxflags_default_hot"
FCFLAGS_HOT="$fcflags_default_hot $user_FCFLAGS_HOT"
# Add optimization flags for linker
LDFLAGS="$LDFLAGS $ldflags_default_opt"
if test "x$profile" = xyes; then
# Profiling flags
CFLAGS_DBG="$cflags_default_prf"
CXXFLAGS_DBG="$cxxflags_default_prf"
FCFLAGS_DBG="$fcflags_default_prf"
# Add profiling flags for linker
LDFLAGS="$LDFLAGS $ldflags_default_prf"
fi
fi
AC_SUBST(CFLAGS_DBG)
AC_SUBST(CFLAGS_OPT)
AC_SUBST(CFLAGS_HOT)
AC_SUBST(CXXFLAGS_DBG)
AC_SUBST(CXXFLAGS_OPT)
AC_SUBST(CXXFLAGS_HOT)
AC_SUBST(CXXFLAGS_STD)
AC_SUBST(FCFLAGS_DBG)
AC_SUBST(FCFLAGS_OPT)
AC_SUBST(FCFLAGS_HOT)
AC_SUBST(LDRPATH)
AC_SUBST(cs_cc_version_string, [${cs_ac_cc_version}])
AC_SUBST(cs_cxx_version_string, [${cs_ac_cxx_version}])
AC_SUBST(cs_fc_version_string, [${cs_ac_fc_version}])
AC_SUBST(cs_nvcc_version_string, [${cs_ac_nvcc_version}])
if test "x$cs_ac_cc_version" != "x" -a "x$cs_ac_cc_version" != "xunknown" ; then
AC_DEFINE_UNQUOTED([CS_CC_VERSION_STRING], ["$cs_ac_cc_version"], [C compiler version string])
fi
if test "x$cs_ac_cxx_version" != "x" -a "x$cs_ac_cxx_version" != "xunknown" ; then
AC_DEFINE_UNQUOTED([CS_CXX_VERSION_STRING], ["$cs_ac_cxx_version"], [C++ compiler version string])
fi
if test "x$cs_ac_fc_version" != "x" -a "x$cs_ac_fc_version" != "xunknown" ; then
AC_DEFINE_UNQUOTED([CS_FC_VERSION_STRING], ["$cs_ac_fc_version"], [Fortran compiler version string])
fi
if test "x$cs_ac_nvcc_version" != "x" ; then
AC_DEFINE_UNQUOTED([CS_NVCC_VERSION_STRING], ["$cs_ac_nvcc_version"], [CUDA compiler version string])
fi
fi
# Add some preprocessor flags to include additional system features
#------------------------------------------------------------------
case "$host_os" in
linux*)
CPPFLAGS="${CPPFLAGS} -D_POSIX_C_SOURCE=200809L"
;;
darwin*)
CPPFLAGS="${CPPFLAGS} -D_DARWIN_C_SOURCE"
;;
*)
;;
esac
# Preprocessor flags for debugging purposes
if test "x$debug" = "xyes"; then
CPPFLAGS="${CPPFLAGS} -DDEBUG"
else
CPPFLAGS="${CPPFLAGS} -DNDEBUG"
fi
# We may only turn on processing for libtool now that the basic compiler
# and linker flags are set (to avoid issues with linkers with different
# modes such as 32 and 64 bit which may be modified by compiler or
# linker flags).
# AC_DISABLE_SHARED may not be used inside a test, as it seems to
# take effect whether the result is true or not (maybe due to a bug),
# so we directly use autoconf's enable_shared variable.
if test "$host_os" = mingw64 ; then
enable_shared=no
fi
AC_SUBST(enable_shared)
# Initialize libtool.
m4_pushdef([cs_lt_init_args], [disable-static, win32-dll, no-pic])
LT_INIT([disable-static, win32-dll])
# In static mode, multiple definitions must be allowed for the linker.
# On some systems, such as Mac OS X in static mode, limitations
# of the linker require special handling for user user subroutines
# (due to not handling multiple definitions in the case of Mac OS X).
# Detect this here, so as to transfer the name of a specific solution
# (if necessary) to the Python package.
cs_special_user_link=
if test "x$enable_shared" = "xno" ; then
case "$host_os" in
linux* | *bsd* | cnk* | mingw64 | cygwin* )
if test "x$auto_flags" = "xyes" ; then
LDFLAGS="${LDFLAGS} -Wl,--allow-multiple-definition"
fi
;;
darwin*)
cs_special_user_link='ar_x'
;;
esac
else
case "$host_os" in
linux* )
if test "x$auto_flags" = "xyes" ; then
case "$cs_ac_cc_version" in
Cray* )
CFLAGS="${CFLAGS} -fPIC"
;;
*)
LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
;;
esac
case "$cs_ac_cxx_version" in
Cray* )
CXXFLAGS="${CXXFLAGS} -fPIC"
;;
*)
;;
esac
case "$cs_ac_fc_version" in
Cray* )
FCFLAGS="${FCFLAGS} -fPIC"
;;
*)
;;
esac
fi
;;
esac
fi
AC_SUBST(cs_special_user_link)
#------------------------------------------------------------------------------
# Checks for typedefs, structures, and compiler characteristics.
#------------------------------------------------------------------------------
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_PID_T
AC_HEADER_TIME
AC_HEADER_STDBOOL
AC_CHECK_TYPES([long long, unsigned long long])
AC_CHECK_TYPES([int32_t])
AC_CHECK_TYPES([int64_t])
AC_CHECK_TYPES([uint32_t])
AC_CHECK_TYPES([uint64_t])
AC_CHECK_TYPES([ptrdiff_t])
AC_CHECK_SIZEOF([void *])
AC_CHECK_SIZEOF([short])
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([long long])
AC_CHECK_SIZEOF([float])
AC_CHECK_SIZEOF([double])
# Use long global numbers ?
AC_ARG_ENABLE(long-gnum,
[AS_HELP_STRING([--enable-long-gnum],[use long global numbers])],
[
case "${enableval}" in
yes) cs_have_long_gnum=yes ;;
no) cs_have_long_gnum=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-long-gnum]) ;;
esac
],
[ cs_have_long_gnum=yes ]
)
if test "x$cs_have_long_gnum" = "xyes"; then
AC_DEFINE([HAVE_LONG_GNUM], 1, [Use 64-bit type for cs_gnum_t.])
fi
AC_SUBST(cs_have_long_gnum)
# Use long local numbers ?
AC_ARG_ENABLE(long-lnum,
[AS_HELP_STRING([--enable-long-lnum],[use long local numbers])],
[
case "${enableval}" in
yes) cs_have_long_lnum=yes ;;
no) cs_have_long_lnum=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-long-lnum]) ;;
esac
],
[ cs_have_long_lnum=no ]
)
if test "x$cs_have_long_lnum" = "xyes"; then
AC_DEFINE([HAVE_LONG_LNUM], 1, [Use 64-bit type for cs_lnum_t.])
fi
AC_SUBST(cs_have_long_lnum)
# Check for Fortran module generation
CS_AC_TEST_FC_MOD
# First determination of Fortran libraries (before OpenMP test)
AC_FC_LIBRARY_LDFLAGS
#------------------------------------------------------------------------------
# Determine OpenMP support
#------------------------------------------------------------------------------
# It seems that we may not use AC_OPENMP both for C and Fortran, so
# we use our own method here, based on flags already set by default
# or by the user.
# From this point, no runtime tests should be run, so no issues should
# arise due to missing RPATH or LD_LIBRARY_PATH values in case of non-standard
# compiler install paths, such as may happen with gcc's libgomp.
cs_have_openmp=no
cs_have_openmp_f=no
AC_ARG_ENABLE(openmp,
[AS_HELP_STRING([--disable-openmp], [disable OpenMP support])],
[
case "${enableval}" in
yes) cs_have_openmp=yes ;;
no) cs_have_openmp=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-openmp]) ;;
esac
],
[ cs_have_openmp=yes ]
)
if test "x$cs_have_openmp" = "xyes" ; then
saved_CFLAGS="$CFLAGS"
saved_CXXFLAGS="$CFLAGS"
saved_FCFLAGS="$FCFLAGS"
saved_LDFLAGS="$LDFLAGS"
CFLAGS="${CFLAGS} ${cflags_default_omp}"
CXXFLAGS="${CXXFLAGS} ${cxxflags_default_omp}"
FCFLAGS="${FCFLAGS} ${fcflags_default_omp}"
LDFLAGS="${LDFLAGS} ${cflags_default_omp}"
AC_MSG_CHECKING([for OpenMP (C)])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <omp.h>]],
[[ omp_get_num_threads();]])],
[cs_have_openmp=yes],
[cs_have_openmp=no])
AC_MSG_RESULT($cs_have_openmp)
if test "x$cs_have_openmp" = "xyes" ; then
AC_MSG_CHECKING([for OpenMP simd])
# Note that as the m4 language does not allow escaping [ and ],
# we use quadrigraphs @<:@ and @>:@ instead here.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <omp.h>]],
[[double a@<:@128@:>@;
#pragma omp for simd safelen(4)
for (int i = 0; i < 128; i++) a@<:@i@:>@ = i;]])],
[cs_have_openmp_simd=yes],
[cs_have_openmp_simd=no])
AC_MSG_RESULT($cs_have_openmp_simd)
AC_LANG_PUSH([Fortran])
AC_MSG_CHECKING([for OpenMP (Fortran)])
AC_LINK_IFELSE([AC_LANG_PROGRAM([],
[[
integer n
n = omp_get_num_threads()
]])],
[cs_have_openmp_f=yes],
[cs_have_openmp_f=no])
AC_MSG_RESULT($cs_have_openmp_f)
AC_LANG_POP([Fortran])
fi
if test "x$cs_have_openmp" = "xyes" ; then
AC_DEFINE([HAVE_OPENMP], 1, [openmp support])
if test "x$cs_have_openmp_simd" = "xyes" ; then
AC_DEFINE([HAVE_OPENMP_SIMD], 1, [openmp simd support])
fi
if test "x$cs_have_openmp_f" = "xno" ; then
FCFLAGS="$saved_FCFLAGS"
fi
else
cs_have_openmp=no
CFLAGS="$saved_CFLAGS"
CXXFLAGS="$saved_CXXFLAGS"
FCFLAGS="$saved_FCFLAGS"
LDFLAGS="$saved_LDFLAGS"
fi
fi
AC_SUBST(cs_have_openmp)
# Now that compiler options are determined (relative notably to OpenMP),
# update Fortran libraries necessary to link.
if test "x$cs_have_openmp_f" = "xyes" ; then
AC_FC_LIBRARY_LDFLAGS
fi
#------------------------------------------------------------------------------
# Determine CUDA support
#------------------------------------------------------------------------------
CS_AC_TEST_CUDA
if test "x$auto_flags" = "xyes" ; then
if test "$cs_have_cuda" = "yes"; then
$NVCCFLAGS="$NVCCFLAGS $nvccflags_default"
if test "x$debug" = xyes; then
$NVCCFLAGS_DBG="$nvccflags_default_dbg"
else
$NVCCFLAGS="$NVCCFLAGS $nvccflags_default_opt"
if test "x$profile" = xyes; then
$NVCCFLAGS="$NVCCFLAGS $nvccflags_default_prf"
fi
fi
AC_SUBST(NVCCFLAGS_DBG)
AC_SUBST(NVCCFLAGS_OPT)
AC_SUBST(NVCCCFLAGS_HOT)
fi
fi
#------------------------------------------------------------------------------
# Checks for Python support.
#------------------------------------------------------------------------------
AC_ARG_VAR([PYTHON], [the Python interpreter])
AM_PATH_PYTHON(["3.4"])
# On MinGW hosts, Automake/Python mixes Windows-style and GNU-style paths
# It seems better to use the standard way of installing Python modules,
# as it is on Unix systems (whichever is chosen, Python modules will be
# frozen by cx_freeze for Windows packaging).
# So, we choose to override some Python paths.
if test "$host_os" = mingw64 ; then
AC_MSG_NOTICE([Overriding Python paths on MinGW hosts])
am_cv_python_pythondir=\${prefix}/lib/python$PYTHON_VERSION/site-packages
AC_MSG_CHECKING([for $PYTHON script directory])
pythondir=$am_cv_python_pythondir
pkgpythondir=\${pythondir}/$PACKAGE
AC_MSG_RESULT([$pythondir])
am_cv_python_pyexecdir=\${exec_prefix}/lib/python$PYTHON_VERSION/site-packages
AC_MSG_CHECKING([for $PYTHON extension module directory])
pyexecdir=$am_cv_python_pyexecdir
pkgpyexecdir=\${pyexecdir}/$PACKAGE
AC_MSG_RESULT([$pyexecdir])
AC_SUBST(pythonversion, [${PYTHON_VERSION}])
fi
win_prefix=""
if test "$host_os" = mingw64 ; then
win_prefix=`cygpath --path --windows "${prefix}"`
AC_SUBST(win_prefix, [${win_prefix}])
fi
#------------------------------------------------------------------------------
# Checks for additional version information.
#------------------------------------------------------------------------------
# Define the different version number where needed
# (detailed version numbers are generated during the build step as a
# precaution, so that when switching revisions not requiring
# rebuild of the configure file / re-configure, the correct
# version number is used).
cs_version_short=`$PYTHON ${srcdir}/build-aux/cs_version.py --short`
AC_SUBST(cs_version_short)
#------------------------------------------------------------------------------
# Optional shared library and plugin support
#------------------------------------------------------------------------------
cs_have_dlloader=no
AC_ARG_ENABLE(dlloader,
[AS_HELP_STRING([--disable-dlloader], [disable dynamic shared library loading])],
[
case "${enableval}" in
yes) cs_have_dlloader=yes ;;
no) cs_have_dlloader=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-dlloader]) ;;
esac
],
[ cs_have_dlloader=yes ]
)
if test "x$cs_have_dlloader" = "xyes" ; then
saved_LIBS="$LIBS"
LIBS="$LIBS -ldl"
AC_MSG_CHECKING([for dlopen])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <dlfcn.h>]],
[[ dlopen("none.so", RTLD_LAZY);]])],
[cs_have_dlloader=dlopen],
[cs_have_dlloader=no])
AC_MSG_RESULT($cs_have_dlloader)
if test "x$cs_have_dlloader" = "xdlopen" ; then
AC_DEFINE([HAVE_DLOPEN], 1, [dlopen support])
else
LIBS="$saved_LIBS"
cs_have_dlloader=no
fi
fi
# Use RTLD_GLOBAL for dlopen ?
# Note setting enable_dlopen_rtld_global in the last statement is not
# useful on modern systems but avoids error due to empty else on Centos 6...
AC_ARG_ENABLE(dlopen-rtld-global,
[AS_HELP_STRING([--enable-dlopen-rtld-global], [add RTLD_GLOBAL to dlopen flags])],
[
case "${enableval}" in
yes) AC_DEFINE([CS_DLOPEN_USE_RTLD_GLOBAL], 1,
[use RTLD_GLOBAL in dlopen flags.]) ;;
no) ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-dlopen-rtld-global]) ;;
esac
],
[ enable_dlopen_rtld_global=no ]
)
#------------------------------------------------------------------------------
# Checks for libraries.
#------------------------------------------------------------------------------
CS_AC_TEST_PLE(["2.0.0"])
AM_CONDITIONAL(HAVE_INTERNAL_PLE, test x$cs_have_internal_ple = xyes)
if test "x$cs_have_internal_ple" = xyes; then
AC_CONFIG_SUBDIRS([libple])
fi
CS_AC_TEST_BLAS([$cs_have_openmp])
CS_AC_TEST_MPI
CS_AC_TEST_METIS
CS_AC_TEST_SCOTCH
CS_AC_TEST_HDF5
CS_AC_TEST_CGNS
CS_AC_TEST_MED
CS_AC_TEST_CCM
CS_AC_TEST_EOS
CS_AC_TEST_FREESTEAM
CS_AC_TEST_COOLPROP
CS_AC_TEST_ZLIB
CS_AC_TEST_MEDCOUPLING
CS_AC_TEST_CATALYST
CS_AC_TEST_MELISSA
CS_AC_TEST_MUMPS
CS_AC_TEST_PETSC
CS_AC_TEST_AMGX
CS_AC_TEST_DOCS
cs_have_neptune_cfd=no
if test -f ${srcdir}/neptune_cfd/configure; then
cs_have_neptune_cfd=yes
fi
# Check if we need to force link with C++
cs_have_link_cxx=no
if test x$cs_have_neptune_cfd = xyes ; then
cs_have_link_cxx=yes
elif test x$cs_have_med_link_cxx = xyes ; then
cs_have_link_cxx=yes
elif test x$cs_have_medcoupling = xyes -o x$cs_have_paramedmem = xyes ; then
if test x$enable_shared = xno -o x$cs_have_plugin_medcoupling = xno ; then
cs_have_link_cxx=yes
fi
elif test x$cs_have_eos = xyes ; then
cs_have_link_cxx=yes
elif test x$cs_have_coolprop = xyes ; then
cs_have_link_cxx=yes
elif test x$cs_have_catalyst = xyes ; then
if test x$enable_shared = xno -o x$cs_have_plugin_catalyst = xno ; then
cs_have_link_cxx=yes
fi
fi
if test x$user_CS_LD != "x" ; then
CS_LD=$user_CS_LD
elif test $cs_have_link_cxx = yes ; then
CS_LD=$CXX
else
CS_LD=$CC
fi
AC_SUBST(CS_LD)
AM_CONDITIONAL(HAVE_LINK_CXX, test x$cs_have_link_cxx = xyes)
#------------------------------------------------------------------------------
# Enables Code_Saturne front-end
#------------------------------------------------------------------------------
AC_ARG_ENABLE(frontend, [AS_HELP_STRING([--disable-frontend],
[disable front-end elements])],
[
case "${enableval}" in
yes) cs_have_frontend=yes ;;
no) cs_have_frontend=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-frontend]) ;;
esac
],
[ cs_have_frontend=yes ]
)
AM_CONDITIONAL(HAVE_FRONTEND, test x$cs_have_frontend = xyes)
AC_SUBST(cs_have_frontend)
#------------------------------------------------------------------------------
# Enables Code_Saturne back-end
#------------------------------------------------------------------------------
AC_ARG_ENABLE(backend, [AS_HELP_STRING([--disable-backend],
[disable back-end elements])],
[
case "${enableval}" in
yes) cs_have_backend=yes ;;
no) cs_have_backend=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-backend]) ;;
esac
],
[ cs_have_backend=yes ]
)
AM_CONDITIONAL(HAVE_BACKEND, test x$cs_have_backend = xyes)
AC_SUBST(cs_have_backend)
#------------------------------------------------------------------------------
# Enables Code_Saturne graphical user interface
#------------------------------------------------------------------------------
AC_ARG_ENABLE(gui, [AS_HELP_STRING([--disable-gui],
[disable the Graphical User Interface])],
[
case "${enableval}" in
yes) cs_have_gui=check ;;
no) cs_have_gui=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-gui]) ;;
esac
],
[ cs_have_gui=check ]
)
if test "x$cs_have_frontend" = "xno" ; then
cs_have_gui=no
fi
#------------------------------------------------------------------------------
# Checks for PyQt support.
#------------------------------------------------------------------------------
# Test for PyQt4 or PyQt5
cs_have_gui_qt4=no
cs_have_gui_qt5=no
if test "x$cs_have_gui" = "xcheck" ; then
if test "x$QT_SELECT" = "x" -o "x$QT_SELECT" = "x5" ; then
AC_MSG_CHECKING([for PyQt5 version >= 5.0])
prog="[import sys, string
try: import PyQt5
except ImportError: sys.exit(1)
from PyQt5.QtCore import *
if list(map(int, QT_VERSION_STR.split('.'))) < [5,0,0]: sys.exit(1)
if list(map(int, PYQT_VERSION_STR.split('.'))) < [5,0,0]: sys.exit(1)
sys.exit(0)]"
${PYTHON} -c "${prog}"
retval=$?
if test $retval -ne 0 ; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
cs_have_gui=yes
cs_have_gui_qt5=yes
fi
fi
fi
if test "x$cs_have_gui" = "xcheck" ; then
cs_have_gui=no
if test "x$QT_SELECT" = "x" -o "x$QT_SELECT" = "x4" ; then
AC_MSG_CHECKING([for PyQt4 version >= 4.5])
prog="[import sys, string
try: import PyQt4
except ImportError: sys.exit(1)
from PyQt4.QtCore import *
if list(map(int, QT_VERSION_STR.split('.'))) < [4,5,0]: sys.exit(1)
if list(map(int, PYQT_VERSION_STR.split('.'))) < [4,5,0]: sys.exit(1)
sys.exit(0)]"
${PYTHON} -c "${prog}"
retval=$?
if test $retval -ne 0 ; then
AC_MSG_RESULT([no])
AC_MSG_FAILURE([cannot find PyQt5 support (>= 5.0) or PyQt4 support (>= 4.5), Graphical User Interface cannot be installed])
else
AC_MSG_RESULT([yes])
cs_have_gui=yes
cs_have_gui_qt4=yes
fi
fi
fi
# Test for PyQt4 developer tools
if test "x$cs_have_gui_qt4" = "xyes" ; then
# Try to find PyQt4 tools through Python interpreter
prog="[import os, sys
from PyQt4.QtCore import QCoreApplication
app = QCoreApplication([])
path = app.applicationDirPath()
sys.stdout.write(path)]"
PYPATH=`${PYTHON} -c "${prog}"`
# On Cygwin hosts, the PATH does not seem to be correctly found
if test "$host_os" = cygwin ; then
PYPATH=/usr/lib/python$PYTHON_VERSION/site-packages/PyQt4
fi
AC_ARG_VAR([PYUIC4], [PyQt4 user interfaces compiler])
AC_ARG_VAR([PYRCC4], [PyQt4 resources compiler])
# On MinGW (MSYS) or Cygwin (BASH) build systems, and for MinGW hosts,
# pyuic4 is a batch file and cannot be run from the shell.
# To bypass this issue, we launch pyuic4 through cmd.exe
# with a "standard" PATH.
# pyrcc4 does not need this trick as it is a standard executable.
if test "$host_os" = mingw64 ; then
if test "$build_os" = mingw64 ; then
CMDPYUIC4="cmd //C $PYPATH/Lib/site-packages/PyQt4/pyuic4"
elif test "$build_os" = cygwin ; then
CMDPYUIC4="cmd /C $PYPATH/Lib/site-packages/PyQt4/pyuic4"
fi
fi
if test "x$PYUIC4" = "x" ; then
AC_PATH_PROG([PYUIC4], [pyuic4], [$CMDPYUIC4], [${PYPATH}:$PATH])
fi
if test "x$PYRCC4" = "x" ; then
AC_PATH_PROG([PYRCC4], [pyrcc4], [], [${PYPATH}:$PATH])
fi
if test "x$PYUIC4" = "x" -o "x$PYRCC4" = "x" ; then
AC_MSG_FAILURE([cannot find PyQt4 dev tools, Graphical User Interface cannot be installed])
cs_have_gui=no
fi
fi
# Test for PyQt5 developer tools
if test "x$cs_have_gui_qt5" = "xyes" ; then
# Try to find PyQt5 tools through Python interpreter
prog="[import os, sys
from PyQt5.QtCore import QCoreApplication
app = QCoreApplication([])
path = app.applicationDirPath()
sys.stdout.write(path)]"
PYPATH=`${PYTHON} -c "${prog}"`
## On Cygwin hosts, the PATH does not seem to be correctly found
#if test "$host_os" = cygwin ; then
# PYPATH=/usr/lib/python$PYTHON_VERSION/site-packages/PyQt5
#fi
AC_ARG_VAR([PYUIC5], [PyQt5 user interfaces compiler])
AC_ARG_VAR([PYRCC5], [PyQt5 resources compiler])
if test "x$PYUIC5" = "x" ; then
AC_PATH_PROG([PYUIC5], [pyuic5], [$CMDPYUIC5], [${PYPATH}:$PATH])
fi
if test "x$PYRCC5" = "x" ; then
AC_PATH_PROG([PYRCC5], [pyrcc5], [], [${PYPATH}:$PATH])
fi
if test "x$PYUIC5" = "x" -o "x$PYRCC5" = "x" ; then
AC_MSG_FAILURE([cannot find PyQt5 dev tools, Graphical User Interface cannot be installed])
cs_have_gui=no
fi
fi
#------------------------------------------------------------------------------
# Checks for Qt tools.
#------------------------------------------------------------------------------
AM_CONDITIONAL(HAVE_GUI, [test "x$cs_have_gui" = "xyes"])
AC_SUBST(cs_have_gui)
AM_CONDITIONAL(HAVE_QT4, [test "x$cs_have_gui_qt4" = "xyes"])
AC_SUBST(cs_have_gui_qt4)
AM_CONDITIONAL(HAVE_QT5, [test "x$cs_have_gui_qt5" = "xyes"])
AC_SUBST(cs_have_gui_qt5)
#------------------------------------------------------------------------------
# Checks for header files.
#------------------------------------------------------------------------------
AC_HEADER_STDC
AC_CHECK_HEADERS([sys/types.h sys/utsname.h sys/stat.h dirent.h stddef.h])
AC_CHECK_HEADERS([unistd.h fcntl.h sys/types.h sys/signal.h])
AC_CHECK_HEADERS([sys/procfs.h sys/sysinfo.h sys/resource.h])
AC_CHECK_HEADERS([float.h string.h sys/time.h])
#------------------------------------------------------------------------------
# Checks for library functions.
#------------------------------------------------------------------------------
AC_CHECK_FUNCS([mkdir chdir stat dup2 access])
AC_CHECK_FUNCS([snprintf])
AC_CHECK_FUNCS([getcwd sleep])
AC_CHECK_FUNCS([getpwuid geteuid])
AC_CHECK_FUNCS([uname linkat])
AC_CHECK_FUNCS([clock_gettime clock_getcpuclockid])
AC_CHECK_FUNCS([getrusage gettimeofday sbrk sysinfo])
AC_CHECK_FUNCS([posix_memalign])
AC_CHECK_FUNCS([memset])
AC_CHECK_FUNCS([sigaction])
AC_CHECK_FUNCS([strtok_r])
saved_LIBS="$LIBS"
LIBS="${LIBS} -lm"
AC_CHECK_FUNCS([pow modf tgamma erf])
LIBS="$saved_LIBS"
AC_FUNC_STRTOD
#------------------------------------------------------------------------------
# Checks for system services.
#------------------------------------------------------------------------------
# Largefile support (may be disabled in case of conflicts)
#------------------
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
# Test for size of off_t once largefile support is activated
AC_CHECK_SIZEOF([off_t])
# Optional malloc hooks support (for glibc)
#------------------------------
cs_have_malloc_hooks=no