-
Notifications
You must be signed in to change notification settings - Fork 163
/
configure.ac
161 lines (132 loc) · 3.47 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# License here
#
AC_PREREQ(2.61)
AC_INIT(mta, 1.0-trunk, nospam@mtanet)
AC_CONFIG_AUX_DIR([.])
AM_CONFIG_HEADER(config.h)
AC_CONFIG_MACRO_DIR([m4])
if test x$prefix = xNONE; then
prefix=/usr/local
fi
# Output directory
outputdir=`pwd`/MTA10_Server/output
AC_SUBST(outputdir)
AC_SUBST(prefix)
AC_SUBST(INCLUDES)
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
AM_INIT_AUTOMAKE
AM_PROG_CC_C_O
AC_PROG_MAKE_SET
AM_CHECK_PCH
# Templates
AH_TEMPLATE([USING_BIG_ENDIAN], Define this if you are on a big-endian system.)
AH_TEMPLATE([USING_LITTLE_ENDIAN], Define this if you are on a non-big-endian system.)
AH_TEMPLATE([X64], Define this if you are under an X64-based operating system.)
AH_TEMPLATE([X86], Define this if you are under an X86-based 32bit operating system.)
# Flags
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[enable debug]),
[ if test "x$enable_debug" = "xyes" ; then
CFLAGS="$CFLAGS -g"
CXXFLAGS="$CXXFLAGS -g"
fi
],
)
# Checks for libraries.
# pcre
AX_PATH_LIB_PCRE()
AC_SUBST(PCRE_CFLAGS)
AC_SUBST(PCRE_LIBS)
# sqlite3
AX_LIB_SQLITE3()
# curl
AC_CHECK_CURL(7)
# Checking for a 64-bit system
AC_MSG_CHECKING([uname -m for detecting host operating system architecture])
ARCH=`uname -m`
case "$ARCH" in
amd64*)
dnl yay 21st century hardware
AC_MSG_RESULT(x64 feel teh power)
AC_DEFINE(X64)
AC_SUBST(ARCH,x64)
;;
x86_64*)
dnl yay 21st century hardware
AC_MSG_RESULT(x64 feel teh power)
AC_DEFINE(X64)
AC_SUBST(ARCH,x64)
;;
*)
AC_MSG_RESULT(x86 oh noes i ran out of address space)
AC_DEFINE(X86)
AC_SUBST(ARCH,x86)
;;
esac
# Platform specific rules
AC_MSG_CHECKING([operating system])
case $host in
*-linux*)
AC_MSG_RESULT(linux)
AC_CHECK_LIB(rt, clock_gettime)
;;
*-darwin*)
AC_MSG_RESULT(darwin)
;;
*-bsd*)
AC_MSG_RESULT(bsd)
;;
*)
AC_MSG_ERROR(unsupported)
;;
esac
# Check for BigEndian
AC_C_BIGENDIAN([AC_DEFINE(USING_BIG_ENDIAN)],[AC_DEFINE(USING_LITTLE_ENDIAN)],[])
# Check for zlib
AX_CHECK_ZLIB()
# Check for curses
AC_CHECK_LIB(curses, stdscr,, AC_MSG_ERROR([can't find curses]))
# Define compile/library flags.
AC_SUBST(AM_CXXFLAGS, "$AM_CXXFLAGS $INCLUDES $PCRE_CFLAGS -Wall -DTIXML_USE_STL")
AC_SUBST(AM_LDFLAGS, "$AM_LDFLAGS -lstdc++")
# Checks for header files.
AC_CHECK_HEADERS(curses.h sqlite3.h pcre.h fcntl.h limits.h strings.h syslog.h unistd.h [sys/param.h] stdarg.h,, AC_MSG_ERROR([You are missing one or more header(s)]))
# Check for libraries
AC_CHECK_FUNCS(strndup strerror vsnprintf vasprintf open vsyslog strncasecmp)
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_LANG(C++)
# Check for google sparsehash
AC_CHECK_HEADERS([google/sparse_hash_map],,AC_MSG_ERROR([can't find google sparse_hash_map]))
# Checks for library functions.
# Configure subdirectories where necessary
# NOTE: Put these on separate single lines due to a bug in autoconf
# http://readlist.com/lists/lists.sourceforge.net/mingw-users/2/12488.html
AC_CONFIG_SUBDIRS([vendor/lua])
AC_CONFIG_SUBDIRS([vendor/json-c])
# Generate makefiles
AC_CONFIG_FILES([
Makefile
vendor/Makefile
vendor/tinyxml/Makefile
vendor/pme/Makefile
vendor/ehs/Makefile
Shared/Makefile
Shared/XML/Makefile
MTA10_Server/Makefile
MTA10_Server/sdk/Makefile
MTA10_Server/core/Makefile
MTA10_Server/mods/Makefile
MTA10_Server/mods/deathmatch/Makefile
MTA10_Server/launcher/Makefile
])
AC_OUTPUT