forked from monkins1010/ccminer
-
Notifications
You must be signed in to change notification settings - Fork 7
/
configure.ac
182 lines (153 loc) · 4.31 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
AC_INIT([ccminer_CPU], [3.7], [], [ccminer], [http://github.com/shmutalov/ccminer])
AC_PREREQ([2.59c])
AC_CANONICAL_SYSTEM
AC_CONFIG_SRCDIR([ccminer.cpp])
AC_CONFIG_MACRO_DIRS([m4])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AC_CONFIG_HEADERS([ccminer-config.h])
dnl Make sure anyone changing configure.ac/Makefile.am has a clue
AM_MAINTAINER_MODE
dnl Checks for programs
AC_PROG_CC_C99
AC_PROG_GCC_TRADITIONAL
AM_PROG_CC_C_O
AM_PROG_AS
AC_PROG_RANLIB
AC_PROG_CXX
AC_OPENMP
LT_INIT
dnl Checks for header files
AC_HEADER_STDC
AC_CHECK_HEADERS([sys/endian.h sys/param.h syslog.h])
# sys/sysctl.h requires sys/types.h on FreeBSD
# sys/sysctl.h requires sys/param.h on OpenBSD
AC_CHECK_HEADERS([sys/sysctl.h], [], [],
[#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
])
AC_CHECK_DECLS([be32dec, le32dec, be32enc, le32enc], [], [],
[AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
#endif
])
AC_FUNC_ALLOCA
AC_CHECK_FUNCS([getopt_long])
case $target in
i*86-*-*)
have_x86=true
;;
x86_64-*-*)
have_x86=true
have_x86_64=true
;;
amd64-*-*)
have_x86=true
have_x86_64=true
;;
aarch64-*-*)
have_arm=true
have_arm_64=true
;;
arm*-*-*)
have_arm=true
;;
esac
# ANDROID
dnl Check for Android system
AC_MSG_CHECKING([for an Android system])
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[#ifndef __ANDROID__
#error __ANDROID__ not defined
#endif
]],[[;]])], [have_android=true; AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])])
PTHREAD_FLAGS="-pthread"
WS2_LIBS=""
case $target in
*-*-mingw*)
have_win32=true
PTHREAD_FLAGS=""
WS2_LIBS="-lws2_32"
;;
*86*-apple-darwin*)
have_osx=true
PTHREAD_FLAGS=""
;;
esac
AC_CHECK_LIB(jansson, json_loads, request_jansson=false, request_jansson=true)
AC_CHECK_LIB([pthread], [pthread_create], PTHREAD_LIBS="-lpthread",
AC_CHECK_LIB([pthreadGC2], [pthread_create], PTHREAD_LIBS="-lpthreadGC2",
AC_CHECK_LIB([pthreadGC1], [pthread_create], PTHREAD_LIBS="-lpthreadGC1",
AC_CHECK_LIB([pthreadGC], [pthread_create], PTHREAD_LIBS="-lpthreadGC"
))))
AM_CONDITIONAL([WANT_JANSSON], [test x$request_jansson = xtrue])
AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue])
AM_CONDITIONAL([HAVE_OSX], [test x$have_osx = xtrue])
AM_CONDITIONAL([HAVE_ANDROID], [test x$have_android = xtrue])
AM_CONDITIONAL([ARCH_x86], [test x$have_x86 = xtrue])
AM_CONDITIONAL([ARCH_x86_64], [test x$have_x86_64 = xtrue])
AM_CONDITIONAL([ARCH_ARM], [test x$have_arm = xtrue])
AM_CONDITIONAL([ARCH_ARM_64], [test x$have_arm_64 = xtrue])
AM_CONDITIONAL([BUILD_STATIC], [test x$BUILD_STATIC = xtrue])
AM_COND_IF([BUILD_STATIC], [AC_MSG_NOTICE([Build is static. No need to check zlib, ssl, crypto, curl binaries])],
[AC_CHECK_LIB([z],[gzopen], [], []),
AC_CHECK_LIB([ssl],[SSL_free], [], [AC_MSG_ERROR([OpenSSL library required])]),
AC_CHECK_LIB([crypto],[EVP_DigestFinal_ex], [], [AC_MSG_ERROR([OpenSSL library required])]),
LIBCURL_CHECK_CONFIG(, 7.15.2, ,[AC_MSG_ERROR([Missing required libcurl >= 7.15.2])])])
if test x$request_jansson = xtrue
then
JANSSON_LIBS="compat/jansson/libjansson.a"
else
JANSSON_LIBS=-ljansson
fi
AC_SUBST(JANSSON_LIBS)
AC_SUBST(PTHREAD_FLAGS)
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(WS2_LIBS)
AC_CONFIG_FILES([
Makefile
compat/Makefile
compat/jansson/Makefile
])
dnl find out what version we are running
SUFFIX=""
if test x$have_x86_64 = xtrue
then
SUFFIX="64"
fi
if test x$have_osx = xtrue
then
SUFFIX=""
fi
dnl Setup CUDA paths
AC_ARG_WITH([cuda],
[ --with-cuda=PATH prefix where cuda is installed [default=/usr/local/cuda]])
AC_ARG_WITH([nvml],
[ --with-nvml=PATH prefix where libnvml is installed [default=/usr/lib]])
AM_CONDITIONAL([HAVE_NVML], [test -n "$with_nvml"])
NVCC="nvcc"
if test -n "$with_cuda" ; then
CUDA_INCLUDES="-I$with_cuda/include"
CUDA_LIBS="-lcudart"
CUDA_LDFLAGS="-L$with_cuda/lib$SUFFIX"
if test -x "$with_cuda/bin/nvcc" ; then
NVCC="$with_cuda/bin/nvcc"
fi
else
CUDA_INCLUDES="-I/usr/local/cuda/include"
CUDA_LIBS="-lcudart -static-libstdc++"
CUDA_LDFLAGS="-L/usr/local/cuda/lib$SUFFIX"
fi
if test -n "$with_nvml" ; then
NVML_LIBPATH=$with_nvml
CUDA_LDFLAGS="$CUDA_LDFLAGS -ldl"
fi
AC_SUBST(NVML_LIBPATH)
AC_SUBST(CUDA_CFLAGS)
AC_SUBST(CUDA_INCLUDES)
AC_SUBST(CUDA_LIBS)
AC_SUBST(CUDA_LDFLAGS)
AC_SUBST(NVCC)
AC_SUBST(OPENMP_CFLAGS)
AC_OUTPUT