-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
126 lines (115 loc) · 3.3 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
# Process this file with autoconf to create configure.
AC_PREREQ([2.65])
# ====================
# Version informations
# ====================
m4_define([openxcom_version_major],[1])
m4_define([openxcom_version_minor],[0])
m4_define([openxcom_version_micro],[0])
m4_define([openxcom_version],[openxcom_version_major.openxcom_version_minor.openxcom_version_micro])
# =============
# Automake init
# =============
AC_INIT([openxcom],[openxcom_version],[[email protected]])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.11 foreign dist-xz])
AM_SILENT_RULES([yes])
AC_LANG([C++])
# ===========================
# Find required base packages
# ===========================
AC_PROG_CXX
AC_PROG_CC
PKG_PROG_PKG_CONFIG([0.24])
# ================
# Check for cflags
# ================
AC_ARG_ENABLE([werror],
[AS_HELP_STRING([--disable-werror], [Treat all warnings as errors, useful for development])],
[enable_werror="$enableval"],
[enable_werror=yes]
)
AS_IF([test x"$enable_werror" != "xno"], [
CFLAGS="$CFLAGS -Werror"
CXXFLAGS="$CXXFLAGS -Werror"
])
AS_IF([test x"$GCC" = xyes], [
# Be tough with warnings and produce less careless code
CFLAGS="$CFLAGS -Wall -pedantic"
CXXFLAGS="$CXXFLAGS -Wall"
LDFLAGS="$LDFLAGS -Wl,--as-needed"
])
# ============
# Debug switch
# ============
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug], [Turn on debugging])],
[enable_debug="$enableval"],
[enable_debug=no]
)
AS_IF([test "x$enable_debug" = "xyes"], [
DEBUG_CFLAGS="-D_DEBUG -g"
])
AC_SUBST(DEBUG_CFLAGS)
# =============
# Documentation
# =============
AC_ARG_WITH(docs,
[AS_HELP_STRING([--without-docs], [Do not build documentation])],
[with_docs="$withval"],
[with_docs=yes]
)
AS_IF([test "x$with_docs" != "xno"], [
AC_PATH_PROG(DOXYGEN, [doxygen])
AS_IF([test -z "$DOXYGEN"], [
AC_MSG_WARN([*** Could not find doxygen in your PATH.])
AC_MSG_WARN([*** The documentation will not be built.])
build_docs=no
], [build_docs=yes])
], [build_docs=no])
AM_CONDITIONAL([WITH_OPENXCOM_DOCS], [test "x$build_docs" != "xno"])
# =============
# Documentation
# =============
AC_ARG_WITH(man,
[AS_HELP_STRING([--without-man], [Do not build manpage])],
[with_man="$withval"],
[with_man=yes]
)
AS_IF([test "x$with_man" != "xno"], [
build_man=yes
# Ask your favorite distribution WHY
AS_IF([test -z "$XMLTO"], [
AC_PATH_PROG(XMLTO,[xmlto])
AS_IF([test -z "$XMLTO"], [
AC_MSG_ERROR([xmlto binary is missing. Install xmlto package.])
])
])
], [build_man=no])
AC_SUBST(XMLTO)
AM_CONDITIONAL([WITH_OPENXCOM_MAN], [test "x$build_man" != "xno"])
# ==================
# Check dependencies
# ==================
AC_SEARCH_LIBS([dladdr], [dl], [], [ AC_MSG_ERROR([unable to find dladdr()]) ])
PKG_CHECK_MODULES([SDL],[sdl >= 1.2.13 SDL_mixer >= 1.2.11 SDL_gfx >= 2.0.22 SDL_image >= 1.2])
PKG_CHECK_MODULES([YAML],[yaml-cpp >= 0.5.3])
AX_CHECK_GL
AC_CONFIG_FILES([
Makefile
docs/Makefile
docs/Doxyfile
])
AC_OUTPUT
# ==============================================
# Display final informations about configuration
# ==============================================
AC_MSG_NOTICE([
==============================================================================
Build configuration:
debug: ${enable_debug}
docs: ${build_docs}
man: ${build_man}
werror: ${enable_werror}
==============================================================================
])