-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
108 lines (73 loc) · 3.63 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
dnl Initialize autoconf
AC_INIT([zark],[0.1],[[email protected]])
dnl Try to keep as much autoconf stuff as possible out of the root dir..
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([foreign -Wall])
dnl Make building silent..
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
dnl Check for programs, headers, libs.. ------------------------------------------------------------
AC_PROG_CC
AC_C_BIGENDIAN
dnl Attempt to enable C99 mode
AC_PROG_CC_C99
AS_IF([test "x$ac_cv_prog_cc_c99" = xno], AC_MSG_WARN([C99 was not enabled!]))
dnl TODO: Maybe also check for some of these
dnl time.h signal.h locale.h unistd.h pwd.h sys/types.h sys/stat.h sys/time.h
dnl TODO: Check for Xutf8 functions.
PKG_CHECK_MODULES(x11, x11)
AC_CHECK_HEADER([X11/keysym.h], [], [AC_MSG_ERROR(X11/keysym.h not found)])
dnl Some environments have lua installed without 5.1 postfixed (gentoo)
PKG_CHECK_MODULES(lua, [lua5.1], [],
[PKG_CHECK_MODULES(lua, [lua], [],
[AC_MSG_ERROR(lua not found, make sure it is installed.)]
)]
)
PKG_CHECK_MODULES(ftgl, [ftgl > 2.1.2]) dnl Must be 2.1.3 or newer for ftgl.h
PKG_CHECK_MODULES(xrandr, xrandr)
AC_CHECK_HEADER([X11/extensions/Xrandr.h], [], [AC_MSG_ERROR(X11/extensions/Xrandr.h not found)])
AC_CHECK_HEADER([GL/glew.h], [], [AC_MSG_ERROR(GL/glew.h not found, make sure glew is installed)])
AC_CHECK_HEADER([GL/glxew.h], [], [AC_MSG_ERROR(GL/glxew.h not found, make sure glew is installed)])
AC_CHECK_LIB([GLEW], [main], [], [AC_MSG_ERROR([libGLEW not found, make sure glew is installed])])
AC_CHECK_HEADER([IL/il.h], [], [AC_MSG_ERROR(IL/il.h not found, make sure DevIL is installed)])
AC_CHECK_LIB([IL], [main], [], [AC_MSG_ERROR([libIL not found, make sure DevIL is installed])])
AC_CHECK_HEADER([IL/ilu.h], [], [AC_MSG_ERROR(IL/ilu.h not found, make sure DevIL is installed)])
AC_CHECK_LIB([ILU], [main], [], [AC_MSG_ERROR([libILU not found, make sure DevIL is installed])])
CFLAGS="$CFLAGS $x11_CFLAGS $ftgl_CFLAGS $lua_CFLAGS $xrandr_CFLAGS"
dnl FIXME: do proper check for GL and GLU
LIBS="$LIBS -lGL -lGLU $x11_LIBS $ftgl_LIBS $lua_LIBS $xrandr_LIBS"
dnl Misc stuff -------------------------------------------------------------------------------------
dnl For now I requre the user to pass the path to the asset data..
AC_ARG_WITH(
[asset-dir],
AS_HELP_STRING([--with-asset-dir=DIR], [Path to assets (models, textures, etc)]),
ASSET_DIR=$withval,
AC_MSG_ERROR([must give asset path with --with-asset-dir])
)
dnl AC_DEFINE_UNQUOTED([ASSET_DIR], "$ASSET_DIR", [Asset directory])
AC_SUBST(ASSET_DIR)
dnl Check if I need to enable debugging stuff.
AC_ARG_ENABLE(
[debug],
AS_HELP_STRING([--enable-debug], [Compile with debugging features])
)
if test "x$enable_debug" = xyes; then
AC_DEFINE([DEBUG], [], [Compile with debugging features])
dnl I am not entirely sure if I should add -g to CFLAGS here, it's added by default, unless the
dnl user specified custom CFLAGS.
fi
dnl Add a few things to CFLAGS. Maybe I shouldnt bother with the warnings, since they are only
dnl relevant to me?
CFLAGS="$CFLAGS -ffast-math -Wall -Wdeclaration-after-statement -Wsign-compare"
dnl Output files -----------------------------------------------------------------------------------
dnl Declare output header
AC_CONFIG_HEADERS([config.h])
dnl Declare output files
AC_CONFIG_FILES([ Makefile src/Makefile ])
dnl Create output files
AC_OUTPUT
dnl Debugging stuff --------------------------------------------------------------------------------
echo "Using CFLAGS: $CFLAGS"
echo "Using LDFLAGS: $LDFLAGS"
echo "Using CPPFLAGS: $CPPFLAGS"
echo "Using LIBS: $LIBS"
echo "Using CC: $CC"