This repository has been archived by the owner on Oct 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfigure.ac
2710 lines (2305 loc) · 74.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
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
AC_INIT(libmaus,0.0.196,[gt1@sanger.ac.uk],[libmaus],[http://www.sanger.ac.uk])
LIBRARY_VERSION=0:196:0
AC_MSG_NOTICE([Configuring for source in directory ${srcdir}])
AC_CANONICAL_SYSTEM
AC_CANONICAL_HOST
AC_PROG_LIBTOOL
AM_INIT_AUTOMAKE([std-options subdir-objects])
AM_CONFIG_HEADER(config.h)
AC_CONFIG_MACRO_DIR([m4])
CFLAGS_SAVE="${CFLAGS}"
CFLAGS=""
AC_PROG_CC
AM_PROG_CC_C_O
CFLAGS="${CFLAGS_SAVE}"
abs_builddir="${PWD}"
CXXFLAGS_SAVE="${CXXFLAGS}"
CXXFLAGS=""
AC_PROG_CXX
CXXFLAGS="${CXXFLAGS_SAVE}"
AC_MSG_CHECKING([whether host cpu is x86_64])
HOSTCPUISX86_64=no
case ${host_cpu} in
x86_64)
HOSTCPUISX86_64=yes
;;
esac
AC_MSG_RESULT([${HOSTCPUISX86_64}])
AC_MSG_CHECKING([whether host os is GNU/Linux])
HOSTOSISGNULINUX=no
case ${host_os} in
linux-gnu)
HOSTOSISGNULINUX=yes
;;
esac
AC_MSG_RESULT([${HOSTOSISGNULINUX}])
AC_MSG_CHECKING([whether we are compiling for x86_64 CPU on GNU/Linux OS ])
HOSTISX86_64GNULINUX=no
if test \( ${HOSTCPUISX86_64} = "yes" \) -a \( ${HOSTOSISGNULINUX} = "yes" \) ; then
HOSTISX86_64GNULINUX=yes
fi
AC_MSG_RESULT([${HOSTISX86_64GNULINUX}])
YASMEXE=
DIGESTASMOBJ=
LIBMAUS_HAVE_SHA2_ASSEMBLY=
if test ${HOSTISX86_64GNULINUX} = "yes" ; then
AC_ARG_WITH([yasm],
[AS_HELP_STRING([--with-yasm@<:@=PATH@:>@], [path to installed yasm program @<:@default=no@:>@])],
[with_yasm=${withval}],
[with_yasm=no])
if test "${with_yasm}" != "no" ; then
if test \( -z "${with_yasm}" \) -o \( "${with_yasm}" = "yes" \) ; then
with_yasm=`which yasm`
fi
YASMEXE=${with_yasm}
DIGESTASMOBJ="sha256_sse4.o sha256_avx1.o sha512_avx.o sha512_sse4.o"
# yasm in Ubuntu precise cannot process the files below and we currently do not use them
DIGESTASMOBJUNUSED="sha256_avx2_rorx2.o sha256_avx2_rorx8.o sha512_avx2_rorx.o"
LIBMAUS_HAVE_SHA2_ASSEMBLY="#define LIBMAUS_HAVE_SHA2_ASSEMBLY"
fi
fi
AC_CHECK_SIZEOF([unsigned long])
LIBMAUS_SIZEOF_UNSIGNED_LONG="#define LIBMAUS_SIZEOF_UNSIGNED_LONG $ac_cv_sizeof_unsigned_long"
LIBMAUSCPPFLAGS="${CPPFLAGS}"
LIBMAUSLDFLAGS="${LDFLAGS}"
PKG_PROG_PKG_CONFIG
LIBMAUS_HAVE_IGZIP=
AC_ARG_WITH([igzip],
[AS_HELP_STRING([--with-igzip@<:@=PATH@:>@], [path to installed igzip library @<:@default=no@:>@])],
[with_igzip=${withval}],
[with_igzip=no])
IGZIPCPPFLAGS=
IGZIPLDFLAGS=
IGZIPLIBS=
if test "${with_igzip}" != "no" ; then
IGZIPPATH=${with_igzip}
IGZIPCPPFLAGS=
IGZIPLDFLAGS=
IGZIPLIBS="-ligzip1c"
if test ! -z "${IGZIPPATH}" ; then
IGZIPCPPFLAGS="-I${IGZIPPATH}/include"
IGZIPLDFLAGS="-L${IGZIPPATH}/lib -Wl,-rpath,${IGZIPPATH}/lib"
fi
CPPFLAGS_SAVE="${CPPFLAGS}"
LDFLAGS_SAVE="${LDFLAGS}"
LIBS_SAVE="${LIBS}"
LIBS="${LIBS} ${IGZIPLIBS}"
LDFLAGS="${LDFLAGS} ${IGZIPLDFLAGS}"
CPPFLAGS="${CPPFLAGS} ${IGZIPCPPFLAGS}"
AC_LANG_PUSH([C++])
AC_MSG_CHECKING([whether we can compile a igzip program])
AC_TRY_LINK([extern "C" {
#include <igzip_lib.h>
}
],[
LZ_Stream2 stream;
init_stream(&stream);
fast_lz(&stream);
],[igzip=yes],[igzip=no])
AC_MSG_RESULT([${igzip}])
AC_LANG_POP
CPPFLAGS="${CPPFLAGS_SAVE}"
LDFLAGS="${LDFLAGS_SAVE}"
LIBS="${LIBS_SAVE}"
if test ${igzip} = "yes" ; then
LIBMAUS_HAVE_IGZIP="#define LIBMAUS_HAVE_IGZIP"
LIBMAUSPKGLIBS="${LIBMAUSPKGLIBS} ${IGZIPLDFLAGS} ${IGZIPLIBS}"
LIBMAUSPKGCPPFLAGS="${LIBMAUSPKGCPPFLAGS} ${IGZIPCPPFLAGS}"
else
IGZIPCPPFLAGS=
IGZIPLDFLAGS=
IGZIPLIBS=
AC_MSG_ERROR([Failed to compile igzip program.]);
fi
fi
AC_ARG_WITH([kmlocal],
[AS_HELP_STRING([--with-kmlocal@<:@=PATH@:>@], [path to installed kmlocal library @<:@default=no@:>@])],
[with_kmlocal=${withval}],
[with_kmlocal=no])
KMLOCAL=
if test "${with_kmlocal}" != "no" ; then
if test ! -z "${with_kmlocal}" ; then
PKGCONFIGPATHSAVE="${PKG_CONFIG_PATH}"
if test -z "${PKG_CONFIG_PATH}" ; then
export PKG_CONFIG_PATH="${with_kmlocal}/lib/pkgconfig"
else
export PKG_CONFIG_PATH="${with_kmlocal}/lib/pkgconfig:${PKG_CONFIG_PATH}"
fi
fi
PKG_CHECK_MODULES([kmlocal],[kmlocal >= 1.7.2],[kmlocalpkg=yes],[kmlocalpkg=no])
if test ! -z "${with_kmlocal}" ; then
if test ! -z "${PKGCONFIGPATHSAVE}" ; then
export PKG_CONFIG_PATH="${PKGCONFIGPATHSAVE}"
fi
fi
KMLOCAL=
if [[ "${kmlocalpkg}" = "yes" ]] ; then
# PKG_CHECK_MODULES([kmlocal],[kmlocal >= 1.7.2])
AC_LANG_PUSH([C++])
LIBSSAVE="${LIBS}"
LIBS="${LIBS} ${kmlocal_LIBS}"
CPPFLAGSSAVE="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${kmlocal_CFLAGS}"
AC_MSG_CHECKING([whether we can compile a kmlocal program])
AC_TRY_LINK([#include "KMlocal.h"
#include <cstring>
#include <iostream>
],[KMterm term(100, 0, 0, 0, // run for 100 stages
0.10, 0.10, 3, // other typical parameter values
0.50, 10, 0.95);
int k = 4; // number of centers
int dim = 2; // dimension
int nPts = 20; // number of data points
KMdata dataPts(dim, nPts); // allocate data storage
kmUniformPts(dataPts.getPts(), nPts, dim); // generate random points
dataPts.buildKcTree(); // build filtering structure
KMfilterCenters ctrs(k, dataPts); // allocate centers
// run the algorithm
KMlocalLloyds kmAlg(ctrs, term); // repeated Lloyd's
// KMlocalSwap kmAlg(ctrs, term); // Swap heuristic
// KMlocalEZ_Hybrid kmAlg(ctrs, term); // EZ-Hybrid heuristic
// KMlocalHybrid kmAlg(ctrs, term); // Hybrid heuristic
ctrs = kmAlg.execute(); // execute
// print number of stages
std::cout << "Number of stages: " << kmAlg.getTotalStages() << "\n";
// print average distortion
std::cout << "Average distortion: " << ctrs.getDist()/nPts << "\n";
ctrs.print(); // print final centers
kmExit(0);
],[kmlocal=yes],[kmlocal=no])
AC_MSG_RESULT([${kmlocal}])
LIBS="${LIBSSAVE}"
CPPFLAGS="${CPPFLAGSSAVE}"
AC_LANG_POP
if [[ "$kmlocal" = "no" ]] ; then
AC_MSG_ERROR([Failed to compile kmlocal program.]);
else
KMLOCAL="#define LIBMAUS_HAVE_KMLOCAL"
KMLOCALLIBS="${kmlocal_LIBS}"
KMLOCALCPPFLAGS="${kmlocal_CFLAGS}"
fi
fi
fi
PKG_CHECK_MODULES([zlib],[zlib >= 0],[zlibpkg=yes],[zlibpkg=no])
if [[ "${zlibpkg}" = "yes" ]] ; then
PKG_CHECK_MODULES([zlib],[zlib >= 0])
AC_LANG_PUSH([C++])
LIBSSAVE="${LIBS}"
LIBS="${LIBS} ${zlib_LIBS}"
CPPFLAGSSAVE="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS} ${zlib_CFLAGS}"
AC_MSG_CHECKING([whether we can compile a zlib program])
AC_TRY_LINK([#include <zlib.h>
#include <cstring>
],[
z_stream strm;
memset ( &strm , 0, sizeof(z_stream) );
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
deflateInit(&strm,Z_DEFAULT_COMPRESSION);
],[zlib=yes],[zlib=no])
AC_MSG_RESULT([${zlib}])
LIBS="${LIBSSAVE}"
CPPFLAGS="${CPPFLAGSSAVE}"
AC_LANG_POP
if [[ "$zlib" = "no" ]] ; then
AC_MSG_ERROR([Required library zlib not found.]);
else
ZLIBREQ=zlib
ZLIBCPPFLAGS="${zlib_CFLAGS}"
ZLIBLIBS="${zlib_LIBS}"
fi
else
AC_MSG_WARN([zlib pkgconfig file is not installed. Trying if -lz for LIBS is enough.])
AC_LANG_PUSH([C++])
LIBSSAVE="${LIBS}"
LIBS="${LIBS} -lz"
AC_MSG_CHECKING([whether we can compile a zlib program])
AC_TRY_LINK([#include <zlib.h>
#include <cstring>
],[
z_stream strm;
memset ( &strm , 0, sizeof(z_stream) );
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
deflateInit(&strm,Z_DEFAULT_COMPRESSION);
],[zlib=yes],[zlib=no])
AC_MSG_RESULT([${zlib}])
LIBS="${LIBSSAVE}"
AC_LANG_POP
if [[ "$zlib" = "no" ]] ; then
AC_MSG_ERROR([Required library zlib not found.]);
else
ZLIBREQ=
ZLIBCPPFLAGS=
ZLIBLIBS="-lz"
LIBMAUSPKGLIBS="${LIBMAUSPKGLIBS} -lz"
fi
fi
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(boost/regex.hpp, [boost_regex_hpp=yes], [boost_regex_hpp=no])
AC_LANG_POP
AC_LANG_PUSH([C++])
LIBSSAVE="${LIBS}"
LIBS="${LIBS} -lboost_regex"
AC_MSG_CHECKING([whether we can compile a program using the boost regex library])
AC_TRY_LINK([#include <boost/regex.hpp>],[::boost::regex reg("hello world");
::boost::regex_replace(std::string("in hello world replace"),reg,std::string("hu globe"));
],[boost_regex=yes],[boost_regex=no])
AC_MSG_RESULT([${boost_regex}])
LIBS="${LIBSSAVE}"
AC_LANG_POP
if [[ "${boost_regex} = yes" ]] ; then
LIBMAUSHAVEBOOSTREGEX="#define LIBMAUS_HAVE_BOOST_REGEX"
else
LIBMAUSHAVEBOOSTREGEX
fi
LIBMAUSHAVESNAPPY=
SNAPPYCPPFLAGS=
SNAPPYLDFLAGS=
SNAPPYLIBS=
AC_ARG_WITH([snappy],
[AS_HELP_STRING([--with-snappy@<:@=PATH@:>@], [support for snappy compression @<:@default=no@:>@])],
[with_snappy=${withval}],
[with_snappy=no])
if [[ "${with_snappy}" != "no" ]] ; then
LIBSSAVE="${LIBS}"
LDFLAGSSAVE="${LDFLAGS}"
CPPFLAGSSAVE="${CPPFLAGS}"
if [[ \( ! -z "${with_snappy}" \) -a \( "${with_snappy}" != "yes" \) ]] ; then
SNAPPYCPPFLAGS="-I${with_snappy}/include"
SNAPPYLDFLAGS="-L${with_snappy}/lib"
fi
SNAPPYLIBS="-lsnappy"
LIBS="${LIBS} ${SNAPPYLIBS}"
LDFLAGS="${LDFLAGS} ${SNAPPYLDFLAGS}"
CPPFLAGS="${CPPFLAGS} ${SNAPPYCPPFLAGS}"
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(snappy.h, [snappy_h=yes], [snappy_h=no])
AC_MSG_CHECKING([whether we can compile a program using snappy])
AC_TRY_LINK([#include <snappy.h>
#include <cstring>],[char const * input = "hello snappy";
size_t const input_length = strlen(input);
std::string output;
snappy::Compress(input,input_length,&output);
;],[snappy=yes],[snappy=no])
AC_MSG_RESULT([${snappy}])
AC_LANG_POP
CPPFLAGS="${CPPFLAGSSAVE}"
LDFLAGS="${LDFLAGSSAVE}"
LIBS="${LIBSSAVE}"
if [[ "${snappy}" = "yes" ]] ; then
LIBMAUSHAVESNAPPY="#define LIBMAUS_HAVE_SNAPPY"
LIBMAUSPKGLIBS="${LIBMAUSPKGLIBS} ${SNAPPYLDFLAGS} ${SNAPPYLIBS}"
LIBMAUSPKGCPPFLAGS="${LIBMAUSPKGCPPFLAGS} ${SNAPPYCPPFLAGS}"
fi
fi
AC_LANG_PUSH([C++])
AC_HEADER_STDC
AC_LANG_POP
AC_ARG_ENABLE(aio,
AS_HELP_STRING([--enable-aio],[enable asynchronous I/O classes if available (default yes)]),
[useaio=${enableval}],[useaio=yes])
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(aio.h, [aio_h=yes], [aio_h=no])
AC_LANG_POP
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(execinfo.h, [execinfo_h=yes], [execinfo_h=no])
AC_LANG_POP
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(windows.h, [windows_h=yes], [windows_h=no])
AC_LANG_POP
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(unistd.h, [unistd_h=yes], [unistd_h=no])
AC_LANG_POP
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(features.h, [features_h=yes], [features_h=no])
AC_LANG_POP
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(stdint.h, [stdint_h=yes], [stdint_h=no])
AC_LANG_POP
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(dlfcn.h, [dlfcn_h=yes], [dlfcn_h=no])
AC_LANG_POP
HAVEDLFCNH=
if [[ "${dlfcn_h}" = "yes" ]] ; then
HAVEDLFCNH="#define LIBMAUS_HAVE_DLFCN_H"
fi
DLFUNCS=""
have_dynamic_loading=no
if [[ "${dlfcn_h}" = "yes" ]] ; then
AC_LANG_PUSH([C++])
AC_CHECK_FUNC(dlopen,dlopen_nolib=yes,dlopen_nolib=no)
AC_CHECK_FUNC(dlerror,dlerror_nolib=yes,dlerror_nolib=no)
AC_CHECK_FUNC(dlsym,dlsym_nolib=yes,dlsym_nolib=no)
AC_CHECK_FUNC(dlclose,dlclose_nolib=yes,dlclose_nolib=no)
AC_LANG_POP
AC_LANG_PUSH([C++])
AC_CHECK_LIB([dl],[dlopen],[dlopen_lib_dl=yes],[dlopen_libdl=no])
AC_CHECK_LIB([dl],[dlerror],[dlerror_lib_dl=yes],[dlerror_libdl=no])
AC_CHECK_LIB([dl],[dlsym],[dlsym_lib_dl=yes],[dlsym_libdl=no])
AC_CHECK_LIB([dl],[dlclose],[dlclose_lib_dl=yes],[dlclose_libdl=no])
AC_LANG_POP
AC_MSG_CHECKING([whether we found the dlopen function anywhere])
if [[ "${dlopen_nolib}" = "yes" -o "${dlopen_lib_dl}" = "yes" ]] ; then
dlopen_any=yes
else
dlopen_any=no
fi
AC_MSG_RESULT([$dlopen_any])
AC_MSG_CHECKING([whether we found the dlerror function anywhere])
if [[ "${dlerror_nolib}" = "yes" -o "${dlerror_lib_dl}" = "yes" ]] ; then
dlerror_any=yes
else
dlerror_any=no
fi
AC_MSG_RESULT([$dlerror_any])
AC_MSG_CHECKING([whether we found the dlsym function anywhere])
if [[ "${dlsym_nolib}" = "yes" -o "${dlsym_lib_dl}" = "yes" ]] ; then
dlsym_any=yes
else
dlsym_any=no
fi
AC_MSG_RESULT([$dlsym_any])
AC_MSG_CHECKING([whether we found the dlclose function anywhere])
if [[ "${dlclose_nolib}" = "yes" -o "${dlclose_lib_dl}" = "yes" ]] ; then
dlclose_any=yes
else
dlclose_any=no
fi
AC_MSG_RESULT([$dlclose_any])
AC_MSG_CHECKING([whether we found all the functions required for dynamic modules somewhere])
if [[ "${dlopen_any}" = "yes" -a "${dlerror_any}" = "yes" -a "${dlsym_any}" = "yes" -a "${dlclose_any}" = "yes" ]] ; then
dlall_any=yes
else
dlall_any=no
fi
AC_MSG_RESULT([$dlall_any])
if [[ "$dlall_any" = "yes" ]] ; then
AC_MSG_CHECKING([whether we need the dl library for any of the dl functions])
if [[ "${dlopen_nolib}" = "no" -o "${dlerror_nolib}" = "no" -o "${dlsym_nolib}" = "no" -o "${dlclose_nolib}" = "no" ]] ; then
dlneedlibdl=yes
DLLIB="-ldl"
LIBMAUSPKGLIBS="${LIBMAUSPKGLIBS} ${DLLIB}"
else
dlneedlibdl=no
DLLIB=""
fi
AC_MSG_RESULT([$dlneedlibdl])
DLFUNCS="#define LIBMAUS_HAVE_DL_FUNCS"
have_dynamic_loading=yes
fi
# if [[ "${backtrace}" = "yes" ]] ; then
# HAVEBACKTRACE="#define LIBMAUS_HAVE_BACKTRACE"
# fi
fi
HAVEUNISTDH=
if [[ "${unistd_h}" = "yes" ]] ; then
HAVEUNISTDH="#define LIBMAUS_HAVE_UNISTD_H"
fi
HAVEFEATURESH=
if [[ "${features_h}" = "yes" ]] ; then
HAVEHAVEFEATURESH="#define LIBMAUS_HAVE_FEATURES_H"
fi
HAVESTDINTH=
if [[ "${stdint_h}" = "yes" ]] ; then
HAVESTDINTH="#define LIBMAUS_HAVE_STDINT_H"
fi
HAVEAIO=
if [[ \( "${aio_h}" = "yes" \) -a \( "${useaio}" = "yes" \) ]] ; then
AC_LANG_PUSH([C++])
AC_CHECK_LIB([rt],[aio_suspend],[aiolib=yes],[aiolib=no])
AC_LANG_POP
if [[ "${aiolib}" = "yes" ]] ; then
HAVEAIO="#define LIBMAUS_HAVE_AIO"
LIBMAUSLIBS="${LIBMAUSLIBS} -lrt"
fi
fi
if [[ "${execinfo_h}" = "yes" ]] ; then
AC_LANG_PUSH([C++])
AC_CHECK_FUNC(backtrace,backtrace=yes,backtrace=no)
AC_LANG_POP
if [[ "${backtrace}" = "yes" ]] ; then
HAVEBACKTRACE="#define LIBMAUS_HAVE_BACKTRACE"
fi
fi
if [[ "${windows_h}" = "yes" ]] ; then
HAVEWINDOWSH="#define LIBMAUS_HAVE_WINDOWS_H"
fi
HAVEEXECINFO=
if [[ "${execinfo_h}" = "yes" ]] ; then
LIBMAUS_HAVE_EXECINFO_H="#define LIBMAUS_HAVE_EXECINFO_H"
fi
AC_LANG_PUSH([C++])
AC_CHECK_FUNC(setrlimit,setrlimit=yes,setrlimit=no)
AC_LANG_POP
if [[ "${setrlimit}" = "yes" ]] ; then
HAVESETRLIMIT="#define LIBMAUS_HAVE_SETRLIMIT"
fi
LIBMAUSLIBS="${LIBMAUSLIBS} ${ZLIBLIBS}"
AC_LANG_PUSH([C++])
CXXFLAGS_SAVE="${CXXFLAGS}"
CXXFLAGS="-std=gnu++0x"
AC_MSG_CHECKING([whether the C++ compiler supports the -std=gnu++0x flag])
AC_TRY_COMPILE([#include <cstdint>],[],[nullx=yes],[nullx=no])
AC_MSG_RESULT([${nullx}])
CXXFLAGS="${CXXFLAGS_SAVE}"
AC_LANG_POP
AC_LANG_PUSH([C++])
CXXFLAGS_SAVE="${CXXFLAGS}"
CXXFLAGS="-msse4"
AC_MSG_CHECKING([whether the C++ compiler supports the -msse4 flag])
AC_TRY_COMPILE([],[],[msse4=yes],[msse4=no])
AC_MSG_RESULT([${msse4}])
CXXFLAGS="${CXXFLAGS_SAVE}"
AC_LANG_POP
if test "${msse4}" = "yes" ; then
MSSE4="-msse4"
fi
AC_LANG_PUSH([C++])
CXXFLAGS_SAVE=${CXXFLAGS}
CPPFLAGS_SAVE=${CPPFLAGS}
if test "${msse4}" = "yes" ; then
CXXFLAGS="${CXXFLAGS} -msse4"
CPPFLAGS="${CPPFLAGS} -msse4"
fi
AC_CHECK_HEADER(smmintrin.h, [smmintrin_h=yes], [smmintrin_h=no])
CXXFLAGS=${CXXFLAGS_SAVE}
CPPFLAGS=${CPPFLAGS_SAVE}
AC_LANG_POP
HAVESMMINTRINH=
if [[ "${smmintrin_h}" = "yes" ]] ; then
HAVESMMINTRINH="#define LIBMAUS_HAVE_SMMINTRIN_H"
fi
if test "${nullx}" = "yes" ; then
CXXFLAGS_SAVE="${CXXFLAGS}"
CPPFLAGS_SAVE="${CPPFLAGS}"
CXXFLAGS="-std=gnu++0x"
CPPFLAGS="-std=gnu++0x"
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(cstdint, [cstdint=yes], [cstdint=no])
AC_LANG_POP
CXXFLAGS="${CXXFLAGS_SAVE}"
CPPFLAGS="${CPPFLAGS_SAVE}"
LIBMAUSCXXFLAGS="${LIBMAUSCXXFLAGS} -std=gnu++0x"
LIBMAUSPKGCXXFLAGS="${LIBMAUSPKGCXXFLAGS} -std=gnu++0x"
fi
AC_LANG_PUSH([C++])
CXXFLAGS_SAVE="${CXXFLAGS}"
CXXFLAGS="-msse4"
AC_MSG_CHECKING([whether the C++ compiler supports the -msse4 flag])
AC_TRY_COMPILE([],[__builtin_popcount(4ul)],[sse4flag=yes],[sse4flag=no])
AC_MSG_RESULT([${sse4flag}])
CXXFLAGS="${CXXFLAGS_SAVE}"
AC_LANG_POP
WARNCPPFLAGS=
# effc++ strict-null-sentinel no-non-template-friend old-style-cast overloaded-virtual sign-promo non-virtual-dtor abi extra
for flag in "" all abi non-virtual-dtor ; do
AC_LANG_PUSH([C++])
CPPFLAGS_SAVE="${CPPFLAGS}"
CPPFLAGS="-W${flag}"
AC_MSG_CHECKING([whether the C++ compiler supports the -W${flag} flag])
AC_TRY_COMPILE([],[int c = 0;],[wflag=yes],[wflag=no])
AC_MSG_RESULT([${wflag}])
CPPFLAGS="${CPPFLAGS_SAVE}"
AC_LANG_POP
if test "${wflag}" = "yes" ; then
WARNCPPFLAGS="${WARNCPPFLAGS} -W${flag}"
fi
done
if test "${CXX}" = "cl.exe" ; then
CXXFLAGS="${CXXFLAGS} -EHsc -Gr"
CPPFLAGS="${CPPFLAGS} -W1" # -Wall
fi
AC_ARG_ENABLE(optimization,
AS_HELP_STRING([--enable-optimization],[use compiler optimization (default yes)]),
[optimization=${enableval}],[optimization=yes])
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],[use compiler debug flags (default no)]),
[debug=${enableval}],[debug=no])
AC_ARG_ENABLE(werror,
AS_HELP_STRING([--enable-werror],[treat compiler warnings as errors (default no)]),
[werror=${enableval}],[werror=no])
AC_ARG_ENABLE(profile,
AS_HELP_STRING([--enable-profile],[use compiler profiling flags (default no)]),
[profile=${enableval}],[profile=no])
AC_ARG_ENABLE(fast,
AS_HELP_STRING([--enable-fast],[disable evaluation of assertions (default no)]),
[fast=${enableval}],[fast=no])
AC_ARG_ENABLE(sse4,
AS_HELP_STRING([--enable-sse4],[enable sse4 operations (default no)]),
[sse4=${enableval}],[sse4=no])
AC_ARG_ENABLE(ssse3,
AS_HELP_STRING([--enable-ssse3],[enable ssse3 operations (default no)]),
[ssse3=${enableval}],[ssse3=no])
AC_ARG_ENABLE(asm,
AS_HELP_STRING([--enable-asm],[use inline assembly code (default yes)]),
[assembly=${enableval}],[assembly=yes])
AC_ARG_ENABLE(shared-libmaus,
AS_HELP_STRING([--enable-shared-libmaus],[enable compiling shared libmaus.so and libmauslsf.so]),
[sharedlibmaus=${enableval}],[sharedlibmaus=yes])
LIBMAUSSTATIC=
if test "${sharedlibmaus}" = "no" ; then
LIBMAUSSTATIC="-static"
fi
if test "${fast}" = "yes" ; then
CPPFLAGS="${CPPFLAGS} -DNDEBUG"
fi
if test "${werror}" = "yes" ; then
CXXFLAGS="${CXXFLAGS} -Werror"
CFLAGS="${CFLAGS} -Werror"
fi
AC_ARG_ENABLE(openmp,
AS_HELP_STRING([--enable-openmp],[use OpenMP (default yes)]),
[openmp=${enableval}],[openmp=yes])
if test "${openmp}" = "yes" ; then
AC_LANG_PUSH([C++])
AX_OPENMP(have_openmp=yes,have_openmp=no)
AC_LANG_POP
fi
if test "${debug}" = "yes" ; then
CXXFLAGS="${CXXFLAGS} -g -O0 -rdynamic"
CFLAGS="${CFLAGS} -g -O0 -rdynamic"
openmp="no"
else
if test "${profile}" = "yes" ; then
CXXFLAGS="${CXXFLAGS} -g -pg -rdynamic"
CFLAGS="${CFLAGS} -g -pg -rdynamic"
else
if test "${optimization}" = "yes" ; then
case ${CXX} in
g++)
CXXFLAGS="${CXXFLAGS} -O3 -rdynamic"
CFLAGS="${CFLAGS} -O3 -rdynamic"
;;
*-mingw32msvc-g++)
CXXFLAGS="${CXXFLAGS} -O3 -rdynamic"
CFLAGS="${CFLAGS} -O3 -rdynamic"
;;
cl.exe)
CXXFLAGS="${CXXFLAGS} -O2 -Ob2 -Ot -Oy"
;;
esac
fi
fi
fi
AC_LANG_PUSH([C++])
CPPFLAGS_SAVE="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS}"
if test "${nullx}" = "yes" ; then
CPPFLAGS="${CPPFLAGS} -std=gnu++0x"
fi
LIBS_SAVE="${LIBS}"
LIBS="${LIBS}"
AC_MSG_CHECKING([whether std::unique_ptr exists])
AC_LINK_IFELSE([AC_LANG_SOURCE([#include <memory>
int main() {
std::unique_ptr<int> U;
return 0;
}])],
have_std_unique_ptr=yes,
have_std_unique_ptr=no
)
AC_MSG_RESULT($have_std_unique_ptr)
CPPFLAGS="${CPPFLAGS_SAVE}"
LIBS="${LIBS_SAVE}"
AC_LANG_POP
AC_LANG_PUSH([C++])
CPPFLAGS_SAVE="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS}"
if test "${nullx}" = "yes" ; then
CPPFLAGS="${CPPFLAGS} -std=gnu++0x"
fi
LIBS_SAVE="${LIBS}"
LIBS="${LIBS}"
AC_MSG_CHECKING([whether std::shared_ptr exists])
AC_LINK_IFELSE([AC_LANG_SOURCE([#include <memory>
int main() {
std::shared_ptr<int> U;
return 0;
}])],
have_std_shared_ptr=yes,
have_std_shared_ptr=no
)
AC_MSG_RESULT($have_std_shared_ptr)
CPPFLAGS="${CPPFLAGS_SAVE}"
LIBS="${LIBS_SAVE}"
AC_LANG_POP
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(boost/interprocess/smart_ptr/unique_ptr.hpp,[have_boost_unique_include=yes],[have_boost_unique_input=no])
AC_LANG_POP
if test "${have_boost_unique_include}" = "yes" ; then
AC_LANG_PUSH([C++])
CPPFLAGS_SAVE="${CPPFLAGS}"
LIBS_SAVE="${LIBS}"
AC_MSG_CHECKING([whether boost::interprocess::unique_ptr exists])
AC_LINK_IFELSE([AC_LANG_SOURCE([#include <boost/interprocess/smart_ptr/unique_ptr.hpp>
template<typename T>
struct Delete
{
void operator()(T * t) const
{
delete t;
}
};
int main() {
boost::interprocess::unique_ptr<int, Delete<int> > U;
return 0;
}])],
have_boost_unique_ptr=yes,
have_boost_unique_ptr=no
)
AC_MSG_RESULT($have_boost_unique_ptr)
CPPFLAGS="${CPPFLAGS_SAVE}"
LIBS="${LIBS_SAVE}"
AC_LANG_POP
else
have_boost_unique_ptr=no
# AC_MSG_ERROR([Required header boost/interprocess/smart_ptr/unique_ptr.hpp not found])
fi
UNIQUEPTR=
if test "${have_std_unique_ptr}" = "yes" ; then
UNIQUEPTR="#define LIBMAUS_USE_STD_UNIQUE_PTR"
elif test "${have_boost_unique_ptr}" = "yes" ; then
UNIQUEPTR="#define LIBMAUS_USE_BOOST_UNIQUE_PTR"
else
AC_MSG_ERROR([Required unique_ptr class not found (not in standard and not in boost)])
fi
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(boost/shared_ptr.hpp,[have_boost_shared_include=yes],[have_boost_shared_input=no])
AC_LANG_POP
if test "${have_boost_shared_include}" = "yes" ; then
AC_LANG_PUSH([C++])
CPPFLAGS_SAVE="${CPPFLAGS}"
LIBS_SAVE="${LIBS}"
AC_MSG_CHECKING([whether boost::shared_ptr exists])
AC_LINK_IFELSE([AC_LANG_SOURCE([#include <boost/shared_ptr.hpp>
int main() {
boost::shared_ptr<int> U;
return 0;
}])],
have_boost_shared_ptr=yes,
have_boost_shared_ptr=no
)
AC_MSG_RESULT($have_boost_shared_ptr)
CPPFLAGS="${CPPFLAGS_SAVE}"
LIBS="${LIBS_SAVE}"
AC_LANG_POP
else
have_boost_shared_ptr=no
fi
if test "${have_std_shared_ptr}" = "yes" ; then
SHAREDPTR="#define LIBMAUS_USE_STD_SHARED_PTR"
elif test "${have_boost_shared_ptr}" = "yes" ; then
SHAREDPTR="#define LIBMAUS_USE_BOOST_SHARED_PTR"
else
AC_MSG_ERROR([Required shared_ptr class not found (not in standard and not in boost)])
fi
AC_LANG_PUSH([C++])
CPPFLAGS_SAVE="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS}"
if test "${nullx}" = "yes" ; then
CPPFLAGS="${CPPFLAGS} -std=gnu++0x"
fi
LIBS_SAVE="${LIBS}"
LIBS="${LIBS}"
AC_MSG_CHECKING([whether std::unordered_map exists])
AC_LINK_IFELSE([AC_LANG_SOURCE([#include <unordered_map>
int main() {
std::unordered_map<int,int> U;
return 0;
}])],
have_std_unordered_map=yes,
have_std_unordered_map=no
)
AC_MSG_RESULT($have_std_unordered_map)
CPPFLAGS="${CPPFLAGS_SAVE}"
LIBS="${LIBS_SAVE}"
AC_LANG_POP
AC_LANG_PUSH([C++])
CPPFLAGS_SAVE="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS}"
if test "${nullx}" = "yes" ; then
CPPFLAGS="${CPPFLAGS} -std=gnu++0x"
fi
LIBS_SAVE="${LIBS}"
LIBS="${LIBS}"
AC_MSG_CHECKING([whether std::unordered_set exists])
AC_LINK_IFELSE([AC_LANG_SOURCE([#include <unordered_set>
int main() {
std::unordered_set<int> U;
return 0;
}])],
have_std_unordered_set=yes,
have_std_unordered_set=no
)
AC_MSG_RESULT($have_std_unordered_set)
CPPFLAGS="${CPPFLAGS_SAVE}"
LIBS="${LIBS_SAVE}"
AC_LANG_POP
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(boost/unordered_map.hpp,[have_boost_unordered_map=yes],[have_boost_unordered_map=no])
AC_LANG_POP
if test "${have_boost_unordered_map}" = "yes" ; then
AC_LANG_PUSH([C++])
CPPFLAGS_SAVE="${CPPFLAGS}"
LIBS_SAVE="${LIBS}"
AC_MSG_CHECKING([whether boost::unordered_map exists])
AC_LINK_IFELSE([AC_LANG_SOURCE([#include <boost/unordered_map.hpp>
int main() {
boost::unordered_map<int,int> U;
return 0;
}])],
have_boost_unordered_map=yes,
have_boost_unordered_map=no
)
AC_MSG_RESULT($have_boost_unordered_map)
CPPFLAGS="${CPPFLAGS_SAVE}"
LIBS="${LIBS_SAVE}"
AC_LANG_POP
else
have_boost_unordered_map=no
fi
AC_LANG_PUSH([C++])
AC_CHECK_HEADER(boost/unordered_set.hpp,[have_boost_unordered_set=yes],[have_boost_unordered_set=no])
AC_LANG_POP
if test "${have_boost_unordered_set}" = "yes" ; then
AC_LANG_PUSH([C++])
CPPFLAGS_SAVE="${CPPFLAGS}"
LIBS_SAVE="${LIBS}"
AC_MSG_CHECKING([whether boost::unordered_set exists])
AC_LINK_IFELSE([AC_LANG_SOURCE([#include <boost/unordered_set.hpp>
int main() {
boost::unordered_set<int> U;
return 0;
}])],
have_boost_unordered_set=yes,
have_boost_unordered_set=no
)
AC_MSG_RESULT($have_boost_unordered_set)
CPPFLAGS="${CPPFLAGS_SAVE}"
LIBS="${LIBS_SAVE}"
AC_LANG_POP
else
have_boost_unordered_set=no
fi
if test "${have_std_unordered_set}" = "yes" ; then
UNORDEREDSET="#define LIBMAUS_USE_STD_UNORDERED_SET"
elif test "${have_boost_unordered_set}" = "yes" ; then
UNORDEREDSET="#define LIBMAUS_USE_BOOST_UNORDERED_SET"
else
AC_MSG_ERROR([Required unordered_set class not found (not in standard and not in boost)])
fi
if test "${have_std_unordered_map}" = "yes" ; then
UNORDEREDMAP="#define LIBMAUS_USE_STD_UNORDERED_MAP"
elif test "${have_boost_unordered_map}" = "yes" ; then
UNORDEREDMAP="#define LIBMAUS_USE_BOOST_UNORDERED_MAP"
else
AC_MSG_ERROR([Required unordered_map class not found (not in standard and not in boost)])
fi
AC_LANG_PUSH([C++])
CPPFLAGS_SAVE="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS}"
if test "${nullx}" = "yes" ; then
CPPFLAGS="${CPPFLAGS} -std=gnu++0x"
fi
LIBS_SAVE="${LIBS}"
LIBS="${LIBS}"
AC_MSG_CHECKING([whether std::move exists])
AC_LINK_IFELSE([AC_LANG_SOURCE([#include <tuple>
int main() {
std::move(0);
return 0;
}])],
have_std_move=yes,
have_std_move=no
)
AC_MSG_RESULT($have_std_move)
CPPFLAGS="${CPPFLAGS_SAVE}"
LIBS="${LIBS_SAVE}"
AC_LANG_POP
AC_LANG_PUSH([C++])
CPPFLAGS_SAVE="${CPPFLAGS}"
CPPFLAGS="${CPPFLAGS}"
if test "${nullx}" = "yes" ; then
CPPFLAGS="${CPPFLAGS} -std=gnu++0x"
fi
LIBS_SAVE="${LIBS}"
LIBS="${LIBS}"
AC_MSG_CHECKING([whether boost::move exists])
AC_LINK_IFELSE([AC_LANG_SOURCE([#include <boost/interprocess/smart_ptr/unique_ptr.hpp>
#include <boost/move/move.hpp>
template<typename T>
struct Delete
{
void operator()(T * t) const
{
delete t;
}
};
int main() {
boost::interprocess::unique_ptr<int, Delete<int> > U(new int);
boost::interprocess::unique_ptr<int, Delete<int> > V = ::boost::move(U);
return 0;
}])],
have_boost_move=yes,
have_boost_move=no
)