Don't perform AC_FUNC_MALLOC and AC_FUNC_REALLOC when cross-compiling
[media-ctl.git] / configure.in
1 AC_PREREQ([2.61])
2 AC_INIT([media-ctl], [0.0.1], [laurent.pinchart@ideasonboard.com])
3 AC_CONFIG_SRCDIR([src/main.c])
4 AC_CONFIG_AUX_DIR([config])
5 AC_CONFIG_HEADERS([config.h])
6 AC_CONFIG_MACRO_DIR([m4])
7
8 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
9
10 # Checks for programs.
11 AC_PROG_CC
12 AC_PROG_LIBTOOL
13
14 # Checks for libraries.
15
16 # Kernel headers path.
17 AC_ARG_WITH(kernel-headers,
18     [AC_HELP_STRING([--with-kernel-headers=DIR],
19         [specify path of Linux kernel headers [/usr/src/kernel-headers]])],
20     [case "${withval}" in
21         yes | no) AC_MSG_ERROR([bad value ${withval} for --with-kernel-headers]) ;;
22         *)   KERNEL_HEADERS_DIR="${withval}" ;;
23      esac],
24     [KERNEL_HEADERS_DIR="/usr/src/kernel-headers"])
25
26 CPPFLAGS="-I$KERNEL_HEADERS_DIR/include"
27
28 # Checks for header files.
29 AC_CHECK_HEADERS([linux/media.h \
30                   linux/types.h \
31                   linux/v4l2-mediabus.h \
32                   linux/v4l2-subdev.h \
33                   linux/videodev2.h],
34                   [],
35                   [echo "ERROR: Kernel header file not found or not usable!"; exit 1])
36
37 AC_CHECK_HEADERS([fcntl.h \
38                   stdlib.h \
39                   string.h \
40                   sys/ioctl.h \
41                   sys/time.h \
42                   unistd.h],
43                   [],
44                   [echo "ERROR: Header file not found or not usable!"; exit 1])
45
46 # Checks for typedefs, structures, and compiler characteristics.
47 AC_C_INLINE
48 AC_TYPE_SIZE_T
49 AC_CHECK_MEMBERS([struct stat.st_rdev])
50
51 # Checks for library functions.
52 AC_HEADER_MAJOR
53 AS_IF([test "x$cross_compiling" != "xyes"],
54     [
55         AC_FUNC_MALLOC
56         AC_FUNC_REALLOC
57     ])
58 AC_CHECK_FUNCS([memset strerror strrchr strtoul])
59
60 AC_CONFIG_FILES([
61  Makefile
62  src/Makefile
63  libmediactl.pc
64  libv4l2subdev.pc
65 ])
66
67 AC_OUTPUT
68