configure.ac 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. AC_INIT([cpuminer], [1.0.2])
  2. AC_PREREQ(2.52)
  3. AC_CANONICAL_SYSTEM
  4. AC_CONFIG_SRCDIR([cpu-miner.c])
  5. AM_INIT_AUTOMAKE([gnu])
  6. AC_CONFIG_HEADERS([cpuminer-config.h])
  7. dnl Make sure anyone changing configure.ac/Makefile.am has a clue
  8. AM_MAINTAINER_MODE
  9. dnl Checks for programs
  10. AC_PROG_CC
  11. AC_PROG_GCC_TRADITIONAL
  12. AM_PROG_CC_C_O
  13. AC_PROG_RANLIB
  14. dnl Checks for header files.
  15. AC_HEADER_STDC
  16. AC_CHECK_HEADERS(syslog.h)
  17. AC_FUNC_ALLOCA
  18. case $target in
  19. *-*-mingw*)
  20. have_x86_64=false
  21. have_win32=true
  22. PTHREAD_FLAGS=""
  23. ;;
  24. x86_64-*)
  25. have_x86_64=true
  26. have_win32=false
  27. PTHREAD_FLAGS="-pthread"
  28. ;;
  29. *)
  30. have_x86_64=false
  31. have_win32=false
  32. PTHREAD_FLAGS="-pthread"
  33. ;;
  34. esac
  35. dnl Figure out where OpenCL is, either passed or system-wide
  36. AC_ARG_WITH([opencl-libdir],
  37. [AC_HELP_STRING([--with-opencl-libdir],[specify OpenCL library])],
  38. [with_opencl_lib=$withval],
  39. [with_opencl_lib="auto"])
  40. if test "x$with_opencl_lib" = xauto; then
  41. AC_CHECK_LIB([OpenCL], [OpenCL], [OPENCL_LIBS="-lOpenCL"], AC_MSG_ERROR([OpenCL library could not be found]))
  42. else
  43. OPENCL_LIBS="$with_opencl_lib/libOpenCL.so"
  44. fi
  45. OPENCL_INCLUDES=""
  46. AC_ARG_WITH([opencl-inc],
  47. [AC_HELP_STRING([--with-opencl-inc],[specify OpenCL include paths])],
  48. [with_opencl_inc=$withval],
  49. [with_opencl_inc="auto"])
  50. if test "x$with_opencl_inc" = xauto; then
  51. AC_CHECK_HEADERS(CL/cl.h, [found="yes"])
  52. AC_CHECK_HEADERS(OpenCL/opencl.h, [found="yes"])
  53. if test "x$found" = x; then
  54. AC_MSG_ERROR([OpenCL headers could not be found])
  55. fi
  56. else
  57. OPENCL_INCLUDES="-I$with_opencl_inc"
  58. fi
  59. AC_CHECK_LIB(jansson, json_loads, request_jansson=false, request_jansson=true)
  60. AC_CHECK_LIB(pthread, pthread_create, PTHREAD_LIBS=-lpthread)
  61. AM_CONDITIONAL([WANT_JANSSON], [test x$request_jansson = xtrue])
  62. AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue])
  63. AM_CONDITIONAL([HAVE_x86_64], [test x$have_x86_64 = xtrue])
  64. if test x$request_jansson = xtrue
  65. then
  66. JANSSON_LIBS="compat/jansson/libjansson.a"
  67. else
  68. JANSSON_LIBS=-ljansson
  69. fi
  70. dnl Find YASM
  71. has_yasm=false
  72. AC_PATH_PROG([YASM],[yasm],[false])
  73. if test "x$YASM" != "xfalse" ; then
  74. AC_MSG_CHECKING([if yasm version is greater than 1.0.1])
  75. yasmver=`yasm --version | head -1 | cut -d\ -f2`
  76. yamajor=`echo $yasmver | cut -d. -f1`
  77. yaminor=`echo $yasmver | cut -d. -f2`
  78. yamini=`echo $yasmver | cut -d. -f3`
  79. if test "$yamajor" -ge "1" ; then
  80. if test "$yamajor" -eq "1" ; then
  81. if test "$yaminor" -ge "0" ; then
  82. if test "$yaminor" -eq "0"; then
  83. if test "$yamini" -ge "1"; then
  84. has_yasm=true
  85. fi
  86. else
  87. has_yasm=true
  88. fi
  89. fi
  90. fi
  91. else
  92. has_yasm=false
  93. fi
  94. if test "x$has_yasm" = "xtrue" ; then
  95. AC_MSG_RESULT([yes])
  96. else
  97. AC_MSG_RESULT([no])
  98. fi
  99. fi
  100. if test "x$has_yasm" = "xfalse" ; then
  101. AC_MSG_NOTICE([yasm is required for the sse2_64 algorithm. It will be skipped.])
  102. fi
  103. AM_CONDITIONAL([HAS_YASM], [test x$has_yasm = xtrue])
  104. PKG_PROG_PKG_CONFIG()
  105. LIBCURL_CHECK_CONFIG(, 7.10.1, ,
  106. [AC_MSG_ERROR([Missing required libcurl >= 7.10.1])])
  107. AC_SUBST(OPENCL_LIBS)
  108. AC_SUBST(OPENCL_INCLUDES)
  109. AC_SUBST(JANSSON_LIBS)
  110. AC_SUBST(PTHREAD_FLAGS)
  111. AC_SUBST(PTHREAD_LIBS)
  112. AC_CONFIG_FILES([
  113. Makefile
  114. compat/Makefile
  115. compat/jansson/Makefile
  116. x86_64/Makefile
  117. ])
  118. AC_OUTPUT