forked from usqcd-software/qdpxx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
executable file
·799 lines (698 loc) · 22.2 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
AC_INIT([qdp++],[1.44.0],[[email protected]])
AC_CONFIG_AUX_DIR(config)
AC_LANG([C++])
AC_PROG_CXX(g++ cxx CC)
AC_PROG_RANLIB
AC_CHECK_TOOL(AR, ar, [ar])
dnl Initialise automake
AM_INIT_AUTOMAKE([subdir-objects])
dnl defines...
AC_CONFIG_HEADERS([include/qdp_config_internal.h])
dnl
dnl
dnl --with-xxxx and --enable-xxxx switches
dnl
dnl --enable-Nd
AC_ARG_ENABLE(Nd,
AC_HELP_STRING([--enable-Nd=N ],
[Set No of Spacetime Dimensions, default is Nd=4 ]),
[ ac_Nd=${enableval} ],
[ ac_Nd=4 ]
)
AC_DEFINE_UNQUOTED(QDP_ND, ${ac_Nd}, [Number of dimensions]) dnl config.h file
AC_SUBST(CONFIG_ND, [${ac_Nd}] ) dnl qdp++_config
dnl Tell the user about Nd
AC_MSG_NOTICE([Configuring QDP++ for Nd = ${ac_Nd}])
dnl --enable-Nc
AC_ARG_ENABLE(Nc,
AC_HELP_STRING([--enable-Nc=N ],
[Set Number of Colors, ie N for SU(N) default is SU(3)]),
[ac_Nc=${enableval}],
[ac_Nc=3]
)
AC_DEFINE_UNQUOTED(QDP_NC, ${ac_Nc}, [Number of color components])
AC_SUBST(CONFIG_NC, [${ac_Nc}] )
dnl Tell the user about Nc
AC_MSG_NOTICE([Configuring QDP++ for Nc = ${ac_Nc}])
dnl --enable-Ns
AC_ARG_ENABLE(Ns,
AC_HELP_STRING([--enable-Ns=N],
[Set No of Spin Components, Default is Ns=4]),
[ac_Ns=${enableval}],
[ac_Ns=4]
)
AC_DEFINE_UNQUOTED(QDP_NS, ${ac_Ns}, [Number of spin components])
AC_SUBST(CONFIG_NS, [${ac_Ns}] )
dnl Tell the user about Ns
AC_MSG_NOTICE([Configuring QDP++ for Ns = ${ac_Ns}])
dnl --enable-alignment
AC_ARG_ENABLE(alignment,
AC_HELP_STRING([--enable-alignment=N],
[Set alignment to N bytes for OLattice]),
[ac_alignment=${enableval}],
[ac_alignment=16]
)
AC_DEFINE_UNQUOTED(QDP_AC_ALIGNMENT_SIZE, ${ac_alignment}, [Alignment for OLattice])
AC_SUBST(CONFIG_ALIGNMENT, [${ac_alignment}])
dnl tell the user about alignment
AC_MSG_NOTICE([Configuring QDP++ Alignment size=${ac_alignment}])
AC_ARG_ENABLE(generics,
AC_HELP_STRING([--enable-generics],
[Enable Generic C specializations]),
[ac_generics=${enableval}],
[ac_generics="yes"]
)
if test "X${ac_generics}X" != "XnoX";
then
AC_DEFINE_UNQUOTED(QDP_USE_GENERIC_OPTS, [1] , [Use generic C optimizations])
AC_SUBST(CONFIG_GENERICS, [${ac_generics}])
fi
dnl tell the user
AC_MSG_NOTICE([Fallback to generic C routines if needed: ${ac_generics}])
dnl --enable-profiling
AC_ARG_ENABLE(profiling,
AC_HELP_STRING([--enable-profiling],
[Enable profiling. Diagnostic use only.]),
[ac_profile=1],
[ac_profile=0]
)
dnl --enable-parallel-arch argument
AC_ARG_ENABLE(parallel-arch,
AC_HELP_STRING([--enable-parallel-arch=<arch>],
[Build QDP++ for parallel architecture <arch>]),
[PARALLEL_ARCH=${enableval}],
AC_MSG_ERROR([Require architecture to be set])
)
dnl --enable-memory-debugging
AC_ARG_ENABLE(memory-debugging,
AC_HELP_STRING([--enable-memory-debugging],
[Enable memory debugging code]),
[ac_memdebug_enabled=1
AC_MSG_NOTICE([Enabling memory debugging code])],
[ac_memdebug_enabled=0]
)
dnl database wrapper
AC_ARG_ENABLE(filedb,
AC_HELP_STRING([--enable-filedb],
[Build routines using FileDB]),
[filedb_enabled="${enableval}"],
[filedb_enabled="yes"]
)
dnl --enable-sse
AC_ARG_ENABLE(sse,
AC_HELP_STRING([--enable-sse],
[Optimize code with Intel SSE instructions]),
[if test "x${enableval}x" = "xyesx";
then
ac_sse=1
else
ac_sse=0
fi],
[ac_sse=0]
)
dnl --enable-sse2
AC_ARG_ENABLE(sse2,
AC_HELP_STRING([--enable-sse2],
[Optimize code with Intel SSE2 instructions]),
[if test "x${enableval}x" = "xyesx";
then
ac_sse=1
ac_sse2=1
else
ac_sse2=0
fi],
[ac_sse2=0]
)
dnl --enable-sse3
AC_ARG_ENABLE(sse3,
AC_HELP_STRING([--enable-sse3],
[Optimize code with Intel SSE3 instructions]),
[if test "x${enableval}x" = "xyesx";
then
ac_sse=1
ac_sse2=1
ac_sse3=1
else
ac_sse3=0
fi],
[ac_sse3=0]
)
dnl --enable-3dnow
AC_ARG_ENABLE(3dnow,
AC_HELP_STRING([--enable-3dnow],
[Optimize code with AMD 3DNow instructions]),
[ac_3dnow=${enableval}],
[ac_3dnow=0]
)
dnl --enable-bgl
AC_ARG_ENABLE(bgl,
AC_HELP_STRING([--enable-bgl],
[Enable BlueGeneL Optimizations]),
[ac_bgl_enabled=1
AC_MSG_NOTICE([Enabling BlueGene Specific Optimizations])],
[ac_bgl_enabled=1]
)
AC_ARG_ENABLE(bgq-thread-binding,
AC_HELP_STRING([--enable-bgq-thread-binding],
[ Enable BlueGeneQ Thread Binding ]),
[ ac_bgq_bind_enabled=${enableval}],
[ ac_bgq_bind_enabled="no"]
)
if test "X${ac_bgq_bind_enabled}X" = "XyesX";
then
AC_MSG_NOTICE([Enabling BGQ Thread Binding])
else
AC_MSG_NOTICE([Not Enabling BGQ Thread Binding])
fi
AM_CONDITIONAL(BUILD_BGQ_THREADBIND, [ test "x${ac_bgq_bind_enabled}x" = "xyesx" ])
if test ${ac_sse} -eq 1; then
AC_DEFINE_UNQUOTED(QDP_USE_SSE, ${ac_sse}, [Enable SSE instructions])
AC_SUBST(CONFIG_SSE,[${ac_sse}])
AC_MSG_NOTICE([Configuring QDP++ with SSE extentions enabled])
fi
if test ${ac_sse2} -eq 1; then
AC_DEFINE_UNQUOTED(QDP_USE_SSE2, ${ac_sse2}, [Enable SSE2 instructions])
AC_SUBST(CONFIG_SSE2,[${ac_sse2}])
AC_MSG_NOTICE([Configuring QDP++ with SSE2 extentions enabled]);
AC_CONFIG_SUBDIRS(other_libs/libintrin)
AC_SUBST(LIBINTRIN_DIR, [libintrin])
build_libintrin="yes"
fi
if test ${ac_sse3} -eq 1; then
AC_DEFINE_UNQUOTED(QDP_USE_SSE3, ${ac_sse3}, [Enable SSE3 instructions])
AC_SUBST(CONFIG_SSE3,[${ac_sse3}])
AC_MSG_NOTICE([Configuring QDP++ with SSE3 extentions enabled]);
fi
if test "x${ac_3dnow}x" = "xyesx"; then
AC_DEFINE_UNQUOTED(QDP_USE_3DNOW, ${ac_3dnow}, [Enable 3DNOW instructions])
AC_MSG_NOTICE([Configuring QDP++ with 3DNOW extentions enabled]);
fi
AM_CONDITIONAL(BUILD_LIBINTRIN,
[ test "x${build_libintrin}x" = "xyesx"] )
dnl if BGL is enabled change some settings
if test ${ac_bgl_enabled} -eq 1; then
AC_DEFINE_UNQUOTED(QDP_USE_BLUEGENEL, ${ac_bgl_enabled}, [Enable BGL opts])
fi
dnl Check if profiling is enabled
if test ${ac_profile} -eq 1; then
AC_DEFINE_UNQUOTED(QDP_USE_PROFILING, ${ac_profile}, [Enable profiling])
AC_MSG_NOTICE([Enable profiling])
fi
dnl Check if memory debugging is enabled
if test ${ac_memdebug_enabled} -eq 1; then
AC_DEFINE_UNQUOTED(QDP_DEBUG_MEMORY, ${ac_memdebug_1}, [Enable memory debugging])
AC_MSG_NOTICE([Enable memory debugging])
fi
dnl Precision munging
AC_ARG_ENABLE(precision,
AC_HELP_STRING([--enable-precision=single|double],
[Sets the base precision to be single or double precision (default is single) ]),
[ac_precision=${enableval}],
[ac_precision="single"])
case ${ac_precision} in
single)
AC_MSG_NOTICE( [Configuring QDP++ for single precision ] )
AC_DEFINE(BASE_PRECISION,[32], [Single precision])
AC_SUBST(CONFIG_PRECISION, [32])
;;
double)
AC_MSG_NOTICE( [Configuring for double precision ] )
AC_DEFINE(BASE_PRECISION, [64], [Double precision] )
AC_SUBST(CONFIG_PRECISION, [64])
;;
*)
AC_MSG_ERROR( [Unsupported value of precision. Check --enable-precision ] )
;;
esac
AC_ARG_ENABLE(layout,
AC_HELP_STRING([--enable-layout=lexico|cb2|cb3d|cb32],
[Sets the layout. lexico=lexicographic, cb2=even odd checkerboard, cb3d=even odd checkerboard in 3d, cb32=hypercubic checkerboard. (default is cb2)]),
[ ac_layout=${enableval} ],
[ ac_layout="cb2" ]
)
case "${ac_layout}" in
lexico|lexicographic)
AC_SUBST(CONFIG_LAYOUT,[lexicographic])
AC_DEFINE(QDP_USE_LEXICO_LAYOUT, [1], [Use lexicographic layout])
;;
cb2|checkerboard)
AC_SUBST(CONFIG_LAYOUT,[cb2])
AC_DEFINE(QDP_USE_CB2_LAYOUT, [1], [Use checkerboarded layout])
;;
cb3d|checkerboard-3d)
AC_SUBST(CONFIG_LAYOUT,[cb3d])
AC_DEFINE(QDP_USE_CB3D_LAYOUT,[1], [Use 3d checkerboarded layout])
;;
cb32|hyper|hypercube)
AC_SUBST(CONFIG_LAYOUT,[cb32])
AC_DEFINE(QDP_USE_CB32_LAYOUT, [1], [Use hypercube checkerboard layout])
;;
*)
AC_MSG_ERROR([Unsupported Layout. Check --enable-layout])
;;
esac
AC_MSG_NOTICE([Configuring QDP++ with ${CONFIG_LAYOUT} layout])
dnl George T. Fleming 03/03/2003
dnl This is a total reworking of Balint Joo's implementation
dnl of the qmp_build_env.sh script. First of all, since the plan seems
dnl to have changed from having QMP live in a subdirectory of QDP++
dnl to having QMP configured, built and installed separately, we only
dnl need to know the flags necessary to compile and link user apps
dnl against QMP and not the flags necessary to compile QMP itself.
dnl
dnl Also, QMP is not needed for ac_parallel_arch={scalar,scalarvec}, so don't bother
dnl looking for it in that case.
AC_ARG_WITH(qmp,
AC_HELP_STRING(
[--with-qmp=DIR],
[Build QDP++ on top of QMP, where QMP is installed in DIR.]
),
[QMP_HOME="${with_qmp}"]
)
case ${PARALLEL_ARCH} in
scalar)
AC_DEFINE(ARCH_SCALAR, [1], [Scalar architecture])
AC_SUBST(ARCH_SITE, "scalarsite")
AC_MSG_NOTICE([ Scalar Build! Not checking for QMP ])
AC_SUBST(QMP_HOME)
AC_SUBST(QMP_CFLAGS)
AC_SUBST(QMP_LDFLAGS)
AC_SUBST(QMP_LIBS)
;;
scalarvec)
AC_DEFINE(ARCH_SCALARVEC, [1], [Scalar with vector extensions architecture])
AC_SUBST(ARCH_SITE, "scalarvecsite")
AC_MSG_NOTICE([ Scalar with Vector extensions Build! Not checking for QMP ])
AC_SUBST(QMP_HOME)
AC_SUBST(QMP_CFLAGS)
AC_SUBST(QMP_LDFLAGS)
AC_SUBST(QMP_LIBS)
;;
parscalar)
AC_DEFINE(ARCH_PARSCALAR, [1], [Parallel-scalar architecture])
AC_SUBST(ARCH_SITE, "scalarsite")
AC_MSG_NOTICE([ Parscalar build! Checking for QMP ])
if test "X${QMP_HOME}X" = "XX" ; then
AC_PATH_PROG([QMP_CONFIG], [qmp-config], [])
else
AC_PATH_PROG([QMP_CONFIG], [qmp-config], [], [${QMP_HOME}/bin:${PATH}])
fi
if test "X${QMP_CONFIG}X" != "XX" ; then
AC_MSG_NOTICE([Found QMP configuration program ${QMP_CONFIG}])
AC_SUBST(QMP_HOME, "${QMP_HOME}")
AC_SUBST(QMP_CFLAGS, "`${QMP_CONFIG} --cflags`")
AC_MSG_NOTICE([QMP compile flags: ${QMP_CFLAGS}])
AC_SUBST(QMP_LDFLAGS, "`${QMP_CONFIG} --ldflags`")
AC_MSG_NOTICE([QMP linking flags: ${QMP_LDFLAGS}])
AC_SUBST(QMP_LIBS, "`${QMP_CONFIG} --libs`")
AC_MSG_NOTICE([QMP libraries flags: ${QMP_LIBS}])
else
AC_MSG_WARN([QMP configuration program qmp-config not found.])
AC_MSG_WARN([Set environment variables QMP_CFLAGS QMP_LDFAGS QMP_LIBS
before configure])
fi
;;
parscalarvec)
AC_DEFINE(ARCH_PARSCALARVEC, [1], [Parallel-scalar with vector extensions layout])
AC_SUBST(ARCH_SITE, "scalarvecsite")
AC_MSG_NOTICE([ Parscalar with Vector extensions build! Checking for QMP ])
if test "X${QMP_HOME}X" = "XX" ; then
AC_PATH_PROG([QMP_CONFIG], [qmp-config], [])
else
AC_PATH_PROG([QMP_CONFIG], [qmp-config], [], [${QMP_HOME}/bin:${PATH}])
fi
if test "X${QMP_CONFIG}X" != "XX" ; then
AC_MSG_NOTICE([Found QMP configuration program ${QMP_CONFIG}])
AC_SUBST(QMP_HOME, "${QMP_HOME}")
AC_SUBST(QMP_CFLAGS, "`${QMP_CONFIG} --cflags`")
AC_MSG_NOTICE([QMP compile flags: ${QMP_CFLAGS}])
AC_SUBST(QMP_LDFLAGS, "`${QMP_CONFIG} --ldflags`")
AC_MSG_NOTICE([QMP linking flags: ${QMP_LDFLAGS}])
AC_SUBST(QMP_LIBS, "`${QMP_CONFIG} --libs`")
AC_MSG_NOTICE([QMP libraries flags: ${QMP_LIBS}])
else
AC_MSG_WARN([QMP configuration program qmp-config not found.])
AC_MSG_WARN([Set environment variables QMP_CFLAGS QMP_LDFAGS QMP_LIBS
before configure])
fi
;;
*)
AC_MSG_ERROR([ Unknown value for --enable-parallel-arch ])
;;
esac
AC_SUBST(CONFIG_PARALLEL_ARCH, [${PARALLEL_ARCH}])
dnl verify we can compile and link against QMP, if needed
PAC_QMP_LINK_CXX_FUNC(
[${QMP_CFLAGS}],
[${QMP_LDFLAGS}],
[${QMP_LIBS}],
,
,
[qmp_link_ok=yes],
[qmp_link_ok=no]
)
AC_MSG_CHECKING([if we can compile/link of a simple QMP C++ program])
case ${PARALLEL_ARCH} in
parscalar)
if test "X${qmp_link_ok}X" = "XyesX" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_ERROR([Cannot compile/link a basic QMP C++ program!
Check QMP_CFLAGS, QMP_LDFLAGS, QMP_LIBS.])
fi
;;
parscalarvec)
if test "X${qmp_link_ok}X" = "XyesX" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_ERROR([Cannot compile/link a basic QMP C++ program!
Check QMP_CFLAGS, QMP_LDFLAGS, QMP_LIBS.])
fi
;;
*)
AC_MSG_RESULT(ignored)
;;
esac
dnl
dnl
dnl now libxml2
dnl
dnl
AC_ARG_WITH(libxml2,
AC_HELP_STRING(
[--with-libxml2=DIR],
[Build on top of libxml2 where libxml2 is installed in DIR]
),
[LIBXML2_HOME="$with_libxml2"]
)
echo Value of with_libxml2 is X${with_libxml2}X
if test "X${with_libxml2}X" = "XnoX" ; then
AC_MSG_NOTICE([Disabling Libxml])
AC_SUBST(LIBXML2_CXXFLAGS, "")
AC_SUBST(LIBXML2_LIBS,"")
else
if test "X${LIBXML2_HOME}X" = "XX" ; then
AC_PATH_PROG(LIBXML2_CONFIG, [xml2-config], [])
else
AC_PATH_PROG(LIBXML2_CONFIG, [xml2-config], [], [${LIBXML2_HOME}/bin:${PATH}])
fi
if test "X${LIBXML2_CONFIG}X" = "XX" ; then
AC_MSG_ERROR([libxml2 configuration program xml2-config not found.])
fi
AC_MSG_NOTICE([Found libxml2 configuration program ${LIBXML2XX_CONFIG}])
AC_SUBST(LIBXML2_CXXFLAGS, "`${LIBXML2_CONFIG} --cflags`")
AC_MSG_NOTICE([libxml2 compile flags: ${LIBXML2_CXXFLAGS}])
AC_SUBST(LIBXML2_LIBS, "`${LIBXML2_CONFIG} --libs`")
AC_MSG_NOTICE([libxml2 libraries flags: ${LIBXML2_LIBS}])
AC_DEFINE_UNQUOTED(QDP_USE_LIBXML2, [1], [Enable LIBXML2 support])
dnl This function is defined in acinclude.m4
dnl it tries to try to compile the program
AC_MSG_CHECKING([if we can compile/link a simple libxml2 program])
PAC_LIBXML2_LINK_CXX_FUNC(
${LIBXML2_CXXFLAGS},
${LIBXML2_LIBS},
,
,
[libxml2_link_ok=yes],
[libxml2_link_ok=no]
)
if test "X${libxml2_link_ok}X" = "XyesX" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_ERROR([Cannot compile/link a program with libxml2.
Use --with-libxml2=<dir> to select a working version.])
fi
fi
dnl Abhinav Sarje, 10/09/2013
dnl Andre Walker-Loud, 10/09/2013
dnl
dnl adding hdf5
dnl
dnl
dnl --with-hdf5
AC_ARG_WITH(hdf5,
AC_HELP_STRING(
[--with-hdf5=DIR],
[Build on top of hdf5 where hdf5 is installed in DIR]
),
[ac_build_hdf5="yes";
HDF5_HOME="$with_hdf5"],
[ac_build_hdf5="no"]
)
if test "X${ac_build_hdf5}X" = "XnoX"; then
AC_MSG_NOTICE([Disabling HDF5])
AC_SUBST(HDF5_CFLAGS, "")
AC_SUBST(HDF5_CXXFLAGS, "")
AC_SUBST(HDF5_LDFLAGS,"")
AC_SUBST(HDF5_LIBS,"")
else
AC_DEFINE_UNQUOTED(QDP_USE_HDF5, [1], [Enable HDF5 support])
if test "X${HDF5_HOME}X" = "XX" ; then
AC_PATH_PROG(HDF5_BIN, [h5dump], [])
else
AC_PATH_PROG(HDF5_BIN, [h5dump], [], [${HDF5_HOME}/bin:${PATH}])
fi
if test "X${HDF5_BIN}X" = "XX" ; then
AC_MSG_ERROR([hdf5 utility h5dump not found.])
fi
AC_MSG_NOTICE([Found hdf5 utility ${HDF5_BIN}])
AC_SUBST(HDF5_CFLAGS, "-I${HDF5_HOME}/include")
AC_SUBST(HDF5_CXXFLAGS, "-I${HDF5_HOME}/include")
AC_MSG_NOTICE([hdf5 c-compile flags: ${HDF5_CFLAGS}])
AC_MSG_NOTICE([hdf5 c++-compile flags: ${HDF5_CXXFLAGS}])
AC_SUBST(HDF5_LDFLAGS, "-L${HDF5_HOME}/lib")
AC_MSG_NOTICE([hdf5 ldflags: ${HDF5_LDFLAGS}])
AC_SUBST(HDF5_LIBS, "-lhdf5 -lz -lm")
AC_MSG_NOTICE([hdf5 libraries: ${HDF5_LIBS}])
AC_SUBST(CONFIG_HDF5,[1])
AC_MSG_NOTICE([Configuring QDP++ with HDF5 enabled]);
fi
dnl bagel support
AC_ARG_WITH(bagel-qdp,
AC_HELP_STRING(
[--with-bagel-qdp=DIR],
[Build QDP++ using bagel_qdp where bagel_qdp is in DIR.]
),
[BAGEL_QDP_DIR=${with_bagel_qdp}
BAGEL_QDP_ENABLED="yes"],
[BAGEL_QDP_DIR=""
BAGEL_QDP_ENABLED="no" ]
)
if test "X${BAGEL_QDP_ENABLED}X" = "XyesX";
then
AC_MSG_NOTICE([Using BAGEL QDP])
AC_DEFINE(QDP_USE_BAGEL_QDP, [1], [Use Bagel QDP library for BLAS])
dnl get flags
if test "X${BAGEL_QDP_DIR}X" = "XX" ;
then
AC_PATH_PROG([BAGEL_QDP_CONFIG], [bagel-qdp-config], [])
else
AC_PATH_PROG([BAGEL_QDP_CONFIG], [bagel-qdp-config], [], [${BAGEL_QDP_DIR}/bin:${PATH}])
fi
if test "X${BAGEL_QDP_CONFIG}X" = "XX";
then
AC_MSG_ERROR([bagel-qdp-config not found])
fi
AC_MSG_NOTICE([Found bagel_qdp configuration program ${BAGEL_QDP_CONFIG}])
AC_SUBST(BAGEL_QDP_CXXFLAGS, "`${BAGEL_QDP_CONFIG} --cxxflags`")
AC_MSG_NOTICE([bagel_qdp compile flags: ${BAGEL_QDP_CXXFLAGS}])
AC_SUBST(BAGEL_QDP_LDFLAGS, "`${BAGEL_QDP_CONFIG} --ldflags`")
AC_MSG_NOTICE([bagel_qdp link flags : ${BAGEL_QDP_LDFLAGS}])
AC_SUBST(BAGEL_QDP_LIBS, "`${BAGEL_QDP_CONFIG} --libs`")
AC_MSG_NOTICE([bagel_qdp libraries flags: ${BAGEL_QDP_LIBS}])
AC_MSG_CHECKING([if we can compile/link a simple bagel_qdp program])
PAC_BAGEL_QDP_LINK_CXX_FUNC(
${BAGEL_QDP_CXXFLAGS},
${BAGEL_QDP_LDFLAGS},
${BAGEL_QDP_LIBS},
,
,
[bagelqdp_link_ok=yes],
[bagelqdp_link_ok=no]
)
if test "X${bagelqdp_link_ok}X" = "XyesX" ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_ERROR([Cannot compile/link a program with bagel_qdp. Use --with-bagel-qdp=<dir> to select a working version.])
fi
else
AC_MSG_NOTICE([not using bagel_qdp])
AC_DEFINE(QDP_USE_BAGEL_QDP, [0], [Donot use Bagel QDP library for BLAS])
AC_SUBST(BAGEL_QDP_CXXFLAGS, "")
AC_SUBST(BAGEL_QDP_LDFLAGS, "")
AC_SUBST(BAGEL_QDP_LIBS, "")
fi
dnl Build filedb
if test "X${filedb_enabled}X" == "XyesX";
then
AC_MSG_NOTICE([Configuring to use FileDB routines])
AC_CONFIG_SUBDIRS(other_libs/filedb)
AC_DEFINE([BUILD_FILEDB],[],[Build filedb])
AC_SUBST(FILEDB_DIR, [filedb])
else
AC_MSG_NOTICE([Not building filedb])
AC_SUBST(FILEDB_DIR,"")
fi
AM_CONDITIONAL(BUILD_FILEDB,
[test "x${filedb_enabled}x" = "xyesx" ])
dnl Use Jie Chens threads library
AC_ARG_WITH(qmt,
AC_HELP_STRING(
[--with-qmt=<DIR>],
[Enable use of QMT Threads library installed in DIR]
),
[ qmt_enabled="yes"
QMT_HOME=${with_qmt} ],
[ qmt_enabled="no" ]
)
dnl QMT Threads stuff
if test "X${qmt_enabled}X" == "XyesX";
then
AC_MSG_NOTICE([Configuring QMT Threading])
if test "X${omp_enabled}X" == "XyesX";
then
AC_MSG_ERROR([Cannot have OpenMP and QMT threading defined simultaneously])
else
AC_DEFINE([QDP_USE_QMT_THREADS], [1], [ Use QMT Threads library ])
AC_SUBST(QMT_HOME, "${QMT_HOME}")
AC_MSG_NOTICE(QMT_HOME: ${QMT_HOME})
AC_SUBST(QMT_CXXFLAGS, "-I${QMT_HOME}/include")
AC_MSG_NOTICE(QMT_CXXFLAGS: ${QMT_CXXFLAGS})
AC_SUBST(QMT_LDFLAGS, "-L${QMT_HOME}/lib")
AC_MSG_NOTICE(QMT_LDFLAGS: ${QMT_LDFLAGS})
AC_SUBST(QMT_LIBS, "-lqmt -lpthread -lm")
AC_MSG_NOTICE(QMT_LIBS: ${QMT_LIBS})
fi
else
AC_SUBST(QMT_CXXFLAGS, "")
AC_SUBST(QMT_LDFLAGS, "")
AC_SUBST(QMT_LIBS, "")
fi
dnl Use OpenMP threading
AC_ARG_ENABLE(openmp,
AC_HELP_STRING(
[--enable-openmp],
[Enable building of OpenMP dispatcher. Pass flags necessary for OpenMP on CFLAGS]
),
[ omp_enabled="yes" ],
[ omp_enabled="no" ]
)
dnl OpenMP Threads stuff
if test "X${omp_enabled}X" == "XyesX";
then
AC_MSG_NOTICE([Configuring OpenMP Threading])
if test "X${qmt_enabled}X" == "XyesX";
then
AC_MSG_ERROR([Cannot have OpenMP and QMT threading defined simultaneously])
fi
AC_DEFINE([QDP_USE_OMP_THREADS], [1], [ Use OpenMP Threads ])
fi
dnl
dnl
dnl Now have all the options... Do some configuration
dnl
dnl
AM_CONDITIONAL(ARCH_SCALAR, [test "X${PARALLEL_ARCH}X" = "XscalarX"])
AM_CONDITIONAL(ARCH_PARSCALAR, [test "X${PARALLEL_ARCH}X" = "XparscalarX"])
AM_CONDITIONAL(ARCH_SCALARVEC, [test "X${PARALLEL_ARCH}X" = "XscalarvecX"])
AM_CONDITIONAL(ARCH_PARSCALARVEC, [test "X${PARALLEL_ARCH}X" = "XparscalarvecX"])
AM_CONDITIONAL(QDP_USE_SCALAR_SSE, [test "X${ac_sse}X" = "X1X" -a "X${ARCH_SITE}X" = "XscalarsiteX"])
AM_CONDITIONAL(QDP_USE_SCALAR_SSE2, [test "X${ac_sse2}X" = "X1X" -a "X${ARCH_SITE}X" = "XscalarsiteX"])
AM_CONDITIONAL(QDP_USE_SCALARVEC_SSE, [test "X${ac_sse}X" = "X1X" -a "X${ARCH_SITE}X" = "XscalarvecsiteX"])
AM_CONDITIONAL(QDP_USE_SCALARVEC_SSE2, [test "X${ac_sse2}X" = "X1X" -a "X${ARCH_SITE}X" = "XscalarvecsiteX"])
#
# For the examples directory, conditionally compile some files.
# These conditionals are *only* used there.
#
AM_CONDITIONAL(BUILD_STAGGERED_EXAMPLES,
[test "X${ac_Ns}X" = "X1X"])
AM_CONDITIONAL(BUILD_WILSON_EXAMPLES,
[test "X${ac_Ns}X" != "X1X"])
AM_CONDITIONAL(BUILD_DEFAULT_ALLOCATOR,
[test "X0X" = "X0X"])
#
# Conditional for use qmt
#
AM_CONDITIONAL(QDP_USE_QMT_THREADS, [test "x${qmt_enabled}x" = "xyesx" ])
#
# Conditional for use omp
#
AM_CONDITIONAL(QDP_USE_OMP_THREADS, [test "x${omp_enabled}x" = "xyesx" ])
#
# Conditional for use of libxml
if test "x${with_libxml2}x" != "xnox"; then
echo True
else
echo False
fi
AM_CONDITIONAL(QDP_USE_LIBXML2, [test "x${with_libxml2}x" != "xnox" ])
# Conditional for use of HDF5
if test "x${ac_build_hdf5}x" = "xyesx"; then
echo True
else
echo False
fi
AM_CONDITIONAL(QDP_USE_HDF5, [test "x${ac_build_hdf5}x" = "xyesx" ])
##################################
# Check for programs to build docs
##################################
AC_CHECK_PROG(LATEX, latex, latex, true)
AC_CHECK_PROG(DVIPS, dvips, dvips, true)
AC_CHECK_PROG(DVIPDF, dvipdf, dvipdf, true)
AC_CHECK_PROG(DOXYGEN, doxygen, doxygen, true)
##################################
# Check for various functions
##################################
AC_CHECK_FUNCS(gethostname)
AC_CHECK_FUNCS(strnlen)
case ${PARALLEL_ARCH} in
parscalar|parscalarvec)
QMP_BKUP_CXXFLAGS="${CXXFLAGS}"
QMP_BKUP_LDFLAGS="${LDFLAGS}"
QMP_BKUP_LIBS="${LIBS}"
AC_LANG_SAVE
CXXFLAGS="${CXXFLAGS} ${QMP_CFLAGS}"
LDFLAGS="${LDFLAGS} ${QMP_LDFLAGS}"
LIBS="${LIBS} ${QMP_LIBS}"
AC_CHECK_FUNCS(QMP_abort QMP_error_exit QMP_verbose)
CXXFLAGS="${QMP_BKUP_CXXFLAGS}"
LDFLAGS="${QMP_BKUP_LDFLAGS}"
LIBS="${LIBS}"
AC_LANG_RESTORE
;;
esac
#######################
# Produce output
#######################
#
# Configure subdir packages
#
if test "x${with_libxml2}x" != "xnox";
then
AC_CONFIG_SUBDIRS(other_libs/qio)
AC_CONFIG_SUBDIRS(other_libs/xpath_reader)
fi
#
# Set up the doxygen file
# Substitute the right directories
#
# AC_CONFIG_FILES(docs/qdpdoc)
#
# Generate makefiles
#
AC_CONFIG_FILES(Makefile)
AC_CONFIG_FILES(qdp++-config)
AC_CONFIG_FILES(lib/Makefile)
AC_CONFIG_FILES(other_libs/Makefile)
AC_CONFIG_FILES(include/Makefile)
#AC_CONFIG_FILES(docs/Makefile)
AC_CONFIG_FILES(examples/Makefile)
AC_CONFIG_FILES(tests/Makefile)
#
# Finish
#
AC_OUTPUT