| 1 | AC_INIT(libftdi, 0.17) |
| 2 | AM_INIT_AUTOMAKE |
| 3 | AM_CONFIG_HEADER(config.h) |
| 4 | |
| 5 | AC_LANG_C |
| 6 | AC_PROG_CC |
| 7 | AM_PROG_LIBTOOL |
| 8 | AC_PROG_CXX |
| 9 | |
| 10 | AC_CONFIG_MACRO_DIR([m4]) |
| 11 | |
| 12 | dnl check for libusb-1.0 |
| 13 | have_libusb_1_0=no |
| 14 | PKG_CHECK_MODULES(LIBUSB_1_0, [ libusb-1.0 >= 1.0.0 ], have_libusb_1_0=yes, have_libusb_1_0=no) |
| 15 | if test "$have_libusb_1_0" = "yes"; then |
| 16 | CFLAGS="$CFLAGS $LIBUSB_1_0_CFLAGS" |
| 17 | CXXFLAGS="$CXXFLAGS $LIBUSB_1_0_CFLAGS" |
| 18 | USB_LIBS="$USB_LIBS $LIBUSB_1_0_LIBS" |
| 19 | HAVE_USB=yes |
| 20 | AC_DEFINE(HAVE_LIBUSB_1_0, 1, [Define to 1 if you have libusb-1.0.]) |
| 21 | AC_SUBST(USB_LIBS) |
| 22 | else |
| 23 | AC_MSG_ERROR([libusb-1.0 not found.]) |
| 24 | fi |
| 25 | |
| 26 | ENABLE_ASYNC_MODE=0 |
| 27 | AC_ARG_WITH(async-mode, |
| 28 | [ --with-async-mode enable experimental async mode. Linux only.], |
| 29 | [ |
| 30 | AC_MSG_CHECKING(for experimental linux async mode) |
| 31 | if test "$withval" != "no"; then |
| 32 | ENABLE_ASYNC_MODE=1 |
| 33 | CFLAGS="$CFLAGS -DLIBFTDI_LINUX_ASYNC_MODE" |
| 34 | AC_MSG_RESULT(yes) |
| 35 | else |
| 36 | AC_MSG_RESULT(no) |
| 37 | fi |
| 38 | ]) |
| 39 | AC_SUBST(ENABLE_ASYNC_MODE) |
| 40 | |
| 41 | AC_ARG_WITH(examples, |
| 42 | AS_HELP_STRING([--without-examples], [disable example programs])) |
| 43 | AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$with_examples" != "xno"]) |
| 44 | |
| 45 | LIBFTDI_MODULES= |
| 46 | LIBFTDI_MODULES_PKGCONFIG= |
| 47 | |
| 48 | dnl libftdi C++ wrapper. Needs boost. |
| 49 | AX_BOOST_BASE([1.33]) |
| 50 | ENABLE_LIBFTDIPP=0 |
| 51 | AC_MSG_CHECKING(if we can build the C++ wrapper) |
| 52 | AC_ARG_ENABLE(libftdipp, |
| 53 | AS_HELP_STRING([--enable-libftdipp], |
| 54 | [enable libftdi C++ wrapper. Needs boost (default: auto)]), |
| 55 | [ |
| 56 | if test "$enableval" != "no"; then |
| 57 | if test "x$HAVE_BOOST" != "xyes"; then |
| 58 | AC_MSG_ERROR(Sorry, we need the boost library for the C++ wrapper) |
| 59 | fi |
| 60 | ENABLE_LIBFTDIPP=1 |
| 61 | fi |
| 62 | ], |
| 63 | [ |
| 64 | dnl Build the wrapper if we got the boost library |
| 65 | if test "x$HAVE_BOOST" = "xyes"; then |
| 66 | ENABLE_LIBFTDIPP=1 |
| 67 | fi |
| 68 | ]) |
| 69 | if test "x$ENABLE_LIBFTDIPP" = "x1"; then |
| 70 | LIBFTDI_MODULES="$LIBFTDI_MODULES ftdipp" |
| 71 | LIBFTDI_MODULES_PKGCONFIG="$LIBFTDI_MODULES_PKGCONFIG libftdipp.pc" |
| 72 | AC_MSG_RESULT(yes) |
| 73 | else |
| 74 | AC_MSG_RESULT(no) |
| 75 | fi |
| 76 | AM_CONDITIONAL(HAVE_LIBFTDIPP, [test "x$ENABLE_LIBFTDIPP" = "x1"]) |
| 77 | |
| 78 | dnl check for doxygen |
| 79 | AC_PATH_PROG(DOXYGEN, doxygen) |
| 80 | AM_CONDITIONAL(HAVE_DOXYGEN, test -n $DOXYGEN) |
| 81 | |
| 82 | dnl ============================ |
| 83 | dnl Bindings for other languages |
| 84 | dnl == |
| 85 | |
| 86 | dnl =============== |
| 87 | dnl Checks for SWIG |
| 88 | dnl =============== |
| 89 | AC_PATH_PROG([SWIG], [swig]) |
| 90 | AM_CONDITIONAL(HAVE_SWIG, test "$SWIG") |
| 91 | |
| 92 | dnl ================= |
| 93 | dnl Checks for Python |
| 94 | dnl ================= |
| 95 | AM_PATH_PYTHON([2.0], |
| 96 | [], |
| 97 | [AC_MSG_WARN([Python not found. Python is required to build presage python binding. Python can be obtained from http://www.pyth |
| 98 | on.org])]) |
| 99 | if test "$PYTHON" |
| 100 | then |
| 101 | python_include_path=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_python_inc();"` |
| 102 | AC_CHECK_HEADERS([${python_include_path}/Python.h], |
| 103 | [have_python_header=true], |
| 104 | [AC_MSG_WARN([Python.h header file not found. Python development files are required to build presage python binding. Pyt |
| 105 | hon can be obtained from http://www.python.org])], |
| 106 | []) |
| 107 | fi |
| 108 | AM_CONDITIONAL(HAVE_PYTHON, test "$PYTHON" -a "x$have_python_header" = "xtrue") |
| 109 | |
| 110 | AC_ARG_ENABLE([python-binding], |
| 111 | AS_HELP_STRING([--enable-python-binding], |
| 112 | [build python binding (default=no)]), |
| 113 | [ac_enable_python_binding=$enableval], |
| 114 | [ac_enable_python_binding=no]) |
| 115 | if test "x$ac_enable_python_binding" = "xyes" |
| 116 | then |
| 117 | if test ! "$SWIG" -o ! "$PYTHON" -o ! "x$have_python_header" = "xtrue" |
| 118 | then |
| 119 | AC_MSG_WARN([Python binding for libftdi cannot be built. Ensure that SWIG and Python packages are available.]) |
| 120 | fi |
| 121 | else |
| 122 | AC_MSG_NOTICE([Python binding for libftdi will not be built.]) |
| 123 | AC_MSG_NOTICE([Enable Python binding module building with --enable-python-binding]) |
| 124 | fi |
| 125 | AM_CONDITIONAL(ENABLE_PYTHON_BINDING, test "x$ac_enable_python_binding" = "xyes") |
| 126 | |
| 127 | if test "$SWIG" -a "$PYTHON" -a "x$have_python_header" = "xtrue" -a "x$ac_enable_python_binding" = "xyes" |
| 128 | then |
| 129 | AC_MSG_NOTICE([Python binding for libftdi will be built.]) |
| 130 | build_python_binding="yes" |
| 131 | else |
| 132 | build_python_binding="no" |
| 133 | fi |
| 134 | |
| 135 | AC_SUBST(LIBFTDI_MODULES) |
| 136 | AC_SUBST(LIBFTDI_MODULES_PKGCONFIG) |
| 137 | |
| 138 | AC_CONFIG_FILES([libftdi-config],[chmod a+x libftdi-config]) |
| 139 | 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) |
| 140 | |
| 141 | if test "x$ENABLE_LIBFTDIPP" = "x1"; then |
| 142 | AC_CONFIG_FILES(ftdipp/Makefile libftdipp.pc) |
| 143 | fi |
| 144 | |
| 145 | AC_OUTPUT |