~braiampe/+junk/cgminer

« back to all changes in this revision

Viewing changes to configure.ac

  • Committer: Braiam Peguero
  • Date: 2011-10-09 06:47:47 UTC
  • Revision ID: braiamp@gmail.com-20111009064747-iju2nhzrh6ya56zs
* Forgot adding files to the branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
 
2
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
 
3
m4_define([v_maj], [2])
 
4
m4_define([v_min], [0])
 
5
m4_define([v_mic], [5])
 
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([main.c])
 
20
AC_CONFIG_HEADERS([config.h])
 
21
 
 
22
AM_INIT_AUTOMAKE([foreign])
 
23
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 
24
AC_GNU_SOURCE
 
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
AC_PROG_RANLIB
 
54
 
 
55
gl_INIT
 
56
 
 
57
dnl Checks for header files.
 
58
AC_HEADER_STDC
 
59
AC_CHECK_HEADERS(syslog.h)
 
60
 
 
61
AC_FUNC_ALLOCA
 
62
 
 
63
have_win32=false
 
64
PTHREAD_FLAGS="-lpthread"
 
65
DLOPEN_FLAGS="-ldl"
 
66
OPENCL_LIBS="-lOpenCL"
 
67
WS2_LIBS=""
 
68
 
 
69
case $target in
 
70
  x86_64-*)
 
71
    have_x86_64=true
 
72
    ;;
 
73
  *)
 
74
    have_x86_64=false
 
75
    ;;
 
76
esac
 
77
 
 
78
case $target in
 
79
  *-*-mingw*)
 
80
    have_x86_64=false
 
81
    have_win32=true
 
82
    PTHREAD_FLAGS=""
 
83
    DLOPEN_FLAGS=""
 
84
    WS2_LIBS="-lws2_32"
 
85
    ;;
 
86
  *-*-darwin*)
 
87
    OPENCL_LIBS="-framework OpenCL"
 
88
        ;;
 
89
esac
 
90
 
 
91
if test "x$ATISTREAMSDKROOT" != x; then
 
92
        if test "x$have_x86_64" = xtrue; then
 
93
                ATI_STREAM_ARCH_DIR=x86_64
 
94
        else
 
95
                ATI_STREAM_ARCH_DIR=x86
 
96
        fi
 
97
        OPENCL_FLAGS="-I$ATISTREAMSDKROOT/include $OPENCL_FLAGS"
 
98
        OPENCL_LIBS="-L$ATISTREAMSDKROOT/lib/$ATI_STREAM_ARCH_DIR $OPENCL_LIBS"
 
99
fi
 
100
 
 
101
AC_ARG_ENABLE([opencl],
 
102
        [AC_HELP_STRING([--disable-opencl],[Override detection and disable building with opencl])],
 
103
        [opencl=$enableval]
 
104
        )
 
105
if test "x$opencl" != xno; then
 
106
        # Check for OpenCL (the long way needed on mingw32 due to calling conventions)
 
107
        AC_MSG_CHECKING([for OpenCL])
 
108
        SAVED_LIBS=$LIBS
 
109
        SAVED_CFLAGS=$CFLAGS
 
110
        LIBS="$LIBS $OPENCL_LIBS"
 
111
        CFLAGS="$CFLAGS $OPENCL_FLAGS"
 
112
        AC_LINK_IFELSE(
 
113
        [AC_LANG_PROGRAM([[
 
114
                #ifdef __APPLE_CC__
 
115
                #include <OpenCL/opencl.h>
 
116
                #else
 
117
                #include <CL/cl.h>
 
118
                #endif
 
119
        ]],
 
120
        [[return clSetKernelArg(0, 0, 0, 0); ]])],
 
121
        [AC_MSG_RESULT(yes)
 
122
        AC_DEFINE([HAVE_OPENCL], [1], [Defined to 1 if OpenCL is present on the system.])
 
123
        found_opencl=1
 
124
        ],
 
125
        [AC_MSG_RESULT(no)
 
126
        OPENCL_FLAGS=
 
127
        OPENCL_LIBS=
 
128
        found_opencl=0])
 
129
        LIBS=$SAVED_LIBS
 
130
        CFLAGS=$SAVED_CFLAGS
 
131
else
 
132
        OPENCL_FLAGS=""
 
133
        OPENCL_LIBS=""
 
134
fi
 
135
 
 
136
AC_CHECK_LIB(pthread, pthread_create, ,
 
137
        AC_MSG_ERROR([Could not find pthread library - please install libpthread]))
 
138
PTHREAD_LIBS=-lpthread
 
139
 
 
140
AC_CHECK_LIB(jansson, json_loads, request_jansson=false, request_jansson=true)
 
