-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
3672 lines (3333 loc) · 113 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
dnl $Header$
dnl Process this file with autoconf to produce a configure script.
dnl
dnl MBDyn (C) is a multibody analysis code.
dnl http://www.mbdyn.org
dnl
dnl Copyright (C) 1996-2023
dnl
dnl Pierangelo Masarati <[email protected]>
dnl Paolo Mantegazza <[email protected]>
dnl
dnl Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
dnl via La Masa, 34 - 20156 Milano, Italy
dnl http://www.aero.polimi.it
dnl
dnl Changing this copyright notice is forbidden.
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation (version 2 of the License).
dnl
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
dnl ----------------------------------------------------------------
dnl Redefine AC_INIT_BINSH to provide copyright notice at top
dnl of generated configure script. Prints simple copyright.
define([AC_INIT_BINSH],
[[#! /bin/sh
] ] [
#
# MBDyn (C) is a multibody analysis code.
# http://www.mbdyn.org
#
# Copyright (C) 1996-2023
#
# Pierangelo Masarati <[email protected]>
# Paolo Mantegazza <[email protected]>
#
# Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
# via La Masa, 34 - 20156 Milano, Italy
# http://www.aero.polimi.it
#
# Changing this copyright notice is forbidden.
#
# 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 (version 2 of the License).
#
#
echo ""
echo " Copyright (C) 1996-2023"
echo " "
echo " Pierangelo Masarati <[email protected]>"
echo " Paolo Mantegazza <[email protected]>"
echo " "
echo " Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano"
echo " via La Masa, 34 - 20156 Milano, Italy"
echo " http://www.aero.polimi.it"
echo " "
echo " Restrictions apply, see COPYRIGHT and LICENSE files."
echo ""
])dnl
dnl ----------------------------------------------------------------
dnl Disable config.cache!
define([AC_CACHE_LOAD], )dnl
define([AC_CACHE_SAVE], )dnl
dnl ================================================================
dnl configure.ac for MBDyn
DATE=`date "+%B %e, %Y"`
# set unset (borrowed from autoconf 2.14a)
if (unset FOO) >/dev/null 2>&1; then
ol_unset=unset
else
ol_unset=false
fi
# unset CDPATH
$ol_unset CDPATH || test "${CDPATH:+set}" != set || CDPATH=: && export CDPATH
AC_INIT([mbdyn],m4_esyscmd(tr -d '\n' < build/version))
AC_CONFIG_AUX_DIR(build)dnl
AC_CONFIG_SRCDIR([build/version])
MBDYN_DEVEL=no
if test -f "$ac_aux_dir/DEVEL" ; then
MBDYN_DEVEL=yes
AC_DEFINE(MBDYN_DEVEL,1,[define to enable features under development])
MB_VERSION="Devel"
else
MB_VERSION=`cat $ac_aux_dir/version`
fi
if test -z "$MB_VERSION"; then
AC_MSG_ERROR([could not determine version])
fi
echo "Configuring MBDyn $MB_VERSION ..."
dnl Determine host platform
dnl we try not to use this for much
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([subdir-objects])
dnl We use autoconf features new to 2.13.
dnl aclocal.m4 should be built using aclocal from automake 1.4
dnl libtool 1.3.3 should be installed.
AC_PREREQ([2.69])dnl Required Autoconf version
AC_CONFIG_HEADERS([include/mbconfig.h])
AH_TOP([
/*
* MBDyn (C) is a multibody analysis code.
* http://www.mbdyn.org
*
* Copyright (C) 1996-2023
*
* Pierangelo Masarati <[email protected]>
* Paolo Mantegazza <[email protected]>
*
* Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
* via La Masa, 34 - 20156 Milano, Italy
* http://www.aero.polimi.it
*
* Changing this copyright notice is forbidden.
*
* 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 (version 2 of the License).
*
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
])
AH_BOTTOM([
/* this file must be included by every .c/.cc file */
#include "mbdyn.h"
])
top_builddir=`pwd`
dnl AC_SUBST(top_builddir)dnl
dnl ----------------------------------------------------------------
dnl Checks for args.
dnl
AC_MSG_CHECKING(configure arguments)
AC_PREFIX_DEFAULT(/usr/local/mbdyn)
dnl ----------------------------------------------------------------
dnl --with-subdir
mbdyn_subdir="/mbdyn"
AC_ARG_WITH(subdir,
[ --with-subdir=DIR change default subdirectory used for installs],
[case "$withval" in
no)
mbdyn_subdir=""
;;
yes)
;;
/*|\\*)
mbdyn_subdir="$withval"
;;
*)
mbdyn_subdir="/$withval"
;;
esac
])dnl
AC_SUBST(mbdyn_subdir)dnl
PKG_PROG_PKG_CONFIG
dnl ----------------------------------------------------------------
dnl General "enable" options
OL_ARG_ENABLE(Werror,[ --enable-Werror enable building with -Werror], yes)dnl
OL_ARG_ENABLE(debug,[ --enable-debug enable debugging], no)dnl
OL_ARG_WITH(debug_mode,[ --with-debug-mode[={none|mem}] with debug mode {none|mem}],none,[none mem])
OL_ARG_ENABLE(runtime_loading,[ --enable-runtime-loading enable runtime loading], auto)dnl
OL_ARG_WITH(static_modules,[ --with-static-modules build (known) modules as static],auto,[no yes auto])
OL_ARG_ENABLE(crypt,[ --enable-crypt enable crypt (deprecated)], no)dnl
OL_ARG_ENABLE(eig,[ --enable-eig enable direct eigensolution
(needs one of LAPACK, ARPACK or JDQZ)],auto,[auto yes no])dnl needs LAPACK, ARPACK or JDQZ
OL_ARG_ENABLE(schur,[ --enable-schur enable Schur parallel solver
(needs MPI and either Metis or Chaco)],auto,[auto yes no])dnl needs MPI and Metis or Chaco
OL_ARG_ENABLE(multithread,[ --enable-multithread enable multithread assembly],no,[auto yes no force])dnl
OL_ARG_ENABLE(multithread_naive,[ --enable-multithread-naive enable multithread naive solver],no,[auto yes no force])dnl
OL_ARG_ENABLE(mbc,[ --enable-mbc enable MBC - multibody communication library],yes)dnl
OL_ARG_ENABLE(netcdf,[ --enable-netcdf enable NetCDF4 based binary output],auto,[auto yes no])dnl
OL_ARG_ENABLE(python,[ --enable-python enable Python support],no)dnl
OL_ARG_ENABLE(octave,[ --enable-octave enable Octave support],no)dnl
OL_ARG_ENABLE(octave_utils,[ --enable-octave-utils enable Octave utility functions],no)dnl
AC_ARG_WITH(mkoctfile,[ --with-mkoctfile=exec-path Octave build tool mkoctfile],[
ol_with_mkoctfile_exec="$withval"
],[ol_with_mkoctfile_exec=mkoctfile])
AC_ARG_WITH(octave-cli,[ --with-octave-cli=exec-path Octave command line interpreter],[
ol_with_octave_cli_exec="$withval"
],[ol_with_octave_cli_exec=""])
OL_ARG_ENABLE(install_test_progs, [ --enable-install_test_progs enable installation of some test programs which are otherwise not installed], no)
dnl ----------------------------------------------------------------
dnl General "with" options
OL_ARG_WITH(g2c,[ --with-g2c with g2c header],no,[auto yes no])
OL_ARG_WITH(mpi,[ --with-mpi with MPI support (=pmpi for profiling)],auto,[auto yes pmpi no])
OL_ARG_ENABLE(debug_mpi,[ --enable-debug-mpi enable MPI debugging], no)dnl
OL_ARG_WITH(metis,[ --with-metis with Metis model partitioning support],auto,[auto yes no])
dnl temporarily disabled until we figure out how to make chaco work...
OL_ARG_WITH(chaco,[ --with-chaco with Chaco model partitioning support],no,[auto yes no])
dnl ol_with_chaco=no
OL_ARG_WITH(threads,[ --with-threads with threads],auto,[auto yes no])
OL_ARG_WITH(rt,[ --with-rt with POSIX realtime support],auto,[auto yes no])
OL_ARG_WITH(rtai,[ --with-rtai with RTAI support],no,[auto yes no])
OL_ARG_WITH(boost,[ --with-boost with BOOST support],no,[auto yes no])
OL_ARG_WITH(ann,[ --with-ann with ANN support],no,[auto yes no])
OL_ARG_WITH(bullet,[ --with-bullet with bullet support],no,[auto yes no])
OL_ARG_WITH(blas,[
math libraries:
--with-blas[={auto|goto|atlas|cblas|blas|openblas}]
with (C)BLAS math library],auto,[auto goto atlas cblas blas openblas])
AC_ARG_WITH(goto,[ --with-goto=lib(s) with Goto BLAS implementation],[
ol_with_goto_lib="$withval"
],[ol_with_goto_lib=])
AC_ARG_WITH(openblas,[ --with-openblas=lib(s) with OpenBLAS implementation],[
ol_with_openblas_lib="$withval"
],[ol_with_openblas_lib=])
OL_ARG_WITH(ginac,[ --with-ginac with GiNaC support
(ginac-config must be in $PATH)],auto,[auto yes no])
OL_ARG_WITH(y12,[
optional linear algebra solvers (naive is enabled by default):
--with-y12 with Y12 sparse math library],auto,[auto yes no])
OL_ARG_WITH(umfpack,[ --with-umfpack with Umfpack math library],auto,[auto yes no])
OL_ARG_WITH(klu,[ --with-klu with KLU math library],auto,[auto yes no])
OL_ARG_WITH(lapack,[ --with-lapack with LAPACK math library],auto,[auto yes no])
OL_ARG_WITH(harwell,[ --with-harwell with HSL (Harwell) sparse math library - historical],no,[auto yes no])
OL_ARG_WITH(superlu,[ --with-superlu with SuperLU math library - eXperimental],no,[auto yes no])
OL_ARG_WITH(wsmp,[ --with-wsmp with IBM Watson library],no,[auto yes no])
OL_ARG_WITH(pardiso,[ --with-pardiso with Intel MKL Pardiso library],no,[auto yes no])
OL_ARG_WITH(pastix,[ --with-pastix with Pastix math library],no,[auto yes no])
with_suitesparseqr_default=auto
OL_ARG_WITH(qrupdate,[ --with-qrupdate with QRUPDATE library],$with_suitesparseqr_default,[auto yes no])
OL_ARG_WITH(suitesparseqr,[ --with-suitesparseqr with SuiteSparseQR library],$with_suitesparseqr_default,[auto yes no])
OL_ARG_WITH(strumpack,[ --with-strumpack with STRUMPACK library],auto,[auto yes no])
OL_ARG_WITH(trilinos,[ --with-trilinos with Trilinos library],auto,[auto yes no])
OL_ARG_WITH(siconos,[ --with-siconos with Siconos library],auto,[auto yes no])
dnl temporarily disabled until we find out how to make it work...
dnl OL_ARG_WITH(taucs,[ --with-taucs with TAUCS math library - eXperimental],auto,[auto yes no])
ol_with_taucs=no
OL_ARG_WITH(arpack,[ --with-arpack with ARPACK math library],auto,[auto yes no])
OL_ARG_WITH(jdqz,[ --with-jdqz with JDQZ math library],auto,[auto yes no])
OL_ARG_WITH(pam,[
misc security libraries:
--with-pam with PAM support],no,[auto yes no])
OL_ARG_WITH(sasl2,[ --with-sasl2 with Cyrus SASL2 support],no,[auto yes no])
dnl module with's
AC_ARG_WITH(module,[
--with-module=<list> build listed modules (stripping 'module-' from the
module's folder name, see modules/)
],[
ol_arg=
for ol_val in $withval ; do
ol_arg="$ol_arg module-$ol_val"
done
if test "${ol_arg:-set}" = set ; then
AC_MSG_ERROR(bad value $withval for --with-module)
fi
MODULES_DIRS=$ol_arg
],[MODULES_DIRS=])dnl
OL_ARG_WITH(charm,[ --with-charm with CHARM WP module],no,[auto yes no])
fool_libtool=yes
build_windows=no
case "$host" in
*-apple-*)
fool_libtool=no
;;
cygwin*|*mingw*)
build_windows=yes
;;
*)
;;
esac
dnl Add a conditional we can use in Makefile.am for MS Windows builds
AM_CONDITIONAL([WINDOWS], [test "$build_windows" = "yes"])
dnl ----------------------------------------------------------------
dnl
dnl Checks for programs.
dnl
AC_PROG_CC
if test "x$CC" = "x" ; then
AC_MSG_ERROR([Need a working C compiler])
fi
AC_PROG_CXX
if test "x$CXX" = "x" ; then
AC_MSG_ERROR([Need a working C++ compiler])
fi
AC_PROG_FC
AC_FC_DUMMY_MAIN
AC_FC_LIBRARY_LDFLAGS
AC_PROG_F77
have_fc_f77=no
if test "x$FC" = "x" ; then
if test "x$F77" != "x" ; then
dnl AC_MSG_ERROR([Need a working Fortran compiler])
dnl else
AC_F77_LIBRARY_LDFLAGS
LIBS="$LIBS $F77LIBS"
have_fc_f77=yes
fi
else
F77="$FC"
F77LIBS="$FCLIBS"
LIBS="$LIBS $FCLIBS"
have_fc_f77=yes
fi
if test "$have_fc_f77" = "yes" ; then
AC_DEFINE(HAVE_FC_F77, 1, [define if a Fortran 77 compiler is available])
AC_DEFINE(USE_AEROD2_F, 1, [define Fortran 77 aerodynamic routines can be used])
fi
dnl AC_DISABLE_SHARED([]) dnl Remove when you want to build shared libs also
LT_INIT
dnl
dnl check for c++17
dnl
AC_LANG([C++])
AC_MSG_CHECKING(for c++ >= c++17)
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([],
[
if (__cplusplus == 202101L || __cplusplus == 202002L|| __cplusplus == 201703L) {
return 0;
}
return 1;
])
],
[AC_MSG_RESULT([yes])],
[
save_CXXFlAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -std=c++17"
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([],
[
if (__cplusplus == 202101L || __cplusplus == 202002L|| __cplusplus == 201703L) {
return 0;
}
return 1;
])],
[AC_MSG_RESULT([yes])],
[
AC_MSG_RESULT([no])
CXXFLAGS="$save_CXXFLAGS"
AC_MSG_ERROR([I'm afraid MBDyn now requires compiler to support at least c++17.])
])
]
)
AC_LANG([C])
dnl ----------------------------------------------------------------
dnl
dnl Initialize vars
dnl
MPI_LIBS=
METIS_LIBS=
CHACO_LIBS=
Y12_LIBS=
UMFPACK_LIBS=
KLU_LIBS=
BLAS_LIBS=
THREAD_LIBS=
ATOMIC_OPS_LIBS=
SUPERLU_LIBS=
PARDISO_LIBS=
WSMP_LIBS=
HARWELL_LIBS=
LAPACK_LIBS=
TAUCS_LIBS=
PASTIX_LIBS=
PASTIX_INC=
QRUPDATE_LIBS=
SUITESPARSEQR_LIBS=
STRUMPACK_LIBS=
TRILINOS_LIBS=
SICONOS_LIBS=
ARPACK_LIBS=
JDQZ_LIBS=
SECURITY_LIBS=
NETCDF_LIBS=
UDUNITS_LIBS=
RTAI_LDFLAGS=
RT_LIBS=
ANN_LIBS=
BULLET_LIBS=
PYTHON_NUMPY_HEADERS=
OCTAVE_LIBS=
OCTAVE_INCLUDE=
OCTAVE_MKOCTFILE=
OCTAVE_CLI=
dnl GINACLIB_CONFIG=
GINACLIB_LIBS=
GINACLIB_CPPFLAGS=
wl=
EXPORT_DYNAMIC_FLAG_SPEC=
dnl MODULES_DIRS=
MODULE_LOADPATH=
dnl ----------------------------------------------------------------
dnl
dnl MBDyn requires STDC features
dnl
AC_PROG_CC
if test "X${am_cv_prog_cc_stdc}" = "Xno" ; then
AC_MSG_ERROR([I'm afraid MBDyn requires compiler to support STDC constructs.])
fi
dnl ----------------------------------------------------------------
dnl
dnl Checks for header files.
dnl
AC_STDC_HEADERS
AC_CHECK_HEADERS(arpa/inet.h)
AC_CHECK_HEADERS(atomic_ops.h)
AC_CHECK_HEADERS(cxxabi.h)
AC_CHECK_HEADERS(fenv.h)
AC_CHECK_HEADERS(getopt.h)
AC_CHECK_HEADERS(netdb.h)
AC_CHECK_HEADERS(netinet/in.h)
AC_CHECK_HEADERS(pwd.h)
AC_CHECK_HEADERS(pthread.h)
AC_CHECK_HEADERS(sched.h)
AC_CHECK_HEADERS(semaphore.h)
AC_CHECK_HEADERS(signal.h)
AC_CHECK_HEADERS(stdint.h)
AC_CHECK_HEADERS(stdio.h)
AC_CHECK_HEADERS(stdlib.h)
AC_CHECK_HEADERS(string.h)
AC_CHECK_HEADERS(sys/ipc.h)
AC_CHECK_HEADERS(sys/mman.h)
AC_CHECK_HEADERS(sys/param.h)
AC_CHECK_HEADERS(sys/poll.h)
AC_CHECK_HEADERS(sys/pstat.h)
AC_CHECK_HEADERS(sys/select.h)
AC_CHECK_HEADERS(sys/shm.h)
AC_CHECK_HEADERS(sys/socket.h)
AC_CHECK_HEADERS(sys/sysinfo.h)
AC_CHECK_HEADERS(sys/times.h)
AC_CHECK_HEADERS(sys/types.h)
AC_CHECK_HEADERS(sys/ioctl.h)
AC_CHECK_HEADERS(time.h)
AC_CHECK_HEADERS(unistd.h)
AC_CHECK_HEADERS(values.h)
dnl termios.h used in utils autopilot.c, we don't build if we don't have it (e.g. on windows)
AC_CHECK_HEADER(termios.h, [have_termios=yes], [have_termios=no])
dnl on windows we use winsock
AC_CHECK_HEADERS(winsock2.h)
dnl ----------------------------------------------------------------
dnl
dnl Checks for C++ header files (takes care of ANSI/pre-ANSI naming)
dnl
AC_LANG([C++])
AC_CHECK_HEADERS(exception)
AC_CHECK_HEADERS(stdexcept)
AC_LANG([C])
dnl ----------------------------------------------------------------
dnl
dnl Typedefs
dnl
dnl ----------------------------------------------------------------
dnl
dnl Set symbol table for Math Parser
dnl
AC_DEFINE(USE_TABLE,1,[define this to use external symbol table (default)])
dnl ----------------------------------------------------------------
dnl
dnl Set inter-language naming convention for calling Fortran routines
dnl
AC_DEFINE(USE_UNDERSCORE,1,[append underscore to fortran calls])
dnl ----------------------------------------------------------------
dnl
dnl Check for DEBUG
dnl
if test "$ol_enable_debug_mpi" != no ; then
AC_DEFINE(DEBUG_MPI,1,[define this to add MPI debugging code])
fi
if test "$ol_enable_debug" != no -o "$ol_enable_debug_mpi" != no ; then
AC_DEFINE(DEBUG,1,[define this to add debugging code])
if test "$ol_with_debug_mode" = "mem" ; then
AC_DEFINE(DEBUG_MEMMANAGER,1,[define this to add memory debugging code])
fi
fi
have_environ=no
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
]], [[
environ;
]])],[have_environ=yes],[have_environ=no])
if test $have_environ != yes ; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <unistd.h>
]], [[
environ;
]])],[have_environ=yes],[have_environ=no])
if test $have_environ = yes ; then
AC_DEFINE(ENVIRON_NEEDS_UNISTD_H,1,[define if variable environ needs unistd.h])
fi
fi
if test $have_environ != yes ; then
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#include <unistd.h>
]], [[
environ;
]])],[have_environ=yes],[have_environ=no])
if test $have_environ = yes ; then
AC_DEFINE(ENVIRON_NEEDS_GNU_SOURCE_AND_UNISTD_H,1,[define if variable environ needs _GNU_SOURCE and unistd.h])
fi
fi
if test $have_environ != yes ; then
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
extern char **environ;
]], [[
environ;
]])],[have_environ=yes],[have_environ=no])
if test $have_environ = yes ; then
AC_DEFINE(ENVIRON_NEEDS_DECLARATION,1,[define if variable environ needs to be declared])
fi
fi
if test $have_environ = yes; then
AC_DEFINE(HAVE_ENVIRON,1,[define if variable environ is declared])
fi
dnl try to detect MPI and either Metis or Chaco
use_schur=no
if test "$ol_enable_schur" = yes ; then
case "$ol_with_mpi" in
no)
AC_MSG_ERROR([Schur parallel solver needs MPI])
;;
auto)
ol_with_mpi=yes
;;
esac
dnl add further partitioning package detection code here
if test "$ol_with_metis" = no \
-a "$ol_with_chaco" = no \
; then
AC_MSG_WARN([No partitioning library available; Schur parallel solver will only allow manual partitioning.])
fi
fi
dnl ----------------------------------------------------------------
dnl
dnl Enable NetCDF binary output (netcdf4)
dnl
if test "$ol_enable_netcdf" != no ; then
have_netcdf4=no
have_libnetcdf4=no
AC_LANG([C++])
dnl checks for netcdf header file (for netcdf4 c++):
AC_CHECK_HEADER(netcdf,[have_netcdf4=yes],[have_netcdf4=no])
AC_LANG([C])
if test $have_netcdf4 = "yes" ; then
save_LIBS="$LIBS"
try_NETCDF_LIBS="-lnetcdf-cxx4 -lnetcdf"
LIBS="$try_NETCDF_LIBS $LIBS"
AC_LANG([C++])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <netcdf>
]], [[
/* test for netcdf */
netCDF::NcFile nc("foobar", netCDF::NcFile::replace); // Create and leave in define mode
]])],[
have_libnetcdf4=yes
NETCDF_LIBS="$try_NETCDF_LIBS"
],[])
if test $have_libnetcdf4 != "yes"; then
try_NETCDF_LIBS="-lnetcdf_c++4 -lnetcdf"
LIBS="$try_NETCDF_LIBS $save_LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <netcdf>
]], [[
/* test for netcdf */
netCDF::NcFile nc("foobar", netCDF::NcFile::replace); // Create and leave in define mode
]])],[
have_libnetcdf4=yes
NETCDF_LIBS="$try_NETCDF_LIBS"
],[])
fi
if test $have_libnetcdf4 != "yes"; then
try_NETCDF_LIBS="-lnetcdf_cxx4 -lnetcdf"
LIBS="$try_NETCDF_LIBS $save_LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <netcdf>
]], [[
/* test for netcdf */
netCDF::NcFile nc("foobar", netCDF::NcFile::replace); // Create and leave in define mode
]])],[
have_libnetcdf4=yes
NETCDF_LIBS="$try_NETCDF_LIBS"
],[])
fi
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <netcdf>
]], [[
/* test for netcdf sync */
netCDF::NcFile nc("foobar", netCDF::NcFile::replace); // Create and leave in define mode
nc.sync(); // test for sync option (comes in later version, >=4.3.0)
nc.close(); // test for close (appears in 4.3.0)
]])],[
have_libnetcdf4=yes
],[
have_libnetcdf4=no
AC_MSG_WARN([netcdf-cxx4 version too old, link version 4.3.0 or more recent])
])
AC_LANG([C])
LIBS="$save_LIBS"
fi
if test $have_libnetcdf4 = yes ; then
AC_DEFINE(USE_NETCDF,1,[define this to enable NetCDF4 based output])
AC_MSG_NOTICE([Enabling netcdf4 output capabilities])
elif test $ol_enable_netcdf != auto ; then
if test "$ol_enable_netcdf" = yes ; then
AC_MSG_ERROR([User requested netcdf4 but cannot be enabled, see messages above.])
else
AC_MSG_WARN([Not using netcdf4])
fi
fi
fi
if test "$ol_enable_netcdf" != no ; then
have_udunits=no
have_libudunits=no
AC_CHECK_HEADER(udunits.h,[have_udunits_h=yes],[have_udunits_h=no])
if test $have_udunits_h = "yes" ; then
save_LIBS="$LIBS"
try_UDUNITS_LIBS="-ludunits"
LIBS="$try_UDUNITS_LIBS $LIBS"
AC_CHECK_LIB(udunits,utInit,[
have_libudunits=yes
UDUNITS_LIBS="$try_UDUNITS_LIBS"
],[have_libudunits=no],[-lm])
LIBS="$save_LIBS"
fi
if test $have_libudunits = yes ; then
AC_DEFINE(USE_UDUNITS,1,[define this to enable udunits in NetCDF based output])
fi
fi
dnl ----------------------------------------------------------------
dnl
dnl Enable Python support
dnl
use_python=no
if test "$ol_enable_python" != no ; then
AX_PYTHON_DEVEL
dnl ----------------------------------------------------------------
dnl
dnl detect and configure swig for python bindings
dnl
dnl AX_PKG_SWIG(1.3.17, [], [ AC_MSG_ERROR([SWIG required]) ])
AX_PKG_SWIG
if test x"$SWIG" = x -a "$ol_enable_python" = yes ; then
AC_MSG_ERROR([python needs swig])
fi
if test "$ol_enable_python" = yes ; then
PYTHON_NUMPY_HEADERS=`$PYTHON -c "from __future__ import print_function; import numpy; print(\"{}\".format(numpy.get_include()))" 2>/dev/null`
if test x"$PYTHON_NUMPY_HEADERS" = x ; then
AC_MSG_ERROR([python needs numpy - including its development packages])
else
PYTHON_NUMPY_HEADERS="-I$PYTHON_NUMPY_HEADERS"
fi
fi
AX_SWIG_ENABLE_CXX
AX_SWIG_MULTI_MODULE_SUPPORT
AX_SWIG_PYTHON
use_python=yes
fi
dnl ----------------------------------------------------------------
dnl
dnl Enable Octave support <http://www.octave.org/>
dnl
use_octave=no
use_octave_utils=no
if test "$ol_enable_octave" != no || test "$ol_enable_octave_utils" != no ; then
if ! test -z "${ol_with_octave_cli_exec}"; then
OCTAVE_CLI="${ol_with_octave_cli_exec}"
fi
have_mkoctfile=no
AC_MSG_CHECKING(for mkoctfile)
$ol_with_mkoctfile_exec --help > /dev/null 2>&1
RC=$?
if test "$RC" = 0 ; then
AC_MSG_RESULT([yes])
have_mkoctfile=yes
OCTAVE_MKOCTFILE=$ol_with_mkoctfile_exec
dnl On Windows systems the output from mkoctfile contains backslashes which cause build failures!
try_OCTAVE_LIBS="`$ol_with_mkoctfile_exec -p OCTAVE_LIBS`"
try_OCTAVE_LIBS="${try_OCTAVE_LIBS} `$ol_with_mkoctfile_exec -p LDFLAGS | sed 's/-IC\:/-I\/c/g;s/-LC\:/-L\/c/g;s/\\\\/\//g'`"
try_OCTAVE_LIBS="${try_OCTAVE_LIBS} -L`$ol_with_mkoctfile_exec -p OCTLIBDIR | sed 's/-IC\:/-I\/c/g;s/-LC\:/-L\/c/g;s/\\\\/\//g'`"
try_OCTAVE_LIBS="${try_OCTAVE_LIBS} -Wl,-rpath=`$ol_with_mkoctfile_exec -p OCTLIBDIR | sed 's/-IC\:/-I\/c/g;s/-LC\:/-L\/c/g;s/\\\\/\//g'`"
try_OCTAVE_INCLUDE="`$ol_with_mkoctfile_exec -p INCFLAGS | sed 's/-IC\:/-I\/c/g;s/-LC\:/-L\/c/g;s/\\\\/\//g'`"
export LD_LIBRARY_PATH="`$ol_with_mkoctfile_exec -p OCTLIBDIR`:${LD_LIBRARY_PATH}"
OCTAVE_EXEC_HOME=`${OCTAVE_MKOCTFILE} -p OCTAVE_EXEC_HOME | sed 's/C\:/\/c/g;s/\\\\/\//g'`
if test -z "${OCTAVE_CLI}"; then
if test -d "${OCTAVE_EXEC_HOME}" && test -f "${OCTAVE_EXEC_HOME}/bin/octave-cli"; then
OCTAVE_CLI="${OCTAVE_EXEC_HOME}/bin/octave-cli"
fi
fi
else
AC_MSG_RESULT([no])
try_OCTAVE_LIBS="-loctinterp -loctave -lcruft"
try_OCTAVE_INCLUDE=
fi
AC_LANG([C++])
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $try_OCTAVE_INCLUDE"
AC_CHECK_HEADER(octave/oct.h,[have_octave_oct_h=yes],[have_octave_oct_h=no])
AC_CHECK_HEADER(octave/parse.h,[have_octave_parse_h=yes],[have_octave_parse_h=no],[
#include <octave/oct.h>
])
AC_CHECK_HEADER(octave/toplev.h,[have_octave_toplev_h=yes],[have_octave_toplev_h=no],[
#include <octave/oct.h>
])
AC_CHECK_HEADER(octave/interpreter.h,[have_octave_interpreter_h=yes],[have_octave_interpreter_h=no],[
#include <octave/oct.h>
])
AC_CHECK_HEADER(octave/octave.h,[have_octave_octave_h=yes],[have_octave_octave_h=no],[
#include <octave/oct.h>
])
CPPFLAGS="$save_CPPFLAGS"
AC_LANG([C])
link_octave="no"
have_clean_up_and_exit="no"
have_do_octave_atexit="no"
if test "$have_octave_oct_h" = "yes" \
-a "$have_octave_parse_h" = "yes" \
-a "$have_octave_toplev_h" = "yes" \
-a "$have_octave_octave_h" = "yes" \
-a "$have_mkoctfile" = "yes" ; \
then
OCTAVE_INCLUDE="$try_OCTAVE_INCLUDE"
save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS"
try_LIBS="$try_OCTAVE_LIBS"
LIBS="$try_LIBS $LIBS"
CPPFLAGS="$CPPFLAGS $OCTAVE_INCLUDE"
AC_LANG([C++])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <octave/oct.h>
#include <octave/parse.h>
#include <octave/toplev.h>
#include <octave/octave.h>
]], [[
octave_main(0, NULL, 1);
]])],[link_octave="yes"],[])
AC_LANG([C++])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <octave/oct.h>
#include <octave/parse.h>
#include <octave/toplev.h>
#include <octave/octave.h>
]], [[
do_octave_atexit();
]])],[have_do_octave_atexit="yes"],[])
AC_LANG([C++])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <octave/oct.h>
#include <octave/parse.h>
#include <octave/toplev.h>
#include <octave/octave.h>
]], [[
clean_up_and_exit(0, true);
]])],[have_clean_up_and_exit="yes"],[])
AC_LANG([C])
LIBS="$save_LIBS"
CPPFLAGS="$save_CPPFLAGS"
OCTAVE_LIBS="$try_LIBS"
fi
if test "$have_octave_oct_h" = "yes" \
-a "$have_octave_parse_h" = "yes" \
-a "$have_octave_interpreter_h" = "yes" \
-a "$have_octave_octave_h" = "yes" \
-a "$have_mkoctfile" = "yes" ; \
then
OCTAVE_INCLUDE="$try_OCTAVE_INCLUDE"
save_CPPFLAGS="$CPPFLAGS"
save_LIBS="$LIBS"
try_LIBS="$try_OCTAVE_LIBS"
LIBS="$try_LIBS $LIBS"
CPPFLAGS="$CPPFLAGS $OCTAVE_INCLUDE"
AC_LANG([C++])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <octave/oct.h>
#include <octave/parse.h>
#include <octave/interpreter.h>
#include <octave/octave.h>
]], [[
octave::interpreter interpreter;
int status = interpreter.execute();
octave_value_list out = octave::feval ("cos", octave_value(0.), 1);
]])],[link_octave="yes"],[])
AC_LANG([C])
LIBS="$save_LIBS"
CPPFLAGS="$save_CPPFLAGS"
OCTAVE_LIBS="$try_LIBS"
fi
if test "$link_octave" = yes ; then
if test "$have_do_octave_atexit" = yes; then
AC_DEFINE(HAVE_DO_OCTAVE_ATEXIT, 1, [define if do_octave_atexit can be used])
fi
if test "$have_clean_up_and_exit" = yes; then
AC_DEFINE(HAVE_CLEAN_UP_AND_EXIT, 1, [define if clean_up_and_exit can be used])
fi
use_octave=yes
AC_DEFINE(USE_OCTAVE, 1, [define if octave can be used])
else
if test "$ol_enable_octave" = "yes" ; then
AC_MSG_ERROR([octave support not available])
fi
fi
if test "$have_octave_oct_h" = "yes" -a "$have_mkoctfile" = "yes"; then
use_octave_utils="yes"
else
AC_MSG_ERROR([octave utils support not available])
fi
if test -z "${OCTAVE_CLI}"; then
OCTAVE_CLI=octave-cli
fi
fi
AC_MSG_CHECKING([for _aligned_malloc and _aligned_free])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdlib.h>
]], [[
void* p = _aligned_malloc(1024, 32);
_aligned_free(p);
]])],[have_aligned_malloc="yes"],[])
if test "$have_aligned_malloc" == "yes"; then
AC_DEFINE(HAVE_ALIGNED_MALLOC, 1, [define if _aligned_malloc and _aligned_free can be used])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([for posix_memalign])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdlib.h>
]], [[
void *p;
posix_memalign(&p, 32, 1024);
]])],[have_posix_memalign="yes"],[])
if test "$have_posix_memalign" == "yes"; then
AC_DEFINE(HAVE_POSIX_MEMALIGN, 1, [define if posix_memalign can be used])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([for memalign])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdlib.h>
]], [[
void* p = memalign(32, 1024);
]])],[have_memalign="yes"],[])
if test "$have_memalign" == "yes"; then
AC_DEFINE(HAVE_MEMALIGN, 1, [define if memalign can be used])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([for aligned_alloc])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdlib.h>
]], [[
void* p = aligned_alloc(32, 1024);
free(p);
]])],[have_aligned_alloc="yes"],[])
if test "$have_aligned_alloc" == "yes"; then
AC_DEFINE(HAVE_ALIGNED_ALLOC, 1, [define if aligned_alloc can be used])
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
dnl ----------------------------------------------------------------
dnl
dnl Check for POSIX realtime
dnl
if test $ol_with_rt != no ; then
save_LIBS="$LIBS"
try_RT_LIBS="-lrt"
LIBS="$try_RT_LIBS $LIBS"
AC_CHECK_LIB(rt,clock_nanosleep,[
have_librt=yes
RT_LIBS="$try_RT_LIBS"
],[have_librt=no])
if test "$have_librt" = "yes" ; then
AC_DEFINE(USE_RT,1,[define to use POSIX realtime])
dnl ----------------------------------------------------------------
dnl
dnl Check for clock_gettime()
dnl
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <time.h>
]], [[
struct timespec tp;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &tp);
]])],[use_clock_gettime=yes],[use_clock_gettime=no])
if test $use_clock_gettime = yes; then
AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [define if clock_gettime can be used])
fi
elif test "$ol_with_rt" = "yes" ; then
AC_MSG_ERROR([POSIX realtime is not available])
fi
LIBS="$save_LIBS"
fi
dnl ----------------------------------------------------------------
dnl
dnl Check for RTAI
dnl
use_rtai=no
if test $ol_with_rtai != no ; then
dnl RTAI >= 3.0
AC_CHECK_HEADERS(rtai_lxrt.h)
AC_CHECK_HEADERS(rtai_netrpc.h)
if test "$ac_cv_header_rtai_lxrt_h" = "yes" -a \
"$ac_cv_header_rtai_netrpc_h" = "yes" ; then
use_rtai=yes
else
dnl RTAI ~ 2.4.13
AC_CHECK_HEADERS(rtai_lxrt_user.h)
AC_CHECK_HEADERS(net_rpc.h)
if test "$ac_cv_header_rtai_lxrt_user_h" = "yes" -a \