| 1 | AC_INIT(libftdi, 0.18) |
| 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 | dnl check for libusb-config |
| 11 | AC_CHECK_TOOL(HAVELIBUSB, libusb-config) |
| 12 | |
| 13 | if test ! -z "$HAVELIBUSB"; then |
| 14 | LIBUSB_CFLAGS=`$HAVELIBUSB --cflags` |
| 15 | LIBUSB_LIBS=`$HAVELIBUSB --libs` |
| 16 | |
| 17 | CFLAGS="$CFLAGS $LIBUSB_CFLAGS" |
| 18 | LIBS="$LIBS $LIBUSB_LIBS" |
| 19 | else |
| 20 | AC_MSG_ERROR([*** libusb-config not found. You need a working libusb installation.]) |
| 21 | fi |
| 22 | |
| 23 | dnl check for version of libusb |
| 24 | AC_MSG_CHECKING([if libusb version is >= 0.1.7]) |
| 25 | libusb_version_needed="1007" |
| 26 | libusb_version=`$HAVELIBUSB --version | sed -e "s/libusb //" | awk 'BEGIN { FS = "."; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'` |
| 27 | |
| 28 | if test $libusb_version -lt $libusb_version_needed; then |
| 29 | AC_MSG_RESULT(no) |
| 30 | AC_MSG_ERROR([*** libusb is too old ($libusb_version). You need a libusb installation newer or equal to 0.1.7.]) |
| 31 | else |
| 32 | AC_MSG_RESULT(yes) |
| 33 | fi |
| 34 | |
| 35 | ENABLE_ASYNC_MODE=0 |
| 36 | AC_ARG_WITH(async-mode, |
| 37 | [ --with-async-mode enable experimental async mode. Linux only.], |
| 38 | [ |
| 39 | AC_MSG_CHECKING(for experimental linux async mode) |
| 40 | if test "$withval" != "no"; then |
| 41 | ENABLE_ASYNC_MODE=1 |
| 42 | CFLAGS="$CFLAGS -DLIBFTDI_LINUX_ASYNC_MODE" |
| 43 | AC_MSG_RESULT(yes) |
| 44 | else |
| 45 | AC_MSG_RESULT(no) |
| 46 | fi |
| 47 | ]) |
| 48 | AC_SUBST(ENABLE_ASYNC_MODE) |
| 49 | |
| 50 | AC_ARG_WITH(examples, |
| 51 | AS_HELP_STRING([--without-examples], [disable example programs])) |
| 52 | AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$with_examples" != "xno"]) |
| 53 | |
| 54 | LIBFTDI_MODULES= |
| 55 | LIBFTDI_MODULES_PKGCONFIG= |
| 56 | |
| 57 | dnl libftdi C++ wrapper. Needs boost. |
| 58 | AX_BOOST_BASE([1.33]) |
| 59 | ENABLE_LIBFTDIPP=0 |
| 60 | AC_MSG_CHECKING(if we can build the C++ wrapper) |
| 61 | AC_ARG_ENABLE(libftdipp, |
| 62 | AS_HELP_STRING([--enable-libftdipp], |
| 63 | [enable libftdi C++ wrapper. Needs boost (default: auto)]), |
| 64 | [ |
| 65 | if test "$enableval" != "no"; then |
| 66 | if test "x$HAVE_BOOST" != "xyes"; then |
| 67 | AC_MSG_ERROR(Sorry, we need the boost library for the C++ wrapper) |
| 68 | fi |
| 69 | ENABLE_LIBFTDIPP=1 |
| 70 | fi |
| 71 | ], |
| 72 | [ |
| 73 | dnl Build the wrapper if we got the boost library |
| 74 | if test "x$HAVE_BOOST" = "xyes"; then |
| 75 | ENABLE_LIBFTDIPP=1 |
| 76 | fi |
| 77 | ]) |
| 78 | if test "x$ENABLE_LIBFTDIPP" = "x1"; then |
| 79 | LIBFTDI_MODULES="$LIBFTDI_MODULES ftdipp" |
| 80 | LIBFTDI_MODULES_PKGCONFIG="$LIBFTDI_MODULES_PKGCONFIG libftdipp.pc" |
| 81 | AC_MSG_RESULT(yes) |
| 82 | else |
| 83 | AC_MSG_RESULT(no) |
| 84 | fi |
| 85 | AM_CONDITIONAL(HAVE_LIBFTDIPP, [test "x$ENABLE_LIBFTDIPP" = "x1"]) |
| 86 | |
| 87 | dnl check for doxygen |
| 88 | AC_ARG_WITH(docs, |
| 89 | AS_HELP_STRING([--without-docs], [disable doxygen usage])) |
| 90 | if test "x$with_docs" != "xno"; then |
| 91 | AC_PATH_PROG(DOXYGEN, doxygen) |
| 92 | else |
| 93 | DOXYGEN= |
| 94 | fi |
| 95 | AM_CONDITIONAL(HAVE_DOXYGEN, test -n $DOXYGEN) |
| 96 | |
| 97 | dnl ============================ |
| 98 | dnl Bindings for other languages |
| 99 | dnl == |
| 100 | |
| 101 | dnl =============== |
| 102 | dnl Checks for SWIG |
| 103 | dnl =============== |
| 104 | AC_PATH_PROG([SWIG], [swig]) |
| 105 | AM_CONDITIONAL(HAVE_SWIG, test "$SWIG") |
| 106 | |
| 107 | dnl ================= |
| 108 | dnl Checks for Python |
| 109 | dnl ================= |
| 110 | AM_PATH_PYTHON([2.0], |
| 111 | [], |
| 112 | [AC_MSG_WARN([Python not found. Python is required to build presage python binding. Python can be obtained from http://www.pyth |
| 113 | on.org])]) |
| 114 | if test "$PYTHON" |
| 115 | then |
| 116 | python_include_path=`$PYTHON -c "import distutils.sysconfig; print distutils.sysconfig.get_python_inc();"` |
| 117 | AC_CHECK_HEADERS([${python_include_path}/Python.h], |
| 118 | [have_python_header=true], |
| 119 | [AC_MSG_WARN([Python.h header file not found. Python development files are required to build presage python binding. Pyt |
| 120 | hon can be obtained from http://www.python.org])], |
| 121 | []) |
| 122 | fi |
| 123 | AM_CONDITIONAL(HAVE_PYTHON, test "$PYTHON" -a "x$have_python_header" = "xtrue") |
| 124 | |
| 125 | AC_ARG_ENABLE([python-binding], |
| 126 | AS_HELP_STRING([--enable-python-binding], |
| 127 | [build python binding (default=no)]), |
| 128 | [ac_enable_python_binding=$enableval], |
| 129 | [ac_enable_python_binding=no]) |
| 130 | if test "x$ac_enable_python_binding" = "xyes" |
| 131 | then |
| 132 | if test ! "$SWIG" -o ! "$PYTHON" -o ! "x$have_python_header" = "xtrue" |
| 133 | then |
| 134 | AC_MSG_WARN([Python binding for libftdi cannot be built. Ensure that SWIG and Python packages are available.]) |
| 135 | fi |
| 136 | else |
| 137 | AC_MSG_NOTICE([Python binding for libftdi will not be built.]) |
| 138 | AC_MSG_NOTICE([Enable Python binding module building with --enable-python-binding]) |
| 139 | fi |
| 140 | AM_CONDITIONAL(ENABLE_PYTHON_BINDING, test "x$ac_enable_python_binding" = "xyes") |
| 141 | |
| 142 | if test "$SWIG" -a "$PYTHON" -a "x$have_python_header" = "xtrue" -a "x$ac_enable_python_binding" = "xyes" |
| 143 | then |
| 144 | AC_MSG_NOTICE([Python binding for libftdi will be built.]) |
| 145 | build_python_binding="yes" |
| 146 | else |
| 147 | build_python_binding="no" |
| 148 | fi |
| 149 | |
| 150 | AC_SUBST(LIBFTDI_MODULES) |
| 151 | AC_SUBST(LIBFTDI_MODULES_PKGCONFIG) |
| 152 | |
| 153 | AC_CONFIG_FILES([libftdi-config],[chmod a+x libftdi-config]) |
| 154 | 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) |
| 155 | |
| 156 | if test "x$ENABLE_LIBFTDIPP" = "x1"; then |
| 157 | AC_CONFIG_FILES(ftdipp/Makefile libftdipp.pc) |
| 158 | fi |
| 159 | |
| 160 | AC_OUTPUT |