141
 
 
142
AC_ARG_ENABLE([adl],
 
143
        [AC_HELP_STRING([--disable-adl],[Override detection and disable building with adl])],
 
144
        [adl=$enableval]
 
145
        )
 
146
 
 
147
if test "$found_opencl" = 1; then
 
148
        if test "x$adl" != xno; then
 
149
                AC_CHECK_FILE([ADL_SDK/adl_sdk.h], have_adl=true, have_adl=false,)
 
150
                if test x$have_adl = xtrue
 
151
                then
 
152
                        AC_DEFINE([HAVE_ADL], [1], [Defined if ADL headers were found])
 
153
                else
 
154
                        DLOPEN_FLAGS=""
 
155
                fi
 
156
        fi
 
157
else
 
158
        DLOPEN_FLAGS=""
 
159
fi
 
160
 
 
161
AC_SEARCH_LIBS(addstr, ncurses pdcurses, ,
 
162
        AC_MSG_ERROR([Could not find curses library - please install libncurses-dev or pdcurses-dev]))
 
163
 
 
164
AC_CHECK_LIB(ncurses, addstr, NCURSES_LIBS=-lncurses)
 
165
AC_CHECK_LIB(pdcurses, addstr, PDCURSES_LIBS=-lpdcurses)
 
166
 
 
167
AM_CONDITIONAL([WANT_JANSSON], [test x$request_jansson = xtrue])
 
168
AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue])
 
169
AM_CONDITIONAL([HAVE_x86_64], [test x$have_x86_64 = xtrue])
 
170
 
 
171
if test x$request_jansson = xtrue
 
172
then
 
173
        JANSSON_LIBS="compat/jansson/libjansson.a"
 
174
else
 
175
        JANSSON_LIBS=-ljansson
 
176
fi
 
177
 
 
178
dnl Find YASM
 
179
has_yasm=false
 
180
AC_PATH_PROG([YASM],[yasm],[false])
 
181
if test "x$YASM" != "xfalse" ; then
 
182
  AC_MSG_CHECKING([if yasm version is greater than 1.0.1])
 
183
  yasmver=`yasm --version | head -1 | cut -d\  -f2`
 
184
  yamajor=`echo $yasmver | cut -d. -f1`
 
185
  yaminor=`echo $yasmver | cut -d. -f2`
 
186
  yamini=`echo $yasmver | cut -d. -f3`
 
187
  if test "$yamajor" -ge "1" ; then
 
188
    if test "$yamajor" -eq "1" ; then
 
189
      if test "$yaminor" -ge "0" ; then
 
190
        if test "$yaminor" -eq "0"; then
 
191
          if test "$yamini" -ge "1"; then
 
192
            has_yasm=true
 
193
          fi
 
194
        else
 
195
          has_yasm=true
 
196
        fi
 
197
      fi
 
198
    fi
 
199
  else
 
200
    has_yasm=false
 
201
  fi
 
202
  if test "x$has_yasm" = "xtrue" ; then
 
203
    AC_MSG_RESULT([yes])
 
204
  else
 
205
    AC_MSG_RESULT([no])
 
206
  fi
 
207
fi
 
208
if test "x$has_yasm" = "xfalse" ; then
 
209
  AC_MSG_NOTICE([yasm is required for the assembly algorithms. They will be skipped.])
 
210
fi
 
211
 
 
212
AM_CONDITIONAL([HAS_YASM], [test x$has_yasm = xtrue])
 
213
 
 
214
PKG_PROG_PKG_CONFIG()
 
215
 
 
216
PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.15.6], [AC_DEFINE([CURL_HAS_SOCKOPT], [1], [Defined if version of curl supports sockopts.])],
 
217
[PKG_CHECK_MODULES([LIBCURL], [libcurl >= 7.10.1], ,[AC_MSG_ERROR([Missing required libcurl dev >= 7.10.1])])])
 
218
AC_SUBST(LIBCURL_LIBS)
 
219
 
 
220
dnl CCAN wants to know a lot of vars.
 
221
# All the configuration checks.  Regrettably, the __attribute__ checks will
 
222
# give false positives on old GCCs, since they just cause warnings.  But that's
 
223
# fairly harmless.
 
224
AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((cold)) cleanup(void) { }])],
 
225
                          AC_DEFINE([HAVE_ATTRIBUTE_COLD], [1],
 
226
                                    [Define if __attribute__((cold))]))
 
227
AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((const)) cleanup(void) { }])],
 
228
                          AC_DEFINE([HAVE_ATTRIBUTE_CONST], [1],
 
229
                                    [Define if __attribute__((const))]))
 
230
AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((noreturn)) cleanup(void) { exit(1); }])],
 
