-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconfigure.ac
72 lines (57 loc) · 2.52 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
AC_PREREQ([2.69])
AC_INIT([Vulkan Tutorials], [0.1], [https://github.com/ShabbyX/vktut/issues])
AC_CONFIG_AUX_DIR([bin])
AC_CONFIG_MACRO_DIR([m4])
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE([1.14 subdir-objects -Wall -Wno-portability -Werror foreign])
AC_CONFIG_SRCDIR([tut1/main.c])
AC_CONFIG_HEADERS([config.h])
# Checks for programs
AC_PROG_CC_C99
AC_PROG_INSTALL
AM_PROG_AR
LT_INIT
# Make sure C99 is available. We really need C11, but this is the best autoconf currently provides
AS_IF([test x"$ac_cv_prog_cc_c99" = xno],
[AC_MSG_ERROR([C99 support is required])])
# Checks for header files
AC_CHECK_HEADERS([stddef.h stdlib.h string.h time.h], [], [AC_MSG_ERROR(Required header missing)])
# Checks for typedefs, structures, and compiler characteristics
AC_C_INLINE
AC_TYPE_SIZE_T
# Checks for library functions
AC_CHECK_FUNCS([malloc realloc memmove memset], [], [AC_MSG_ERROR(Required function missing)])
AC_CHECK_LIB([rt], [clock_gettime])
# Check for pthread
AX_PTHREAD([
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
], [AC_MSG_ERROR(Pthread missing)])
# Now that the basics are checked, make sure vulkan is installed
AS_IF([test x"$VULKAN_SDK" != x], [
CPPFLAGS="$CPPFLAGS -I$VULKAN_SDK/include"
LDFLAGS="$LDFLAGS -L$VULKAN_SDK/lib"
glslangvalidator="$VULKAN_SDK/bin/glslangValidator"
], [glslangvalidator="glslangValidator"])
AC_CHECK_HEADER([vulkan/vulkan.h], [], [AC_MSG_ERROR(Vulkan header not found)])
AC_CHECK_LIB([vulkan], [vkCreateInstance], [], [AC_MSG_ERROR(Vulkan library not found)])
# Make sure external dependencies are also installed
# - SDL2
# - XCB and Xlib
AC_CHECK_HEADER([SDL2/SDL.h], [], [AC_MSG_ERROR(SDL2 headers not found)])
AC_CHECK_LIB([SDL2], [SDL_Init], [], [AC_MSG_ERROR(SDL2 library not found)])
AC_CHECK_HEADER([X11/Xlib-xcb.h], [], [AC_MSG_ERROR(Xlib-xcb header missing)])
AC_CHECK_LIB([X11-xcb], [XGetXCBConnection], [], [AC_MSG_ERROR(X11 library not found)])
# Optional libraries
AC_ARG_WITH(ncurses,
[AS_HELP_STRING([--with-ncurses@<:@=ARG@:>@], [Whether ncurses tutorials should be built @<:@default=yes@:>@])], , [with_ncurses=yes])
AS_IF([test x"$with_ncurses" = xyes], [
AC_CHECK_HEADER([curses.h], [], [with_ncurses=no])
AS_IF([test x"$with_ncurses" != xyes], [AC_CHECK_HEADER([ncurses/curses.h], [with_ncurses=yes], [with_ncurses=no])])
AC_CHECK_LIB([ncurses], [initscr], [], [with_ncurses=no])
])
AC_SUBST(GLSLANGVALIDATOR, [$glslangvalidator])
AM_CONDITIONAL(HAVE_NCURSES, [test x"$with_ncurses" = xyes])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT