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
34 # Obtain compiler/linker options for depedencies
35 PKG_CHECK_MODULES(DRM, libdrm libdrm_omap)
37 # Check optional X11:
38 PKG_CHECK_MODULES(X11, x11 libdri2, [HAVE_X11=yes], [HAVE_X11=no])
40 if test "x$HAVE_X11" = "xyes"; then
41 AC_DEFINE(HAVE_X11, 1, [Have X11 support])
42 else
43 AC_MSG_WARN([No X11 support detected, disabling X11 support])
44 fi
45 AM_CONDITIONAL(ENABLE_X11, [test "x$HAVE_X11" = xyes])
48 dnl ===========================================================================
49 dnl check compiler flags
50 AC_DEFUN([LIBDRM_CC_TRY_FLAG], [
51 AC_MSG_CHECKING([whether $CC supports $1])
53 libdrm_save_CFLAGS="$CFLAGS"
54 CFLAGS="$CFLAGS $1"
56 AC_COMPILE_IFELSE([ ], [libdrm_cc_flag=yes], [libdrm_cc_flag=no])
57 CFLAGS="$libdrm_save_CFLAGS"
59 if test "x$libdrm_cc_flag" = "xyes"; then
60 ifelse([$2], , :, [$2])
61 else
62 ifelse([$3], , :, [$3])
63 fi
64 AC_MSG_RESULT([$libdrm_cc_flag])
65 ])
67 MAYBE_WARN="-Wall -Wextra \
68 -Wsign-compare -Werror-implicit-function-declaration \
69 -Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
70 -Wnested-externs \
71 -Wpacked -Wswitch-enum -Wmissing-format-attribute \
72 -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
73 -Wdeclaration-after-statement -Wold-style-definition \
74 -Wno-missing-field-initializers -Wno-unused-parameter \
75 -Wno-attributes -Wno-long-long -Winline"
77 # invalidate cached value if MAYBE_WARN has changed
78 if test "x$libdrm_cv_warn_maybe" != "x$MAYBE_WARN"; then
79 unset libdrm_cv_warn_cflags
80 fi
81 AC_CACHE_CHECK([for supported warning flags], libdrm_cv_warn_cflags, [
82 echo
83 WARN_CFLAGS=""
85 # Some warning options are not supported by all versions of
86 # gcc, so test all desired options against the current
87 # compiler.
88 #
89 # Note that there are some order dependencies
90 # here. Specifically, an option that disables a warning will
91 # have no net effect if a later option then enables that
92 # warnings, (perhaps implicitly). So we put some grouped
93 # options (-Wall and -Wextra) up front and the -Wno options
94 # last.
96 for W in $MAYBE_WARN; do
97 LIBDRM_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"])
98 done
100 libdrm_cv_warn_cflags=$WARN_CFLAGS
101 libdrm_cv_warn_maybe=$MAYBE_WARN
103 AC_MSG_CHECKING([which warning flags were supported])])
104 WARN_CFLAGS="$libdrm_cv_warn_cflags"
105 AC_SUBST(WARN_CFLAGS)
108 AC_CONFIG_FILES([Makefile util/Makefile])
109 AC_OUTPUT