231
                          AC_DEFINE([HAVE_ATTRIBUTE_NORETURN], [1],
 
232
                                    [Define if __attribute__((noreturn))]))
 
233
AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((format(__printf__, 1, 2))) cleanup(const char *fmt, ...) { }])],
 
234
                          AC_DEFINE([HAVE_ATTRIBUTE_PRINTF], [1],
 
235
                                    [Define if __attribute__((format(__printf__)))]))
 
236
AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((unused)) cleanup(void) { }])],
 
237
                          AC_DEFINE([HAVE_ATTRIBUTE_UNUSED], [1],
 
238
                                    [Define if __attribute__((unused))]))
 
239
AC_COMPILE_IFELSE([AC_LANG_SOURCE([static void __attribute__((used)) cleanup(void) { }])],
 
240
                          AC_DEFINE([HAVE_ATTRIBUTE_USED], [1],
 
241
                                    [Define if __attribute__((used))]))
 
242
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_constant_p(1) ? 0 : 1; }])],
 
243
                          AC_DEFINE([HAVE_BUILTIN_CONSTANT_P], [1],
 
244
                                    [Define if have __builtin_constant_p]))
 
245
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return __builtin_types_compatible_p(char *, int) ? 1 : 0; }])],
 
246
                          AC_DEFINE([HAVE_BUILTIN_TYPES_COMPATIBLE_P], [1],
 
247
                                    [Define if have __builtin_types_compatible_p]))
 
248
AC_COMPILE_IFELSE([AC_LANG_SOURCE([static int __attribute__((warn_unused_result)) func(int x) { return x; }])],
 
249
                          AC_DEFINE([HAVE_WARN_UNUSED_RESULT], [1],
 
250
                                    [Define if __attribute__((warn_unused_result))]))
 
251
 
 
252
if test "x$prefix" = xNONE; then
 
253
        prefix=/usr/local
 
254
fi
 
255
 
 
256
AC_DEFINE_UNQUOTED([CGMINER_PREFIX], ["$prefix/bin"], [Path to cgminer install])
 
257
 
 
258
AC_SUBST(OPENCL_LIBS)
 
259
AC_SUBST(OPENCL_FLAGS)
 
260
AC_SUBST(JANSSON_LIBS)
 
261
AC_SUBST(PTHREAD_FLAGS)
 
262
AC_SUBST(DLOPEN_FLAGS)
 
263
AC_SUBST(PTHREAD_LIBS)
 
264
AC_SUBST(NCURSES_LIBS)
 
265
AC_SUBST(PDCURSES_LIBS)
 
266
AC_SUBST(WS2_LIBS)
 
267
 
 
268
AC_CONFIG_FILES([
 
269
        Makefile
 
270
        compat/Makefile
 
271
        compat/jansson/Makefile
 
272
        x86_64/Makefile
 
273
        x86_32/Makefile
 
274
        ccan/Makefile
 
275
        lib/Makefile
 
276
        ])
 
277
AC_OUTPUT
 
278
 
 
279
 
 
280
echo
 
281
echo
 
282
echo
 
283
echo "------------------------------------------------------------------------"
 
284
echo "$PACKAGE $VERSION"
 
285
echo "------------------------------------------------------------------------"
 
286
echo
 
287
echo
 
288
echo "Configuration Options Summary:"
 
289
echo
 
290
 
 
291
if test "x$opencl" != xno; then
 
292
        if test $found_opencl = 1; then
 
293
                echo "  OpenCL...............: FOUND. GPU mining support enabled"
 
294
        else
 
295
                echo "  OpenCL...............: NOT FOUND. GPU mining support DISABLED"
 
296
        fi
 
297
else
 
298
        echo "  OpenCL...............: Detection overrided. GPU mining support DISABLED"
 
299
fi
 
300
 
 
301
if test "x$adl" != xno; then
 
302
        if test x$have_adl = xtrue; then
 
303
                echo "  ADL..................: SDK found, GPU monitoring support enabled"
 
304
        else
 
305
                echo "  ADL..................: SDK NOT found, GPU monitoring support DISABLED"
 
306
        fi
 
307
else
 
308
        echo "  ADL..................: Detection overrided. GPU monitoring support DISABLED"
 
309
fi
 
310
 
 
311
echo "  ASM..................: $has_yasm"
 
312
echo
 
313
echo "Compilation............: make (or gmake)"
 
314
echo "  CPPFLAGS.............: $CPPFLAGS"
 
315
echo "  CFLAGS...............: $CFLAGS"
 
316
echo "  LDFLAGS..............: $LDFLAGS $PTHREAD_FLAGS $DLOPEN_FLAGS"
 
317
echo
 
318
echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')"
 
319
echo "  prefix...............: $prefix"
 
320
echo
 
321