forked from dfu-programmer/dfu-programmer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
80 lines (67 loc) · 2.55 KB
/
configure.ac
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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT([dfu-programmer],[0.7.2],[],[],[https://github.com/dfu-programmer/dfu-programmer])
AC_CONFIG_AUX_DIR(m4)
AC_CONFIG_SRCDIR([src/atmel.c])
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER([src/config.h])
AM_MAINTAINER_MODE
# Checks for programs.
AC_PROG_CC
# Checks for libusb - from sane-backends configuration
dnl Enable libusb-1.0, if available
disable_libusb_1_0=no
AC_ARG_ENABLE(libusb_1_0,
AC_HELP_STRING([--disable-libusb_1_0], [disable libusb-1.0 support even if available]),
[ if test "x$enableval" = "xno"; then disable_libusb_1_0=yes; fi ], [])
dnl If libusb-1.0 is enabled and available, prefer that to the old libusb
have_libusb_1_0=no
if test "$disable_libusb_1_0" = "no"; then
ifdef([PKG_CHECK_MODULES],
[PKG_CHECK_MODULES(LIBUSB_1_0, [ libusb-1.0 >= 1.0.0 ], have_libusb_1_0=yes, have_libusb_1_0=no)],
[have_libusb_1_0=yes
LIBUSB_1_0_CFLAGS='-I${includedir}/libusb-1.0 -I${oldincludedir}/libusb-1.0'
LIBUSB_1_0_LIBS=-lusb-1.0])
if test "$have_libusb_1_0" = "yes"; then
AS_ECHO("using libusb_1.0");
CFLAGS="$CFLAGS $LIBUSB_1_0_CFLAGS"
LIBS="$LIBS $LIBUSB_1_0_LIBS"
HAVE_USB=yes
fi
fi
if test "$have_libusb_1_0" = "no"; then
dnl Fallback to the old libusb
dnl libusb >= 0.1.8 is required, as we need usb_interrupt_read()
AS_ECHO("using libusb");
AC_CHECK_HEADER(usb.h,
AC_CHECK_LIB(usb, usb_interrupt_read,
[LIBS="$LIBS -lusb"
HAVE_USB=yes]))
fi
dnl The following logic is useful for distributions. If they force
dnl USB support with --enable-libusb=yes then configure will fail
dnl when its detected that it can not be supported. Default is
dnl "auto" which means only enable if libraries are found and do
dnl not error out.
if test "$HAVE_USB" = "no"; then
AC_MSG_ERROR([USB support requested but required libraries not found.])
fi
if test "$HAVE_USB" = "yes"; then
if test "$have_libusb_1_0" = "yes"; then
AC_DEFINE(HAVE_LIBUSB_1_0, 1, [Define to 1 if you have libusb-1.0.])
else
AC_DEFINE(HAVE_LIBUSB, 1, [Define to 1 if you have libusb.])
fi
fi
# Checks for header files.
AC_HEADER_STDC
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
#AC_CHECK_FUNC([memset], :, [AC_CHECK_LIB([libc], [libc])])
AC_CONFIG_FILES(fedora/dfu-programmer.spec Makefile docs/Makefile src/Makefile)
AC_OUTPUT