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
|
AC_INIT(libftdi, 0.20)
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
AC_LANG_C
AC_PROG_CC
AM_PROG_LIBTOOL
AC_PROG_CXX
dnl check for libusb
PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1.11)
CFLAGS="$CFLAGS $LIBUSB_CFLAGS"
LIBS="$LIBS $LIBUSB_LIBS"
dnl Check for recent pkg-config which supports Requires.private
case `$PKG_CONFIG --version` in
0.?|0.1[0-7]) PKGCONFIG_REQUIRES="Requires"; ;;
*) PKGCONFIG_REQUIRES="Requires.private"; ;;
esac
AC_SUBST(PKGCONFIG_REQUIRES)
ENABLE_ASYNC_MODE=0
AC_ARG_WITH(async-mode,
[ --with-async-mode enable experimental async mode. Linux only.],
[
AC_MSG_CHECKING(for experimental linux async mode)
if test "$withval" != "no"; then
ENABLE_ASYNC_MODE=1
CFLAGS="$CFLAGS -DLIBFTDI_LINUX_ASYNC_MODE"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
])
AC_SUBST(ENABLE_ASYNC_MODE)
AC_ARG_WITH(examples,
AS_HELP_STRING([--without-examples], [disable example programs]))
AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$with_examples" != "xno"])
LIBFTDI_MODULES=
LIBFTDI_MODULES_PKGCONFIG=
dnl libftdi C++ wrapper. Needs boost.
AX_BOOST_BASE([1.33])
ENABLE_LIBFTDIPP=0
AC_MSG_CHECKING(if we can build the C++ wrapper)
AC_ARG_ENABLE(libftdipp,
AS_HELP_STRING([--enable-libftdipp],
[enable libftdi C++ wrapper. Needs boost (default: auto)]),
[
if test "$enableval" != "no"; then
if test "x$HAVE_BOOST" != "xyes"; then
AC_MSG_ERROR(Sorry, we need the boost library for the C++ wrapper)
fi
ENABLE_LIBFTDIPP=1
fi
],
[
dnl Build the wrapper if we got the boost library
if test "x$HAVE_BOOST" = "xyes"; then
ENABLE_LIBFTDIPP=1
fi
])
if test "x$ENABLE_LIBFTDIPP" = "x1"; then
LIBFTDI_MODULES="$LIBFTDI_MODULES ftdipp"
LIBFTDI_MODULES_PKGCONFIG="$LIBFTDI_MODULES_PKGCONFIG libftdipp.pc"
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AM_CONDITIONAL(HAVE_LIBFTDIPP, [test "x$ENABLE_LIBFTDIPP" = "x1"])
dnl check for doxygen
AC_ARG_WITH(docs,
AS_HELP_STRING([--without-docs], [disable doxygen usage]))
if test "x$with_docs" != "xno"; then
AC_PATH_PROG(DOXYGEN, doxygen)
else
DOXYGEN=
fi
AM_CONDITIONAL(HAVE_DOXYGEN, test -n $DOXYGEN)
dnl ============================
dnl Bindings for other languages
dnl ==
dnl ===============
dnl Checks for SWIG
dnl ===============
AC_PATH_PROG([SWIG], [swig])
AM_CONDITIONAL(HAVE_SWIG, test "$SWIG")
dnl =================
dnl Checks for Python
dnl =================
AM_PATH_PYTHON([2.0],
[],
[AC_MSG_WARN([Python not found. Python is required to build presage python binding. Python can be obtained from http://www.pyth
on.org])])
if test "$PYTHON"
then
python_include_path=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_python_inc();"`
AC_CHECK_HEADERS([${python_include_path}/Python.h],
[have_python_header=true],
[AC_MSG_WARN([Python.h header file not found. Python development files are required to build presage python binding. Pyt
hon can be obtained from http://www.python.org])],
[])
fi
AM_CONDITIONAL(HAVE_PYTHON, test "$PYTHON" -a "x$have_python_header" = "xtrue")
AC_ARG_ENABLE([python-binding],
AS_HELP_STRING([--enable-python-binding],
[build python binding (default=no)]),
[ac_enable_python_binding=$enableval],
[ac_enable_python_binding=no])
if test "x$ac_enable_python_binding" = "xyes"
then
if test ! "$SWIG" -o ! "$PYTHON" -o ! "x$have_python_header" = "xtrue"
then
AC_MSG_WARN([Python binding for libftdi cannot be built. Ensure that SWIG and Python packages are available.])
fi
else
AC_MSG_NOTICE([Python binding for libftdi will not be built.])
AC_MSG_NOTICE([Enable Python binding module building with --enable-python-binding])
fi
AM_CONDITIONAL(ENABLE_PYTHON_BINDING, test "x$ac_enable_python_binding" = "xyes")
if test "$SWIG" -a "$PYTHON" -a "x$have_python_header" = "xtrue" -a "x$ac_enable_python_binding" = "xyes"
then
AC_MSG_NOTICE([Python binding for libftdi will be built.])
build_python_binding="yes"
else
build_python_binding="no"
fi
AC_SUBST(LIBFTDI_MODULES)
AC_SUBST(LIBFTDI_MODULES_PKGCONFIG)
AC_CONFIG_FILES([libftdi-config],[chmod a+x libftdi-config])
AC_CONFIG_FILES(Makefile src/Makefile bindings/Makefile bindings/python/Makefile bindings/python/setup.py examples/Makefile doc/Doxyfile doc/Makefile libftdi.pc libftdi.spec)
if test "x$ENABLE_LIBFTDIPP" = "x1"; then
AC_CONFIG_FILES(ftdipp/Makefile libftdipp.pc)
fi
AC_OUTPUT
|