Root/configure.ac

Source at commit c26a0ce1da3bde5a48d8919372a7b647277dd1eb created 9 years 4 months ago.
By Peter Zotov, Adjusted configure.ac to search for libraries required for jzboot.
1# -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.63)
5AC_INIT([xburst-tools], [0.1])
6AC_CONFIG_AUX_DIR(m4)
7AM_INIT_AUTOMAKE([foreign])
8AM_CONFIG_HEADER([config.h])
9
10AM_MAINTAINER_MODE
11
12AC_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])
19AM_CONDITIONAL([COND_FIRMWARE], [test "$firmware" = true])
20
21AC_ARG_VAR([CROSS_COMPILE],
22    [Cross compiler prefix for building firmware, ]
23    [e.g. CROSS_COMPILE=mipsel-openwrt-linux-.])
24
25AS_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.
37AC_PROG_CC
38AC_PROG_CXX
39
40# Checks for libraries.
41AC_CHECK_LIB([c], [main])
42AC_CHECK_LIB([confuse], [main], [], [
43echo "Error! You need to have libconfuse."
44echo "Maybe run 'sudo apt-get install libconfuse-dev' under debian"
45exit -1 ])
46AC_CHECK_LIB([gcc], [main])
47AC_CHECK_LIB([m], [main])
48AC_CHECK_LIB([usb], [main], [], [
49echo "Error! You need to have libusb-0.1. \n"
50echo "Maybe run 'sudo apt-get install libusb-dev' under debian"
51exit -1 ])
52AC_CHECK_LIB([usb-1.0], [main], [], [
53echo "Error! You need to have libusb-1.0. \n"
54echo "Maybe run 'sudo apt-get install libusb1.0-0-dev' under debian"
55exit -1 ])
56
57AC_ARG_WITH([readline],
58  [AS_HELP_STRING([--with-readline],
59     [support fancy command line editing @<:@default=check@:>@])],
60     [],
61  [with_readline=check])
62
63READLINE_LIBS=
64AS_IF([test "x$with_readline" != xno],
65  [AC_CHECK_LIB([readline], [main],
66    [AC_SUBST([READLINE_LIBS], ["-lreadline -lncurses"])
67     AC_DEFINE([HAVE_READLINE], [1],
68               [Define if you have libreadline])
69    ],
70    [if test "x$with_readline" != xcheck; then
71      AC_MSG_FAILURE(
72        [--with-readline was given, but test for readline failed])
73     fi
74    ], -lncurses)])
75
76LIBS="$LIBS $USB_LIBS $READLINE_LIBS"
77CFLAGS="$CFLAGS $USB_CFLAGS"
78
79# Checks for header files.
80AC_HEADER_STDC
81AC_CHECK_HEADERS([fcntl.h stdint.h stdlib.h string.h unistd.h])
82
83# Checks for typedefs, structures, and compiler characteristics.
84AC_C_INLINE
85AC_TYPE_SIZE_T
86AC_TYPE_UINT8_T
87
88# Checks for library functions.
89AC_FUNC_MALLOC
90AC_FUNC_MEMCMP
91AC_CHECK_FUNCS([memset strerror])
92
93AC_CONFIG_FILES(Makefile \
94        usbboot/Makefile usbboot/src/Makefile \
95        xbboot/Makefile xbboot/host-app/Makefile \
96        jzboot/Makefile jzboot/src/Makefile)
97AC_OUTPUT
98

Archive Download this file



interactive