forked from nwoolls/bfgminer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1380 lines (1260 loc) · 39.6 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl * Copyright 2012-2013 Luke Dashjr
dnl * Copyright 2011-2013 Con Kolivas
dnl * Copyright 2010-2011 Jeff Garzik
dnl * Copyright 2012 Xiangfu
dnl * Copyright 2011 Rusty Russell
dnl * Copyright 2011 Mark Crichton
dnl *
dnl * This program is free software; you can redistribute it and/or modify it
dnl * under the terms of the GNU General Public License as published by the Free
dnl * Software Foundation; either version 3 of the License, or (at your option)
dnl * any later version. See COPYING for more details.
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
m4_define([v_maj], [3])
m4_define([v_min], [5])
m4_define([v_mic], [5])
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
m4_define([v_ver], [v_maj.v_min.v_mic])
m4_define([lt_rev], m4_eval(v_maj + v_min))
m4_define([lt_cur], v_mic)
m4_define([lt_age], v_min)
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
AC_INIT([bfgminer], [v_ver], [[email protected]])
AC_PREREQ([2.59c])
AC_CANONICAL_SYSTEM
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([miner.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign subdir-objects])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_USE_SYSTEM_EXTENSIONS
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
m4_ifdef([v_rev], , [m4_define([v_rev], [0])])
m4_ifdef([v_rel], , [m4_define([v_rel], [])])
AC_DEFINE_UNQUOTED(CGMINER_MAJOR_VERSION, [v_maj], [Major version])
AC_DEFINE_UNQUOTED(CGMINER_MINOR_VERSION, [v_min], [Minor version])
AC_DEFINE_UNQUOTED(CGMINER_MINOR_SUBVERSION, [v_mic], [Micro version])
version_info="lt_rev:lt_cur:lt_age"
release_info="v_rel"
AC_SUBST(version_info)
AC_SUBST(release_info)
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
VMAJ=v_maj
AC_SUBST(VMAJ)
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
dnl Make sure anyone changing configure.ac/Makefile.am has a clue
AM_MAINTAINER_MODE([enable])
dnl Checks for programs
AC_PROG_CC_C99
gl_EARLY
AC_PROG_GCC_TRADITIONAL
AM_PROG_CC_C_O
AC_PROG_RANLIB
AC_PROG_CPP
gl_INIT
AC_SYS_LARGEFILE
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(syslog.h)
AC_CHECK_HEADERS([sys/epoll.h])
AC_CHECK_HEADERS([sys/prctl.h])
AC_CHECK_HEADERS([sys/file.h])
AC_CHECK_HEADERS([linux/spi/spidev.h])
AC_CHECK_HEADERS([sys/file.h])
AC_CHECK_MEMBER([struct i2c_msg.buf],[
true
],[
dnl Note the member is different here to avoid caching screwing things up
AC_CHECK_MEMBER([struct i2c_msg.len],[
AC_DEFINE([NEED_LINUX_I2C_H],[1],[Defined if linux/i2c.h is needed to supplement linux/i2c-dev.h])
],[
true
],[
AC_INCLUDES_DEFAULT
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
])
],[
AC_INCLUDES_DEFAULT
#include <linux/i2c-dev.h>
])
# Setuid
AC_CHECK_HEADERS([pwd.h])
# Check for chroot support
AC_CHECK_FUNCS([chroot])
AC_CHECK_FUNCS([sleep])
AC_FUNC_ALLOCA
driverlist=
algolist=SHA256d
optlist=
need_dynclock=no
need_fpgautils=no
need_lowlevel=no
need_lowl_hid=no
have_cygwin=false
have_win32=false
have_macho=false
AUTOSCAN_CPPFLAGS=""
AUTOSCAN_LIBS=""
DLOPEN_FLAGS="-ldl"
WS2_LIBS=""
MM_LIBS=""
MATH_LIBS="-lm"
RT_LIBS=""
case $target in
amd64-* | x86_64-*)
have_x86_32=false
have_x86_64=true
bitness="64"
;;
i386-* | i486-* | i586-* | i686-* | x86-*)
have_x86_32=true
have_x86_64=false
bitness="32"
;;
*)
have_x86_32=false
have_x86_64=false
;;
esac
case $target in
*-*-mingw*)
have_win32=true
DLOPEN_FLAGS=""
WS2_LIBS="-lws2_32"
MM_LIBS="-lwinmm"
AC_DEFINE([_WIN32_WINNT], [0x0501], "WinNT version for XP+ support")
AC_DEFINE([FD_SETSIZE], [4096], [Maximum sockets before fd_set overflows])
;;
*-*-cygwin*)
have_cygwin=true
;;
powerpc-*-darwin*)
CFLAGS="$CFLAGS -faltivec"
have_macho=true
;;
*-*-darwin*)
have_macho=true
;;
esac
m4_define([BFG_INCLUDE],
if test "x$2" = "x"; then
$1=''
else
$1="[#]include <$2>"
fi
)
m4_define([BFG_PREPROC_IFELSE],
BFG_INCLUDE([headerinclude], $2)
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
${headerinclude}
], [
#if !( $1 )
#error "$1 false in preprocessor"
#endif
])
],[$3],[$4])
)
AC_CHECK_DECL([HASH_ITER],[
AC_CHECK_DECL([DL_CONCAT],[
true
],[
AC_MSG_ERROR([Could not find DL_FOREACH_SAFE - install uthash-dev 1.9.4+])
],[
#include <utlist.h>
])
],[
AC_MSG_ERROR([Could not find HASH_ITER - please install uthash-dev 1.9.4+])
],[
#include <uthash.h>
])
driverlist="$driverlist cpu/cpumining"
cpumining="no"
AC_ARG_ENABLE([cpumining],
[AC_HELP_STRING([--enable-cpumining],[Build with CPU mining support (default disabled)])],
[cpumining=$enableval]
)
if test "x$cpumining" = xyes; then
AC_DEFINE_UNQUOTED([WANT_CPUMINE], [1], [Enable CPUMINING])
driverlist="$driverlist cpu:asm/has_yasm"
driverlist="$driverlist cpu:sse2/have_sse2"
fi
AM_CONDITIONAL([HAS_CPUMINE], [test x$cpumining = xyes])
driverlist="$driverlist opencl"
opencl="yes"
AC_ARG_ENABLE([opencl],
[AC_HELP_STRING([--disable-opencl],[Build without support for OpenCL (default enabled)])],
[opencl=$enableval]
)
if test "x$opencl" = xyes; then
AC_DEFINE([HAVE_OPENCL], [1], [Defined to 1 if OpenCL support is wanted])
fi
AM_CONDITIONAL([HAVE_OPENCL], [test x$opencl = xyes])
m4_define([BFG_PTHREAD_FLAG_CHECK],
AC_MSG_CHECKING([for $1])
for cflag in ' -pthread' ''; do
for lib in ' -lpthread' ' -lwinpthread' ''; do
CFLAGS="${save_CFLAGS}${cflag}"
LIBS="${save_LIBS}${lib}"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([
#include <pthread.h>
], [
void *f = $1;
])
], [
found_pthread=true
PTHREAD_FLAGS="${cflag}"
PTHREAD_LIBS="${lib}"
if test "x${cflag}${lib}" = "x"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([with${cflag}${lib}])
fi
$2
break 2
])
done
done
if test "x${found_pthread}" = "xfalse"; then
AC_MSG_RESULT([no])
fi
)
save_CFLAGS="${CFLAGS}"
save_LIBS="${LIBS}"
found_pthread=false
BFG_PTHREAD_FLAG_CHECK([pthread_cancel],[
AC_DEFINE([HAVE_PTHREAD_CANCEL], [1], [Define if you have a native pthread_cancel])
])
if test "x${found_pthread}" = "xfalse"; then
BFG_PTHREAD_FLAG_CHECK([pthread_create])
if test "x${found_pthread}" = "xfalse"; then
AC_MSG_ERROR([Could not find pthread library - please install libpthread])
fi
fi
# check for nanosleep here, since it is provided by winpthread
AC_CHECK_FUNCS([nanosleep])
CFLAGS="${save_CFLAGS}"
LIBS="${save_LIBS}"
PKG_CHECK_MODULES([JANSSON],[jansson],[
true
],[
AC_MSG_CHECKING([for jansson in system-default locations])
LIBS="$LIBS -ljansson"
AC_TRY_LINK([
#include <jansson.h>
],[
json_object();
],[
AC_MSG_RESULT([found])
JANSSON_LIBS=-ljansson
],[
AC_MSG_RESULT([not found])
AC_MSG_ERROR([Could not find jansson library])
])
LIBS="${save_LIBS}"
])
AC_SUBST(JANSSON_CFLAGS)
AC_SUBST(JANSSON_LIBS)
if test "x$opencl" = xyes; then
adl="yes"
driverlist="$driverlist opencl:sensors/with_sensors"
AC_ARG_WITH([sensors],
[AC_HELP_STRING([--without-sensors],[Build with libsensors monitoring (default enabled)])],
[true],[with_sensors=auto])
if test "x$opencl" != xyes; then
with_sensors=no
fi
if test "x$with_sensors" != xno; then
AC_MSG_CHECKING([for libsensors])
save_LIBS="${LIBS}"
LIBS="$LIBS -lsensors"
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <stddef.h>
#include <sensors/sensors.h>
],[
const sensors_chip_name *cn;
cn = sensors_get_detected_chips(NULL, NULL);
])],[
with_sensors=yes
sensors_LIBS="-lsensors"
AC_DEFINE([HAVE_SENSORS], [1], [Defined if libsensors was found])
AC_MSG_RESULT([yes])
],[
with_sensors=no
AC_MSG_RESULT([no])
if ! $have_win32; then
with_sensors_enableaction="install libsensors"
fi
])
LIBS="$save_LIBS"
fi
AC_SUBST(sensors_LIBS)
driverlist="$driverlist opencl:adl/adl"
AC_ARG_ENABLE([adl],
[AC_HELP_STRING([--disable-adl],[Build without ADL monitoring (default enabled)])],
[adl=$enableval]
)
if test x$adl = xyes
then
AC_DEFINE([HAVE_ADL], [1], [Defined if ADL headers were found])
fi
else
adl="no"
fi
driverlist="$driverlist bitforce"
AC_ARG_ENABLE([bitforce],
[AC_HELP_STRING([--disable-bitforce],[Compile support for BitForce (default enabled)])],
[bitforce=$enableval],
[bitforce=yes]
)
if test "x$bitforce" = xyes; then
AC_DEFINE([USE_BITFORCE], [1], [Defined to 1 if BitForce support is wanted])
need_fpgautils=yes
fi
AM_CONDITIONAL([HAS_BITFORCE], [test x$bitforce = xyes])
driverlist="$driverlist icarus cairnsmore/icarus erupter/icarus"
AC_ARG_ENABLE([icarus],
[AC_HELP_STRING([--disable-icarus],[Compile support for Icarus (default enabled)])],
[icarus=$enableval],
[icarus=yes]
)
if test "x$icarus" = xyes; then
AC_DEFINE([USE_ICARUS], [1], [Defined to 1 if Icarus support is wanted])
need_dynclock=yes
need_fpgautils=yes
fi
AM_CONDITIONAL([HAS_ICARUS], [test x$icarus = xyes])
driverlist="$driverlist avalon"
avalon="no"
AC_ARG_ENABLE([avalon],
[AC_HELP_STRING([--disable-avalon],[Compile support for Avalon (default enabled)])],
[avalon=$enableval],
[avalon=yes]
)
if test "x$avalon" = xyes; then
AC_DEFINE([USE_AVALON], [1], [Defined to 1 if Avalon support is wanted])
need_fpgautils=yes
fi
AM_CONDITIONAL([HAS_AVALON], [test x$avalon = xyes])
driverlist="$driverlist knc"
AC_ARG_ENABLE([knc],
[AC_HELP_STRING([--enable-knc],[Compile support for KnC (default disabled)])],
[knc=$enableval],
[knc=no]
)
if test "x$knc" = xyes; then
AC_CHECK_HEADERS([linux/i2c-dev-user.h])
AC_CHECK_DECL([i2c_smbus_read_word_data],[true],[
AC_MSG_ERROR([linux/i2c-dev.h header from i2c-tools (NOT linux headers) is required for knc driver])
],[
#include <stddef.h>
#ifdef HAVE_LINUX_I2C_DEV_USER_H
#include <linux/i2c-dev-user.h>
#else
#ifdef NEED_LINUX_I2C_H
#include <linux/i2c.h>
#endif
#include <linux/i2c-dev.h>
#endif
])
AC_DEFINE([USE_KNC], [1], [Defined to 1 if KnC support is wanted])
fi
AM_CONDITIONAL([USE_KNC], [test x$knc = xyes])
httpsrv=auto
AC_ARG_WITH([libmicrohttpd],
[AC_HELP_STRING([--without-libmicrohttpd],[Compile support for libmicrohttpd getwork server (default enabled)])],
[httpsrv=$withval]
)
if test "x$httpsrv" != "xno"; then
PKG_CHECK_MODULES([libmicrohttpd],[libmicrohttpd >= 0.9.5],[
AC_DEFINE([USE_LIBMICROHTTPD],[1],[Defined to 1 if libmicrohttpd support is wanted])
httpsrv=yes
],[
httpsrv=no
httpsrv_enableaction="install libmicrohttpd 0.9.5+"
need_bfg_driver_proxy_enableaction="install libmicrohttpd 0.9.5+"
if test "x$httpsrv" = "xyes"; then
AC_MSG_ERROR([Unable to find libmicrohttpd 0.9.5+])
else
AC_MSG_WARN([libmicrohttpd 0.9.5+ not found; getwork proxy will be unavailable])
fi
])
fi
AM_CONDITIONAL([USE_LIBMICROHTTPD], [test x$httpsrv = xyes])
libevent=auto
AC_ARG_WITH([libevent],
[AC_HELP_STRING([--without-libevent],[Compile support for libevent stratum server (default enabled)])],
[libevent=$withval]
)
if test "x$libevent" != "xno"; then
PKG_CHECK_MODULES([libevent],[libevent >= 2.0.3],[
AC_DEFINE([USE_LIBEVENT],[1],[Defined to 1 if libevent support is wanted])
libevent=yes
],[
libevent=no
libevent_enableaction="install libevent 2.0.3+"
if test -n "$need_bfg_driver_proxy_enableaction"; then
need_bfg_driver_proxy_enableaction="${need_bfg_driver_proxy_enableaction} (getwork) or libevent 2.0.3+ (stratum)"
else
need_bfg_driver_proxy_enableaction="install libevent 2.0.3+"
fi
if test "x$libevent" = "xyes"; then
AC_MSG_ERROR([Unable to find libevent 2.0.3+])
else
AC_MSG_WARN([libevent 2.0.3+ not found; stratum proxy will be unavailable])
fi
])
fi
AM_CONDITIONAL([USE_LIBEVENT], [test x$libevent = xyes])
driverlist="$driverlist proxy/need_bfg_driver_proxy"
if test x$libevent$httpsrv = xnono; then
need_bfg_driver_proxy=no
else
need_bfg_driver_proxy=yes
driverlist="$driverlist proxy:getwork/httpsrv proxy:stratum/libevent"
fi
AM_CONDITIONAL([NEED_BFG_DRIVER_PROXY], [test x$libevent$httpsrv != xnono])
driverlist="$driverlist modminer"
AC_ARG_ENABLE([modminer],
[AC_HELP_STRING([--disable-modminer],[Compile support for ModMiner (default enabled)])],
[modminer=$enableval],
[modminer=yes]
)
if test "x$modminer" = xyes; then
AC_DEFINE([USE_MODMINER], [1], [Defined to 1 if ModMiner support is wanted])
need_dynclock=yes
need_fpgautils=yes
fi
AM_CONDITIONAL([HAS_MODMINER], [test x$modminer = xyes])
PKG_PROG_PKG_CONFIG()
libusb=no
libusb_include_path=""
PKG_CHECK_MODULES([LIBUSB], [libusb-1.0],[
libusb=yes
],[
for usb_lib in usb-1.0 usb; do
AC_CHECK_LIB($usb_lib, libusb_init, [
libusb=yes
break
])
done
if test "x$libusb" = xyes; then
AC_CHECK_DECL([libusb_init],[
LIBUSB_LIBS="-l$usb_lib"
],[
AC_MSG_CHECKING([whether libusb_init is declared in subdirectory])
libusb_include_path=`echo '#include <libusb-1.0/libusb.h>' | ${CPP} -M - 2>/dev/null | sed -E -e 's/^[^:]+:[[:space:]]*(([^[:space:]]|\\\\[[:space:]])*)libusb\\.h([[:space:]].*|$)$/\\1/' -e 't my' -e d -e ': my' -e 's/\\\\?([\\\\[:space:]])/\\\\\\1/g'`
if test "x$libusb_include_path" != "x"; then
LIBUSB_LIBS="-l$usb_lib"
LIBUSB_CFLAGS="-I$libusb_include_path"
AC_MSG_RESULT([yes])
else
libusb=no
AC_MSG_RESULT([no])
fi
],[#include <libusb.h>])
fi
])
driverlist="$driverlist x6500"
AC_ARG_ENABLE([x6500],
[AC_HELP_STRING([--disable-x6500],[Compile support for X6500 (default if libusb)])],
[x6500=$enableval],
[x6500=auto]
)
if test "x$x6500$libusb" = xyesno; then
AC_MSG_ERROR([Could not find libusb, required for X6500 support])
elif test "x$x6500" = xauto; then
x6500="$libusb"
if test "x$libusb" = xno; then
AC_MSG_WARN([Could not find libusb, required for X6500 support])
x6500_enableaction="install libusb 1.0+"
fi
fi
if test "x$x6500" = xyes; then
AC_DEFINE([USE_X6500], [1], [Defined to 1 if X6500 support is wanted])
need_dynclock=yes
need_fpgautils=yes
need_lowlevel=yes
fi
AM_CONDITIONAL([HAS_X6500], [test x$x6500 = xyes])
driverlist="$driverlist ztex"
AC_ARG_ENABLE([ztex],
[AC_HELP_STRING([--disable-ztex],[Compile support for ZTEX (default if libusb)])],
[ztex=$enableval],
[ztex=auto]
)
if test "x$ztex$libusb" = xyesno; then
AC_MSG_ERROR([Could not find libusb, required for ZTEX support])
elif test "x$ztex" = xauto; then
ztex="$libusb"
if test "x$libusb" = xno; then
AC_MSG_WARN([Could not find libusb, required for ZTEX support])
ztex_enableaction="install libusb 1.0+"
fi
fi
if test "x$ztex" = xyes; then
AC_DEFINE([USE_ZTEX], [1], [Defined to 1 if ZTEX support is wanted])
need_dynclock=yes
need_fpgautils=yes
fi
AM_CONDITIONAL([HAS_ZTEX], [test x$ztex = xyes])
driverlist="$driverlist bitfury_gpio/bitfury"
bitfury=yes
AC_ARG_ENABLE([bitfury],
[AC_HELP_STRING([--disable-bitfury],[Compile support for Bitfury (default enabled)])],
[bitfury=$enableval]
)
if test "x$bitfury" = xyes; then
AC_DEFINE([USE_BITFURY], [1], [Defined to 1 if Bitfury support is wanted])
fi
AM_CONDITIONAL([HAS_BITFURY], [test x$bitfury = xyes])
driverlist="$driverlist bfsb"
bfsb=no
AC_ARG_ENABLE([bfsb],
[AC_HELP_STRING([--enable-bfsb],[Compile support for BFSB (default disabled)])],
[bfsb=$enableval]
)
if test "x$bfsb" = "xyes"; then
if test "x$bitfury" = "xno"; then
AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled BFSB])
fi
AC_DEFINE([USE_BFSB], [1], [Defined to 1 if BFSB support is wanted])
fi
AM_CONDITIONAL([HAS_BFSB], [test x$bfsb = xyes])
driverlist="$driverlist bigpic"
bigpic=auto
AC_ARG_ENABLE([bigpic],
[AC_HELP_STRING([--disable-bigpic],[Compile support for Big Picture Mining USB (default enabled)])],
[bigpic=$enableval]
)
if test "x$bigpic" = "xno"; then
true
elif test "x$bitfury" = "xyes"; then
bigpic=yes
elif test "x$bigpic" = "xyes"; then
AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled BigPic])
else
bigpic=no
fi
if test "x$bigpic" = "xyes"; then
AC_DEFINE([USE_BIGPIC], [1], [Defined to 1 if Big Picture Mining USB support is wanted])
need_fpgautils=yes
fi
AM_CONDITIONAL([HAS_BIGPIC], [test x$bigpic = xyes])
driverlist="$driverlist littlefury"
littlefury=auto
AC_ARG_ENABLE([littlefury],
[AC_HELP_STRING([--disable-littlefury],[Compile support for LittleFury (default enabled)])],
[littlefury=$enableval]
)
if test "x$littlefury" = "xno"; then
true
elif test "x$bitfury" = "xyes"; then
littlefury=yes
elif test "x$littlefury" = "xyes"; then
AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled LittleFury])
else
littlefury=no
fi
if test "x$littlefury" = "xyes"; then
AC_DEFINE([USE_LITTLEFURY], [1], [Defined to 1 if LittleFury support is wanted])
need_fpgautils=yes
fi
AM_CONDITIONAL([HAS_LITTLEFURY], [test x$littlefury = xyes])
found_hidapi=false
for _hidapi_lib in hidapi hidapi-hidraw hidapi-libusb; do
PKG_CHECK_MODULES([hidapi],[$_hidapi_lib],[
found_hidapi=true
break
],[
true
])
done
driverlist="$driverlist nanofury"
nanofury=auto
AC_ARG_ENABLE([nanofury],
[AC_HELP_STRING([--disable-nanofury],[Compile support for NanoFury (default enabled)])],
[nanofury=$enableval]
)
if test "x$nanofury" = "xno"; then
true
elif test "x$bitfury" = "xyes"; then
if test x$found_hidapi = xtrue; then
nanofury=yes
else
if test x$nanofury = xauto; then
nanofury=no
nanofury_enableaction="install hidapi"
else
AC_MSG_ERROR([Could not find hidapi, required for NanoFury support])
fi
fi
elif test "x$nanofury" = "xyes"; then
AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled NanoFury])
else
nanofury=no
fi
if test "x$nanofury" = "xyes"; then
AC_DEFINE([USE_NANOFURY], [1], [Defined to 1 if NanoFury support is wanted])
need_fpgautils=yes
need_lowlevel=yes
need_lowl_hid=yes
fi
AM_CONDITIONAL([HAS_NANOFURY], [test x$nanofury = xyes])
driverlist="$driverlist hashbuster"
hashbuster=auto
AC_ARG_ENABLE([hashbuster],
[AC_HELP_STRING([--disable-hashbuster],[Compile support for HashBuster (default enabled)])],
[hashbuster=$enableval]
)
if test "x$hashbuster" = "xno"; then
true
elif test "x$bitfury" = "xyes"; then
if test x$found_hidapi = xtrue; then
hashbuster=yes
else
if test x$hashbuster = xauto; then
hashbuster=no
hashbuster_enableaction="install hidapi"
else
AC_MSG_ERROR([Could not find hidapi, required for HashBuster support])
fi
fi
elif test "x$hashbuster" = "xyes"; then
AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled HashBuster])
else
hashbuster=no
fi
if test "x$hashbuster" = "xyes"; then
AC_DEFINE([USE_HASHBUSTER], [1], [Defined to 1 if HashBuster support is wanted])
need_fpgautils=yes
need_lowlevel=yes
need_lowl_hid=yes
fi
AM_CONDITIONAL([USE_HASHBUSTER], [test x$hashbuster = xyes])
driverlist="$driverlist metabank"
metabank=no
AC_ARG_ENABLE([metabank],
[AC_HELP_STRING([--enable-metabank],[Compile support for Metabank (default disabled)])],
[metabank=$enableval]
)
if test "x$metabank" = "xyes"; then
if test "x$bitfury" = "xno"; then
AC_MSG_ERROR([You explicitly disabled Bitfury and explicitly enabled Metabank])
fi
AC_DEFINE([USE_METABANK], [1], [Defined to 1 if Metabank support is wanted])
fi
AM_CONDITIONAL([HAS_METABANK], [test x$metabank = xyes])
if test "x$x6500$ztex" = "xnono"; then
libusb=no
LIBUSB_LIBS=''
LIBUSB_CFLAGS=''
fi
if test "x$libusb" = xyes; then
AC_DEFINE([HAVE_LIBUSB], [1], [Define if you have libusb-1.0])
save_CFLAGS="$CFLAGS"
CFLAGS="$LIBUSB_CFLAGS $CFLAGS"
AC_CHECK_DECLS([libusb_error_name],[true],[true],[#include <libusb.h>])
CFLAGS="$save_CFLAGS"
fi
algolist="$algolist scrypt"
scrypt="no"
AC_ARG_ENABLE([scrypt],
[AC_HELP_STRING([--enable-scrypt],[Compile support for scrypt mining (default disabled)])],
[scrypt=$enableval]
)
if test "x$scrypt" = xyes; then
AC_DEFINE([USE_SCRYPT], [1], [Defined to 1 if scrypt support is wanted])
fi
if test x$need_fpgautils = xyes; then
AC_DEFINE([HAVE_FPGAUTILS], [1], [Defined to 1 if fpgautils is being used])
need_lowlevel=yes
if $have_win32; then
echo '#include <iospeeds.h>' >iospeeds_local.h
found_ddkusb=false
AC_CHECK_HEADER([usbiodef.h],[
found_ddkusb=true
],[
AC_CHECK_HEADER([ddk/usbiodef.h],[
found_ddkusb=true
AUTOSCAN_CPPFLAGS="-I"`echo '#include <ddk/usbiodef.h>' | ${CPP} -M - 2>/dev/null | sed -E -e 's/^[^:]+:[[:space:]]*(([^[:space:]]|\\\\[[:space:]])*)usbiodef\\.h([[:space:]].*|$)$/\\1/' -e 't my' -e d -e ': my' -e 's/\\\\?([\\\\[:space:]])/\\\\\\1/g'`
],[
true
],[
#include <windows.h>
#include <ddk/usbioctl.h>
AC_INCLUDES_DEFAULT
])
],[
#include <windows.h>
#include <usbioctl.h>
AC_INCLUDES_DEFAULT
])
if $found_ddkusb; then
AUTOSCAN_LIBS="-lsetupapi"
AC_DEFINE([HAVE_WIN_DDKUSB],[1],[Defined to 1 if Windows DDK USB headers are being used])
fi
else
AC_MSG_CHECKING([what baud rates your system supports])
echo '#include <termios.h>' | ${CPP} -dM - 2>/dev/null | sed 's/.*[ ]B\([0-9][0-9]*\)[ ].*/IOSPEED(\1)/' | grep IOSPEED >iospeeds_local.h
if grep -q IOSPEED iospeeds_local.h; then
AC_MSG_RESULT([done])
else
AC_MSG_RESULT([failed, using standard POSIX])
echo '#include <iospeeds_posix.h>' >iospeeds_local.h
fi
fi
fi
if test "x$opencl$need_lowl_hid" = xnono; then
DLOPEN_FLAGS=""
fi
if test x$need_lowl_hid = xyes; then
AC_DEFINE([NEED_BFG_LOWL_HID], [1], [Defined to 1 if lowlevel hid drivers are being used])
need_lowlevel=yes
fi
if test x$need_lowlevel = xyes; then
AC_DEFINE([HAVE_BFG_LOWLEVEL], [1], [Defined to 1 if lowlevel drivers are being used])
fi
curses="auto"
AC_ARG_WITH([curses],
[AC_HELP_STRING([--without-curses],[Compile support for curses TUI (default enabled)])],
[curses=$withval]
)
if test "x$curses" = "xno"; then
optlist="$optlist curses"
else
curses_enableaction="install a curses library"
orig_libs="$LIBS"
if test "x${curses}" = "xyes"; then
preferl=''
else
preferl="${curses} ${curses}6 ${curses}5"
fi
for wideornot in w u ''; do
for ncursesver in '' 6 5; do
preferl="${preferl} ncurses${wideornot}${ncursesver}"
done
preferl="${preferl} pdcurses${wideornot}"
done
if test "x$cross_compiling" != "xyes"; then
AC_MSG_CHECKING([for best native curses library])
orig_cflags="$CFLAGS"
for curses_lib in ${preferl}; do
if ! ${curses_lib}-config --cflags >/dev/null 2>/dev/null; then
continue
fi
CFLAGS="$orig_cflags $(${curses_lib}-config --cflags)"
LIBS="$orig_libs $(${curses_lib}-config --libs)"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <curses.h>
]], [[
WINDOW *w = NULL;
mvwprintw(w, 2, 2, "Testing %s", "o hai");
]])], [
curses=yes
optlist="$optlist ${curses_lib}/curses"
AC_MSG_RESULT([$curses_lib])
NCURSES_LIBS=`${curses_lib}-config --libs`
NCURSES_CPPFLAGS=`${curses_lib}-config --cflags`
break
], [
AC_MSG_WARN([${curses_lib} doesn't seem to be installed properly])
])
done
CFLAGS="$orig_cflags"
if test "x$curses" != "xyes"; then
AC_MSG_RESULT([none?])
fi
fi
if test "x$curses" != "xyes"; then
sym=addstr
AC_SEARCH_LIBS(${sym}, ${preferl}, [
curses=yes
eval "curseslib=\"\${ac_cv_search_${sym}}\""
barelib="${curseslib/-l/}"
optlist="$optlist ${barelib}/curses"
if test "x${curseslib}" != "xnone required"; then
NCURSES_LIBS="${curseslib}"
fi
# Need to check for headers in subdirectories, to ensure we get wide stuff
AC_MSG_CHECKING([for curses header subdirectory])
barelib="${barelib/6/}"
barelib="${barelib/5/}"
cursesincl=`echo '#include <'"${barelib}"'/curses.h>' | ${CPP} -M - 2>/dev/null | sed -E -e 's/^[^:]+:[[:space:]]*(([^[:space:]]|\\\\[[:space:]])*)curses\\.h([[:space:]].*|$)$/\\1/' -e 't my' -e d -e ': my' -e 's/\\\\?([\\\\[:space:]])/\\\\\\1/g'`
if test "x$cursesincl" != "x"; then
NCURSES_CPPFLAGS="-I${cursesincl}"
AC_MSG_RESULT([$cursesincl])
else
AC_MSG_RESULT([none found])
fi
break
], [
if test "x$curses" = "xyes"; then
AC_MSG_ERROR([Could not find curses library - please install libncurses-dev or pdcurses-dev (or configure --without-curses)])
else
AC_MSG_WARN([Could not find curses library - if you want a TUI, install libncurses-dev or pdcurses-dev])
curses=no
optlist="$optlist curses"
fi
])
fi
if test "x$curses" = "xyes"; then
AC_DEFINE([HAVE_CURSES], [1], [Defined to 1 if curses TUI support is wanted])
AC_MSG_CHECKING([whether curses library supports wide characters])
LIBS="$orig_libs $NCURSES_CPPFLAGS $NCURSES_LIBS"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([
#define PDC_WIDE
#include <curses.h>
],[
addwstr(L"test");
add_wch(WACS_VLINE);
])
],[
AC_MSG_RESULT([yes])
AC_DEFINE([USE_UNICODE],[1],[Defined to 1 if curses supports wide characters])
],[
AC_MSG_RESULT([no])
])
fi
LIBS="$orig_libs"
fi
maybe_ldconfig=
AC_ARG_WITH([system-libblkmaker], [AC_HELP_STRING([--with-system-libblkmaker], [Use system libblkmaker rather than bundled one (default disabled)])],[true],[with_system_libblkmaker=no])
if test "x$with_system_libblkmaker" = "xyes"; then
PKG_CHECK_MODULES([libblkmaker],[libblkmaker_jansson-0.1],[
true
],[
AC_MSG_ERROR([Could not find system libblkmaker])
])
else
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,-zorigin"
origin_LDFLAGS=
AC_MSG_CHECKING([whether the linker recognizes the -zorigin option])
AC_TRY_LINK([],[],[
AC_MSG_RESULT([yes])
origin_LDFLAGS=',-zorigin'
],[
AC_MSG_RESULT([no])
])
LDFLAGS="$save_LDFLAGS"
libblkmaker_CFLAGS='-Ilibblkmaker'
libblkmaker_LDFLAGS='-Llibblkmaker/.libs -Wl,-rpath,\$$ORIGIN/libblkmaker/.libs'"$origin_LDFLAGS"
libblkmaker_LIBS='-lblkmaker_jansson-0.1 -lblkmaker-0.1'
AC_CONFIG_SUBDIRS([libblkmaker])
_ROOTPATH=$PATH$PATH_SEPARATOR`echo $PATH | sed s/bin/sbin/g`
possible_ldconfigs="${target}-ldconfig"
if test "x$cross_compiling" != "xyes"; then
possible_ldconfigs="${possible_ldconfigs} ldconfig"
fi
AC_CHECK_PROGS([LDCONFIG],[${possible_ldconfigs}],[],[$_ROOTPATH])
if test "x$LDCONFIG" != "x"; then
maybe_ldconfig=" && $LDCONFIG"
fi
fi
AC_SUBST(libblkmaker_CFLAGS)
AC_SUBST(libblkmaker_LDFLAGS)
AC_SUBST(libblkmaker_LIBS)
AM_CONDITIONAL([NEED_LIBBLKMAKER], [test x$with_system_libblkmaker != xyes])
AM_CONDITIONAL([NEED_DYNCLOCK], [test x$need_dynclock = xyes])
AM_CONDITIONAL([NEED_FPGAUTILS], [test x$need_fpgautils = xyes])
AM_CONDITIONAL([NEED_BFG_LOWL_HID], [test x$need_lowl_hid = xyes])
AM_CONDITIONAL([NEED_BFG_LOWLEVEL], [test x$need_lowlevel = xyes])
AM_CONDITIONAL([HAS_SCRYPT], [test x$scrypt = xyes])
AM_CONDITIONAL([HAVE_CURSES], [test x$curses = xyes])
AM_CONDITIONAL([HAVE_SENSORS], [test x$with_sensors = xyes])
AM_CONDITIONAL([HAVE_CYGWIN], [test x$have_cygwin = xtrue])
AM_CONDITIONAL([HAVE_LIBUSB], [test x$libusb = xyes])
AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue])
AM_CONDITIONAL([HAVE_x86_64], [test x$have_x86_64 = xtrue])
AM_CONDITIONAL([HAVE_WIN_DDKUSB], [test x$found_ddkusb = xtrue])
AM_CONDITIONAL([HAS_FPGA], [test x$bitforce$icarus$modminer$x6500$ztex != xnonononono])
AM_CONDITIONAL([HAS_ASIC], [test x$avalon$bfsb$bigpic$bitforce$icarus$hashbuster$httpsrv$littlefury$metabank$nanofury != xnononononononononono])
dnl Find YASM
has_yasm=false
if test "x$have_x86_32$have_x86_64" != "xfalsefalse"; then
AC_PATH_PROG([YASM],[yasm],[false])
if test "x$YASM" != "xfalse" ; then
has_yasm_enableaction="install yasm 1.0.1+"
AC_MSG_CHECKING([if yasm version is greater than 1.0.1])
yasmver=`"$YASM" --version | head -1 | cut -d\ -f2`
yamajor=`echo $yasmver | cut -d. -f1`
yaminor=`echo $yasmver | cut -d. -f2`
yamini=`echo $yasmver | cut -d. -f3`
if test "$yamajor" -ge "1" ; then
if test "$yamajor" -eq "1" ; then
if test "$yaminor" -ge "0" ; then
if test "$yaminor" -eq "0"; then
if test "$yamini" -ge "1"; then
has_yasm=true
fi
else
has_yasm=true
fi
fi
fi
else
has_yasm=false
fi
if test "x$has_yasm" = "xtrue" ; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])