Skip to content

Commit

Permalink
configure: Deduplicate Linux i2c-dev.h checks for KnCMiner drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-jr committed Oct 17, 2014
1 parent 504306a commit 5feff7b
Showing 1 changed file with 21 additions and 42 deletions.
63 changes: 21 additions & 42 deletions configure.ac
Expand Up @@ -124,6 +124,7 @@ has_asic=no
need_binloader=no
need_dynclock=no
need_gc3355=no
need_linux_i2c_dev=no
need_lowl_vcom=no
need_lowlevel=no
need_lowl_ftdi=no
Expand Down Expand Up @@ -600,20 +601,7 @@ AC_ARG_ENABLE([knc],
[knc=$ddno]
)
if test "x$knc" = xyes; then
AC_CHECK_HEADERS([linux/i2c-dev-user.h])
AC_CHECK_DECL([i2c_smbus_read_word_data],[true],[
AC_MSG_ERROR([linux/i2c-dev.h header from i2c-tools/libi2c-dev (NOT linux headers) is required for knc driver])
],[
#include <stddef.h>
#ifdef HAVE_LINUX_I2C_DEV_USER_H
#include <linux/i2c-dev-user.h>
#else
#ifdef NEED_LINUX_I2C_H
#include <linux/i2c.h>
#endif
#include <linux/i2c-dev.h>
#endif
])
need_linux_i2c_dev=yes
AC_DEFINE([USE_KNC], [1], [Defined to 1 if KnC support is wanted])
need_lowl_spi=yes
fi
Expand All @@ -631,20 +619,7 @@ if test "x$kncasic" != xno && test "x$kncasic" != xauto; then
kncasic_controller=BBB
fi
kncasic=yes
AC_CHECK_HEADERS([linux/i2c-dev-user.h])
AC_CHECK_DECL([i2c_smbus_read_word_data],[true],[
AC_MSG_ERROR([linux/i2c-dev.h header from i2c-tools/libi2c-dev (NOT linux headers) is required for knc driver])
],[
#include <stddef.h>
#ifdef HAVE_LINUX_I2C_DEV_USER_H
#include <linux/i2c-dev-user.h>
#else
#ifdef NEED_LINUX_I2C_H
#include <linux/i2c.h>
#endif
#include <linux/i2c-dev.h>
#endif
])
need_linux_i2c_dev=yes
AC_DEFINE([USE_KNCASIC], [1], [Defined to 1 if KnC gen 2 support is wanted])
AC_DEFINE_UNQUOTED([CONTROLLER_BOARD_$titan_controller],[1])
AH_TEMPLATE([CONTROLLER_BOARD_BACKPLANE])
Expand Down Expand Up @@ -843,20 +818,7 @@ if test "x$titan" != xno && test "x$titan" != xauto; then
if test "x$scrypt" = "xno"; then
AC_MSG_ERROR([You explicitly enabled KnC Titan, but did not enable scrypt])
fi
AC_CHECK_HEADERS([linux/i2c-dev-user.h])
AC_CHECK_DECL([i2c_smbus_read_word_data],[true],[
AC_MSG_ERROR([linux/i2c-dev.h header from i2c-tools/libi2c-dev (NOT linux headers) is required for titan driver])
],[
#include <stddef.h>
#ifdef HAVE_LINUX_I2C_DEV_USER_H
#include <linux/i2c-dev-user.h>
#else
#ifdef NEED_LINUX_I2C_H
#include <linux/i2c.h>
#endif
#include <linux/i2c-dev.h>
#endif
])
need_linux_i2c_dev=yes
AC_DEFINE([USE_TITAN], [1], [Defined to 1 if KnC Titan support is wanted])
AC_DEFINE_UNQUOTED([CONTROLLER_BOARD_$titan_controller],[1])
AH_TEMPLATE([CONTROLLER_BOARD_BACKPLANE])
Expand Down Expand Up @@ -1390,6 +1352,23 @@ if test x$need_lowlevel = xyes; then
AC_DEFINE([HAVE_BFG_LOWLEVEL], [1], [Defined to 1 if lowlevel drivers are being used])
fi

if test x$need_linux_i2c_dev = xyes; then
AC_CHECK_HEADERS([linux/i2c-dev-user.h])
AC_CHECK_DECL([i2c_smbus_read_word_data],[true],[
AC_MSG_ERROR([linux/i2c-dev.h header from i2c-tools/libi2c-dev (NOT linux headers) is required for KnCMiner drivers])
],[
#include <stddef.h>
#ifdef HAVE_LINUX_I2C_DEV_USER_H
#include <linux/i2c-dev-user.h>
#else
#ifdef NEED_LINUX_I2C_H
#include <linux/i2c.h>
#endif
#include <linux/i2c-dev.h>
#endif
])
fi


curses="auto"

Expand Down

0 comments on commit 5feff7b

Please sign in to comment.