forked from nakatamaho/mplapack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
774 lines (696 loc) · 23.7 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
dnl
dnl Configure for MPACK
dnl
AC_INIT(mlapack, 0.8.1)
AC_SUBST([PACKAGE_DESCRIPTION], "A multiple precision version of BLAS and LAPACK")
AC_CONFIG_HEADER(include/config.h)
AC_CONFIG_FILES([ Makefile mlapack.pc ])
AC_CONFIG_FILES([packaging/PKGBUILD packaging/mlapack.spec])
AC_PROG_CC
AC_PROG_CXX
AC_PROG_LIBTOOL
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_MACRO_DIR([m4])
dnl OpenMP Compiler flags.
AC_OPENMP
AC_LANG_PUSH([C++])
AC_OPENMP
AC_LANG_POP
dnl Checking host name
AC_CANONICAL_HOST
IS_MINGW=0
case "$host" in
*-mingw32*)
IS_MINGW=1
;;
*)
esac
AM_CONDITIONAL(IS_MINGW, test x$IS_MINGW = x1)
IS_MACOSX=0
case "$host" in
*apple-darwin*)
IS_MACOSX=1
;;
*)
esac
AM_CONDITIONAL(IS_MACOSX, test x$IS_MACOSX = x1)
IS_LINUX=0
case "$host" in
*linux*)
IS_LINUX=1
;;
*)
esac
DYLD=
AM_CONDITIONAL(IS_LINUX, test x$IS_LINUX = x1)
if test x"$IS_LINUX" = x"1"; then
DYLD=-ldl
fi
AC_SUBST(DYLD)
dnl dummy for Intel Xeon Phi (aka MIC)
IS_MIC=0
AM_CONDITIONAL(IS_MIC, test x$IS_MIC = x1)
dnl enable debug; compare with reference LAPACK and BLAS.
dnl when enable this flag, we perform full build;
dnl all mp versions of mlapack and mblas, etc.
AC_ARG_ENABLE(debug,
[ --enable-debug Enable debug])
AM_CONDITIONAL(ENABLE_DEBUG, test x$enable_debug = xyes)
AC_ARG_ENABLE(optimization,
AS_HELP_STRING([--enable-optimization], [Enable compiler level optimization]),
[case "${enableval}" in
yes) enable_optimization=yes ;;
no) enable_optimization=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-optimization) ;;
esac],[enable_optimization=yes])
AC_ARG_ENABLE(cuda,
[ --enable-cuda Enable compiler level cuda])
AM_CONDITIONAL(ENABLE_CUDA, test x$enable_cuda = xyes)
AC_ARG_WITH(cudatoolkithome,
AS_HELP_STRING([--with-cudatoolkithome], [Specify path to CUDA Toolkit (default: /usr/local/cuda)]),
[ CUDATOOLKITHOME="$withval"],
[ CUDATOOLKITHOME=/usr/local/cuda]
)
ARCH=`uname -m`
if test $ARCH = "x86_64"; then
SUFFIX="64"
else
SUFFIX=""
fi
CUDA_CFLAGS="-I$CUDATOOLKITHOME/include"
CUDA_LIBS="-L$CUDATOOLKITHOME/lib$SUFFIX"
CUDA_LDFLAGS="-L$CUDATOOLKITHOME/lib$SUFFIX"
NVCC="$CUDATOOLKITHOME/bin/nvcc"
IS_CUDA_VERSION_MAJOR_3="FALSE"
dnl we should write check part for CUDA toolkit
if test x$enable_cuda = x"yes"; then
CUDA_VERSION=`"$NVCC" --version | grep "Cuda compilation tools" | awk '{print $5}' | sed 's/,//g'`
CUDA_VERSION_MAJOR=`"$NVCC" --version | grep "Cuda compilation tools" | awk '{print $5}' | sed 's/,//g' | sed 's/\..$//g'`
AC_MSG_RESULT([CUDA version is $CUDA_VERSION])
AC_MSG_RESULT([CUDA major version is $CUDA_VERSION_MAJOR])
fi
AM_CONDITIONAL(IS_CUDA_VERSION_MAJOR_3, test x"$CUDA_VERSION_MAJOR" = x"3")
AC_SUBST(CUDATOOLKITHOME)
AC_SUBST(CUDA_LDFLAGS)
AC_SUBST(CUDA_CFLAGS)
AC_SUBST(CUDA_LIBS)
AC_SUBST(CUDA_VERSION)
AC_SUBST(CUDA_VERSION_MAJOR)
AC_SUBST(IS_CUDA_VERSION_MAJOR_3)
AC_SUBST(NVCC)
dnl enable FORTRAN warpper
AC_ARG_ENABLE(fortranwrapper,
AS_HELP_STRING([--enable-fortranwrapper], [Enable fortranwrapper]))
AM_CONDITIONAL(ENABLE_FORTRANWRAPPER, test x$enable_fortranwrapper = xyes)
AC_ARG_ENABLE(wrapper,
AS_HELP_STRING([--enable-wrapper], [Enable wrapper for BLAS and LAPACK. xBLAS like approach]))
AM_CONDITIONAL(ENABLE_WRAPPER, test x$enable_wrapper = xyes)
dnl disable benchmark
AC_ARG_ENABLE(benchmark,
AS_HELP_STRING([--disable-benchmark], [Disable benchmark]))
AM_CONDITIONAL(DISABLE_BENCHMARK, test x$enable_benchmark = xno)
dnl disable examples
AC_ARG_ENABLE(examples,
AS_HELP_STRING([--disable-examples], [Disable examples]))
AM_CONDITIONAL(DISABLE_EXAMPLES, test x$enable_examples = xno)
dnl disable reference
AC_ARG_ENABLE(reference,
AS_HELP_STRING([--disable-reference], [Build without reference libraries]))
AM_CONDITIONAL(DISABLE_REFERENCE, test x$enable_reference = xno)
dnl enable GMP version of MPACK.
AC_ARG_ENABLE(gmp,
AS_HELP_STRING([--enable-gmp], [Enable GMP version]))
AM_CONDITIONAL(ENABLE_GMP, test x$enable_gmp = xyes)
dnl enable MPFR version of MPACK.
AC_ARG_ENABLE(mpfr,
AS_HELP_STRING([--enable-mpfr], [Enable MPFR version]))
dnl We use MPFR version as reference
dnl so if debug is turned on,
if test x$enable_debug = x"yes"; then
enable_mpfr=yes
fi
AM_CONDITIONAL(ENABLE_MPFR, test x$enable_mpfr = xyes)
dnl enable QD version of MPACK.
AC_ARG_ENABLE(qd,
AS_HELP_STRING([--enable-qd], [Enable QD version]))
AM_CONDITIONAL(ENABLE_QD, test x$enable_qd = xyes)
AC_ARG_WITH(qdlib-flags,
AS_HELP_STRING([--with-qdlib-flags], [passing flag to internal qd library])
,,with_qdlib_flags="")
QDLIB_FLAGS=$with_qdlib_flags;
AC_SUBST(QDLIB_FLAGS)
dnl enable DD version of MPACK.
AC_ARG_ENABLE(dd,
AS_HELP_STRING([--enable-dd], [Enable DD version]),
[case "${enableval}" in
yes) enable_dd=yes ;;
no) enable_dd=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-dd) ;;
esac],[
if test x"$IS_MINGW" = x"1"; then
enable_dd=no
else
enable_dd=yes
fi
])
AM_CONDITIONAL(ENABLE_DD, test x$enable_dd = xyes)
dnl enable double
AC_ARG_ENABLE(double,
AS_HELP_STRING([--enable-double], [Enable double version]),
[case "${enableval}" in
yes) enable_double=yes ;;
no) enable_double=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-double) ;;
esac],[enable_double=no])
AM_CONDITIONAL(ENABLE_DOUBLE, test x$enable_double = xyes)
AC_ARG_ENABLE(__float128,
AS_HELP_STRING([--enable-__float128], [Enable __float128 version using non standard extension of gcc and icc]),
[case "${enableval}" in
yes) enable___float128=yes ;;
no) enable___float128=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-__float128) ;;
esac],[enable___float128=no])
AC_ARG_WITH(gccname,
AS_HELP_STRING([--with-gccname], [Specify path to gcc for libquadmath (only for Intel Composer)]),
[ GCCNAME="$withval"]
)
if test x$enable___float128 = x"yes"; then
__ICC=`basename $CC`
if test x$__ICC = x"icc"; then
AC_MSG_RESULT([Note: your compiler is Intel Composer, so you need -lquadmath, thus -gcc-name])
if test x$GCCNAME != x"" ; then
_GCC_FLOAT128_FLAGS="-gcc-name=$GCCNAME"
else
__GCC=`which gcc`
_GCC_FLOAT128_FLAGS="-gcc-name=$__GCC"
fi
fi
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $_GCC_FLOAT128_FLAGS"
AC_MSG_CHECKING([whether __float128 is supported])
AC_TRY_COMPILE([
#include <quadmath.h>
],[__float128 a = 0.0Q; return 0;], have___float128=yes, have___float128=no)
if test "$have___float128" = "no"; then
AC_MSG_ERROR([__float128 is not supported on this platform])
else
AC_MSG_RESULT([__float128 is supported])
fi
fi
CFLAGS="$SAVE_CFLAGS"
AM_CONDITIONAL(ENABLE___FLOAT128, test x$enable___float128 = xyes)
AC_ARG_ENABLE(longdouble,
AS_HELP_STRING([--enable-longdouble], [Enable long double version]),
[case "${enableval}" in
yes) enable_longdouble=yes ;;
no) enable_longdouble=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-longdouble) ;;
esac],[enable_longdouble=no])
AM_CONDITIONAL(ENABLE_LONGDOUBLE, test x$enable_longdouble = xyes)
highest_abs_top_srcdir=`cd "$srcdir" && pwd`
dnl GMP library start
AC_ARG_WITH(system-gmp,
AS_HELP_STRING([--with-system-gmp=PREFIX],
[ ="yes" if it is at the default location (/usr/local/lib), or alternative prefix path to gmp library]
),
GMP_PATHSET=1,
GMP_PATHSET=0;
with_system_gmp="no";
)
GMP_INCLUDEDIR=$highest_abs_top_srcdir/external/i/GMP/include/
GMP_LIBDIR=$highest_abs_top_srcdir/external/i/GMP/lib/
if test $GMP_PATHSET = 1 ; then
if test $with_system_gmp != "yes"; then
GMP_INCLUDEDIR="$with_system_gmp/include"
GMP_LIBDIR="$with_system_gmp/lib"
fi
fi
if test x$enable_gmp = x"yes" -o x$enable_mpfr = x"yes" -o x$enable_debug = x"yes"; then
if test x$with_system_gmp != x"no"; then
HAVE_GMP=""
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS -I$GMP_INCLUDEDIR"
AC_CHECK_HEADER(gmp.h, HAVE_GMP_HEADER=yes)
CXXFLAGS=$save_CXXFLAGS
if test x$HAVE_GMP_HEADER = xyes; then
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -L$GMP_LIBDIR"
AC_CHECK_LIB(gmp, __gmpz_init, [GMP_LIBS="-lgmpxx -lgmp"; HAVE_GMP=yes])
LDFLAGS=$save_LDFLAGS
fi
if test x$HAVE_GMP != xyes; then
AC_MSG_RESULT([No GMP library with C++ wrapper found; using internal one instead])
else
AC_MSG_RESULT([GMP library found: using GMP library comes with the system])
SYSTEM_GMP=yes
fi
else
AC_MSG_RESULT([Using GMP library comes with MPACK])
GMP_INCLUDEDIR=$highest_abs_top_srcdir/external/i/GMP/include/
GMP_LIBDIR=$highest_abs_top_srcdir/external/i/GMP/lib/
fi
fi
AM_CONDITIONAL(SYSTEM_GMP, test x$SYSTEM_GMP = xyes)
AC_SUBST(GMP_INCLUDEDIR, [$GMP_INCLUDEDIR])
AC_SUBST(GMP_LIBDIR, [$GMP_LIBDIR])
dnl GMP library end
dnl MPFR library start
AC_ARG_WITH(system-mpfr,
AS_HELP_STRING([--with-system-mpfr=PREFIX],
[ ="yes" if it is at the default location (/usr/local/lib), or alternative prefix path to mpfr library]
),
MPFR_PATHSET=1,
MPFR_PATHSET=0;
with_system_mpfr="no";
)
MPFR_INCLUDEDIR=$highest_abs_top_srcdir/external/i/MPFR/include/
MPFR_LIBDIR=$highest_abs_top_srcdir/external/i/MPFR/lib/
if test $MPFR_PATHSET = 1 ; then
if test $with_system_mpfr != "yes"; then
MPFR_INCLUDEDIR="$with_system_mpfr/include"
MPFR_LIBDIR="$with_system_mpfr/lib"
fi
fi
if test x$enable_mpfr = x"yes" -o x$enable_debug = x"yes"; then
if test x$with_system_mpfr != x"no"; then
HAVE_MPFR=""
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -I$MPFR_INCLUDEDIR -I$GMP_INCLUDEDIR"
AC_CHECK_HEADER(mpfr.h, HAVE_MPFR_HEADER=yes)
if test x$HAVE_MPFR_HEADER = xyes; then
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -L$MPFR_LIBDIR -L$GMP_LIBDIR"
AC_CHECK_LIB(mpfr, mpfr_init, [MPFR_LIBS="-lmpfr -lgmp"; HAVE_MPFR=yes])
LDFLAGS=$save_LDFLAGS
fi
if test x$HAVE_MPFR != xyes; then
AC_MSG_RESULT([No MPFR library found; using internal one instead])
else
AC_MSG_RESULT([MPFR found: using MPFR comes with the system])
SYSTEM_MPFR=yes
fi
CFLAGS=$save_CFLAGS
else
AC_MSG_RESULT([Using MPFR comes with MPACK])
MPFR_INCLUDEDIR=$highest_abs_top_srcdir/external/i/MPFR/include/
MPFR_LIBDIR=$highest_abs_top_srcdir/external/i/MPFR/lib/
fi
fi
AM_CONDITIONAL(SYSTEM_MPFR, test x$SYSTEM_MPFR = xyes)
AC_SUBST(MPFR_INCLUDEDIR, [$MPFR_INCLUDEDIR])
AC_SUBST(MPFR_LIBDIR, [$MPFR_LIBDIR])
dnl MPFR library end
dnl MPC library start
AC_ARG_WITH(system-mpc,
AS_HELP_STRING([--with-system-mpc=PREFIX],
[ ="yes" if it is at the default location (/usr/local/lib), or alternative prefix path to mpc library]
),
MPC_PATHSET=1,
MPC_PATHSET=0;
with_system_mpc="no";
)
MPC_INCLUDEDIR=$highest_abs_top_srcdir/external/i/MPC/include/
MPC_LIBDIR=$highest_abs_top_srcdir/external/i/MPC/lib/
if test $MPC_PATHSET = 1 ; then
if test $with_system_mpc != "yes"; then
MPC_INCLUDEDIR="$with_system_mpc/include"
MPC_LIBDIR="$with_system_mpc/lib"
fi
fi
if test x$enable_mpfr = x"yes" -o x$enable_debug = x"yes"; then
if test x$with_system_mpc != x"no"; then
HAVE_MPC=""
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -I$MPC_INCLUDEDIR -I$MPFR_INCLUDEDIR -I$GMP_INCLUDEDIR"
AC_CHECK_HEADER(mpc.h, HAVE_MPC_HEADER=yes)
if test x$HAVE_MPC_HEADER = xyes; then
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -L$MPC_LIBDIR -L$MPFR_LIBDIR -L$GMP_LIBDIR"
AC_CHECK_LIB(mpc, mpc_init2, [MPC_LIBS="-lmpc -lmpfr -lgmp"; HAVE_MPC=yes])
LDFLAGS=$save_LDFLAGS
fi
if test x$HAVE_MPC != xyes; then
AC_MSG_RESULT([No MPC library found; using internal one instead])
else
AC_MSG_RESULT([MPC library found: using MPC library comes with the system])
SYSTEM_MPC=yes
fi
CFLAGS=$save_CFLAGS
else
AC_MSG_RESULT([Using MPC library comes with MPACK])
MPC_INCLUDEDIR=$highest_abs_top_srcdir/external/i/MPC/include/
MPC_LIBDIR=$highest_abs_top_srcdir/external/i/MPC/lib/
fi
fi
AM_CONDITIONAL(SYSTEM_MPC, test x$SYSTEM_MPC = xyes)
AC_SUBST(MPC_INCLUDEDIR, [$MPC_INCLUDEDIR])
AC_SUBST(MPC_LIBDIR, [$MPC_LIBDIR])
dnl MPC library end
dnl QD library start
AC_ARG_WITH(system-qd,
AS_HELP_STRING([--with-system-qd=PREFIX],
[ ="yes" if it is at the default location (/usr/local/lib), or alternative prefix path to qd library]
),
QD_PATHSET=1,
QD_PATHSET=0;
with_system_qd="no";
)
QD_INCLUDEDIR=$highest_abs_top_srcdir/external/i/QD/include/
QD_LIBDIR=$highest_abs_top_srcdir/external/i/QD/lib/
if test $QD_PATHSET = 1 ; then
if test $with_system_qd != "yes"; then
QD_INCLUDEDIR="$with_system_qd/include"
QD_LIBDIR="$with_system_qd/lib"
fi
fi
if test x$enable_qd = x"yes" -o x$enable_dd = x"yes" -o x$enable_debug = x"yes"; then
if test x$with_system_qd != x"no"; then
HAVE_QD=""
save_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS -I$QD_INCLUDEDIR"
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(qd/qd_real.h, HAVE_QD_HEADER=yes)
CXXFLAGS=$save_CXXFLAGS
if test x$HAVE_QD_HEADER = xyes; then
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -L$QD_LIBDIR"
AC_CHECK_LIB(qd, c_qd_sqrt, [QD_LIBS="-lqd"; HAVE_QD=yes])
LDFLAGS=$save_LDFLAGS
fi
if test x$HAVE_QD != xyes; then
AC_MSG_RESULT([No QD library found; using internal one instead])
else
AC_MSG_RESULT([QD library found: using QD library comes with the system])
SYSTEM_QD=yes
fi
AC_LANG_POP([C++])
else
AC_MSG_RESULT([Using QD library comes with MPACK])
QD_INCLUDEDIR=$highest_abs_top_srcdir/external/i/QD/include/
QD_LIBDIR=$highest_abs_top_srcdir/external/i/QD/lib/
fi
fi
AM_CONDITIONAL(SYSTEM_QD, test x$SYSTEM_QD = xyes)
AC_SUBST(QD_INCLUDEDIR, [$QD_INCLUDEDIR])
AC_SUBST(QD_LIBDIR, [$QD_LIBDIR])
dnl QD library end
need_internal_gmplib=no
if test x$enable_gmp = x"yes" && test x$SYSTEM_GMP != x"yes"; then
need_internal_gmplib=yes
AC_SUBST(GMP_DIR, [gmp])
fi
#AM_CONDITIONAL(NEED_INTERNAL_GMPLIB, test x$need_internal_gmplib = xyes)
need_internal_qdlib=no
if test x$enable_qd = x"yes" || test x$enable_dd = x"yes"; then
if test x$SYSTEM_QD != x"yes"; then
need_internal_qdlib=yes
AC_SUBST(QD_DIR, [qd])
fi
fi
#AM_CONDITIONAL(NEED_INTERNAL_QDLIB, test x$need_internal_qdlib = xyes)
need_internal_mpfrlib=no
if test x$enable_mpfr = x"yes" && test x$SYSTEM_MPFR != x"yes"; then
need_internal_mpfrlib=yes
AC_SUBST(MPFR_DIR, [mpfr])
fi
#AM_CONDITIONAL(NEED_INTERNAL_MPFRLIB, test x$need_internal_mpfrlib = xyes)
need_internal_mpclib=no
if test x$enable_mpfr = x"yes" && test x$SYSTEM_MPC != x"yes"; then
need_internal_mpclib=yes
AC_SUBST(MPC_DIR, [mpc])
fi
#AM_CONDITIONAL(NEED_INTERNAL_MPCLIB, test x$need_internal_mpclib = xyes)
dnl print status...start
if test x$enable_gmp = x"yes"; then
AC_MSG_RESULT([Enable GMP version])
else
AC_MSG_RESULT([Disable GMP version])
fi
if test x$enable_dd = x"yes"; then
AC_MSG_RESULT([Enable DD version])
else
AC_MSG_RESULT([Disable DD version])
fi
if test x$enable_cuda = x"yes"; then
AC_MSG_RESULT([Enable CUDA version : the home of CUDA Toolkit : $CUDATOOLKITHOME])
else
AC_MSG_RESULT([Disable CUDA version])
fi
if test x"$IS_MINGW" = x"1" && test x$enable_dd = x"yes"; then
#it builds fine but we have to explicitly call mpack_initialize_qd(void);
#when we start dd calculation and call mpack_finalize_qd(void)
#at the end of calculation
AC_MSG_ERROR([dd is not supported on this platform; constructor issue])
fi
if test x$enable_qd = x"yes"; then
AC_MSG_RESULT([Enable QD version])
else
AC_MSG_RESULT([Disable QD version])
fi
if test x"$IS_MINGW" = x"1" && test x$enable_qd = x"yes"; then
#it builds fine but we have to explicitly call mpack_initialize_qd(void);
#when we start dd calculation and call mpack_finalize_qd(void)
#at the end of calculation
AC_MSG_ERROR([qd is not supported on this platform; constructor issue])
fi
if test x$enable_mpfr = x"yes"; then
AC_MSG_RESULT([Enable MPFR version])
else
AC_MSG_RESULT([Disable MPFR version])
fi
if test x$enable_double = x"yes"; then
AC_MSG_RESULT([Enable double version])
else
AC_MSG_RESULT([Disable double version])
fi
if test x$enable_longdouble = x"yes"; then
AC_MSG_RESULT([Enable long double version])
else
AC_MSG_RESULT([Disable long double version])
fi
if test x$enable___float128 = x"yes"; then
AC_MSG_RESULT([Enable __float128 version])
else
AC_MSG_RESULT([Disable __float128 version])
fi
if test x$enable_debug = x"yes"; then
AC_MSG_RESULT([Enable debug])
AC_SUBST(LAPACK_DIR, [lapack])
else
AC_MSG_RESULT([Disable debug])
fi
if test x$enable_fortranwrapper = x"yes"; then
AC_MSG_RESULT([Enable fortran wrapper])
else
AC_MSG_RESULT([Disable fortran wrapper])
fi
dnl print status...end
AC_ARG_WITH(external-blas,
AS_HELP_STRING([--with-external-blas], [Specify location of external BLAS e.g. "-L/usr/local/lib -lblas". It is used for benchmark only.]))
AC_ARG_WITH(external-lapack,
AS_HELP_STRING([--with-external-lapack], [Specify how to link against external LAPACK e.g. "-L/usr/local/lib -llapack". It is used for benchmark only.]))
dnl First we check Fotran 90 compiler stuffs.
if test x"$enable_debug" = x"yes" || test x"$enable_fortranwrapper" = x"yes"; then
AC_PROG_FC
AC_FC_LIBRARY_LDFLAGS
AC_FC_WRAPPERS
AC_SUBST(FCLIBS)
AC_LANG_PUSH([Fortran])
AC_OPENMP
AC_LANG_POP([Fortran])
fi
dnl For benchmarking, we can set explicitly BLAS and LAPACK
dnl libraries, like Intel MKL, GotoBLAS2, etc.
dnl very specific case: veclib is shipped for MacOSX. it should be used without fortran compiler
dnl this library should be the default for benchmarking (actually it is ATLAS).
dnl TODO: MacOSX support.
if test x"$with_external_blas" != x""; then
HAVE_EXTERNAL_BLAS=""
BLAS=$with_external_blas;
save_LIBS="$LIBS"
AC_FC_FUNC(dgemm)
LIBS="$LIBS $BLAS $FCLIBS"
AC_CHECK_FUNC($dgemm, [HAVE_EXTERNAL_BLAS=yes])
LIBS="$save_LIBS"
AC_SUBST(BLAS)
if test x"$HAVE_EXTERNAL_BLAS" != xyes; then
AC_MSG_ERROR([No external BLAS found])
fi
fi
if test x"$with_external_lapack" != x""; then
dnl Check whether we can call LAPACK subroutines
HAVE_EXTERNAL_LAPACK=""
LAPACK=$with_external_lapack;
dnl default blas name is libblas, thus we pass -lblas.
if test x"$with_external_blas" = x; then
BLAS="-lblas"
fi
save_LIBS="$LIBS"
AC_FC_FUNC(dsyev)
LIBS="$LIBS $LAPACK $BLAS $FCLIBS"
AC_CHECK_FUNC($dsyev, [HAVE_EXTERNAL_LAPACK=yes])
LIBS="$save_LIBS"
AC_SUBST(LAPACK)
if test x"$HAVE_EXTERNAL_LAPACK" != xyes; then
AC_MSG_ERROR([No external LAPACK found])
fi
fi
AM_CONDITIONAL(HAVE_EXTERNAL_BLAS, test x$HAVE_EXTERNAL_BLAS = xyes)
AM_CONDITIONAL(HAVE_EXTERNAL_LAPACK, test x$HAVE_EXTERNAL_LAPACK = xyes)
DO_BLASBENCH=no
if test x"$enable_debug" = x"yes" || test x"$HAVE_EXTERNAL_BLAS" = x"yes"; then
DO_BLASBENCH=yes
fi
AM_CONDITIONAL(DO_BLASBENCH, test x$DO_BLASBENCH = xyes)
DO_LAPACKBENCH=no
if test x"$enable_debug" = x"yes" || test x"$HAVE_EXTERNAL_LAPACK" = x"yes"; then
DO_LAPACKBENCH=yes
fi
AM_CONDITIONAL(DO_LAPACKBENCH, test x$DO_LAPACKBENCH = xyes)
dnl __float128 support part II.
if test x$__ICC = x"icc"; then
CFLAGS="$CFLAGS $_GCC_FLOAT128_FLAGS"
CXXFLAGS="$CXXFLAGS $_GCC_FLOAT128_FLAGS"
FCFLAGS="$FCFLAGS $_GCC_FLOAT128_FLAGS"
fi
if test x"$enable_optimization" = x"yes"; then
CFLAGS="$CFLAGS -O2 -fomit-frame-pointer -finline-functions -funroll-all-loops"
CXXFLAGS="$CXXFLAGS -O2 -fomit-frame-pointer -finline-functions -funroll-all-loops"
FCFLAGS="$FCFLAGS -O2 -fomit-frame-pointer -finline-functions -funroll-all-loops"
if test x$__ICC = x"icc"; then
CFLAGS="$CFLAGS -xHost -O3"
CXXFLAGS="$CXXFLAGS -xHost -O3"
FCFLAGS="$FCFLAGS -xHost -O3"
fi
AC_SUBST(CFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(FCFLAGS)
fi
############ select created libraries for the pkg-config ###############
# add external libraries only if they will be installed with the package
# otherwise add external libraries to 'REQUIRED_SYSTEM_LIBS' to use it
# in pkg-config file
PACKAGE_CREATED_LIBS=""
REQUIRED_SYSTEM_LIBS=""
if test x$enable_dd = x"yes"; then
PACKAGE_CREATED_LIBS=$PACKAGE_CREATED_LIBS" -lmlapack_dd -lmblas_dd"
fi
if test x$enable_qd = x"yes"; then
PACKAGE_CREATED_LIBS=$PACKAGE_CREATED_LIBS" -lmlapack_qd -lmblas_qd"
if test x$need_internal_qdlib = xyes; then
PACKAGE_CREATED_LIBS=$PACKAGE_CREATED_LIBS" -lqd"
else
REQUIRED_SYSTEM_LIBS=$REQUIRED_SYSTEM_LIBS" -lqd"
fi
fi
if test x$enable_gmp = x"yes"; then
PACKAGE_CREATED_LIBS=$PACKAGE_CREATED_LIBS" -lmlapack_gmp -lmblas_gmp"
if test x$need_internal_gmplib = xyes; then
PACKAGE_CREATED_LIBS=$PACKAGE_CREATED_LIBS" -lgmpxx -lgmp"
else
REQUIRED_SYSTEM_LIBS=$REQUIRED_SYSTEM_LIBS" -lgmpxx -lgmp"
fi
fi
if test x$enable_mpfr = x"yes"; then
PACKAGE_CREATED_LIBS=$PACKAGE_CREATED_LIBS" -lmlapack_mpfr -lmblas_mpfr -lmpfrcxx"
if test x$need_internal_mpclib = xyes; then
PACKAGE_CREATED_LIBS=$PACKAGE_CREATED_LIBS" -lmpc"
else
REQUIRED_SYSTEM_LIBS=$REQUIRED_SYSTEM_LIBS" -lmpc"
fi
if test x$need_internal_mpfrlib = xyes; then
PACKAGE_CREATED_LIBS=$PACKAGE_CREATED_LIBS" -lmpfr"
else
REQUIRED_SYSTEM_LIBS=$REQUIRED_SYSTEM_LIBS" -lmpfr"
fi
fi
if test x$enable_mpc = x"yes"; then
PACKAGE_CREATED_LIBS=$PACKAGE_CREATED_LIBS" -lmlapack_mpc -lmblas_mpc"
if test x$need_internal_mpclib = xyes; then
PACKAGE_CREATED_LIBS=$PACKAGE_CREATED_LIBS" -lmpc"
else
REQUIRED_SYSTEM_LIBS=$REQUIRED_SYSTEM_LIBS" -lmpc"
fi
fi
if test x$enable___float128 = x"yes"; then
PACKAGE_CREATED_LIBS=$PACKAGE_CREATED_LIBS" -lmlapack___float128 -lmblas___float128 -lquadmath"
fi
if test x$enable_double = x"yes"; then
PACKAGE_CREATED_LIBS=$PACKAGE_CREATED_LIBS" -lmlapack_double -lmblas_double"
fi
if test x$enable_longdouble = x"yes"; then
PACKAGE_CREATED_LIBS=$PACKAGE_CREATED_LIBS" -lmlapack_longdouble -lmblas_longdouble"
fi
PACKAGE_CREATED_LIBS=$PACKAGE_CREATED_LIBS" ${OPENMP_CXXFLAGS}"
AC_SUBST([PACKAGE_CREATED_LIBS])
AC_SUBST([REQUIRED_SYSTEM_LIBS])
########################################################################
AC_CONFIG_FILES([
mpfrc++/Makefile
mblas/optimized/Makefile
mblas/optimized/gmp/Makefile
mblas/optimized/mpfr/Makefile
mblas/optimized/qd/Makefile
mblas/optimized/dd/Makefile
mblas/optimized/dd/cuda/Makefile
mblas/optimized/double/Makefile
mblas/optimized/longdouble/Makefile
mblas/optimized/__float128/Makefile
mblas/blaswrapper/Makefile
mblas/fortranwrapper/Makefile
mblas/debug/Makefile
mblas/debug/gmp/Makefile
mblas/debug/mpfr/Makefile
mblas/debug/qd/Makefile
mblas/debug/dd/Makefile
mblas/debug/double/Makefile
mblas/debug/longdouble/Makefile
mblas/debug/__float128/Makefile
mblas/Makefile
mlapack/debug/Makefile
mlapack/debug/gmp/Makefile
mlapack/debug/mpfr/Makefile
mlapack/debug/qd/Makefile
mlapack/debug/dd/Makefile
mlapack/debug/double/Makefile
mlapack/debug/longdouble/Makefile
mlapack/debug/__float128/Makefile
mlapack/optimized/Makefile
mlapack/optimized/gmp/Makefile
mlapack/optimized/mpfr/Makefile
mlapack/optimized/qd/Makefile
mlapack/optimized/dd/Makefile
mlapack/optimized/double/Makefile
mlapack/optimized/longdouble/Makefile
mlapack/optimized/__float128/Makefile
mlapack/lapackwrapper/Makefile
mlapack/fortranwrapper/Makefile
mlapack/Makefile
external/Makefile
external/gmp/Makefile
external/mpfr/Makefile
external/mpc/Makefile
external/qd/Makefile
external/lapack/Makefile
])
if test x$enable_benchmark != xno; then
AC_CONFIG_FILES([
benchmark/Makefile
benchmark/mblas/Makefile
benchmark/mlapack/Makefile
])
fi
if test x$enable_examples != xno; then
AC_CONFIG_FILES([
examples/Makefile
examples/mblas/Makefile
examples/mlapack/Makefile
])
fi
if test x$enable_reference != xno; then
AC_CONFIG_FILES([
mblas/reference/Makefile
mlapack/reference/Makefile
])
fi
AC_OUTPUT