options: don't imply -v when doing a -p.
[media-ctl.git] / configure.ac
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 AM_PROG_CC_C_O
13 # automake 1.12 seems to require this, but automake 1.11 doesn't recognize it
14 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
15 AC_PROG_LIBTOOL
16
17 # Checks for libraries.
18
19 AC_ARG_WITH([libudev],
20     AS_HELP_STRING([--with-libudev],
21         [Enable libudev to detect a device name]))
22
23 AS_IF([test "x$with_libudev" = "xyes"],
24     [PKG_CHECK_MODULES(libudev, libudev, have_libudev=yes, have_libudev=no)],
25     [have_libudev=no])
26
27 AS_IF([test "x$have_libudev" = "xyes"],
28     [
29         AC_DEFINE([HAVE_LIBUDEV], [], [Use libudev])
30         LIBUDEV_CFLAGS="$libudev_CFLAGS"
31         LIBUDEV_LIBS="$libudev_LIBS"
32         AC_SUBST(LIBUDEV_CFLAGS)
33         AC_SUBST(LIBUDEV_LIBS)
34     ],
35     [AS_IF([test "x$with_libudev" = "xyes"],
36         [AC_MSG_ERROR([libudev requested but not found])
37     ])
38 ])
39
40
41 # Kernel headers path.
42 AC_ARG_WITH(kernel-headers,
43     [AC_HELP_STRING([--with-kernel-headers=DIR],
44         [specify path of Linux kernel headers [/usr/src/kernel-headers]])],
45     [case "${withval}" in
46         yes | no) AC_MSG_ERROR([bad value ${withval} for --with-kernel-headers]) ;;
47         *)   KERNEL_HEADERS_DIR="${withval}" ;;
48      esac],
49     [KERNEL_HEADERS_DIR="/usr/src/kernel-headers"])
50
51 CPPFLAGS="$CPPFLAGS -I$KERNEL_HEADERS_DIR/include"
52
53 # Checks for header files.
54 AC_CHECK_HEADERS([linux/media.h \
55                   linux/types.h \
56                   linux/v4l2-mediabus.h \
57                   linux/v4l2-subdev.h \
58                   linux/videodev2.h],
59                   [],
60                   [echo "ERROR: Kernel header file not found or not usable!"; exit 1])
61
62 AC_CHECK_HEADERS([fcntl.h \
63                   stdlib.h \
64                   string.h \
65                   sys/ioctl.h \
66                   sys/time.h \
67                   unistd.h],
68                   [],
69                   [echo "ERROR: Header file not found or not usable!"; exit 1])
70
71 # Checks for typedefs, structures, and compiler characteristics.
72 AC_C_INLINE
73 AC_TYPE_SIZE_T
74 AC_CHECK_MEMBERS([struct stat.st_rdev])
75
76 # Checks for library functions.
77 AC_HEADER_MAJOR
78 AS_IF([test "x$cross_compiling" != "xyes"],
79     [
80         AC_FUNC_MALLOC
81         AC_FUNC_REALLOC
82     ])
83 AC_CHECK_FUNCS([memset strerror strrchr strtoul])
84
85 AC_CONFIG_FILES([
86  Makefile
87  src/Makefile
88  libmediactl.pc
89  libv4l2subdev.pc
90 ])
91
92 AC_OUTPUT
93