1 #
2 # Copyright (c) 2012 Rob Clark <rob@ti.com>
3 #
4 # Permission is hereby granted, free of charge, to any person obtaining a
5 # copy of this software and associated documentation files (the "Software"),
6 # to deal in the Software without restriction, including without limitation
7 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 # and/or sell copies of the Software, and to permit persons to whom the
9 # Software is furnished to do so, subject to the following conditions:
10 #
11 # The above copyright notice and this permission notice (including the next
12 # paragraph) shall be included in all copies or substantial portions of the
13 # Software.
14 #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 # SOFTWARE.
22 #
24 # Initialize Autoconf
25 AC_PREREQ([2.60])
26 AC_INIT([kmscube], [0.0.1], [https://github.com/robclark/kmscube/], [kmscube])
27 AC_CONFIG_SRCDIR([Makefile.am])
28 AC_CONFIG_HEADERS([config.h])
29 AC_CONFIG_AUX_DIR([build-aux])
30 AC_CONFIG_MACRO_DIR([m4])
32 # Initialize Automake
33 AM_INIT_AUTOMAKE([foreign dist-bzip2])
34 AM_MAINTAINER_MODE
36 # Enable quiet compiles on automake 1.11.
37 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
39 # Initialize libtool
40 AC_PROG_LIBTOOL
42 # Obtain compiler/linker options for depedencies
43 PKG_CHECK_MODULES(DRM, libdrm)
44 PKG_CHECK_MODULES(GBM, gbm)
45 PKG_CHECK_MODULES(EGL, egl)
46 PKG_CHECK_MODULES(GLES2, glesv2)
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([AC_LANG_PROGRAM([[]],[[]])],
57 [libdrm_cc_flag=yes],
58 [libdrm_cc_flag=no])
59 CFLAGS="$libdrm_save_CFLAGS"
61 if test "x$libdrm_cc_flag" = "xyes"; then
62 ifelse([$2], , :, [$2])
63 else
64 ifelse([$3], , :, [$3])
65 fi
66 AC_MSG_RESULT([$libdrm_cc_flag])
67 ])
69 MAYBE_WARN="-Wall -Wextra -Wno-packed-bitfield-compat \
70 -Wsign-compare -Werror-implicit-function-declaration \
71 -Wpointer-arith -Wwrite-strings -Wstrict-prototypes \
72 -Wnested-externs \
73 -Wpacked -Wswitch-enum -Wmissing-format-attribute \
74 -Wstrict-aliasing=2 -Winit-self -Wunsafe-loop-optimizations \
75 -Wdeclaration-after-statement -Wold-style-definition \
76 -Wno-missing-field-initializers -Wno-unused-parameter \
77 -Wno-attributes -Wno-long-long -Winline"
79 AC_MSG_CHECKING([which warning flags were supported])
80 for W in $MAYBE_WARN; do
81 LIBDRM_CC_TRY_FLAG([$W], [WARN_CFLAGS="$WARN_CFLAGS $W"])
82 done
84 AC_SUBST(WARN_CFLAGS)
86 AC_CONFIG_FILES([Makefile])
87 AC_OUTPUT