build out of source dir
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
diff --git a/Makefile.am b/Makefile.am
index 48847c0..e93f827 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -33,6 +33,8 @@ else
cgminer_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib @OPENCL_FLAGS@ @LIBUSB_CFLAGS@ @LIBCURL_CFLAGS@
endif
+cgminer_CPPFLAGS += $(ADL_CPPFLAGS)
+
# common sources
cgminer_SOURCES := cgminer.c
diff --git a/autogen.sh b/autogen.sh
index e922cfc..8bb94c3 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,17 +1,11 @@
#!/bin/sh
-cwd="$PWD"
bs_dir="$(dirname $(readlink -f $0))"
rm -rf "${bs_dir}"/autom4te.cache
rm -f "${bs_dir}"/aclocal.m4 "${bs_dir}"/ltmain.sh
echo 'Running autoreconf -if...'
-autoreconf -if || exit 1
+autoreconf -if ${AC_FLAGS} "${bs_dir}" || exit 1
if test -z "$NOCONFIGURE" ; then
echo 'Configuring...'
- cd "${bs_dir}" &> /dev/null
- test "$?" = "0" || e=1
- test "$cwd" != "$bs_dir" && cd "$bs_dir" &> /dev/null
- ./configure $@
- test "$e" = "1" && exit 1
- cd "$cwd"
+ "$bs_dir"/configure "$@"
fi
diff --git a/ccan/Makefile.am b/ccan/Makefile.am
index 1514f6f..a667df3 100644
--- a/ccan/Makefile.am
+++ b/ccan/Makefile.am
@@ -1,3 +1,4 @@
noinst_LIBRARIES = libccan.a
libccan_a_SOURCES = compiler/compiler.h opt/helpers.c opt/opt.c opt/opt.h opt/parse.c opt/private.h opt/usage.c typesafe_cb/typesafe_cb.h
+libccan_a_CPPFLAGS = -I$(top_srcdir)
diff --git a/configure.ac b/configure.ac
index b2b45e4..124cdd0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -117,6 +117,13 @@ if test "x$have_win32" != xtrue; then
fi
fi
+have_cgminer_sdk=false
+if test -n "$CGMINER_SDK"; then
+ have_cgminer_sdk=true
+ CPPFLAGS="-I$CGMINER_SDK/include $CPPFLAGS"
+ LDFLAGS="-L$CGMINER_SDK/lib/$target $LDFLAGS"
+fi
+
cpumining="no"
AC_ARG_ENABLE([cpumining],,[cpumining=$enableval] )
@@ -186,7 +193,11 @@ scrypt="no"
if test "$found_opencl" = 1; then
if test "x$adl" != xno; then
- AC_CHECK_FILE([${ADL_SDK:-ADL_SDK}/adl_sdk.h], have_adl=true, have_adl=false,)
+ ADL_CPPFLAGS=
+ AC_CHECK_FILE([$srcdir/ADL_SDK/adl_sdk.h], [have_adl=true; ADL_CPPFLAGS=-I$srcdir], have_adl=false,)
+ if test x$have_adl+$have_cgminer_sdk = xfalse+true; then
+ AC_CHECK_FILE([$CGMINER_SDK/include/ADL_SDK/adl_sdk.h], [have_adl=true; ADL_CPPFLAGS=-I$CGMINER_SDK/include], have_adl=false,)
+ fi
if test x$have_adl = xtrue
then
AC_DEFINE([HAVE_ADL], [1], [Defined if ADL headers were found])
@@ -375,6 +386,16 @@ AM_CONDITIONAL([HAVE_LIBUDEV], [test x$libudev != xno])
PKG_PROG_PKG_CONFIG()
+if test "x$have_cgminer_sdk" = "xtrue"; then
+ if test "x$have_x86_64" = xtrue; then
+ ARCH_DIR=x86_64
+ else
+ ARCH_DIR=x86
+ fi
+ PKG_CONFIG="${PKG_CONFIG:-pkg-config} --define-variable=arch=$ARCH_DIR --define-variable=target=$target --define-variable=cgminersdkdir=$CGMINER_SDK"
+ PKG_CONFIG_PATH="$CGMINER_SDK/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
+fi
+
if test "x$ztex$modminer$bitforce$bflsc" != xnononono; then
case $target in
*-*-freebsd*)
@@ -464,6 +485,7 @@ AC_SUBST(WS2_LIBS)
AC_SUBST(MATH_LIBS)
AC_SUBST(UDEV_LIBS)
AC_SUBST(YASM_FMT)
+AC_SUBST(ADL_CPPFLAGS)
AC_CONFIG_FILES([
Makefile