1 #
2 # Copyright (C) 2011 Texas Instruments
3 # Author: Rob Clark <rob.clark@linaro.org>
4 #
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License version 2 as published by
7 # the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 # more details.
13 #
14 # You should have received a copy of the GNU General Public License along with
15 # this program. If not, see <http://www.gnu.org/licenses/>.
16 #
18 # Initialize Autoconf
19 AC_PREREQ([2.60])
20 AC_INIT([omapdrmtest], [1.0.0], [https://www.ti.com], [omapdrmtest])
21 AC_CONFIG_SRCDIR([Makefile.am])
22 AC_CONFIG_HEADERS([config.h])
24 # Initialize Automake
25 AM_INIT_AUTOMAKE([foreign dist-bzip2])
26 AM_MAINTAINER_MODE
28 # Enable quiet compiles on automake 1.11.
29 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
31 # Initialize libtool
32 AC_PROG_LIBTOOL
33 AC_PROG_CXX
35 # Obtain compiler/linker options for depedencies
36 PKG_CHECK_MODULES(DRM, libdrm libdrm_omap)
38 # Check for kernel headers
39 AC_CHECK_HEADER([linux/videodev2.h],
40 [HAVE_V4L2_DMABUF=yes],
41 [HAVE_V4L2_DMABUF=no],
42 [[#include <linux/videodev2.h>]])
44 if test "x$HAVE_V4L2_DMABUF" = "xyes"; then
45 AC_DEFINE(HAVE_V4L2_DMABUF, 1, [Have V4L2 DMABUF support])
46 AC_MSG_NOTICE([V4L2 DMABUF support detected, building V4L2 DMABUF tests])
47 else
48 AC_MSG_WARN([No V4L2 DMABUF support detected, disabling V4L2 DMABUF tests])
49 fi
50 AM_CONDITIONAL(ENABLE_V4L2_DMABUF, [test "x$HAVE_V4L2_DMABUF" = xyes])
52 # Check optional KMSCUBE:
53 AC_ARG_ENABLE([kmscube], AS_HELP_STRING([--disable-kmscube], [disable kmscube display support]))
54 AS_IF([test "x$enable_kmscube" != "xno"], [PKG_CHECK_EXISTS(gbm egl glesv2, [HAVE_KMSCUBE=yes], [HAVE_KMSCUBE=no])])
55 if test "x$HAVE_KMSCUBE" = "xyes"; then
56 AC_DEFINE(HAVE_KMSCUBE, 1, [Have KMSCUBE support])
57 PKG_CHECK_MODULES(GBM, gbm)
58 PKG_CHECK_MODULES(EGL, egl)
59 PKG_CHECK_MODULES(GLES2, glesv2)
60 else
61 AC_MSG_WARN([No KMSCUBE support detected, disabling KMSCUBE support])
62 fi
63 AM_CONDITIONAL(ENABLE_KMSCUBE, [test "x$HAVE_KMSCUBE" = xyes])
65 # Check optional WAYLAND:
66 AC_ARG_ENABLE([wayland], AS_HELP_STRING([--disable-wayland], [disable wayland display support]))
67 AS_IF([test "x$enable_wayland" != "xno"], [PKG_CHECK_EXISTS(wayland-egl wayland-cursor wayland-client, [HAVE_WAYLAND=yes], [HAVE_WAYLAND=no])])
68 if test "x$HAVE_WAYLAND" = "xyes"; then
69 AC_DEFINE(HAVE_WAYLAND, 1, [Have WAYLAND support])
70 PKG_CHECK_MODULES(EGL, egl)
71 PKG_CHECK_MODULES(WAYLAND, wayland-egl wayland-cursor wayland-client)
72 else
73 AC_MSG_WARN([No WAYLAND support detected, disabling WAYLAND support])
74 fi
75 AM_CONDITIONAL(ENABLE_WAYLAND, [test "x$HAVE_WAYLAND" = xyes])
77 # Check for libdce and libav..
78 PKG_CHECK_MODULES(DCE, libdce libavformat libavutil, [HAVE_DCE=yes], [HAVE_DCE=no])
79 if test "x$HAVE_DCE" = "xyes"; then
80 AC_DEFINE(HAVE_DCE, 1, [Have DCE support])
81 AC_MSG_NOTICE([Detected libdce and libavformat, building video codec tests])
82 else
83 AC_MSG_WARN([No libdce and/or libavformat support detected, disabling video codec tests])
84 fi
85 AM_CONDITIONAL(ENABLE_DCE, [test "x$HAVE_DCE" = xyes])
87 # Check for libdomx..
88 PKG_CHECK_MODULES(DOMX, libdomx, [HAVE_DOMX=yes], [HAVE_DOMX=no])
89 if test "x$HAVE_DOMX" = "xyes"; then
90 AC_DEFINE(HAVE_DOMX, 1, [Have DOMX support])
91 AC_MSG_NOTICE([Detected libdomx, building omx camera test])
92 else
93 AC_MSG_WARN([No libdomx support detected, disabling omx camera test])
94 fi
95 AM_CONDITIONAL(ENABLE_DOMX, [test "x$HAVE_DOMX" = xyes])
97 dnl ===========================================================================
98 dnl check compiler flags
99 AC_DEFUN([LIBDRM_CC_TRY_FLAG], [
100 AC_MSG_CHECKING([whether $CC supports $1])
102 libdrm_save_CFLAGS="$CFLAGS"
103 CFLAGS="$CFLAGS $1"
105 AC_COMPILE_IFELSE([ ], [libdrm_cc_flag=yes], [libdrm_cc_flag=no])
106 CFLAGS="$libdrm_save_CFLAGS"
108 if test "x$libdrm_cc_flag" = "xyes"; then
109 ifelse([$2], , :, [$2])
110 else
111 ifelse([$3], , :, [$3])
112 fi
113 AC_MSG_RESULT([$libdrm_cc_flag])
114 ])
116 MAYBE_WARN="-Wall -Wextra \
117 -Wsign-compare -Werror-implicit-function-declaration \
118 -Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
119 -Wnested-externs \
120 -Wpacked -Wswitch-enum -Wmissing-format-attribute \
121 -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
122 -Wdeclaration-after-statement -Wold-style-definition \
123 -Wno-missing-field-initializers -Wno-unused-parameter \
124 -Wno-attributes -Wno-long-long -Winline"
126 # invalidate cached value if MAYBE_WARN has changed
127 if test "x$libdrm_cv_warn_maybe" != "x$MAYBE_WARN"; then
128 unset libdrm_cv_warn_cflags
129 fi
130 AC_CACHE_CHECK([for supported warning flags], libdrm_cv_warn_cflags, [
131 echo
132 WARN_CFLAGS=""
134 # Some warning options are not supported by all versions of
135 # gcc, so test all desired options against the current
136 # compiler.
137 #
138 # Note that there are some order dependencies
139 # here. Specifically, an option that disables a warning will
140 # have no net effect if a later option then enables that
141 # warnings, (perhaps implicitly). So we put some grouped
142 # options (-Wall and -Wextra) up front and the -Wno options
143 # last.
145 for W in $MAYBE_WARN; do
146 LIBDRM_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"])
147 done
149 libdrm_cv_warn_cflags=$WARN_CFLAGS
150 libdrm_cv_warn_maybe=$MAYBE_WARN
152 AC_MSG_CHECKING([which warning flags were supported])])
153 WARN_CFLAGS="$libdrm_cv_warn_cflags"
154 AC_SUBST(WARN_CFLAGS)
157 AC_CONFIG_FILES([Makefile omx_cam/Makefile util/Makefile])
158 AC_OUTPUT