forked from olajep/coprthr
-
Notifications
You must be signed in to change notification settings - Fork 4
/
configure.in
1051 lines (868 loc) · 27.9 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(coprthr, 1.1, [email protected])
#AC_CONFIG_SRCDIR([clmalloc.h])
#AC_CONFIG_HEADER([config.h])
AC_PREFIX_DEFAULT(/usr/local/browndeer)
AC_DEFUN([SET_OPT],
[if test x$1 != xno; then
echo "enabled $3"
$2=1
else
echo "disabled $3"
$2=0
fi;]
)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
#AC_PROG_LIBTOOL
AC_PATH_PROG([BASH],[bash],,[path=`$path`])
#AC_CHECK_PROG(F90,gfortran44,gfortran44)
# Checks for libraries.
# FIXME: Replace `main' with a function in `-lOpenCL':
AC_CHECK_LIB([OpenCL], [main])
# FIXME: Replace `main' with a function in `-ldl':
AC_CHECK_LIB([dl], [main])
# FIXME: Replace `main' with a function in `-lpthread':
AC_CHECK_LIB([pthread], [main])
AC_CHECK_LIB([elf],[elf64_getehdr])
PWD=`pwd`
### extract enable/disable options
AC_ARG_ENABLE(clgl,
AC_HELP_STRING([--enable-clgl],[enable clgl support (default=yes)]),, enable_clgl=yes)
AC_ARG_ENABLE(clete,
AC_HELP_STRING([--enable-clete],[enable clete expression template acceleration (default=yes)]),, enable_clete=yes)
AC_ARG_ENABLE(debug-libs,
AC_HELP_STRING([--enable-debug-libs],[enable building debug versions of librarires (default=yes)]),, enable_debug_libs=yes)
#AC_ARG_ENABLE(cltrace,
# AC_HELP_STRING([--enable-cltrace],[enable building cltrace tool (default=yes)]),, enable_cltrace=yes)
#AC_ARG_ENABLE(clld,
# AC_HELP_STRING([--enable-clld],[enable building clld tool (default=yes)]),, enable_clld=yes)
AC_ARG_ENABLE(clcc,
AC_HELP_STRING([--enable-clcc],[enable building clcc tools (default=yes)]),, enable_clcc=yes)
AC_ARG_ENABLE(libcoprthr,
AC_HELP_STRING([--enable-libcoprthr],[enable libcoprthr (default=yes)]),, enable_libcoprthr=yes)
AC_ARG_ENABLE(libcoprthrcc,
AC_HELP_STRING([--enable-libcoprthrcc],[enable libcoprthrcc (default=yes)]),, enable_libcoprthrcc=yes)
AC_ARG_ENABLE(libocl,
AC_HELP_STRING([--enable-libocl],[enable libocl (default=yes)]),, enable_libocl=yes)
AC_ARG_ENABLE(libclrpc,
AC_HELP_STRING([--enable-libclrpc],[enable libclrpc (default=yes)]),, enable_libclrpc=yes)
AC_ARG_ENABLE(libcoprthr-ncpu,
AC_HELP_STRING([--enable-libcoprthr-ncpu],[enable libcoprthr ncpu (default=yes)]),, enable_libcoprthr_ncpu=yes)
AC_ARG_ENABLE(fortran,
AC_HELP_STRING([--enable-fortran],[enable fortran bindings (default=no)]),, enable_fortran=no)
AC_ARG_ENABLE(silent,
AC_HELP_STRING([--enable-silent],[enable silent build (default=no)]),,
enable_silent=no)
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[enable debug messages (default=no)]),,
enable_debug=no)
AC_ARG_ENABLE(epiphany,
AC_HELP_STRING([--enable-epiphany],[enable epiphany support (default=no)]),,
enable_epiphany=no)
AC_ARG_ENABLE(libocl-hook,
AC_HELP_STRING([--enable-libocl-hook],[enable libocl hook support (default=no)]),,
enable_libocl_hook=no)
AC_ARG_ENABLE(emek-build,
AC_HELP_STRING([--enable-emek-build],[enable build for Epiphany EMEK (default=no)]),,
enable_emek_build=no)
AC_ARG_ENABLE(old-esdk,
AC_HELP_STRING([--enable-old-esdk],[enable old eSDK API for Epiphany (default=no)]),,
enable_old_esdk=no)
AC_ARG_ENABLE(user-install,
AC_HELP_STRING([--enable-user-install],[enable installation by user without roo permission (default=no)]),,
enable_user_install=no)
AC_ARG_ENABLE(android-cross-compile,
AC_HELP_STRING([--enable-android-cross-compile],[enable cross-compile for Android (default=no)]),,
enable_android_cross_compile=no)
AC_ARG_ENABLE(mic-cross-compile,
AC_HELP_STRING([--enable-mic-cross-compile],[enable cross-compile for MIC (default=no)]),,
enable_mic_cross_compile=no)
enable_libcoprthr_ncpu=enable_libcoprthr;
echo enable_libcoprthr $enable_libcoprthr
### now process the selected options
SET_OPT($enable_clete, ENABLE_CLETE, "CLETE expression template acceleration")
#SET_OPT($enable_debug_libs, ENABLE_DEBUG_LIBS, "building debug versions of librarires - use \<libname\>_d.so")
SET_OPT($enable_cltrace, ENABLE_CLTRACE, "building cltrace tool")
SET_OPT($enable_clcc, ENABLE_CLCC, "building clcc tools")
SET_OPT($enable_libcoprthr, ENABLE_LIBCOPRTHR, "building libcoprthr")
SET_OPT($enable_libcoprthrcc, ENABLE_LIBCOPRTHRCC, "building libcoprthrcc")
SET_OPT($enable_libocl, ENABLE_LIBOCL, "building libocl")
#SET_OPT($enable_libcoprthr_ncpu, ENABLE_NCPU, "libcoprthr ncpu support")
SET_OPT($enable_fortran, ENABLE_FORTRAN, "fortran binding support")
#SET_OPT($enable_libcoprthr_atigpu, ENABLE_ATIGPU, "libcoprthr atigpu support")
#SET_OPT($enable_libcoprthr_bdt_builtins, ENABLE_BDT_BUILTINS, "libcoprthr use bdt builtins")
SET_OPT($enable_libclrpc, ENABLE_LIBCLRPC, "building libclrpc")
SET_OPT($enable_epiphany, ENABLE_EPIPHANY, "epiphany support")
SET_OPT($enable_libocl_hook, ENABLE_LIBOCL_HOOK, "libocl hook support")
SET_OPT($enable_emek_build, ENABLE_EMEK_BUILD, "Epiphany EMEK build")
SET_OPT($enable_old_esdk, ENABLE_OLD_ESDK, "Epiphany old eSDK API")
SET_OPT($enable_user_install, ENABLE_USER_INSTALL, "user install without root permission")
SET_OPT($enable_android_cross_compile, ENABLE_ANDROID_CROSS_COMPILE, "Android cross-compile")
SET_OPT($enable_mic_cross_compile, ENABLE_MIC_CROSS_COMPILE, "MIC cross-compile")
#OPENCL_INCLUDE=
#OPENCL_LIB=
#OPENCL_LIBNAME=
#DEFAULT_DEFAULT_OPENCL_PLATFORM=
#AMD_SDK=
###
### OpenCL platform selection is somewhat complicated. Here are the rules:
###
### 1) gather locations of vendor include and lib paths following best
### known search path and save temporarily for use in the next steps
###
### 2) test for --with-opencl-platform, set DEFAULT_OPENCL_PLATFORM.
### If it is not set, use /etc/OpenCL/vendors to build list
### in this order:
### amdapp,nvidia,coprthr,intel
###
### 3) if set scan DEFAULT_OPENCL_PLATFORM in order and set OPENCL_INCLUDE
### and OPENCL_LIB to be first platform for which we have good paths.
###
### 4) unless --disable-libocl is used, override step 3 with libocl
###
### 5) test for --with-opencl-include and --with-opencl-lib, and override
### OPENCL_INCLUDE and OPENCL_LIB as necessary
###
### step 1)
### XXX add vendor checks to make sure there are no collisions -DAR
# find best known AMDAPP paths
if test -n "$(find /etc/OpenCL/vendors -maxdepth 1 -name 'ati*.icd' -print -quit)"; then
tmp_amdapp_sdk=1;
elif test -n "$(find /etc/OpenCL/vendors -maxdepth 1 -name 'amd*.icd' -print -quit)"; then
tmp_amdapp_sdk=1;
else
tmp_amdapp_sdk=0;
fi;
#if test $tmp_amdapp_sdk = 1; then
for d in /opt/AMDAPP /usr/local/atistream
do
if test -e $d/include/CL/cl.h; then
if test -e $d/lib/x86_64/libOpenCL.so; then
tmp_amdapp_include=$d/include;
tmp_amdapp_lib=$d/lib/x86_64;
break;
fi;
fi;
done;
#fi;
# find best known Nvidia paths
if test -n "$(find /etc/OpenCL/vendors -maxdepth 1 -name 'nvidia*.icd' -print -quit)"; then
tmp_nvidia_sdk=1;
else
tmp_nvidia_sdk=0;
fi;
for d in /usr/local/cuda
do
if test -e $d/OpenCL/common/inc/CL/cl.h; then
if test -e $d/OpenCL/common/lib/Linux64/libOpenCL.so; then
tmp_nvidia_include=$d/OpenCL/common/inc;
tmp_nvidia_lib=$d/OpenCL/common/lib/Linux64;
break;
elif test -e /usr/lib64/libOpenCL.so; then
tmp_nvidia_include=$d/OpenCL/common/inc;
tmp_nvidia_lib=/usr/lib64;
break;
fi;
elif test -e $d/include/CL/cl.h; then
if test -e $d/lib/libOpenCL.so; then
tmp_nvidia_include=$d/include;
tmp_nvidia_lib=$d/lib64;
break;
elif test -e /usr/lib64/libOpenCL.so; then
tmp_nvidia_include=$d/include;
tmp_nvidia_lib=/usr/lib64;
break;
fi;
fi;
done;
#else
# tmp_nvidia_sdk=0;
#fi;
# set COPRTHR paths for bootstrap
if test x$enable_libocl = xyes; then
tmp_coprthr_sdk=1
tmp_coprthr_include=$PWD/include
tmp_coprthr_lib=$PWD/src/libocl
else
tmp_coprthr_sdk=0
tmp_coprthr_include=
tmp_coprthr_lib=
fi;
# find best known Intel paths
if test -n "$(find /etc/OpenCL/vendors -maxdepth 1 -name 'intel*.icd' -print -quit)"; then
tmp_intel_sdk=1;
else
tmp_intel_sdk=0;
fi;
for d in /usr/local
do
if test -e $d/include/CL/cl.h; then
if test -e $d/lib64/libOpenCL.so; then
tmp_intel_include=$d/include;
tmp_intel_lib=$d/lib64;
break;
elif test -e /usr/lib/libOpenCL.so; then
tmp_intel_include=$d/include;
tmp_intel_lib=/usr/lib;
break;
fi;
fi;
done;
#else
# tmp_intel_sdk=0;
#fi;
### step 2)
# test for --with-opencl-platform specification
AC_ARG_WITH(opencl-platform,
AC_HELP_STRING([--with-opencl-platform=NAMELIST],
[specify default platform selection as a comma seperated list]),
[
if test x$withval = xyes; then
AC_MSG_ERROR([usage: --with-opencl-platform=NAMELIST])
else
DEFAULT_OPENCL_PLATFORM=$withval;
fi;
],
[
if test $tmp_amdapp_sdk -eq 1; then
DEFAULT_OPENCL_PLATFORM=amdapp;
fi;
if test $tmp_nvidia_sdk -eq 1; then
if ! test -z $DEFAULT_OPENCL_PLATFORM; then
DEFAULT_OPENCL_PLATFORM=$DEFAULT_OPENCL_PLATFORM,nvidia;
else
DEFAULT_OPENCL_PLATFORM=nvidia;
fi;
fi;
if test $tmp_coprthr_sdk -eq 1; then
if ! test -z $DEFAULT_OPENCL_PLATFORM; then
DEFAULT_OPENCL_PLATFORM=$DEFAULT_OPENCL_PLATFORM,coprthr;
else
DEFAULT_OPENCL_PLATFORM=coprthr;
fi;
fi;
if test $tmp_intel_sdk -eq 1; then
if ! test -z $DEFAULT_OPENCL_PLATFORM; then
DEFAULT_OPENCL_PLATFORM=$DEFAULT_OPENCL_PLATFORM,intel;
else
DEFAULT_OPENCL_PLATFORM=intel;
fi;
fi;
])
### step 3)
list2=`echo $DEFAULT_OPENCL_PLATFORM | awk '{sub(/,/," ");print}'`
for p in $list2
do
echo $p
case $p in
amd*)
OPENCL_INCLUDE=$tmp_amdapp_include;
OPENCL_LIB=$tmp_amdapp_lib;
OPENCL_LIBNAME=OpenCL;
break
;;
nvidia*)
OPENCL_INCLUDE=$tmp_nvidia_include;
OPENCL_LIB=$tmp_nvidia_lib;
OPENCL_LIBNAME=OpenCL;
break
;;
coprthr*)
OPENCL_INCLUDE=$tmp_coprthr_include;
OPENCL_LIB=$tmp_coprthr_lib;
OPENCL_LIBNAME=ocl;
break
;;
intel*)
OPENCL_INCLUDE=$tmp_intel_include;
OPENCL_LIB=$tmp_intel_lib;
OPENCL_LIBNAME=OpenCL;
break
;;
*)
echo "unknown OpenCL platform '" $p "'";
;;
esac
done
### step 4)
if test x$enable_libocl = xyes; then
OPENCL_INCLUDE=$tmp_coprthr_include;
OPENCL_LIB=$tmp_coprthr_lib;
OPENCL_LIBNAME=ocl;
fi;
### step 5)
# test for --with-opencl-include specification
AC_ARG_WITH(opencl-include,
AC_HELP_STRING([--with-opencl-include=DIR],
[specify OpenCL include path]),
[
if test x$withval = xyes; then
AC_MSG_ERROR([usage: --with-opencl-include=DIR])
elif ! test -e $withval/CL/cl.h; then
AC_MSG_ERROR([bad include path, could not find CL/cl.h])
else
OPENCL_INCLUDE=$withval;
fi;
],
[])
# test for --with-opencl-lib specification
AC_ARG_WITH(opencl-lib,
AC_HELP_STRING([--with-opencl-lib=DIR],
[specify OpenCL lib path]),
[
if test x$withval = xyes; then
AC_MSG_ERROR([usage: --with-opencl-lib=DIR])
elif ! test -e $withval/lib$OPENCL_LIBNAME.so; then
AC_MSG_ERROR([bad lib path, could not find $OPENCL_LIB])
else
OPENCL_LIB=$withval;
fi;
],
[])
echo "tmp_amdapp_sdk = " $tmp_amdapp_sdk
echo "tmp_amdapp_include = " $tmp_amdapp_include
echo "tmp_amdapp_lib = " $tmp_amdapp_lib
echo "tmp_nvidia_sdk = " $tmp_nvidia_sdk
echo "tmp_nvidia_include = " $tmp_nvidia_include
echo "tmp_nvidia_lib = " $tmp_nvidia_lib
echo "tmp_coprthr_sdk = " $tmp_coprthr_sdk
echo "tmp_coprthr_include = " $tmp_coprthr_include
echo "tmp_coprthr_lib = " $tmp_coprthr_lib
echo "tmp_intel_sdk = " $tmp_intel_sdk
echo "tmp_intel_include = " $tmp_intel_include
echo "tmp_intel_lib = " $tmp_intel_lib
### XXX consider making bootstrap mode a single test -DAR
if test -z $DEFAULT_OPENCL_PLATFORM; then
if test x$enable_libcoprthr = xyes; then
DEFAULT_OPENCL_PLATFORM=coprthr;
echo no default OpenCL platform, libcoprthr enabled, using bootstrap;
else
AC_MSG_ERROR([no default OpenCL platform, try --enable-libcoprthr])
fi
fi
if test -z $OPENCL_INCLUDE; then
if test x$enable_libcoprthr = xyes; then
OPENCL_INCLUDE=$PWD/include;
echo no OpenCL include path, libcoprthr enabled, using bootstrap;
else
AC_MSG_ERROR([no OpenCL include path, try --with-opencl-include=DIR])
fi
fi
if test -z $OPENCL_LIB; then
if test x$enable_libcoprthr = xyes; then
OPENCL_LIB=$PWD/src/libcoprthr;
echo no OpenCL lib path, libcoprthr enabled, using bootstrap;
else
AC_MSG_ERROR([no OpenCL lib path, try --with-opencl-lib=DIR])
fi
fi
if test -z $OPENCL_LIBNAME; then
if test x$enable_libcoprthr = xyes; then
OPENCL_LIBNAME=coprthr;
echo no OpenCL lib name, libcoprthr enabled, using bootstrap;
else
AC_MSG_ERROR([no OpenCL lib name])
fi
fi
echo "DEFAULT_OPENCL_PLATFORM = " $DEFAULT_OPENCL_PLATFORM
echo "OPENCL_INCLUDE = " $OPENCL_INCLUDE
echo "OPENCL_LIB = " $OPENCL_LIB
echo "OPENCL_LIBNAME = " $OPENCL_LIBNAME
if test x$OPENCL_LIBNAME = xcoprthr; then
enable_clgl=no;
fi
SET_OPT($enable_clgl, ENABLE_CLGL, "CLGL support")
AC_ARG_WITH(fortran,
AC_HELP_STRING([--with-fortran=PROG], [Use fortran compiler PROG]),
[
if test x$withval = xno; then
AC_MSG_ERROR([no fortran compiler specified])
else
F90=$withval
fi;
],
[])
if test x$enable_fortran = xyes; then
if ! test -d F90; then
AC_CHECK_PROG(F90,gfortran44,gfortran44)
fi;
fi;
echo $F90
### Allow a default --with-lib to be provided when prerequisite libraries
### are all installed in same place.
###
### The default to /usr/local is intentional since this location is the
### conventional location where the prerequisite libraries are installed by
### default when built from source.
###
### These versions are always prefered since every OS encountered has had
### incorrect and/or ancient versions of required libraries, unfortunately.
AC_ARG_WITH(lib,
AC_HELP_STRING([--with-lib=DIR],
[set path for prerequisite libs]),
[
if test x$withval = xno; then
AC_MSG_ERROR([usage: --with-lib=DIR])
else
LIB_PATH=$withval
fi;
],
[ LIB_PATH=/usr/local ])
### if LIBELF_PATH specified us it, otherwise default to LIB_PATH
AC_ARG_WITH(libelf,
AC_HELP_STRING([--with-libelf=DIR], [specify path to libelf]),
[
if test x$withval = xno; then
AC_MSG_ERROR([usage: --with-libelf=DIR])
else
LIBELF_PATH=$withval
fi;
],
[
LIBELF_PATH=$LIB_PATH
])
### if LIBEVENT_PATH specified us it, otherwise default to LIB_PATH
AC_ARG_WITH(libevent,
AC_HELP_STRING([--with-libevent=DIR], [set path for libevent]),
[
if test x$withval = xno; then
AC_MSG_ERROR([usage: --with-libevent=DIR])
else
LIBEVENT_PATH=$withval
fi;
],
[
LIBEVENT_PATH=$LIB_PATH
])
### if LIBCONFIG_PATH specified us it, otherwise default to LIB_PATH
AC_ARG_WITH(libconfig,
AC_HELP_STRING([--with-libconfig=DIR], [set path for libconfig]),
[
if test x$withval = xno; then
AC_MSG_ERROR([usage: --with-libconfig=DIR])
else
LIBCONFIG_PATH=$withval
fi;
],
[
LIBCONFIG_PATH=$LIB_PATH
])
### now check for libelf, preference is given to the path LIBELF_PATH
echo "libelf path " $LIBELF_PATH
if test -e $LIBELF_PATH/lib/libelf.so; then
tmp_libelf_soname=`readelf -d $LIBELF_PATH/lib/libelf.so | grep 'Library soname' | awk '{print $5}'`
if ! test x$tmp_libelf_soname = x@<:@libelf.so.0@:>@; then
echo $tmp_libelf_soname
AC_MSG_ERROR([incorrect version of libelf found])
fi
echo "found libelf library";
elif test -e $LIBELF_PATH/lib/libelf.a; then
echo "found static libelf library"
else
# AC_MSG_ERROR([cannot find libelf, try --with-libelf=DIR])
unset LIBELF_PATH
fi
echo "libelf path " $LIBELF_PATH
### if libelf not found then fallback to standard paths and hope for the best
if test "x$LIBELF_PATH" = "x"; then
tmp_LIBS=$LIBS
LIBS=
AC_SEARCH_LIBS(
[elf_version], [elf], [ LIBELF_LIB="-lelf" ],
[AC_MSG_ERROR([unable to find libelf])
])
LIBS=$tmp_LIBS
AC_CHECK_HEADERS([libelf/libelf.h], [found_libelf_headers=yes; break;])
AS_IF([test "x$found_libelf_headers" != "xyes"], [AC_MSG_ERROR([unable to find libelf headers]) ])
else
LIBELF_LIB="-Wl,-rpath,$LIBELF_PATH/lib -L$LIBELF_PATH/lib -lelf"
fi
### now check for libevent, preference is given to the path LIBEVENT_PATH
echo "libevent path " $LIBEVENT_PATH
if test -e $LIBEVENT_PATH/lib/libevent.so; then
echo "found libevent library"
if ! test -e $LIBEVENT_PATH/include/event2; then
unset LIBEVENT_PATH
fi;
elif test -e $LIBEVENT_PATH/lib/libevent.a; then
echo "found static libevent library"
if ! test -e $LIBEVENT_PATH/include/event2; then
unset LIBEVENT_PATH
fi;
else
unset LIBEVENT_PATH
fi;
echo "libevent path " $LIBEVENT_PATH
### if libevent not found then fallback to standard paths and hope for the best
if test "x$LIBEVENT_PATH" = "x"; then
AC_SEARCH_LIBS(
[event_init], [event event2], [ ],
[AC_MSG_ERROR([unable to find libevent])
])
AC_CHECK_HEADERS([event2/event.h], [found_libevent_headers=yes; break;])
AS_IF([test "x$found_libevent_headers" != "xyes"],
[AC_MSG_ERROR([unable to find libevent headers]) ])
fi
### check for the event_rpcgen.py program
AC_CHECK_PROG(have_system_event_rpcgen, event_rpcgen.py, yes, no)
if ! test "x${have_system_event_rpcgen}" = "xyes"; then
AC_MSG_NOTICE([will use bundled third-party event_rpcgen.py])
RPCGEN=../../third-party/event_rpcgen.py
else
RPCGEN=event_rpcgen.py
fi
### now check for libconfig, preference is given to the path LIBCONFIG_PATH
echo "libconfig path " $LIBCONFIG_PATH
if test -e $LIBCONFIG_PATH/lib/libconfig.so; then
echo "found libconfig library"
if ! test -e $LIBCONFIG_PATH/include/libconfig.h; then
AC_MSG_ERROR([cannot find libconfig header])
fi;
elif test -e $LIBCONFIG_PATH/lib/libconfig.a; then
echo "found static libconfig library"
if ! test -e $LIBCONFIG_PATH/include/libconfig.h; then
AC_MSG_ERROR([cannot find libconfig header])
fi;
else
unset LIBCONFIG_PATH
fi;
echo "libconfig path " $LIBCONFIG_PATH
### if libconfig not found then fallback to standard paths and hope for the best
if test "x$LIBCONFIG_PATH" = "x"; then
AC_SEARCH_LIBS(
[config_init], [config], [ ],
[AC_MSG_ERROR([unable to find libconfig])
])
AC_CHECK_HEADERS([libconfig.h], [found_libconfig_headers=yes; break;])
AS_IF([test "x$found_libconfig_headers" != "xyes"],
[AC_MSG_ERROR([unable to find libconfig headers]) ])
fi
### select C/C++ compilers for libcoprthr
AC_ARG_WITH(libcoprthr-cc,
AC_HELP_STRING([--with-libcoprthr-cc=PROG],
[use PROG for libcoprthr C compiler]),
[
if test x$withval = xno; then
AC_MSG_ERROR([no C compiler specified])
else
LIBCOPRTHR_CC=$withval
fi;
],
[ LIBCOPRTHR_CC=gcc ])
AC_ARG_WITH(libcoprthr-cxx,
AC_HELP_STRING([--with-libcoprthr-cxx=PROG],
[use PROG for libcoprthr C++ compiler]),
[
if test x$withval = xno; then
AC_MSG_ERROR([no C++ compiler specified])
else
LIBCOPRTHR_CXX=$withval
fi;
],
[ LIBCOPRTHR_CXX=g++ ])
AC_ARG_WITH(libcoprthr-model,
AC_HELP_STRING([--with-libcoprthr-model=default|template|no-template],
[select model for libcoprthr OCL compilation]),
[
if test x$withval = xtemplate; then
LIBCOPRTHR_MODEL=$withval
elif test x$withval = xno-template; then
LIBCOPRTHR_MODEL=$withval
elif test x$withval = xdefault; then
LIBCOPRTHR_MODEL=$withval
else
AC_MSG_ERROR([invalid libcoprthr model selected])
fi;
],
[ LIBCOPRTHR_MODEL=default ])
if test x$enable_libcoprthr = xyes; then
echo LIBCOPRTHR_CC = $LIBCOPRTHR_CC
echo LIBCOPRTHR_CXX = $LIBCOPRTHR_CXX
echo LIBCOPRTHR_MODEL = $LIBCOPRTHR_MODEL
fi;
### allow custom path for ICD files
AC_ARG_WITH(opencl-icd-path,
AC_HELP_STRING([--with-opencl-icd-path=DIR],
[set custom path for ICD files]),
[
if test x$withval = xno; then
AC_MSG_ERROR([no ICD path specified])
else
OPENCL_ICD_PATH=$withval
fi;
],
[
# if test $enable_user_install -eq 1; then
if test "x$enable_user_install" = "xno"; then
OPENCL_ICD_PATH=/etc/OpenCL/vendors
else
OPENCL_ICD_PATH=$prefix/etc/OpenCL/vendors
fi
])
### set max clmesg level
AC_ARG_WITH(max-clmesg-level,
AC_HELP_STRING([--with-max-clmesg-level=LEVEL],
[set max clmesg level]),
[
if test x$withval = xno; then
AC_MSG_ERROR([usage: --with-max-clmesg-level=LEVEL])
else
MAX_CLMESG_LEVEL=$withval
fi;
],
[ MAX_CLMESG_LEVEL=7 ])
### set default clmesg level
AC_ARG_WITH(default-clmesg-level,
AC_HELP_STRING([--with-default-clmesg-level=LEVEL],
[set default clmesg level]),
[
if test x$withval = xno; then
AC_MSG_ERROR([usage: --with-default-clmesg-level=LEVEL])
else
DEFAULT_CLMESG_LEVEL=$withval
fi;
],
[ DEFAULT_CLMESG_LEVEL=6 ])
if test x$enable_debug = xyes; then
if test x$enable_silent = xyes; then
AC_MSG_WARN([--enable-silent overrides --enable-debug]);
enable_debug=no;
else
MAX_CLMESG_LEVEL=7;
DEFAULT_CLMESG_LEVEL=7;
fi;
fi;
SET_OPT($enable_silent, ENABLE_SILENT, "silent build")
SET_OPT($enable_debug, ENABLE_DEBUG, "debug build")
###
### Determine Epiphany SDK paths
###
if test x$enable_epiphany = xyes; then
AC_ARG_WITH(esdk,
AC_HELP_STRING([--with-esdk=DIR],
[set path for esdk]),
[
if test x$withval = xno; then
AC_MSG_ERROR([usage: --with-esdk=DIR])
else
ESDK_PATH=$withval
fi;
],
[
if test -e /opt/adapteva/esdk; then
ESDK_PATH=/opt/adapteva/esdk/;
elif test -e /usr/local/adapteva; then
ESDK_PATH=/usr/local/adapteva;
else
AC_MSG_ERROR([cannot find esdk, try --with-esdk=DIR])
fi;
])
fi;
###
### Optional set path for ANDROID_NDK
###
AC_ARG_WITH(android-ndk,
AC_HELP_STRING([--with-android-ndk=DIR],
[set path for android NDK]),
[
if test x$withval = xno; then
AC_MSG_ERROR([usage: --with-android-ndk=DIR])
else
ANDROID_NDK=$withval
fi;
],
[
# if test -e /opt/adapteva/esdk; then
# ESDK_PATH=/opt/adapteva/esdk/;
# elif test -e /usr/local/adapteva; then
# ESDK_PATH=/usr/local/adapteva;
# else
# AC_MSG_ERROR([cannot find esdk, try --with-esdk=DIR])
# fi;
ANDROID_NDK=
])
AC_ARG_WITH(android-platform,
AC_HELP_STRING([--with-android-platform=DIR],
[set path for android platform]),
[
if test x$withval = xno; then
AC_MSG_ERROR([usage: --with-android-platform=DIR])
else
ANDROID_PLATFORM=$withval
fi;
],
[
# if test -e /opt/adapteva/esdk; then
# ESDK_PATH=/opt/adapteva/esdk/;
# elif test -e /usr/local/adapteva; then
# ESDK_PATH=/usr/local/adapteva;
# else
# AC_MSG_ERROR([cannot find esdk, try --with-esdk=DIR])
# fi;
ANDROID_PLATFORM=
])
AC_ARG_WITH(android-arch,
AC_HELP_STRING([--with-android-arch=DIR],
[set path for android arch]),
[
if test x$withval = xno; then
AC_MSG_ERROR([usage: --with-android-arch=DIR])
else
ANDROID_ARCH=$withval
fi;
],
[
# if test -e /opt/adapteva/esdk; then
# ESDK_PATH=/opt/adapteva/esdk/;
# elif test -e /usr/local/adapteva; then
# ESDK_PATH=/usr/local/adapteva;
# else
# AC_MSG_ERROR([cannot find esdk, try --with-esdk=DIR])
# fi;
ANDROID_ARCH=
])
###
### Optional set path for MIC libraries
###
AC_ARG_WITH(lib-mic,
AC_HELP_STRING([--with-lib-mic=DIR],
[set path for MIC libraries]),
[
if test x$withval = xno; then
AC_MSG_ERROR([usage: --with-lib-mic=DIR])
else
LIB_MIC_PATH=$withval
fi;
],
[
# if test -e /opt/adapteva/esdk; then
# ESDK_PATH=/opt/adapteva/esdk/;
# elif test -e /usr/local/adapteva; then
# ESDK_PATH=/usr/local/adapteva;
# else
# AC_MSG_ERROR([cannot find esdk, try --with-esdk=DIR])
# fi;
LIB_MIC_PATH=
])
BASH=`which bash`
#MAKE=make
case $build_os in
freebsd*)
MAKE=gmake
;;
*)
MAKE=make
;;
esac;
AC_SUBST(BASH)
AC_SUBST(MAKE)
AC_SUBST(F90)
AC_SUBST(ENABLE_CLGL)
AC_SUBST(ENABLE_CLETE)
AC_SUBST(ENABLE_DEBUG_LIBS)
AC_SUBST(ENABLE_CLTRACE)
AC_SUBST(ENABLE_CLCC)
AC_SUBST(ENABLE_LIBCOPRTHR)
AC_SUBST(ENABLE_LIBCOPRTHRCC)
AC_SUBST(ENABLE_LIBOCL)
AC_SUBST(ENABLE_LIBCLRPC)
AC_SUBST(ENABLE_NCPU)
#AC_SUBST(ENABLE_ATIGPU)
#AC_SUBST(ENABLE_BDT_BUILTINS)
AC_SUBST(ENABLE_SILENT)
AC_SUBST(ENABLE_DEBUG)
AC_SUBST(ENABLE_EPIPHANY)
AC_SUBST(ENABLE_LIBOCL_HOOK)
AC_SUBST(ENABLE_EMEK_BUILD)
AC_SUBST(ENABLE_OLD_ESDK)
AC_SUBST(ENABLE_USER_INSTALL)
AC_SUBST(ENABLE_ANDROID_CROSS_COMPILE)
AC_SUBST(ENABLE_MIC_CROSS_COMPILE)
AC_SUBST(MAX_CLMESG_LEVEL)
AC_SUBST(DEFAULT_CLMESG_LEVEL)
AC_SUBST(OPENCL_INCLUDE)
AC_SUBST(OPENCL_LIB)
AC_SUBST(OPENCL_LIBNAME)
AC_SUBST(DEFAULT_OPENCL_PLATFORM)
#AC_SUBST(libelf_inc)
#AC_SUBST(libelf_lib)
AC_SUBST(LIBELF_INC)
AC_SUBST(LIBELF_LIB)
AC_SUBST(RPCGEN)
AC_SUBST(LIBCOPRTHR_CC)
AC_SUBST(LIBCOPRTHR_CXX)
AC_SUBST(LIBCOPRTHR_MODEL)
AC_SUBST(OPENCL_ICD_PATH)
AC_SUBST(LIBEVENT_PATH)
AC_SUBST(LIBCONFIG_PATH)
AC_SUBST(ESDK_PATH)
AC_SUBST(ANDROID_NDK)
AC_SUBST(ANDROID_PLATFORM)
AC_SUBST(ANDROID_ARCH)
AC_SUBST(LIB_MIC_PATH)
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([install-message.txt])
AC_CONFIG_FILES([src/libstdcl/Makefile])
AC_CONFIG_FILES([src/CLETE/Makefile])
AC_CONFIG_FILES([src/libocl/Makefile])
AC_CONFIG_FILES([src/libcoprthr/Makefile])
AC_CONFIG_FILES([src/libcoprthr/arch/x86_64/Makefile])
# AC_CONFIG_FILES([src/libcoprthr/arch/e32/Makefile])
AC_CONFIG_FILES([src/libcoprthr_opencl/Makefile])
AC_CONFIG_FILES([src/libcoprthrcc/Makefile])
if test x$enable_epiphany = xyes; then
AC_CONFIG_FILES([src/libcoprthr/arch/e32/Makefile])
fi;
AC_CONFIG_FILES([src/libclelf/Makefile])