2016-09-21 00:05:15 -07:00
|
|
|
AC_PREREQ([2.69])
|
2023-03-14 09:29:04 -07:00
|
|
|
AC_INIT([vkd3d],[1.7])
|
2016-09-21 00:05:15 -07:00
|
|
|
|
|
|
|
AC_CONFIG_AUX_DIR([bin])
|
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
|
|
|
AC_CONFIG_HEADERS(include/config.h)
|
|
|
|
|
2016-10-10 02:22:50 -07:00
|
|
|
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])
|
2020-09-28 06:30:17 -07:00
|
|
|
AC_ARG_WITH([ncurses], AS_HELP_STRING([--with-ncurses], [Build with the ncurses library (default: test)]))
|
2017-06-19 09:05:53 -07:00
|
|
|
AC_ARG_WITH([spirv-tools], AS_HELP_STRING([--with-spirv-tools],
|
|
|
|
[Build with SPIRV-Tools library (default: disabled)]))
|
2020-09-28 06:30:17 -07:00
|
|
|
AC_ARG_WITH([xcb], AS_HELP_STRING([--with-xcb], [Build with XCB library (default: test)]))
|
2019-01-31 02:29:31 -08:00
|
|
|
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])
|
2016-09-28 05:01:26 -07:00
|
|
|
|
2017-12-14 02:45:55 -08:00
|
|
|
AC_USE_SYSTEM_EXTENSIONS
|
|
|
|
|
2016-09-21 00:05:15 -07:00
|
|
|
dnl Check for progs
|
|
|
|
AM_PROG_AR
|
|
|
|
AC_PROG_CC
|
|
|
|
AM_PROG_CC_C_O
|
|
|
|
AC_PROG_SED
|
|
|
|
AC_PROG_MKDIR_P
|
2019-04-10 08:31:57 -07:00
|
|
|
VKD3D_PROG_WIDL(3, 20)
|
2016-10-28 04:15:47 -07:00
|
|
|
AS_IF([test "x$WIDL" = "xno"], [AC_MSG_WARN([widl is required to build header files.])])
|
2016-09-21 00:05:15 -07:00
|
|
|
|
2020-12-07 10:56:30 -08:00
|
|
|
AC_CHECK_PROGS([FLEX], [flex], [none])
|
|
|
|
AS_IF([test "$FLEX" = "none"], [AC_MSG_ERROR([no suitable flex found. Please install the 'flex' package.])])
|
2022-11-14 16:46:36 -08:00
|
|
|
AC_ARG_VAR([LFLAGS], [extra flags for flex])
|
2020-12-07 10:56:30 -08:00
|
|
|
|
|
|
|
AC_CHECK_PROGS([BISON], [bison], [none])
|
|
|
|
AS_IF([test "$BISON" = "none"], [AC_MSG_ERROR([no suitable bison found. Please install the 'bison' package.])])
|
2022-11-14 16:46:36 -08:00
|
|
|
AC_ARG_VAR([YFLAGS], [extra flags for bison])
|
2020-12-07 10:56:30 -08:00
|
|
|
|
2020-09-01 08:32:29 -07:00
|
|
|
DX_PS_FEATURE([OFF])
|
|
|
|
DX_INIT_DOXYGEN([vkd3d], [Doxyfile], [doc])
|
|
|
|
AC_CONFIG_FILES([Doxyfile])
|
|
|
|
|
2016-10-17 03:08:35 -07:00
|
|
|
AM_INIT_AUTOMAKE([1.11 foreign silent-rules subdir-objects no-dist-gzip dist-xz -Wall -Werror])
|
2016-09-21 00:05:15 -07:00
|
|
|
AM_MAINTAINER_MODE([enable])
|
2016-09-27 03:07:54 -07:00
|
|
|
AM_SILENT_RULES([yes])
|
2016-09-21 00:05:15 -07:00
|
|
|
|
|
|
|
LT_PREREQ([2.4.2])
|
2019-01-31 02:29:30 -08:00
|
|
|
LT_INIT([win32-dll])
|
2016-09-21 00:05:15 -07:00
|
|
|
|
2018-01-15 04:49:01 -08:00
|
|
|
gl_LD_VERSION_SCRIPT
|
|
|
|
|
2016-09-21 00:05:15 -07:00
|
|
|
dnl Check compiler specific flags
|
2017-12-14 02:45:55 -08:00
|
|
|
AC_SUBST([VKD3D_CFLAGS])
|
2016-09-28 02:45:46 -07:00
|
|
|
AS_IF([test "x${GCC}" = "xyes"],
|
|
|
|
[VKD3D_CFLAGS="-Wall -pipe"
|
|
|
|
VKD3D_CHECK_CFLAGS([-std=c99])
|
2021-08-08 23:11:49 -07:00
|
|
|
VKD3D_CHECK_CFLAGS([-fvisibility=hidden])
|
2016-09-28 02:45:46 -07:00
|
|
|
VKD3D_CHECK_CFLAGS([-Wdeclaration-after-statement])
|
2019-08-05 09:03:38 -07:00
|
|
|
VKD3D_CHECK_CFLAGS([-Wimplicit-fallthrough])
|
2021-03-11 14:27:34 -08:00
|
|
|
VKD3D_CHECK_CFLAGS([-Winit-self])
|
2016-09-28 02:45:46 -07:00
|
|
|
VKD3D_CHECK_CFLAGS([-Wmissing-prototypes])
|
|
|
|
VKD3D_CHECK_CFLAGS([-Wunused-but-set-parameter])
|
2016-11-04 06:01:25 -07:00
|
|
|
VKD3D_CHECK_CFLAGS([-Wvla])
|
2019-10-01 09:52:53 -07:00
|
|
|
VKD3D_CHECK_CFLAGS([-Wpointer-arith])
|
2016-11-04 06:01:25 -07:00
|
|
|
VKD3D_CHECK_CFLAGS([-Wl,--no-undefined])])
|
2016-09-21 00:05:15 -07:00
|
|
|
|
2016-10-10 02:22:50 -07:00
|
|
|
dnl Check for cross compilers
|
2016-10-10 02:22:50 -07:00
|
|
|
VKD3D_CHECK_MINGW32_PROG([CROSSCC32], [CROSSTARGET32], [no])
|
|
|
|
VKD3D_CHECK_MINGW64_PROG([CROSSCC64], [CROSSTARGET64], [no])
|
2016-10-10 02:22:50 -07:00
|
|
|
|
2016-09-22 07:56:58 -07:00
|
|
|
dnl Check for headers
|
2022-02-07 04:55:43 -08:00
|
|
|
AC_CHECK_HEADERS([dlfcn.h \
|
2019-03-19 06:41:03 -07:00
|
|
|
vulkan/vulkan.h \
|
2018-04-16 03:16:23 -07:00
|
|
|
vulkan/spirv.h vulkan/GLSL.std.450.h \
|
|
|
|
spirv/unified1/spirv.h spirv/unified1/GLSL.std.450.h])
|
2016-10-05 06:56:27 -07:00
|
|
|
AS_IF([test "x$ac_cv_header_vulkan_vulkan_h" != "xyes"], [AC_MSG_ERROR([vulkan.h not found.])])
|
2018-04-16 03:16:23 -07:00
|
|
|
AS_IF([test "x$ac_cv_header_spirv_unified1_spirv_h" != "xyes" \
|
|
|
|
-a "x$ac_cv_header_vulkan_spirv_h" != "xyes"],
|
|
|
|
[AC_MSG_ERROR([spirv.h not found.])])
|
|
|
|
AS_IF([test "x$ac_cv_header_spirv_unified1_GLSL_std_450_h" != "xyes" \
|
|
|
|
-a "x$ac_cv_header_vulkan_GLSL_std_450_h" != "xyes"],
|
|
|
|
[AC_MSG_ERROR([GLSL.std.450.h not found.])])
|
2016-09-22 07:56:58 -07:00
|
|
|
|
2022-03-23 21:36:09 -07:00
|
|
|
VKD3D_CHECK_VULKAN_HEADER_VERSION([139], [AC_MSG_ERROR([Vulkan headers are too old, 1.2.139 is required.])])
|
2018-10-29 03:12:14 -07:00
|
|
|
|
2019-07-05 22:36:33 -07:00
|
|
|
AC_CHECK_DECL([SpvCapabilityDemoteToHelperInvocationEXT],, [AC_MSG_ERROR([SPIR-V headers are too old.])], [
|
|
|
|
#ifdef HAVE_SPIRV_UNIFIED1_SPIRV_H
|
|
|
|
# include "spirv/unified1/spirv.h"
|
|
|
|
#else
|
|
|
|
# include "vulkan/spirv.h"
|
|
|
|
#endif])
|
|
|
|
|
2019-11-14 15:17:57 -08:00
|
|
|
AC_CHECK_DECLS([program_invocation_name],,,[#include <errno.h>])
|
|
|
|
|
2016-09-22 07:56:58 -07:00
|
|
|
dnl Check for libraries
|
2016-11-03 04:40:54 -07:00
|
|
|
m4_ifdef([PKG_PROG_PKG_CONFIG], [PKG_PROG_PKG_CONFIG], [m4_fatal([pkg-config autoconf macros not found.])])
|
|
|
|
|
2017-06-19 09:05:53 -07:00
|
|
|
AC_CHECK_LIB([m], [ceilf])
|
|
|
|
|
2019-03-19 06:41:05 -07:00
|
|
|
AC_SUBST([DL_LIBS])
|
2018-01-17 03:48:14 -08:00
|
|
|
AC_CHECK_LIB([dl], [dlopen],
|
2019-03-19 06:41:05 -07:00
|
|
|
[DL_LIBS="-ldl"],
|
2019-03-19 06:41:03 -07:00
|
|
|
[AS_IF([test "$ac_cv_header_dlfnc_h" = "xyes"], [AC_MSG_ERROR([libdl not found.])])])
|
2018-01-17 03:48:14 -08:00
|
|
|
|
2022-02-07 04:55:43 -08:00
|
|
|
case $host_os in
|
|
|
|
mingw32*) ;;
|
|
|
|
*) AC_CHECK_HEADERS([pthread.h])
|
|
|
|
AS_IF([test "x$ac_cv_header_pthread_h" != "xyes"], [AC_MSG_ERROR([pthread.h not found.])])
|
|
|
|
AC_ARG_VAR([PTHREAD_LIBS], [linker flags for pthreads])
|
|
|
|
VKD3D_CHECK_PTHREAD
|
|
|
|
VKD3D_CHECK_PTHREAD_SETNAME_NP
|
|
|
|
;;
|
|
|
|
esac
|
2016-10-05 06:56:27 -07:00
|
|
|
|
2022-04-22 13:18:01 -07:00
|
|
|
AC_ARG_VAR([SONAME_LIBVULKAN], [shared object name for the Vulkan library])
|
2022-04-27 09:26:06 -07:00
|
|
|
AC_ARG_VAR([VULKAN_LIBS], [linker flags for the Vulkan library])
|
2022-04-22 13:18:01 -07:00
|
|
|
AS_IF([test "x$SONAME_LIBVULKAN" = "x"],
|
|
|
|
[VKD3D_CHECK_VULKAN],
|
|
|
|
[AC_DEFINE_UNQUOTED([SONAME_LIBVULKAN],["$SONAME_LIBVULKAN"],[Define to the shared object name of the Vulkan library.])])
|
2016-09-22 07:56:58 -07:00
|
|
|
|
2020-09-28 06:30:17 -07:00
|
|
|
AS_IF([test "x$with_ncurses" != "xno"],
|
|
|
|
[PKG_CHECK_MODULES([NCURSES], [ncurses],
|
|
|
|
[AC_DEFINE([HAVE_NCURSES], [1], [Define to 1 if you have ncurses.]) with_ncurses=yes],
|
|
|
|
[with_ncurses=no])])
|
2017-06-19 09:05:53 -07:00
|
|
|
AS_IF([test "x$with_spirv_tools" = "xyes"],
|
2018-02-07 12:27:11 -08:00
|
|
|
[PKG_CHECK_MODULES([SPIRV_TOOLS], [SPIRV-Tools-shared],
|
2018-08-21 09:08:03 -07:00
|
|
|
[AC_DEFINE([HAVE_SPIRV_TOOLS], [1], [Define to 1 if you have SPIRV-Tools.])])],
|
|
|
|
[with_spirv_tools=no])
|
2017-06-19 09:05:53 -07:00
|
|
|
|
2018-08-21 09:08:03 -07:00
|
|
|
HAVE_XCB=no
|
|
|
|
AS_IF([test "x$with_xcb" != "xno"],
|
2022-04-01 14:01:10 -07:00
|
|
|
[PKG_CHECK_MODULES([XCB], [xcb xcb-event xcb-icccm xcb-keysyms],
|
2018-08-21 09:08:03 -07:00
|
|
|
[AC_DEFINE([HAVE_XCB], [1], [Define to 1 if you have libxcb.])
|
|
|
|
HAVE_XCB=yes],
|
|
|
|
[HAVE_XCB=no])])
|
2016-11-03 04:40:54 -07:00
|
|
|
|
2016-09-28 03:20:11 -07:00
|
|
|
dnl Check for functions
|
2018-01-11 08:03:45 -08:00
|
|
|
VKD3D_CHECK_FUNC([HAVE_BUILTIN_CLZ], [__builtin_clz], [__builtin_clz(0)])
|
|
|
|
VKD3D_CHECK_FUNC([HAVE_BUILTIN_POPCOUNT], [__builtin_popcount], [__builtin_popcount(0)])
|
2021-07-26 13:51:28 -07:00
|
|
|
VKD3D_CHECK_FUNC([HAVE_BUILTIN_ADD_OVERFLOW], [__builtin_add_overflow], [__builtin_add_overflow(0, 0, (int *)0)])
|
2018-01-11 08:03:45 -08:00
|
|
|
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)])
|
2016-09-21 03:57:24 -07:00
|
|
|
|
2018-08-21 09:08:03 -07:00
|
|
|
dnl Makefiles
|
2022-02-23 08:27:30 -08:00
|
|
|
case $host_os in
|
|
|
|
mingw32*)
|
|
|
|
AC_SUBST([DEMO_LIBS],["-ld3d12 -ldxgi -lgdi32"])
|
2022-02-23 08:28:11 -08:00
|
|
|
AC_SUBST([DEMO_CFLAGS],["-municode"])
|
2022-02-23 08:27:30 -08:00
|
|
|
;;
|
|
|
|
*) AS_IF([test "x$enable_demos" = "xyes" -a "x$HAVE_XCB" != "xyes"],
|
2018-08-21 09:08:03 -07:00
|
|
|
[AC_MSG_ERROR([libxcb is required for demos.])])
|
2022-02-23 08:27:30 -08:00
|
|
|
AC_SUBST([DEMO_LIBS],[$XCB_LIBS])
|
|
|
|
AC_SUBST([DEMO_CFLAGS],[$XCB_CFLAGS])
|
|
|
|
;;
|
|
|
|
esac
|
2018-08-15 09:13:31 -07:00
|
|
|
AM_CONDITIONAL([BUILD_DEMOS], [test "x$enable_demos" = "xyes"])
|
2020-09-01 08:32:29 -07:00
|
|
|
AM_CONDITIONAL([BUILD_DOC], [test $DX_FLAG_doc = 1])
|
2019-01-31 02:29:31 -08:00
|
|
|
AM_CONDITIONAL([BUILD_TESTS], [test "x$enable_tests" != "xno"])
|
2018-04-13 03:37:43 -07:00
|
|
|
AM_CONDITIONAL([HAVE_WIDL], [test "x$WIDL" != "xno"])
|
|
|
|
AM_CONDITIONAL([HAVE_CROSSTARGET32], [test "x$CROSSTARGET32" != "xno"])
|
|
|
|
AM_CONDITIONAL([HAVE_CROSSTARGET64], [test "x$CROSSTARGET64" != "xno"])
|
2016-09-21 03:57:24 -07:00
|
|
|
|
2016-09-21 00:05:15 -07:00
|
|
|
AC_CONFIG_FILES([Makefile])
|
|
|
|
AC_OUTPUT
|
2016-09-21 03:57:24 -07:00
|
|
|
|
2016-10-10 02:22:50 -07:00
|
|
|
dnl Output configuration summary
|
2016-10-10 02:22:50 -07:00
|
|
|
AS_IF([test "x$CROSSTARGET32" != "xno" -o "x$CROSSTARGET64" != "xno"],
|
2022-04-01 14:01:11 -07:00
|
|
|
[HAVE_CROSSTARGET=yes], [HAVE_CROSSTARGET=no])
|
2020-09-18 07:46:55 -07:00
|
|
|
AS_IF([test $DX_FLAG_doc = 1], [HAVE_DOCS=yes], [HAVE_DOCS=no])
|
2016-10-10 02:22:50 -07:00
|
|
|
|
2022-04-01 14:01:13 -07:00
|
|
|
AS_IF([test "x$enable_demos" != "xyes" -a "x$enable_tests" = "xno"], [CROSSTARGET64=no CROSSTARGET32=no])
|
|
|
|
|
2016-10-10 02:22:50 -07:00
|
|
|
AS_ECHO(["
|
|
|
|
Configuration summary for $PACKAGE $VERSION
|
|
|
|
|
2019-04-15 01:13:55 -07:00
|
|
|
widl: ${WIDL}
|
|
|
|
|
2020-09-28 06:30:17 -07:00
|
|
|
Have ncurses: ${with_ncurses}
|
2018-08-21 09:08:03 -07:00
|
|
|
Have SPIRV-Tools: ${with_spirv_tools}
|
2020-09-28 06:30:17 -07:00
|
|
|
Have xcb: ${HAVE_XCB}
|
2017-06-19 09:05:53 -07:00
|
|
|
|
2018-08-17 00:56:56 -07:00
|
|
|
Building demos: ${enable_demos}
|
2019-01-31 02:29:31 -08:00
|
|
|
Building tests: ${enable_tests}
|
2020-09-18 07:46:55 -07:00
|
|
|
Building documentation: ${HAVE_DOCS}
|
2022-04-01 14:01:11 -07:00
|
|
|
"])
|
2018-08-17 00:56:56 -07:00
|
|
|
|
2022-04-01 14:01:11 -07:00
|
|
|
AS_IF([test "x$enable_demos" = "xyes"], [AS_ECHO([" Cross-compiling demos: ${HAVE_CROSSTARGET}"])])
|
2022-04-01 14:01:13 -07:00
|
|
|
AS_IF([test "x$enable_tests" != "xno"], [AS_ECHO([" Cross-compiling tests: ${HAVE_CROSSTARGET}"])])
|
2016-10-10 02:22:50 -07:00
|
|
|
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"])])
|
2016-10-10 02:22:50 -07:00
|
|
|
AS_ECHO([])
|