-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathconfigure.in
174 lines (138 loc) · 7.17 KB
/
configure.in
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
#
# @version 0.1.3 (2011)
# @author Paolo Margara <[email protected]>
#
# Copyright 2011 Paolo Margara
#
# This file is part of engine-cuda.
#
# engine-cuda is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License or
# any later version.
#
# engine-cuda is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with engine-cuda. If not, see <http://www.gnu.org/licenses/>.
#
define([PACKAGE_VERSION_MAJOR], [0])
define([PACKAGE_VERSION_MINOR], [1])
define([PACKAGE_VERSION_FIX], [3])
AC_INIT([engine-cudamrg],[PACKAGE_VERSION_MAJOR.PACKAGE_VERSION_MINOR.PACKAGE_VERSION_FIX],[[email protected]],[engine-cudamrg-v_''AC_PACKAGE_VERSION.tar.gz],[http://code.google.com/p/engine-cuda/])
AC_PROG_CC
AC_LANG_C
AC_PROG_MAKE_SET
CFLAGS="$CFLAGS -O3 -Wall"
if test $(uname -s) = "Darwin"
then
LDFLAGS="$LDFLAGS -lstdc++"
LIBNAME="libcudamrg.dylib"
LIBNAME_OPENCL="libopencl.dylib"
else
LIBNAME="libcudamrg.so"
LIBNAME_OPENCL="libopencl.so"
fi
AC_ARG_WITH([cudatoolkitpath],AS_HELP_STRING([--with-cudatoolkitpath],[prefix where cuda is installed (default=/usr/local/cuda)]),
[
NVCC="$with_cudatoolkitpath/bin/nvcc";
if test $(uname -m) = "x86_64"
then
LDFLAGS="$LDFLAGS -L$with_cudatoolkitpath/lib64/";
NVLDFLAGS="$NVLDFLAGS -L$with_cudatoolkitpath/lib64/";
else
CFLAGS="$CFLAGS -m32"
LDFLAGS="$LDFLAGS -L$with_cudatoolkitpath/lib/";
NVLDFLAGS="$NVLDFLAGS -L$with_cudatoolkitpath/lib/";
fi
CPPFLAGS="$CPPFLAGS -I$with_cudatoolkitpath/include/";
NVCPPFLAGS="$NVCPPFLAGS -I$with_cudatoolkitpath/include/"],
[if test $(uname -m) = "x86_64"
then
LDFLAGS="$LDFLAGS -L/usr/local/cuda/lib64/";
NVLDFLAGS="$NVLDFLAGS -L/usr/local/cuda/lib64/";
else
CFLAGS="$CFLAGS -m32"
LDFLAGS="$LDFLAGS -L/usr/local/cuda/lib/";
NVLDFLAGS="$NVLDFLAGS -L/usr/local/cuda/lib/";
fi
NVCC="/usr/local/cuda/bin/nvcc";
CPPFLAGS="$CPPFLAGS -I/usr/local/cuda/include/";
NVCPPFLAGS="$NVCPPFLAGS -I/usr/local/cuda/include/"])
AC_ARG_WITH([opensslenginedir],
AS_HELP_STRING([--with-opensslenginedir],[specify the directory where openssl engine are located (default $PREFIX/lib/engines) ]),
[ENGINEDIR="$with_opensslenginedir"],[ENGINEDIR="lib/engines"])
AC_ARG_WITH([buffersize],AS_HELP_STRING([--with-buffersize],[specify the size of the buffer (default 8MB) ]),
[NVCPPFLAGS="$NVCPPFLAGS -DMAX_CHUNK_SIZE=$with_buffersize"],[NVCPPFLAGS="$NVCPPFLAGS -DMAX_CHUNK_SIZE=8*1024*1024"])
AC_ARG_WITH([maxrregcount],AS_HELP_STRING([--with-maxrregcount],[specify the max number of regs that a thread can use (default no restriction) ]),
[NVCPPFLAGS="$NVCPPFLAGS -maxrregcount=$with_maxrregcount"],[NVCPPFLAGS="$NVCPPFLAGS"])
AC_ARG_WITH([maxthreads],AS_HELP_STRING([--with-maxthreads],[specify the number of threads per block (default: 256 threads) ]),
[CFLAGS="$CFLAGS -DMAX_THREAD=$with_maxthreads"],[CFLAGS="$CFLAGS -DMAX_THREAD=256"])
AC_ARG_WITH([gpuarch],AS_HELP_STRING([--with-gpuarch],[supply the lowest compute capability the build product should run on (default: sm_10) ]),
[NVCFLAGS="$NVCFLAGS -arch $with_gpuarch"],[NVCFLAGS="$NVCFLAGS -arch sm_10"])
AC_ARG_WITH([ccbin],[AS_HELP_STRING([--with-ccbin],[specify a compiler different from the default (default=gcc)])],
[NVCFLAGS="$NVCFLAGS -ccbin=$with_ccbin"],[NVCFLAGS="$NVCFLAGS"])
AC_ARG_ENABLE([debug],[AS_HELP_STRING([--enable-debug],[enable debug support (default=disabled)])],
[CFLAGS="$(echo $CFLAGS|sed s/-O./-g/) -DDEBUG";NVCFLAGS="$NVCFLAGS -g -G"],[CFLAGS="$CFLAGS";NVCFLAGS="$NVCFLAGS"])
AC_ARG_ENABLE([timing],[AS_HELP_STRING([--enable-timing],[enable timing support (default=disabled)])],
[CFLAGS="$CFLAGS -DDEBUG"],[CFLAGS="$CFLAGS"])
AC_ARG_ENABLE([aes_coarse],[AS_HELP_STRING([--disable-aes-coarse],[disable coarse AES implementation (default=enabled)])],
[CFLAGS="$CFLAGS"],[CFLAGS="$CFLAGS -DAES_COARSE"])
AC_ARG_ENABLE([gprof],[AS_HELP_STRING([--enable-gprof],[enable gprof support (default=disabled)])],
[CFLAGS="$(echo $CFLAGS|sed s/-O./-pg/)";NVCFLAGS="$NVCFLAGS -pg"],[CFLAGS="$CFLAGS";NVCFLAGS="$NVCFLAGS"])
AC_ARG_ENABLE([verbose],[AS_HELP_STRING([--enable-verbose],[echo verbose compilation (default=disabled)])],
[NVCFLAGS="$NVCFLAGS --ptxas-options=-v";VERBOSE="1"],[NVCFLAGS="$NVCFLAGS";VERBOSE=""])
AC_ARG_ENABLE([cpuonly],[AS_HELP_STRING([--enable-cpuonly],[AES calculation is done through libcrypto (default=disabled)])],
[CPPFLAGS="$CPPFLAGS -DCPU"],[CPPFLAGS="$CPPFLAGS"])
AC_ARG_ENABLE([pageable],[AS_HELP_STRING([--enable-pageable],[specify memory transfer type as pageable (default=disabled)])],
[NVCPPFLAGS="$NVCPPFLAGS -DPAGEABLE"],[NVCPPFLAGS="$NVCPPFLAGS"])
AC_ARG_ENABLE([ttableconstant],[AS_HELP_STRING([--enable-ttableconstant],[choose where T-tables are stored (constant or shared memory) (default=disabled)])],
[NVCPPFLAGS="$NVCPPFLAGS -DT_TABLE_CONSTANT"],[NVCPPFLAGS="$NVCPPFLAGS"])
AC_ARG_ENABLE([libopencl],[AS_HELP_STRING([--disable-libopencl],[disable building libOpenCL.so (default=enabled)])],
[LIBNAME_OPENCL=""],[LIBNAME_OPENCL="$LIBNAME_OPENCL"
AC_CHECK_HEADERS([CL/opencl.h],,AC_MSG_ERROR(CL/opencl.h required))
AC_CHECK_LIB([OpenCL],clGetDeviceIDs,[LIBS_OPENCL="$LIBS_OPENCL -lOpenCL"],[AC_MSG_ERROR([Cannot find cuda runtime library])])
])
AC_HEADER_STDC
AC_CHECK_HEADERS([stdio.h] ,,AC_MSG_ERROR(stdio.h required))
AC_CHECK_HEADERS([stdlib.h],,AC_MSG_ERROR(stdlib.h required))
AC_CHECK_HEADERS([stdint.h],,AC_MSG_ERROR(stdint.h required))
AC_CHECK_HEADERS([assert.h],,AC_MSG_ERROR(assert.h required))
AC_CHECK_HEADERS([memory.h],,AC_MSG_ERROR(memory.h required))
AC_CHECK_HEADERS([openssl/aes.h],,AC_MSG_ERROR(openssl/aes.h required))
AC_CHECK_HEADERS([openssl/blowfish.h],,AC_MSG_ERROR(openssl/blowfish.h required))
AC_CHECK_HEADERS([openssl/camellia.h],,AC_MSG_ERROR(openssl/camellia.h required))
AC_CHECK_HEADERS([openssl/cast.h],,AC_MSG_ERROR(openssl/cast.h required))
AC_CHECK_HEADERS([openssl/des.h],,AC_MSG_ERROR(openssl/des.h required))
AC_CHECK_HEADERS([openssl/idea.h],,AC_MSG_ERROR(openssl/idea.h required))
AC_CHECK_HEADERS([openssl/engine.h],,AC_MSG_ERROR(openssl/engine.h required))
AC_CHECK_HEADERS([cuda_runtime_api.h],,AC_MSG_ERROR(cuda_runtime_api.h required))
AC_CHECK_LIB([crypto],AES_set_encrypt_key,[LIBS="-lcrypto"],[LIBS="-lcrypto"
AC_MSG_WARN([Cannot find AES_set_encrypt_key in crypto library])])
AC_CHECK_LIB([cudart],cudaGetDeviceCount,[LIBS="$LIBS -lcudart"],[LIBS="$LIBS -lcudart"
AC_MSG_WARN([Cannot find cuda runtime library])])
CFLAGS_TEST="$CFLAGS"
CFLAGS="$CFLAGS -fPIC"
AC_SUBST(NVCC)
AC_SUBST(CPPFLAGS)
AC_SUBST(NVCPPFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(NVLDFLAGS)
AC_SUBST(CFLAGS)
AC_SUBST(NVCFLAGS)
AC_SUBST(CFLAGS_TEST)
AC_SUBST(VERBOSE)
AC_SUBST(LIBS)
AC_SUBST(ENGINEDIR)
AC_SUBST(LIBNAME)
AC_SUBST(LIBNAME_OPENCL)
VERSION="PACKAGE_VERSION_MAJOR.PACKAGE_VERSION_MINOR.PACKAGE_VERSION_FIX"
AC_SUBST(VERSION)
TARNAME="$PACKAGE_TARNAME"
DISTDIR="$PACKAGE_NAME"
AC_SUBST(TARNAME)
AC_SUBST(DISTDIR)
AC_OUTPUT(Makefile)