/ configure.ac
configure.ac
   1  ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
   2  ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
   3  m4_define([v_maj], [4])
   4  m4_define([v_min], [11])
   5  m4_define([v_mic], [1])
   6  ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
   7  m4_define([v_ver], [v_maj.v_min.v_mic])
   8  m4_define([lt_rev], m4_eval(v_maj + v_min))
   9  m4_define([lt_cur], v_mic)
  10  m4_define([lt_age], v_min)
  11  ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  12  ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  13  
  14  AC_INIT([cgminer], [v_ver], [kernel@kolivas.org])
  15  
  16  AC_PREREQ(2.59)
  17  AC_CANONICAL_SYSTEM
  18  AC_CONFIG_MACRO_DIR([m4])
  19  AC_CONFIG_SRCDIR([cgminer.c])
  20  AC_CONFIG_HEADERS([config.h])
  21  
  22  AM_INIT_AUTOMAKE([foreign subdir-objects])
  23  m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  24  AC_USE_SYSTEM_EXTENSIONS
  25  
  26  ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  27  ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  28  m4_ifdef([v_rev], , [m4_define([v_rev], [0])])
  29  m4_ifdef([v_rel], , [m4_define([v_rel], [])])
  30  AC_DEFINE_UNQUOTED(CGMINER_MAJOR_VERSION, [v_maj], [Major version])
  31  AC_DEFINE_UNQUOTED(CGMINER_MINOR_VERSION, [v_min], [Minor version])
  32  AC_DEFINE_UNQUOTED(CGMINER_MINOR_SUBVERSION, [v_mic], [Micro version])
  33  version_info="lt_rev:lt_cur:lt_age"
  34  release_info="v_rel"
  35  AC_SUBST(version_info)
  36  AC_SUBST(release_info)
  37  ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  38  ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
  39  VMAJ=v_maj
  40  AC_SUBST(VMAJ)
  41  
  42  AC_CANONICAL_BUILD
  43  AC_CANONICAL_HOST
  44  
  45  dnl Make sure anyone changing configure.ac/Makefile.am has a clue
  46  AM_MAINTAINER_MODE
  47  
  48  dnl Checks for programs
  49  AC_PROG_CC
  50  gl_EARLY
  51  AC_PROG_GCC_TRADITIONAL
  52  AM_PROG_CC_C_O
  53  
  54  # This breaks autoreconf so disable it
  55  # LT_INIT([disable-shared])
  56  
  57  gl_INIT
  58  
  59  dnl Checks for header files.
  60  AC_HEADER_STDC
  61  AC_CHECK_HEADERS(syslog.h)
  62  
  63  AC_FUNC_ALLOCA
  64  
  65  have_win32=false
  66  PTHREAD_FLAGS="-lpthread"
  67  LIBZ_LIBS="-lz"
  68  DLOPEN_FLAGS="-ldl"
  69  WS2_LIBS=""
  70  MM_LIBS=""
  71  MATH_LIBS="-lm"
  72  RT_LIBS="-lrt"
  73  
  74  case $target in
  75    amd64-*)
  76      have_x86_64=true
  77      ;;
  78    x86_64-*)
  79      have_x86_64=true
  80      ;;
  81    *)
  82      have_x86_64=false
  83      ;;
  84  esac
  85  
  86  case $target in
  87    *-*-linux-gnu*)
  88      have_linux=true
  89      ;;
  90    *-*-mingw*)
  91      have_win32=true
  92      PTHREAD_FLAGS=""
  93      DLOPEN_FLAGS=""
  94      WS2_LIBS="-lws2_32"
  95      MM_LIBS="-lwinmm"
  96      RT_LIBS=""
  97      #AC_DEFINE([_WIN32_WINNT], [0x0501], "WinNT version for XP+ support")
  98      ;;
  99    powerpc-*-darwin*)
 100      have_darwin=true
 101      CFLAGS="$CFLAGS -faltivec"
 102      PTHREAD_FLAGS=""
 103      RT_LIBS=""
 104      ;;
 105    *-*-darwin*)
 106      have_darwin=true
 107      PTHREAD_FLAGS=""
 108      RT_LIBS=""
 109  	;;
 110    *-*-freebsd*)
 111      PTHREAD_FLAGS=""
 112      DLOPEN_FLAGS=""
 113      RT_LIBS=""
 114      ;;
 115  esac
 116  
 117  has_winpthread=false
 118  if test "x$have_win32" = xtrue; then
 119          has_winpthread=true
 120          AC_CHECK_LIB(winpthread, nanosleep, , has_winpthread=false)
 121          PTHREAD_LIBS=-lwinpthread
 122  fi
 123  
 124  if test "x$has_winpthread" != xtrue; then
 125          AC_CHECK_LIB(pthread, pthread_create, ,
 126                  AC_MSG_ERROR([Could not find pthread library - please install libpthread]))
 127          PTHREAD_LIBS=-lpthread
 128  fi
 129  
 130  # Drivers that are designed to be run on dedicated hardware should set standalone to yes
 131  # All drivers should prepend an x to the drivercount
 132  
 133  standalone="no"
 134  drivercount=""
 135  
 136  ants1="no"
 137  
 138  AC_ARG_ENABLE([ants1],
 139  	[AC_HELP_STRING([--enable-ants1],[Compile support for Antminer S1 Bitmain STANDALONE(default disabled)])],
 140  	[ants1=$enableval]
 141  	)
 142  if test "x$ants1" = xyes; then
 143  	AC_DEFINE([USE_ANT_S1], [1], [Defined to 1 if Antminer S1 Bitmain support is wanted])
 144  	drivercount=x$drivercount
 145  	standalone="yes"
 146  fi
 147  AM_CONDITIONAL([HAS_ANT_S1], [test x$ants1 = xyes])
 148  
 149  ants2="no"
 150  
 151  AC_ARG_ENABLE([ants2],
 152  	[AC_HELP_STRING([--enable-ants2],[Compile support for Antminer S2 Bitmain STANDALONE(default disabled)])],
 153  	[ants2=$enableval]
 154  	)
 155  if test "x$ants2" = xyes; then
 156  	AC_DEFINE([USE_ANT_S2], [1], [Defined to 1 if Antminer S2 Bitmain support is wanted])
 157  	drivercount=x$drivercount
 158  	standalone="yes"
 159  fi
 160  AM_CONDITIONAL([HAS_ANT_S2], [test x$ants2 = xyes])
 161  
 162  ants3="no"
 163  
 164  AC_ARG_ENABLE([ants3],
 165  	[AC_HELP_STRING([--enable-ants3],[Compile support for Antminer S3 Bitmain STANDALONE(default disabled)])],
 166  	[ants3=$enableval]
 167  	)
 168  if test "x$ants3" = xyes; then
 169  	AC_DEFINE([USE_ANT_S3], [1], [Defined to 1 if Antminer S3 Bitmain support is wanted])
 170  	drivercount=x$drivercount
 171  	standalone="yes"
 172  fi
 173  AM_CONDITIONAL([HAS_ANT_S3], [test x$ants3 = xyes])
 174  
 175  avalon="no"
 176  
 177  AC_ARG_ENABLE([avalon],
 178  	[AC_HELP_STRING([--enable-avalon],[Compile support for Avalon (default disabled)])],
 179  	[avalon=$enableval]
 180  	)
 181  if test "x$avalon" = xyes; then
 182  	AC_DEFINE([USE_AVALON], [1], [Defined to 1 if Avalon support is wanted])
 183  	drivercount=x$drivercount
 184  fi
 185  AM_CONDITIONAL([HAS_AVALON], [test x$avalon = xyes])
 186  
 187  
 188  avalon2="no"
 189  
 190  AC_ARG_ENABLE([avalon2],
 191  	[AC_HELP_STRING([--enable-avalon2],[Compile support for Avalon2 (default disabled)])],
 192  	[avalon2=$enableval]
 193  	)
 194  if test "x$avalon2" = xyes; then
 195  	AC_DEFINE([USE_AVALON2], [1], [Defined to 1 if Avalon2 support is wanted])
 196  	drivercount=x$drivercount
 197  fi
 198  AM_CONDITIONAL([HAS_AVALON2], [test x$avalon2 = xyes])
 199  
 200  
 201  avalon4="no"
 202  
 203  AC_ARG_ENABLE([avalon4],
 204  	[AC_HELP_STRING([--enable-avalon4],[Compile support for Avalon4 (default disabled)])],
 205  	[avalon4=$enableval]
 206  	)
 207  if test "x$avalon4" = xyes; then
 208  	AC_DEFINE([USE_AVALON4], [1], [Defined to 1 if Avalon4 support is wanted])
 209  fi
 210  AM_CONDITIONAL([HAS_AVALON4], [test x$avalon4 = xyes])
 211  
 212  avalon7="no"
 213  
 214  AC_ARG_ENABLE([avalon7],
 215  	[AC_HELP_STRING([--enable-avalon7],[Compile support for Avalon7 (default disabled)])],
 216  	[avalon7=$enableval]
 217  	)
 218  if test "x$avalon7" = xyes; then
 219  	AC_DEFINE([USE_AVALON7], [1], [Defined to 1 if Avalon7 support is wanted])
 220  fi
 221  AM_CONDITIONAL([HAS_AVALON7], [test x$avalon7 = xyes])
 222  
 223  avalon8="no"
 224  
 225  AC_ARG_ENABLE([avalon8],
 226  	[AC_HELP_STRING([--enable-avalon8],[Compile support for Avalon8 (default disabled)])],
 227  	[avalon8=$enableval]
 228  	)
 229  if test "x$avalon8" = xyes; then
 230  	AC_DEFINE([USE_AVALON8], [1], [Defined to 1 if Avalon8 support is wanted])
 231  fi
 232  AM_CONDITIONAL([HAS_AVALON8], [test x$avalon8 = xyes])
 233  
 234  avalon_miner="no"
 235  
 236  AC_ARG_ENABLE([avalon_miner],
 237  	[AC_HELP_STRING([--enable-avalon-miner],[Compile support for Avalon miner(default disabled)])],
 238  	[avalon_miner=$enableval]
 239  	)
 240  if test "x$avalon_miner" = xyes; then
 241  	AC_DEFINE([USE_AVALON_MINER], [1], [Defined to 1 if Avalon miner support is wanted])
 242  fi
 243  AM_CONDITIONAL([HAS_AVALON_MINER], [test x$avalon_miner = xyes])
 244  
 245  bab="no"
 246  
 247  AC_ARG_ENABLE([bab],
 248  	[AC_HELP_STRING([--enable-bab],[Compile support for BlackArrow Bitfury STANDALONE(default disabled)])],
 249  	[bab=$enableval]
 250  	)
 251  if test "x$bab" = xyes; then
 252  	AC_DEFINE([USE_BAB], [1], [Defined to 1 if BlackArrow Bitfury support is wanted])
 253  	drivercount=x$drivercount
 254  	standalone="yes"
 255  fi
 256  AM_CONDITIONAL([HAS_BAB], [test x$bab = xyes])
 257  
 258  
 259  bflsc="no"
 260  
 261  AC_ARG_ENABLE([bflsc],
 262  	[AC_HELP_STRING([--enable-bflsc],[Compile support for BFL ASICs (default disabled)])],
 263  	[bflsc=$enableval]
 264  	)
 265  if test "x$bflsc" = xyes; then
 266  	AC_DEFINE([USE_BFLSC], [1], [Defined to 1 if BFL ASIC support is wanted])
 267  	drivercount=x$drivercount
 268  fi
 269  AM_CONDITIONAL([HAS_BFLSC], [test x$bflsc = xyes])
 270  
 271  
 272  bitforce="no"
 273  
 274  AC_ARG_ENABLE([bitforce],
 275  	[AC_HELP_STRING([--enable-bitforce],[Compile support for BitForce FPGAs (default disabled)])],
 276  	[bitforce=$enableval]
 277  	)
 278  if test "x$bitforce" = xyes; then
 279  	AC_DEFINE([USE_BITFORCE], [1], [Defined to 1 if BitForce support is wanted])
 280  	drivercount=x$drivercount
 281  fi
 282  AM_CONDITIONAL([HAS_BITFORCE], [test x$bitforce = xyes])
 283  
 284  
 285  bitfury="no"
 286  
 287  AC_ARG_ENABLE([bitfury],
 288  	[AC_HELP_STRING([--enable-bitfury],[Compile support for BitFury ASICs (default disabled)])],
 289  	[bitfury=$enableval]
 290  	)
 291  if test "x$bitfury" = xyes; then
 292  	AC_DEFINE([USE_BITFURY], [1], [Defined to 1 if BitFury ASIC support is wanted])
 293  	drivercount=x$drivercount
 294  fi
 295  AM_CONDITIONAL([HAS_BITFURY], [test x$bitfury = xyes])
 296  
 297  
 298  bitfury16="no"
 299  
 300  AC_ARG_ENABLE([bitfury16],
 301  	[AC_HELP_STRING([--enable-bitfury16],[Compile support for BitFury 16nm ASICs STANDALONE(default disabled)])],
 302  	[bitfury16=$enableval]
 303  	)
 304  if test "x$bitfury16" = xyes; then
 305  	AC_DEFINE([USE_BITFURY16], [1], [Defined to 1 if BitFury 16nm ASIC support is wanted])
 306  	drivercount=x$drivercount
 307  	standalone="yes"
 308  fi
 309  AM_CONDITIONAL([HAS_BITFURY16], [test x$bitfury16 = xyes])
 310  
 311  bitmain_soc="no"
 312  bitmain_R4="no"
 313  bitmain_S9="no"
 314  bitmain_T9="no"
 315  bitmain_T9P="no"
 316  
 317  AC_ARG_ENABLE([bitmain_soc],
 318  	[AC_HELP_STRING([--enable-bitmain_soc],[Compile support for Bitmain ASICs STANDALONE(default disabled)])],
 319  	[bitmain_soc=$enableval]
 320  	)
 321  AC_ARG_ENABLE([bitmain_R4],
 322  	[AC_HELP_STRING([--enable-bitmain_R4],[Compile support for Bitmain R4])],
 323  	[bitmain_R4=$enableval]
 324  	)
 325  AC_ARG_ENABLE([bitmain_S9],
 326  	[AC_HELP_STRING([--enable-bitmain_S9],[Compile support for Bitmain S9])],
 327  	[bitmain_S9=$enableval]
 328  	)
 329  AC_ARG_ENABLE([bitmain_T9],
 330  	[AC_HELP_STRING([--enable-bitmain_T9],[Compile support for Bitmain T9])],
 331  	[bitmain_T9=$enableval]
 332  	)
 333  AC_ARG_ENABLE([bitmain_T9P],
 334  	[AC_HELP_STRING([--enable-bitmain_T9P],[Compile support for Bitmain T9+])],
 335  	[bitmain_T9P=$enableval]
 336  	)
 337  if test "x$bitmain_soc" = xyes; then
 338  	AC_DEFINE([USE_BITMAIN_SOC], [1], [Defined to 1 if Bitmain ASICs support is wanted])
 339      if test "x$bitmain_R4" = xyes; then
 340          AC_DEFINE([R4], [1], [Defined to 1 for R4])
 341      fi
 342      if test "x$bitmain_S9" = xyes; then
 343          AC_DEFINE([S9_63], [1], [Defined to 1 for S9])
 344      fi
 345      if test "x$bitmain_T9" = xyes; then
 346          AC_DEFINE([S9_PLUS], [1], [Defined to 1 for T9])
 347      fi
 348      if test "x$bitmain_T9P" = xyes; then
 349          AC_DEFINE([T9_18], [1], [Defined to 1 for T9+])
 350      fi
 351      if test "x$bitmain_R4$bitmain_S9$bitmain_T9$bitmain_T9P" = xnononono; then
 352          AC_DEFINE([S9_63], [1], [Defined to 1 for default])
 353      fi
 354  	drivercount=x$drivercount
 355  	standalone="yes"
 356  fi
 357  AM_CONDITIONAL([HAS_BITMAIN_SOC], [test x$bitmain_soc = xyes])
 358  
 359  bitmine_A1="no"
 360  
 361  AC_ARG_ENABLE([bitmine_A1],
 362  	[AC_HELP_STRING([--enable-bitmine_A1],[Compile support for Bitmine.ch A1 ASICs STANDALONE(default disabled)])],
 363  	[bitmine_A1=$enableval]
 364  	)
 365  if test "x$bitmine_A1" = xyes; then
 366  	AC_DEFINE([USE_BITMINE_A1], [1], [Defined to 1 if Bitmine A1 support is wanted])
 367  	drivercount=x$drivercount
 368  	standalone="yes"
 369  fi
 370  AM_CONDITIONAL([HAS_BITMINE_A1], [test x$bitmine_A1 = xyes])
 371  
 372  
 373  blockerupter="no"
 374  
 375  AC_ARG_ENABLE([blockerupter],
 376  	[AC_HELP_STRING([--enable-blockerupter],[Compile support for BlockErupter BROKEN DRIVER (default disabled)])],
 377  	[blockerupter=$enableval]
 378  	)
 379  if test "x$blockerupter" = xyes; then
 380  	AC_DEFINE([USE_BLOCKERUPTER], [1], [Defined to 1 if BlockErupter support is wanted])
 381  	drivercount=x$drivercount
 382  fi
 383  AM_CONDITIONAL([HAS_BLOCKERUPTER], [test x$blockerupter = xyes])
 384  
 385  
 386  cointerra="no"
 387  
 388  AC_ARG_ENABLE([cointerra],
 389  	[AC_HELP_STRING([--enable-cointerra],[Compile support for Cointerra ASICs (default disabled)])],
 390  	[cointerra=$enableval]
 391  	)
 392  if test "x$cointerra" = xyes; then
 393  	AC_DEFINE([USE_COINTERRA], [1], [Defined to 1 if Cointerra support is wanted])
 394  	drivercount=x$drivercount
 395  fi
 396  AM_CONDITIONAL([HAS_COINTERRA], [test x$cointerra = xyes])
 397  
 398  
 399  dragonmint_t1="no"
 400  
 401  AC_ARG_ENABLE([dragonmint_t1],
 402  	[AC_HELP_STRING([--enable-dragonmint_t1],[Compile support for Dragonmint T1 ASICs STANDALONE(default disabled)])],
 403  	[dragonmint_t1=$enableval]
 404  	)
 405  if test "x$dragonmint_t1" = xyes; then
 406  	AC_DEFINE([USE_DRAGONMINT_T1], [1], [Defined to 1 if Dragonmint T1 support is wanted])
 407  	AC_DEFINE([USE_VMASK], [1], [Defined to 1 if version mask rolling is wanted])
 408  	drivercount=x$drivercount
 409  	standalone="yes"
 410  fi
 411  AM_CONDITIONAL([HAS_DRAGONMINT_T1], [test x$dragonmint_t1 = xyes])
 412  
 413  
 414  drillbit="no"
 415  
 416  AC_ARG_ENABLE([drillbit],
 417  	[AC_HELP_STRING([--enable-drillbit],[Compile support for Drillbit BitFury ASICs (default disabled)])],
 418  	[drillbit=$enableval]
 419  	)
 420  if test "x$drillbit" = xyes; then
 421  	AC_DEFINE([USE_DRILLBIT], [1], [Defined to 1 if Drillbit BitFury support is wanted])
 422  	drivercount=x$drivercount
 423  fi
 424  AM_CONDITIONAL([HAS_DRILLBIT], [test x$drillbit = xyes])
 425  
 426  
 427  hashfast="no"
 428  
 429  AC_ARG_ENABLE([hashfast],
 430  	[AC_HELP_STRING([--enable-hashfast],[Compile support for Hashfast (default disabled)])],
 431  	[hashfast=$enableval]
 432  	)
 433  if test "x$hashfast" = xyes; then
 434  	AC_DEFINE([USE_HASHFAST], [1], [Defined to 1 if Hashfast support is wanted])
 435  	drivercount=x$drivercount
 436  fi
 437  AM_CONDITIONAL([HAS_HASHFAST], [test x$hashfast = xyes])
 438  
 439  
 440  hashratio="no"
 441  
 442  AC_ARG_ENABLE([hashratio],
 443  	[AC_HELP_STRING([--enable-hashratio],[Compile support for Hashratio (default disabled)])],
 444  	[hashratio=$enableval]
 445  	)
 446  if test "x$hashratio" = xyes; then
 447  	AC_DEFINE([USE_HASHRATIO], [1], [Defined to 1 if Hashratiosupport is wanted])
 448  	drivercount=x$drivercount
 449  fi
 450  AM_CONDITIONAL([HAS_HASHRATIO], [test x$hashratio = xyes])
 451  
 452  
 453  icarus="no"
 454  
 455  AC_ARG_ENABLE([icarus],
 456  	[AC_HELP_STRING([--enable-icarus],[Compile support for Icarus (default disabled)])],
 457  	[icarus=$enableval]
 458  	)
 459  if test "x$icarus" = xyes; then
 460  	AC_DEFINE([USE_ICARUS], [1], [Defined to 1 if Icarus support is wanted])
 461  	drivercount=x$drivercount
 462  fi
 463  AM_CONDITIONAL([HAS_ICARUS], [test x$icarus = xyes])
 464  
 465  
 466  klondike="no"
 467  
 468  AC_ARG_ENABLE([klondike],
 469  	[AC_HELP_STRING([--enable-klondike],[Compile support for Klondike (default disabled)])],
 470  	[klondike=$enableval]
 471  	)
 472  if test "x$klondike" = xyes; then
 473  	AC_DEFINE([USE_KLONDIKE], [1], [Defined to 1 if Klondike support is wanted])
 474  	drivercount=x$drivercount
 475  fi
 476  AM_CONDITIONAL([HAS_KLONDIKE], [test x$klondike = xyes])
 477  
 478  
 479  knc="no"
 480  
 481  AC_ARG_ENABLE([knc],
 482  	[AC_HELP_STRING([--enable-knc],[Compile support for KnC miners STANDALONE(default disabled)])],
 483  	[knc=$enableval]
 484  	)
 485  if test "x$knc" = xyes; then
 486  	AC_DEFINE([USE_KNC], [1], [Defined to 1 if KnC miner support is wanted])
 487  	drivercount=x$drivercount
 488  	standalone="yes"
 489  fi
 490  AM_CONDITIONAL([HAS_KNC], [test x$knc = xyes])
 491  
 492  
 493  minion="no"
 494  
 495  AC_ARG_ENABLE([minion],
 496  	[AC_HELP_STRING([--enable-minion],[Compile support for Minion BlackArrow ASIC STANDALONE(default disabled)])],
 497  	[minion=$enableval]
 498  	)
 499  if test "x$minion" = xyes; then
 500  	AC_DEFINE([USE_MINION], [1], [Defined to 1 if Minion BlackArrow ASIC support is wanted])
 501  	drivercount=x$drivercount
 502  	standalone="yes"
 503  fi
 504  AM_CONDITIONAL([HAS_MINION], [test x$minion = xyes])
 505  
 506  
 507  modminer="no"
 508  
 509  AC_ARG_ENABLE([modminer],
 510  	[AC_HELP_STRING([--enable-modminer],[Compile support for ModMiner FPGAs(default disabled)])],
 511  	[modminer=$enableval]
 512  	)
 513  if test "x$modminer" = xyes; then
 514  	AC_DEFINE([USE_MODMINER], [1], [Defined to 1 if ModMiner support is wanted])
 515  	drivercount=x$drivercount
 516  fi
 517  AM_CONDITIONAL([HAS_MODMINER], [test x$modminer = xyes])
 518  
 519  
 520  sp10="no"
 521  
 522  AC_ARG_ENABLE([sp10],
 523  	[AC_HELP_STRING([--enable-sp10],[Compile support for Spondoolies SP10 STANDALONE(default disabled)])],
 524  	[sp10=$enableval]
 525  	)
 526  if test "x$sp10" = xyes; then
 527  	AC_DEFINE([USE_SP10], [1], [Defined to 1 if Spondoolies SP10 support is wanted])
 528  	drivercount=x$drivercount
 529  	standalone="yes"
 530  fi
 531  AM_CONDITIONAL([HAS_SP10], [test x$sp10 = xyes])
 532  
 533  
 534  
 535  sp30="no"
 536  
 537  AC_ARG_ENABLE([sp30],
 538  	[AC_HELP_STRING([--enable-sp30],[Compile support for Spondoolies SP30 STANDALONE(default disabled)])],
 539  	[sp30=$enableval]
 540  	)
 541  if test "x$sp30" = xyes; then
 542  	AC_DEFINE([USE_SP30], [1], [Defined to 1 if SP30 support is wanted])
 543  	drivercount=x$drivercount
 544  	standalone="yes"
 545  fi
 546  AM_CONDITIONAL([HAS_SP30], [test x$sp30 = xyes])
 547  
 548  
 549  forcecombo="no"
 550  
 551  AC_ARG_ENABLE([forcecombo],
 552  	[AC_HELP_STRING([--enable-forcecombo],[Allow combinations of drivers not intended to be built together(default disabled)])],
 553  	[forcecombo=$enableval]
 554  	)
 555  if test "x$forcecombo" = xyes; then
 556  	standalone="no"
 557  fi
 558  
 559  curses="auto"
 560  
 561  AC_ARG_WITH([curses],
 562  	[AC_HELP_STRING([--without-curses],[Compile support for curses TUI (default enabled)])],
 563  	[curses=$withval]
 564  	)
 565  if test "x$curses" = "xno"; then
 566  	cursesmsg='User specified --without-curses. TUI support DISABLED'
 567  else
 568  	AC_SEARCH_LIBS(addstr, pdcurses ncurses pdcurses, [
 569  		curses=yes
 570  		cursesmsg="FOUND: ${ac_cv_search_addstr}"
 571  		AC_DEFINE([HAVE_CURSES], [1], [Defined to 1 if curses TUI support is wanted])
 572  	], [
 573  		if test "x$curses" = "xyes"; then
 574  			AC_MSG_ERROR([Could not find curses library - please install libncurses-dev or pdcurses-dev (or configure --without-curses)])
 575  		else
 576  			AC_MSG_WARN([Could not find curses library - if you want a TUI, install libncurses-dev or pdcurses-dev])
 577  			curses=no
 578  			cursesmsg='NOT FOUND. TUI support DISABLED'
 579  		fi
 580  	])
 581  fi
 582  
 583  
 584  #Add a new device to this list if it needs libusb, along with a no on the end.
 585  if test x$avalon$avalon2$avalon4$avalon7$avalon8$avalon_miner$bitforce$bitfury$blockerupter$modminer$bflsc$icarus$hashfast$hashratio$klondike$drillbit$cointerra$ants1$ants3 != xnonononononononononononononononononono; then
 586  	want_usbutils=true
 587  else
 588  	want_usbutils=false
 589  fi
 590  
 591  if test x$bitfury != xno; then
 592  	want_libbitfury=true
 593  else
 594  	want_libbitfury=false
 595  fi
 596  
 597  if test x$avalon2$avalon4$avalon7$avalon8$avalon_miner$hashratio != xnononononono; then
 598  	want_crc16=true
 599  else
 600  	want_crc16=false
 601  fi
 602  
 603  AM_CONDITIONAL([NEED_FPGAUTILS], [test x$modminer != xno])
 604  AM_CONDITIONAL([WANT_USBUTILS], [test x$want_usbutils != xfalse])
 605  AM_CONDITIONAL([NEED_LIBZ], [test x$bitmain_soc != xno])
 606  AM_CONDITIONAL([WANT_LIBBITFURY], [test x$want_libbitfury != xfalse])
 607  AM_CONDITIONAL([HAVE_CURSES], [test x$curses = xyes])
 608  AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue])
 609  AM_CONDITIONAL([HAVE_x86_64], [test x$have_x86_64 = xtrue])
 610  AM_CONDITIONAL([WANT_CRC16], [test x$want_crc16 != xfalse])
 611  AM_CONDITIONAL([NEED_I2C_CONTEXT], [test x$avalon4$avalon7$avalon8 != xnonono])
 612  
 613  if test "x$want_usbutils" != xfalse; then
 614  	AC_DEFINE([USE_USBUTILS], [1], [Defined to 1 if usbutils support required])
 615  	case $target in
 616  		*-*-freebsd*)
 617  			LIBUSB_LIBS="-lusb"
 618  			LIBUSB_CFLAGS=""
 619  			AC_DEFINE(HAVE_LIBUSB, 1, [Define if you have libusb-1.0])
 620  			;;
 621  		*)
 622  			PKG_CHECK_MODULES(LIBUSB, libusb-1.0, [AC_DEFINE(HAVE_LIBUSB, 1, [Define if you have libusb-1.0])], [AC_MSG_ERROR([Could not find usb library - please install libusb-1.0])])
 623  			;;
 624  	esac
 625  else
 626  	LIBUSB_LIBS=""
 627  fi
 628  
 629  djansson="yes"
 630  case $target in
 631  	*-*-freebsd*)
 632  		JANSSON_LIBS="-ljansson"
 633  		JANSSON_CFLAGS=""
 634  		AC_DEFINE(HAVE_JANSSON, 1, [Define if you have jansson >= 2.6])
 635  		;;
 636  	*)
 637  		PKG_CHECK_MODULES(JANSSON, jansson >= 2.6, [AC_DEFINE(HAVE_JANSSON, 1, [Define if you have jansson >= 2.6])], [djansson="no"])
 638  		;;
 639  esac
 640  
 641  if test "x$djansson" = xno; then
 642  	AC_CONFIG_SUBDIRS([compat/jansson-2.9])
 643  	JANSSON_LIBS="compat/jansson-2.9/src/.libs/libjansson.a"
 644  fi
 645  
 646  AM_CONDITIONAL([WANT_STATIC_JANSSON], [test x$djansson = xno])
 647  
 648  AC_CHECK_HEADERS([uthash.h])
 649  
 650  PKG_PROG_PKG_CONFIG()
 651  
 652  if test "x$have_cgminer_sdk" = "xtrue"; then
 653  	if test "x$have_x86_64" = xtrue; then
 654  		ARCH_DIR=x86_64
 655  	else
 656  		ARCH_DIR=x86
 657  	fi
 658  	PKG_CONFIG="${PKG_CONFIG:-pkg-config} --define-variable=arch=$ARCH_DIR --define-variable=target=$target --define-variable=cgminersdkdir=$CGMINER_SDK"
 659  	PKG_CONFIG_PATH="$CGMINER_SDK/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
 660  fi
 661  
 662  AC_SUBST(LIBUSB_LIBS)
 663  AC_SUBST(LIBUSB_CFLAGS)
 664  
 665  AC_ARG_ENABLE([libcurl],
 666  	[AC_HELP_STRING([--disable-libcurl],[Disable building with libcurl for GBT support])],
 667  	[libcurl=$enableval]
 668  	)
 669  
 670  static_curl="no"
 671  if test "x$libcurl" != xno; then
 672  	if test "x$have_win32" != xtrue; then
 673  		PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.25.0], [AC_DEFINE([CURL_HAS_KEEPALIVE], [1], [Defined if version of curl supports keepalive.])],
 674  			[PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.18.2], ,[AC_MSG_ERROR([Missing required libcurl dev >= 7.18.2])])])
 675  	else
 676  		PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.25.0], ,[AC_MSG_ERROR([Missing required libcurl dev >= 7.25.0])])
 677  		AC_DEFINE([CURL_HAS_KEEPALIVE], [1])
 678  		static_curl="yes"
 679  	fi
 680  	AC_DEFINE([HAVE_LIBCURL], [1], [Defined to 1 if libcurl support built in])
 681  else
 682  	LIBCURL_LIBS=""
 683  fi
 684  AC_SUBST(LIBCURL_LIBS)
 685  AM_CONDITIONAL([STATIC_CURL], [test x$static_curl = xyes])
 686  
 687  libsystemd="no"
 688  
 689  AC_ARG_ENABLE([libsystemd],
 690  	[AC_HELP_STRING([--enable-libsystemd],[Enable building with libsystemd for watchdog and status notification support])],
 691  	[libsystemd=$enableval]
 692  )
 693  
 694  if test "x$libsystemd" != xno; then
 695  	if test "x$have_linux" != xtrue; then
 696  		AC_MSG_ERROR([libsystemd is only supported on Linux platforms])
 697  	fi
 698  
 699  	PKG_CHECK_MODULES(LIBSYSTEMD, libsystemd, , AC_MSG_ERROR(Could not find libsystemd dev))
 700  	AC_DEFINE([USE_LIBSYSTEMD], [1], [Defined to 1 if libsystemd support is wanted])
 701  else
 702  	LIBSYSTEMD_LIBS=""
 703  fi
 704  
 705  #check execv signature
 706  AC_COMPILE_IFELSE([AC_LANG_SOURCE([
 707  		   #include <process.h>
 708  		   int execv(const char*, const char*const*);
 709  		   ])],
 710  		   AC_DEFINE([EXECV_2ND_ARG_TYPE], [const char* const*], [int execv(const char*, const char*const*);]),
 711  		   AC_DEFINE([EXECV_2ND_ARG_TYPE], [char* const*], [int execv(const char*, char*const*);]))
 712  
 713  dnl CCAN wants to know a lot of vars.
 714  # All the configuration checks.  Regrettably, the __attribute__ checks will
 715  # give false positives on old GCCs, since they just cause warnings.  But that's
 716  # fairly harmless.
 717  AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((cold)) cleanup(void) { }])],
 718  			  AC_DEFINE([HAVE_ATTRIBUTE_COLD], [1],
 719                                      [Define if __attribute__((cold))]))
 720  AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((const)) cleanup(void) { }])],
 721  			  AC_DEFINE([HAVE_ATTRIBUTE_CONST], [1],
 722                                      [Define if __attribute__((const))]))
 723  AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((noreturn)) cleanup(void) { exit(1); }])],
 724  			  AC_DEFINE([HAVE_ATTRIBUTE_NORETURN], [1],
 725                                      [Define if __attribute__((noreturn))]))
 726  AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((format(__printf__, 1, 2))) cleanup(const char *fmt, ...) { }])],
 727  			  AC_DEFINE([HAVE_ATTRIBUTE_PRINTF], [1],
 728                                      [Define if __attribute__((format(__printf__)))]))
 729  AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((unused)) cleanup(void) { }])],
 730  			  AC_DEFINE([HAVE_ATTRIBUTE_UNUSED], [1],
 731                                      [Define if __attribute__((unused))]))
 732  AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((used)) cleanup(void) { }])],
 733  			  AC_DEFINE([HAVE_ATTRIBUTE_USED], [1],
 734                                      [Define if __attribute__((used))]))
 735  AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_constant_p(1) ? 0 : 1; }])],
 736  			  AC_DEFINE([HAVE_BUILTIN_CONSTANT_P], [1],
 737                                      [Define if have __builtin_constant_p]))
 738  AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_types_compatible_p(char *, int) ? 1 : 0; }])],
 739  			  AC_DEFINE([HAVE_BUILTIN_TYPES_COMPATIBLE_P], [1],
 740                                      [Define if have __builtin_types_compatible_p]))
 741  AC_COMPILE_IFELSE([AC_LANG_SOURCE([static int __attribute__((warn_unused_result)) func(int x) { return x; }])],
 742  			  AC_DEFINE([HAVE_WARN_UNUSED_RESULT], [1],
 743                                      [Define if __attribute__((warn_unused_result))]))
 744  
 745  if test "x$prefix" = xNONE; then
 746  	prefix=/usr/local
 747  fi
 748  
 749  AC_DEFINE_UNQUOTED([CGMINER_PREFIX], ["$prefix/bin"], [Path to cgminer install])
 750  
 751  AC_SUBST(JANSSON_LIBS)
 752  AC_SUBST(LIBZ_LIBS)
 753  AC_SUBST(PTHREAD_FLAGS)
 754  AC_SUBST(DLOPEN_FLAGS)
 755  AC_SUBST(PTHREAD_LIBS)
 756  AC_SUBST(NCURSES_LIBS)
 757  AC_SUBST(PDCURSES_LIBS)
 758  AC_SUBST(WS2_LIBS)
 759  AC_SUBST(MM_LIBS)
 760  AC_SUBST(MATH_LIBS)
 761  AC_SUBST(RT_LIBS)
 762  
 763  AC_CONFIG_FILES([
 764  	Makefile
 765  	compat/Makefile
 766  	ccan/Makefile
 767  	lib/Makefile
 768  	])
 769  AC_OUTPUT
 770  
 771  
 772  echo
 773  echo
 774  echo
 775  echo "------------------------------------------------------------------------"
 776  echo "$PACKAGE $VERSION"
 777  echo "------------------------------------------------------------------------"
 778  echo
 779  echo
 780  echo "Configuration Options Summary:"
 781  echo
 782  
 783  if test "x$libcurl" != xno; then
 784  	echo "  libcurl(GBT).: Enabled: $LIBCURL_LIBS"
 785  else
 786  	echo "  libcurl(GBT).: Disabled"
 787  fi
 788  
 789  if test "x$libsystemd" != xno; then
 790  	echo "  libsystemd...........: Enabled: $LIBSYSTEMD_LIBS"
 791  else
 792  	echo "  libsystemd...........: Disabled"
 793  fi
 794  
 795  echo "  curses.TUI...........: $cursesmsg"
 796  
 797  
 798  echo
 799  if test "x$dragonmint_t1" = xyes; then
 800  	echo "  DragonMint.T1.Halong.: Enabled"
 801  else
 802          echo "  DragonMint.T1.Halong.: Disabled"
 803  fi
 804  
 805  if test "x$ants1" = xyes; then
 806  	echo "  Antminer.S1.Bitmain..: Enabled"
 807  else
 808  	echo "  Antminer.S1.Bitmain..: Disabled"
 809  fi
 810  
 811  if test "x$ants2" = xyes; then
 812  	echo "  Antminer.S2.Bitmain..: Enabled"
 813  else
 814  	echo "  Antminer.S2.Bitmain..: Disabled"
 815  fi
 816  
 817  if test "x$ants3" = xyes; then
 818  	echo "  Antminer.S3.Bitmain..: Enabled"
 819  else
 820  	echo "  Antminer.S3.Bitmain..: Disabled"
 821  fi
 822  
 823  if test "x$avalon" = xyes; then
 824  	echo "  Avalon.ASICs.........: Enabled"
 825  else
 826  	echo "  Avalon.ASICs.........: Disabled"
 827  fi
 828  
 829  if test "x$avalon2" = xyes; then
 830  	echo "  Avalon2.ASICs........: Enabled"
 831  else
 832  	echo "  Avalon2.ASICs........: Disabled"
 833  fi
 834  
 835  if test "x$avalon4" = xyes; then
 836  	echo "  Avalon4.ASICs........: Enabled"
 837  else
 838  	echo "  Avalon4.ASICs........: Disabled"
 839  fi
 840  
 841  if test "x$avalon7" = xyes; then
 842  	echo "  Avalon7.ASICs........: Enabled"
 843  else
 844  	echo "  Avalon7.ASICs........: Disabled"
 845  fi
 846  
 847  if test "x$avalon8" = xyes; then
 848  	echo "  Avalon8.ASICs........: Enabled"
 849  else
 850  	echo "  Avalon8.ASICs........: Disabled"
 851  fi
 852  
 853  if test "x$avalon_miner" = xyes; then
 854  	echo "  Avalon miner.ASICs...: Enabled"
 855  else
 856  	echo "  Avalon miner.ASICs...: Disabled"
 857  fi
 858  
 859  if test "x$minion" = xyes; then
 860  	echo "  BlackArrowMinion.ASIC: Enabled"
 861  else
 862  	echo "  BlackArrowMinion.ASIC: Disabled"
 863  fi
 864  
 865  if test "x$bab" = xyes; then
 866  	echo "  BlackArrow.ASICs.....: Enabled"
 867  else
 868  	echo "  BlackArrow.ASICs.....: Disabled"
 869  fi
 870  
 871  if test "x$bflsc" = xyes; then
 872  	echo "  BFL.ASICs............: Enabled"
 873  else
 874  	echo "  BFL.ASICs............: Disabled"
 875  fi
 876  
 877  if test "x$bitforce" = xyes; then
 878  	echo "  BitForce.FPGAs.......: Enabled"
 879  else
 880  	echo "  BitForce.FPGAs.......: Disabled"
 881  fi
 882  
 883  if test "x$bitfury" = xyes; then
 884  	echo "  BitFury.ASICs........: Enabled"
 885  else
 886  	echo "  BitFury.ASICs........: Disabled"
 887  fi
 888  
 889  if test "x$bitfury16" = xyes; then
 890  	echo "  BitFury16.ASICs......: Enabled"
 891  else
 892  	echo "  BitFury16.ASICs......: Disabled"
 893  fi
 894  
 895  if test "x$bitmain_soc" = xyes; then
 896  	echo "  Bitmain.ASICs......: Enabled"
 897  else
 898  	echo "  Bitmain.ASICs......: Disabled"
 899  fi
 900  
 901  
 902  if test "x$blockerupter" = xyes; then
 903  	echo "  BlockErupter.ASICs...: Enabled"
 904  else
 905  	echo "  BlockErupter.ASICs...: Disabled"
 906  fi
 907  
 908  if test "x$cointerra" = xyes; then
 909  	echo "  Cointerra.ASICs......: Enabled"
 910  else
 911  	echo "  Cointerra.ASICs......: Disabled"
 912  fi
 913  
 914  if test "x$sp10" = xyes; then
 915  	echo "  Spond-sp10.ASICs.....: Enabled"
 916  else
 917  	echo "  Spond-sp10.ASICs.....: Disabled"
 918  fi
 919  
 920  
 921  if test "x$sp30" = xyes; then
 922  	echo "  Spond-sp30.ASICs.....: Enabled"
 923  else
 924  	echo "  Spond-sp30.ASICs.....: Disabled"
 925  fi
 926  
 927  if test "x$bitmine_A1" = xyes; then
 928  	echo "  Bitmine-A1.ASICs.....: Enabled"
 929  else
 930  	echo "  Bitmine-A1.ASICs.....: Disabled"
 931  fi
 932  
 933  if test "x$dragonmint_t1" = xyes; then
 934  	echo "  Dragonmint.T1.ASICs..: Enabled"
 935  else
 936  	echo "  Dragonmint.T1.ASICs..: Disabled"
 937  fi
 938  
 939  if test "x$drillbit" = xyes; then
 940  	echo "  Drillbit.BitFury.....: Enabled"
 941  else
 942  	echo "  Drillbit.BitFury.....: Disabled"
 943  fi
 944  
 945  if test "x$hashfast" = xyes; then
 946  	echo "  Hashfast.ASICs.......: Enabled"
 947  else
 948  	echo "  Hashfast.ASICs.......: Disabled"
 949  fi
 950  
 951  if test "x$hashratio" = xyes; then
 952  	echo "  Hashratio.ASICs......: Enabled"
 953  else
 954  	echo "  Hashratio.ASICs......: Disabled"
 955  fi
 956  
 957  if test "x$icarus" = xyes; then
 958  	echo "  Icarus.ASICs/FPGAs...: Enabled"
 959  else
 960  	echo "  Icarus.ASICs/FPGAs...: Disabled"
 961  fi
 962  
 963  if test "x$klondike" = xyes; then
 964  	echo "  Klondike.ASICs.......: Enabled"
 965  else
 966  	echo "  Klondike.ASICs.......: Disabled"
 967  fi
 968  
 969  if test "x$knc" = xyes; then
 970  	echo "  KnC.ASICs............: Enabled"
 971  else
 972  	echo "  KnC.ASICs............: Disabled"
 973  fi
 974  
 975  if test "x$modminer" = xyes; then
 976  	echo "  ModMiner.FPGAs.......: Enabled"
 977  else
 978  	echo "  ModMiner.FPGAs.......: Disabled"
 979  fi
 980  
 981  #Add any new device to this, along with a no on the end of the test
 982  if test "x$avalon$avalon2$avalon4$avalon7$avalon8$avalon_miner$bab$bflsc$bitforce$bitfury$bitfury16$bitmain_soc$blockerupter$hashfast$hashratio$icarus$klondike$knc$modminer$drillbit$minion$cointerra$bitmine_A1$ants1$ants2$ants3$sp10$sp30$dragonmint_t1" = xnononononononononononononononononononononononononononono; then
 983  	echo
 984  	AC_MSG_ERROR([No mining devices configured in])
 985  	echo
 986  fi
 987  
 988  if test "x$standalone" = xyes; then
 989  	if test $drivercount != x; then
 990  		echo
 991  		AC_MSG_ERROR([You have configured more than one driver in with a driver that is designed to be standalone only (see ./configure --help)])
 992  		echo
 993  	fi
 994  fi
 995  
 996  echo
 997  echo "Compilation............: make (or gmake)"
 998  echo "  CPPFLAGS.............: $CPPFLAGS"
 999  echo "  CFLAGS...............: $CFLAGS"
1000  echo "  LDFLAGS..............: $LDFLAGS $PTHREAD_FLAGS"
1001  echo "  LDADD................: $DLOPEN_FLAGS $LIBCURL_LIBS $LIBSYSTEMD_LIBS $JANSSON_LIBS $LIBZ_LIBS $PTHREAD_LIBS $NCURSES_LIBS $PDCURSES_LIBS $WS2_LIBS $MATH_LIBS $LIBUSB_LIBS $RT_LIBS"
1002  echo
1003  echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
1004  echo "  prefix...............: $prefix"
1005  echo
1006