Root/
Source at commit fdbf94c90331b37b304735e43390e5fbc3ad7199 created 12 years 11 months ago. By Peter Zotov, Use pkg-config to detect libusb-1.0. | |
---|---|
1 | # -*- Autoconf -*- |
2 | # Process this file with autoconf to produce a configure script. |
3 | |
4 | AC_PREREQ(2.63) |
5 | AC_INIT([xburst-tools], [0.1]) |
6 | AC_CONFIG_AUX_DIR(m4) |
7 | AM_INIT_AUTOMAKE([foreign]) |
8 | AM_CONFIG_HEADER([config.h]) |
9 | |
10 | AM_MAINTAINER_MODE |
11 | |
12 | AC_ARG_ENABLE([firmware], |
13 | [AS_HELP_STRING([--disable-firmware], |
14 | [Do not build initialization code] |
15 | [(for example, because some other package contains it).])], |
16 | [AS_CASE([$enableval], [yes], [firmware=true], [no], [firmware=false], |
17 | [AC_MSG_ERROR([bad value $enableval for --enable-firmware])])], |
18 | [firmware=true]) |
19 | AM_CONDITIONAL([COND_FIRMWARE], [test "$firmware" = true]) |
20 | |
21 | AC_ARG_VAR([CROSS_COMPILE], |
22 | [Cross compiler prefix for building firmware, ] |
23 | [e.g. CROSS_COMPILE=mipsel-openwrt-linux-.]) |
24 | |
25 | AS_VAR_IF([firmware], [true], |
26 | [ |
27 | AS_VAR_IF([CROSS_COMPILE], [], |
28 | [AC_MSG_ERROR([CROSS_COMPILE prefix is not set, set to cross-prefix- use --disable-firmware])]) |
29 | AC_CHECK_PROG([CROSS_GCC], [${CROSS_COMPILE}gcc], [yes], [no]) |
30 | AS_VAR_IF([CROSS_GCC], [no], |
31 | [AC_MSG_ERROR([No cross compiler, check CROSS_COMPILE value])]) |
32 | ], |
33 | [CROSS_COMPILE="dummy-"] |
34 | ) |
35 | |
36 | # Checks for programs. |
37 | AC_PROG_CC |
38 | AC_PROG_CXX |
39 | |
40 | # Checks for libraries. |
41 | AC_CHECK_LIB([c], [main]) |
42 | AC_CHECK_LIB([confuse], [main], [], [ |
43 | echo "Error! You need to have libconfuse." |
44 | echo "Maybe run 'sudo apt-get install libconfuse-dev' under debian" |
45 | exit -1 ]) |
46 | AC_CHECK_LIB([gcc], [main]) |
47 | AC_CHECK_LIB([m], [main]) |
48 | AC_CHECK_LIB([usb], [main], [], [ |
49 | echo "Error! You need to have libusb-0.1. \n" |
50 | echo "Maybe run 'sudo apt-get install libusb-dev' under debian" |
51 | exit -1 ]) |
52 | PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0]) |
53 | |
54 | AC_ARG_WITH([readline], |
55 | [AS_HELP_STRING([--with-readline], |
56 | [support fancy command line editing @<:@default=check@:>@])], |
57 | [], |
58 | [with_readline=check]) |
59 | |
60 | READLINE_LIBS= |
61 | AS_IF([test "x$with_readline" != xno], |
62 | [AC_CHECK_LIB([readline], [main], |
63 | [AC_SUBST([READLINE_LIBS], ["-lreadline -lncurses"]) |
64 | AC_DEFINE([HAVE_READLINE], [1], |
65 | [Define if you have libreadline]) |
66 | ], |
67 | [if test "x$with_readline" != xcheck; then |
68 | AC_MSG_FAILURE( |
69 | [--with-readline was given, but test for readline failed]) |
70 | fi |
71 | ], -lncurses)]) |
72 | |
73 | LIBS="$LIBS $USB_LIBS $READLINE_LIBS $LIBUSB1_LIBS" |
74 | CFLAGS="$CFLAGS $USB_CFLAGS $LIBUSB1_CFLAGS" |
75 | |
76 | # Checks for header files. |
77 | AC_HEADER_STDC |
78 | AC_CHECK_HEADERS([fcntl.h stdint.h stdlib.h string.h unistd.h]) |
79 | |
80 | # Checks for typedefs, structures, and compiler characteristics. |
81 | AC_C_INLINE |
82 | AC_TYPE_SIZE_T |
83 | AC_TYPE_UINT8_T |
84 | |
85 | # Checks for library functions. |
86 | AC_FUNC_MALLOC |
87 | AC_FUNC_MEMCMP |
88 | AC_CHECK_FUNCS([memset strerror]) |
89 | |
90 | AC_CONFIG_FILES(Makefile \ |
91 | usbboot/Makefile usbboot/src/Makefile \ |
92 | xbboot/Makefile xbboot/host-app/Makefile \ |
93 | jzboot/Makefile jzboot/src/Makefile) |
94 | AC_OUTPUT |
95 |