forked from HansKristian-Work/vkd3d-proton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
133 lines (105 loc) · 4.89 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
AC_PREREQ([2.69])
AC_INIT([vkd3d],[1.1])
AC_CONFIG_AUX_DIR([bin])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS(include/config.h)
AC_ARG_VAR([WIDL], [widl IDL compiler])
AC_ARG_VAR([CROSSCC32], [32-bit Windows cross compiler])
AC_ARG_VAR([CROSSCC64], [64-bit Windows cross compiler])
AC_ARG_WITH([xcb], AS_HELP_STRING([--with-xcb], [Build with XCB library (default: test)]))
AC_ARG_WITH([dxil-spirv], AS_HELP_STRING([--with-dxil-spirv],
[Build with dxil-spirv library for DXIL support (default: enabled)]))
AC_ARG_ENABLE([demos],
AS_HELP_STRING([--enable-demos], [Build demo programs (default: disabled)]),,
[enable_demos=no])
AC_ARG_ENABLE([tests],
AS_HELP_STRING([--enable-tests], [Build tests (default: enabled)]),,
[enable_tests=yes])
AC_USE_SYSTEM_EXTENSIONS
dnl Check for progs
AM_PROG_AR
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_SED
AC_PROG_MKDIR_P
VKD3D_PROG_WIDL(3, 20)
AS_IF([test "x$WIDL" = "xno"], [AC_MSG_WARN([widl is required to build header files.])])
AM_INIT_AUTOMAKE([1.11 foreign silent-rules subdir-objects no-dist-gzip dist-xz -Wall -Werror])
AM_MAINTAINER_MODE([enable])
AM_SILENT_RULES([yes])
LT_PREREQ([2.4.2])
LT_INIT([win32-dll])
gl_LD_VERSION_SCRIPT
dnl Check compiler specific flags
AC_SUBST([VKD3D_CFLAGS])
AS_IF([test "x${GCC}" = "xyes"],
[VKD3D_CFLAGS="-Wall -pipe"
VKD3D_CHECK_CFLAGS([-std=c99])
VKD3D_CHECK_CFLAGS([-Wdeclaration-after-statement])
VKD3D_CHECK_CFLAGS([-Wimplicit-fallthrough])
VKD3D_CHECK_CFLAGS([-Wmissing-prototypes])
VKD3D_CHECK_CFLAGS([-Wunused-but-set-parameter])
VKD3D_CHECK_CFLAGS([-Wvla])
VKD3D_CHECK_CFLAGS([-Wpointer-arith])
VKD3D_CHECK_CFLAGS([-Wl,--no-undefined])])
dnl Check for cross compilers
VKD3D_CHECK_MINGW32_PROG([CROSSCC32], [CROSSTARGET32], [no])
VKD3D_CHECK_MINGW64_PROG([CROSSCC64], [CROSSTARGET64], [no])
dnl Check for headers
AC_CHECK_HEADERS([dlfcn.h pthread.h])
AS_IF([test "x$ac_cv_header_pthread_h" != "xyes"], [AC_MSG_ERROR([pthread.h not found.])])
VKD3D_CHECK_VULKAN_HEADER_VERSION([140], [AC_MSG_ERROR([Vulkan headers are too old, 1.2.140 is required.])])
AC_CHECK_DECLS([program_invocation_name],,,[#include <errno.h>])
dnl Check for libraries
m4_ifdef([PKG_PROG_PKG_CONFIG], [PKG_PROG_PKG_CONFIG], [m4_fatal([pkg-config autoconf macros not found.])])
AC_CHECK_LIB([m], [ceilf])
AC_SUBST([DL_LIBS])
AC_CHECK_LIB([dl], [dlopen],
[DL_LIBS="-ldl"],
[AS_IF([test "$ac_cv_header_dlfnc_h" = "xyes"], [AC_MSG_ERROR([libdl not found.])])])
AC_ARG_VAR([PTHREAD_LIBS], [linker flags for pthreads])
VKD3D_CHECK_PTHREAD
HAVE_XCB=no
AS_IF([test "x$with_xcb" != "xno"],
[PKG_CHECK_MODULES([XCB], [xcb xcb-keysyms],
[AC_DEFINE([HAVE_XCB], [1], [Define to 1 if you have libxcb.])
HAVE_XCB=yes],
[HAVE_XCB=no])])
HAVE_DXIL_SPV=no
AS_IF([test "x$with_dxil_spirv" != "xno"],
[PKG_CHECK_MODULES([dxil_spirv_c_shared], [dxil-spirv-c-shared],
[AC_DEFINE([HAVE_DXIL_SPV], [1], [Define to 1 if you have dxil-spirv.])
HAVE_DXIL_SPV=yes], [HAVE_DXIL_SPV=no])],
[HAVE_DXIL_SPV=no])
dnl Check for functions
VKD3D_CHECK_FUNC([HAVE_BUILTIN_CLZ], [__builtin_clz], [__builtin_clz(0)])
VKD3D_CHECK_FUNC([HAVE_BUILTIN_CTZLL], [__builtin_ctzll], [__builtin_ctzll(0)])
VKD3D_CHECK_FUNC([HAVE_BUILTIN_POPCOUNT], [__builtin_popcount], [__builtin_popcount(0)])
VKD3D_CHECK_FUNC([HAVE_SYNC_ADD_AND_FETCH], [__sync_add_and_fetch], [__sync_add_and_fetch((int *)0, 0)])
VKD3D_CHECK_FUNC([HAVE_SYNC_SUB_AND_FETCH], [__sync_sub_and_fetch], [__sync_sub_and_fetch((int *)0, 0)])
VKD3D_CHECK_PTHREAD_SETNAME_NP
dnl Makefiles
AS_IF([test "x$enable_demos" = "xyes" -a "x$HAVE_XCB" != "xyes"],
[AC_MSG_ERROR([libxcb is required for demos.])])
AM_CONDITIONAL([BUILD_DEMOS], [test "x$enable_demos" = "xyes"])
AM_CONDITIONAL([BUILD_TESTS], [test "x$enable_tests" != "xno"])
AM_CONDITIONAL([HAVE_WIDL], [test "x$WIDL" != "xno"])
AM_CONDITIONAL([HAVE_CROSSTARGET32], [test "x$CROSSTARGET32" != "xno"])
AM_CONDITIONAL([HAVE_CROSSTARGET64], [test "x$CROSSTARGET64" != "xno"])
AM_CONDITIONAL([HAVE_DXIL_SPV], [test "x$HAVE_DXIL_SPV" = "xyes"])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
dnl Output configuration summary
AS_IF([test "x$CROSSTARGET32" != "xno" -o "x$CROSSTARGET64" != "xno"],
[HAVE_CROSSTEST=yes], [HAVE_CROSSTEST=no])
AS_ECHO(["
Configuration summary for $PACKAGE $VERSION
widl: ${WIDL}
Have XCB: ${HAVE_XCB}
Have dxil-spirv: ${HAVE_DXIL_SPV}
Building demos: ${enable_demos}
Building tests: ${enable_tests}
Building crosstests: ${HAVE_CROSSTEST}"])
AS_IF([test "x$CROSSTARGET32" != "xno"], [AS_ECHO([" Using 32-bit cross compiler: $CROSSCC32"])])
AS_IF([test "x$CROSSTARGET64" != "xno"], [AS_ECHO([" Using 64-bit cross compiler: $CROSSCC64"])])
AS_ECHO([])