configure.ac 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. AC_INIT([cpuminer], [1.0.2])
  2. AC_PREREQ(2.59)
  3. AC_CANONICAL_SYSTEM
  4. AC_CONFIG_MACRO_DIR([m4])
  5. AC_CONFIG_SRCDIR([cpu-miner.c])
  6. AC_CONFIG_HEADERS([config.h])
  7. AM_INIT_AUTOMAKE([foreign])
  8. dnl Make sure anyone changing configure.ac/Makefile.am has a clue
  9. AM_MAINTAINER_MODE
  10. dnl Checks for programs
  11. AC_PROG_CC
  12. gl_EARLY
  13. AC_PROG_GCC_TRADITIONAL
  14. AM_PROG_CC_C_O
  15. AC_PROG_RANLIB
  16. gl_INIT
  17. dnl Checks for header files.
  18. AC_HEADER_STDC
  19. AC_CHECK_HEADERS(syslog.h)
  20. AC_FUNC_ALLOCA
  21. case $target in
  22. *-*-mingw*)
  23. have_x86_64=false
  24. have_win32=true
  25. PTHREAD_FLAGS=""
  26. ;;
  27. x86_64-*)
  28. have_x86_64=true
  29. have_win32=false
  30. PTHREAD_FLAGS="-pthread"
  31. ;;
  32. *)
  33. have_x86_64=false
  34. have_win32=false
  35. PTHREAD_FLAGS="-pthread"
  36. ;;
  37. esac
  38. # Check for OpenCL (the long way needed on mingw32 due to calling conventions)
  39. AC_MSG_CHECKING([for OpenCL])
  40. SAVED_LIBS=$LIBS
  41. LIBS="$LIBS -lOpenCL"
  42. AC_LINK_IFELSE(
  43. [AC_LANG_PROGRAM([[#include <CL/cl.h>]],
  44. [[return clSetKernelArg(0, 0, 0, 0); ]])],
  45. [AC_MSG_RESULT(yes)
  46. AM_CONDITIONAL(HAVE_OPENCL, true)
  47. OPENCL_LIBS=-lOpenCL],
  48. [AC_MSG_RESULT(no)
  49. AM_CONDITIONAL(HAVE_OPENCL, false)])
  50. LIBS=$SAVED_LIBS
  51. AC_CHECK_LIB(jansson, json_loads, request_jansson=false, request_jansson=true)
  52. AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIBS=-lpthread)
  53. AM_CONDITIONAL([WANT_JANSSON], [test x$request_jansson = xtrue])
  54. AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue])
  55. AM_CONDITIONAL([HAVE_x86_64], [test x$have_x86_64 = xtrue])
  56. if test x$request_jansson = xtrue
  57. then
  58. JANSSON_LIBS="compat/jansson/libjansson.a"
  59. else
  60. JANSSON_LIBS=-ljansson
  61. fi
  62. dnl Find YASM
  63. has_yasm=false
  64. AC_PATH_PROG([YASM],[yasm],[false])
  65. if test "x$YASM" != "xfalse" ; then
  66. AC_MSG_CHECKING([if yasm version is greater than 1.0.1])
  67. yasmver=`yasm --version | head -1 | cut -d\ -f2`
  68. yamajor=`echo $yasmver | cut -d. -f1`
  69. yaminor=`echo $yasmver | cut -d. -f2`
  70. yamini=`echo $yasmver | cut -d. -f3`
  71. if test "$yamajor" -ge "1" ; then
  72. if test "$yamajor" -eq "1" ; then
  73. if test "$yaminor" -ge "0" ; then
  74. if test "$yaminor" -eq "0"; then
  75. if test "$yamini" -ge "1"; then
  76. has_yasm=true
  77. fi
  78. else
  79. has_yasm=true
  80. fi
  81. fi
  82. fi
  83. else
  84. has_yasm=false
  85. fi
  86. if test "x$has_yasm" = "xtrue" ; then
  87. AC_MSG_RESULT([yes])
  88. else
  89. AC_MSG_RESULT([no])
  90. fi
  91. fi
  92. if test "x$has_yasm" = "xfalse" ; then
  93. AC_MSG_NOTICE([yasm is required for the sse2_64 algorithm. It will be skipped.])
  94. fi
  95. AM_CONDITIONAL([HAS_YASM], [test x$has_yasm = xtrue])
  96. PKG_PROG_PKG_CONFIG()
  97. LIBCURL_CHECK_CONFIG(, 7.10.1, ,
  98. [AC_MSG_ERROR([Missing required libcurl >= 7.10.1])])
  99. AC_SUBST(OPENCL_LIBS)
  100. AC_SUBST(JANSSON_LIBS)
  101. AC_SUBST(PTHREAD_FLAGS)
  102. AC_SUBST(PTHREAD_LIBS)
  103. AC_CONFIG_FILES([
  104. Makefile
  105. compat/Makefile
  106. compat/jansson/Makefile
  107. x86_64/Makefile
  108. lib/Makefile
  109. ])
  110. AC_OUTPUT