2 # Copyright (c) 2016 Intel Corporation
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
17 AC_INIT([intel-hw-composer],
19 [https://github.com/android-ia/hwcomposer],
22 AC_CONFIG_SRCDIR([Makefile.am])
23 AC_CONFIG_HEADERS([config.h])
24 AC_CONFIG_MACRO_DIR([m4])
25 AC_USE_SYSTEM_EXTENSIONS
31 AM_INIT_AUTOMAKE([1.12 foreign subdir-objects dist-bzip2])
32 AM_PATH_PYTHON([3],, [:])
43 AC_SUBST(ASSEMBLER_WARN_CFLAGS)
45 # For splash screen dummy compositor
46 AC_ARG_ENABLE(dummy-compositor,
47 AS_HELP_STRING([--enable-dummy-compositor],
48 [Enable the dummy compositor (EXPERIMENTAL)]),
49 [if test x$enableval = xyes; then
50 enable_dummy_compositor=yes
51 AC_DEFINE(ENABLE_DUMMY_COMPOSITOR, 1, [Enable Dummy_Compositor])
54 AM_CONDITIONAL([ENABLE_DUMMY_COMPOSITOR], [test "x$enable_dummy_compositor" = "xyes"])
58 AS_HELP_STRING([--enable-vulkan],
59 [Enable Vulkan backend (EXPERIMENTAL)]),
60 [if test x$enableval = xyes; then
62 AC_DEFINE(ENABLE_VULKAN, 1, [Enable Vulkan backend])
65 AM_CONDITIONAL([ENABLE_VULKAN], [test "x$enable_vulkan" = "xyes"])
68 AC_DEFINE(ENABLE_PREBUILT_SHADER_BIN_ARRAY, 0, [Enable built-in prebuilt shader array])
70 AC_ARG_WITH([prebuilt-shader-pci-id],
71 [AS_HELP_STRING([--with-prebuilt-shader-pci-id@<:@=PCI ID in hex@:>@],
72 [PCI-ID of target GPU is required for using built-in pre-built shaders, e.g.
73 "0x0412" @<:@default=no@:>@])],
74 [prebuilt_shader_pci_id="$withval"],
75 [prebuilt_shader_pci_id=no])
77 # check if shader-db exist
78 SHADERDB_PATH=common/compositor/gl/gl_shader_pre_built/shader-db
80 if test "x$prebuilt_shader_pci_id" != "xno"; then
81 SHADERDB_PATH=common/compositor/gl/gl_shader_pre_built/shader-db
82 AC_CHECK_FILES([$SHADERDB_PATH $SHADERDB_PATH/run
83 $SHADERDB_PATH/intel_stub.so],
84 shaderdb=yes, shaderdb=no)
85 if test "x$shaderdb" = "xyes"; then
86 PREBUILT_SHADER_FOR_PCI_ID="$withval"
87 AC_SUBST([PREBUILT_SHADER_FOR_PCI_ID])
89 prebuilt_shader_pci_id=no
90 AC_MSG_WARN([shader-db is not found at ($SHADERDB_PATH), ignoring prebuilt shaders])
94 AM_CONDITIONAL(ENABLE_PREBUILT_SHADER_BIN_ARRAY, test "x$prebuilt_shader_pci_id" != "xno")
97 AC_ARG_ENABLE(linux-frontend,
98 AS_HELP_STRING([--enable-linux-frontend],
99 [Compile linux frontend (EXPERIMENTAL) @<:@default=no@:>@]),
100 [enable_linux_frontend="$enableval"],
101 [enable_linux_frontend=no])
103 AM_CONDITIONAL([ENABLE_LINUX_FRONTEND], [test "x$enable_linux_frontend" = "xyes"])
106 AC_ARG_ENABLE(hotplug-support,
107 AS_HELP_STRING([--disable-hotplug-support],
108 [Disable Hot Plug Support.]),
109 [if test x$enableval = xyes; then
110 disable_hotplug_support=yes
111 AC_DEFINE(DISABLE_HOTPLUG_SUPPORT, 1, [Disable Hot Plug Support])
114 AM_CONDITIONAL(DISABLE_HOTPLUG_SUPPORT, test "x$disable_hotplug_support" = "xyes")
116 if test "x$disable_hotplug_support" = "xyes"; then
117 AC_MSG_RESULT([Hot Plug support is disabled.])
119 AC_MSG_RESULT([Hot Plug support is enabled.])
123 AC_CONFIG_HEADER(tests/third_party/json-c/json_config.h)
124 AC_ARG_ENABLE(rdrand,
125 AS_HELP_STRING([--enable-rdrand],
126 [Enable RDRAND Hardware RNG Hash Seed generation on supported x86/x64 platforms.]),
127 [if test x$enableval = xyes; then
129 AC_DEFINE(ENABLE_RDRAND, 1, [Enable RDRANR Hardware RNG Hash Seed])
132 if test "x$enable_rdrand" = "xyes"; then
133 AC_MSG_RESULT([RDRAND Hardware RNG Hash Seed enabled on supported x86/x64 platforms])
135 AC_MSG_RESULT([RDRAND Hardware RNG Hash Seed disabled. Use --enable-rdrand to enable])
142 AC_CHECK_HEADERS(fcntl.h limits.h strings.h syslog.h unistd.h [sys/cdefs.h] [sys/param.h] stdarg.h locale.h xlocale.h endian.h)
143 AC_CHECK_HEADER(inttypes.h,[AC_DEFINE([JSON_C_HAVE_INTTYPES_H],[1],[Public define for json_inttypes.h])])
149 AC_CHECK_FUNCS([realloc])
150 AC_CHECK_FUNCS(strcasecmp strdup strerror snprintf vsnprintf vasprintf open vsyslog strncasecmp setlocale uselocale)
151 AC_CHECK_DECLS([INFINITY], [], [], [[#include <math.h>]])
152 AC_CHECK_DECLS([nan], [], [], [[#include <math.h>]])
153 AC_CHECK_DECLS([isnan], [], [], [[#include <math.h>]])
154 AC_CHECK_DECLS([isinf], [], [], [[#include <math.h>]])
155 AC_CHECK_DECLS([_isnan], [], [], [[#include <float.h>]])
156 AC_CHECK_DECLS([_finite], [], [], [[#include <float.h>]])
158 if test "$ac_cv_have_decl_isnan" = "yes" ; then
159 AC_TRY_LINK([#include <math.h>], [float f = 0.0; return isnan(f)], [], [LIBS="$LIBS -lm"])
164 AC_MSG_CHECKING([if .gnu.warning accepts long strings])
165 AC_LINK_IFELSE([AC_LANG_SOURCE([[
166 extern void json_object_get();
167 __asm__(".section .gnu.json_object_get,\n\t.ascii \"Please link against libjson-c instead of libjson\"\n\t.text");
169 int main(int c,char* v) {return 0;}
171 AC_DEFINE(HAS_GNU_WARNING_LONG, 1, [Define if .gnu.warning accepts long strings.])
179 AC_ARG_ENABLE([Bsymbolic],
180 [AS_HELP_STRING([--disable-Bsymbolic], [Avoid linking with -Bsymbolic-function])],
182 [enable_Bsymbolic=check])
184 AS_IF([test "x$enable_Bsymbolic" = "xcheck"],
186 saved_LDFLAGS="${LDFLAGS}"
187 AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
188 LDFLAGS=-Wl,-Bsymbolic-functions
189 AC_TRY_LINK([], [int main (void) { return 0; }],
198 LDFLAGS="${saved_LDFLAGS}"
201 AS_IF([test "x$enable_Bsymbolic" = "xyes"], [JSON_BSYMBOLIC_LDFLAGS=-Wl[,]-Bsymbolic-functions])
202 AC_SUBST(JSON_BSYMBOLIC_LDFLAGS)
204 AX_APPEND_COMPILE_FLAGS([-Wall -Wcast-qual -Wno-error=deprecated-declarations])
205 AX_APPEND_COMPILE_FLAGS([-Wextra -Wwrite-string -Wno-unused-parameter])
206 AX_APPEND_COMPILE_FLAGS([-D_GNU_SOURCE -D_REENTRANT])
208 AX_COMPILE_CHECK_SIZEOF(int)
209 AX_COMPILE_CHECK_SIZEOF(long)
210 AX_COMPILE_CHECK_SIZEOF(long long)
211 AX_COMPILE_CHECK_SIZEOF(size_t, [#include <stdint.h>])
213 #######################################################################
215 PKG_CHECK_MODULES(DRM, [libdrm])
216 PKG_CHECK_MODULES(GBM, [gbm])
217 PKG_CHECK_MODULES(EGL, [egl])
218 PKG_CHECK_MODULES(GLES2, [glesv2])
219 PKG_CHECK_MODULES(LIBVA, [libva])
220 PKG_CHECK_MODULES(LIBVA_DRM, [libva-drm])
222 AC_ARG_ENABLE(git-hash,
223 AS_HELP_STRING([--disable-git-hash],
224 [Do not use git hash in version]),
225 [git_hash=$enableval], [git_hash=yes])
226 AC_SUBST(GIT_HASH, [$git_hash])
232 tests/third_party/json-c/Makefile
238 echo -e """\nEnabled options """
241 Dummy compositor $enable_dummy_compositor
242 Vulkan $enable_vulkan
243 Linux frontend $enable_linux_frontend
244 Hotplug Support $disable_hotplug_support
245 Prebuilt Shader Target PCI-ID($prebuilt_shader_pci_id)
248 # Test both compositors aren't enabled.
249 if [[ ! -z $enable_dummy_compositor ]] && [[ ! -z $enable_vulkan ]];
251 if test $enable_dummy_compositor = yes && test $enable_vulkan = yes; then
253 echo -e "\tOnly up to one compositor may be enabled at a time." 1>&2