-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfigure.ac
More file actions
191 lines (167 loc) · 6.11 KB
/
configure.ac
File metadata and controls
191 lines (167 loc) · 6.11 KB
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.64])
AC_INIT([TuneL common library],
[0.0],
[martin.antony@yahoo.fr],
[tlcommon])
AC_CONFIG_SRCDIR([src/socket.c])
AC_CONFIG_AUX_DIR([build/aux])
AC_CONFIG_MACRO_DIR([build/m4])
AM_INIT_AUTOMAKE([1.11.1 -Wall -Werror foreign])
AM_PROG_AR
AC_CONFIG_HEADERS([config.h])
AM_SILENT_RULES([yes])
# Checks for programs.
LT_PREREQ([2.2.0])
LT_INIT
AC_PROG_CC
AC_PROG_CXX
# basic setup
#
# revision of the library
#
# CURRENT:REVISION:AGE
#
# Please remeber to bump library version before releases
# Remeberer:
# =====================================================================
# | If you have... | Bump version to |
# =====================================================================
# | Not changed the interface (bug fixes) | CURRENT:REV+1:AGE |
# ---------------------------------------------------------------------
# | Augmented the interface (new functions) | CURRENT+1:0:AGE+1 |
# ---------------------------------------------------------------------
# | Broken old interface (e.g. removed functions) | CURRENT+1:0:0 |
# ---------------------------------------------------------------------
TL_COMMON_LTVERSION="0:0:0"
AC_SUBST([TL_COMMON_LTVERSION])
pkgconfigdir="$libdir/pkgconfig"
tl_includedir="$includedir/tunel"
tl_include_commondir="$tl_includedir/common"
AC_SUBST(pkgconfigdir)
AC_SUBST(tl_includedir)
AC_SUBST(tl_include_commondir)
# Checks for libraries.
# AX_REQUIRE_HEADER(HEADER, IF-PRESENT)
# ----------------------------
# Check presence of HEADER and exit if not present, or execute IF-PRESENT if
# prsent
AC_DEFUN([AX_REQUIRE_HEADER],
[AC_CHECK_HEADERS([$1],
[$2],
[AC_MSG_ERROR([[$1 not found]])])])
# AX_REQUIRE_LIBRARY(LIBRARY, FUNC, IF-PRESENT)
# ----------------------------
# Check presence of HEADER and exit if not present, or execute IF-PRESENT if
# present
AC_DEFUN([AX_REQUIRE_LIB],
[AC_CHECK_LIB([$1], [$2],
[$3],
[AC_MSG_ERROR([[$1 not found]])])])
# PThread
AX_REQUIRE_HEADER([pthread.h])
AX_REQUIRE_LIB([pthread], [pthread_create])
# Wrappers around PKG_CHECK_MODULES() that filling the TL_COMMON_C*FLAGS and
# TL_COMMON_LIBS variables according to the PKG's C*FLAGS and LIBS
AC_DEFUN([AX_PKG_CHECK_MODULES_C],
[PKG_CHECK_MODULES([$1],
[$2])
TL_COMMON_CFLAGS="${TL_COMMON_CFLAGS} ${$1_CFLAGS}"
# har har, C++ needs them too.
TL_COMMON_CXXFLAGS="${TL_COMMON_CXXFLAGS} ${$1_CFLAGS}"
TL_COMMON_LIBS="${TL_COMMON_LIBS} ${$1_LIBS}"
])
AC_DEFUN([AX_PKG_CHECK_MODULES_CXX],
[PKG_CHECK_MODULES([$1],
[$2])
TL_COMMON_CXXFLAGS="${TL_COMMON_CXXFLAGS} ${$1_CFLAGS}"
TL_COMMON_LIBS="${TL_COMMON_LIBS} ${$1_LIBS}"
])
TL_COMMON_CFLAGS=
TL_COMMON_CXXFLAGS=
TL_COMMON_LIBS=
AX_PKG_CHECK_MODULES_C([LIBCURL], [libcurl])
AX_PKG_CHECK_MODULES_C([SCEUTILS], [sceutils])
AX_PKG_CHECK_MODULES_C([SCECORE], [scecore])
#AX_PKG_CHECK_MODULES_C([GL], [gl])
AX_PKG_CHECK_MODULES_CXX([BULLET], [bullet])
AC_SUBST([TL_COMMON_CFLAGS])
AC_SUBST([TL_COMMON_CXXFLAGS])
AC_SUBST([TL_COMMON_LIBS])
# Checks for header files.
AC_CHECK_HEADERS([stdlib.h \
string.h \
stdarg.h \
unistd.h \
limits.h \
arpa/inet.h \
netinet/in.h \
sys/socket.h \
sys/time.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_C_CONST
# Checks for library functions.
AC_FUNC_STRTOD
AC_CHECK_FUNCS([memset \
strstr \
strchr \
select \
socket \
strerror \
strtol])
# Tuning
AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug], [enable debugging [[default=yes]]]),
[enable_debug="$enableval"],
[enable_debug="yes"])
AC_MSG_CHECKING([[whether to enable debugging]])
if test "x$enable_debug" = "xyes"; then
AC_DEFINE([TL_DEBUG], [1], [is debugging enabled])
# FIXME: please only use TL_DEBUG, not DEBUG
DEBUG_CPPFLAGS="-DTL_DEBUG -DDEBUG"
CPPFLAGS="$CPPFLAGS $DEBUG_CPPFLAGS"
AC_MSG_RESULT([[yes]])
else
DEBUG_CFLAGS=
AC_MSG_RESULT([[no]])
fi
AC_SUBST([DEBUG_CFLAGS])
AC_ARG_ENABLE([paranoia],
AC_HELP_STRING([--enable-paranoia],
[enable excessively strict compiler options \
(works only with GCC and compatible) [[default=no]]]),
[enable_paranoia="$enableval"],
[enable_paranoia="no"])
AC_MSG_CHECKING([[whether to enable paranoiac compiler options]])
if test "x$enable_paranoia" = "xyes"; then
CFLAGS="$CFLAGS \
-Wall -W -Wchar-subscripts -Wcomment -Wformat=2 -Wimplicit-int \
-Werror-implicit-function-declaration -Wmain -Wparentheses -Wsequence-point \
-Wreturn-type -Wswitch -Wtrigraphs -Wunused -Wuninitialized -Wunknown-pragmas \
-Wfloat-equal -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast \
-Wwrite-strings -Wconversion -Wsign-compare -Waggregate-return \
-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations \
-Wmissing-noreturn -Wformat -Wmissing-format-attribute \
-Wno-deprecated-declarations -Wpacked -Wredundant-decls -Wnested-externs \
-Winline -Wlong-long -Wunreachable-code -pedantic"
AC_MSG_RESULT([[yes]])
else
AC_MSG_RESULT([[no]])
fi
#TL_CHECK_PHY_DEBUG
# output
AC_CONFIG_FILES([Makefile
tlcommon.pc
src/Makefile
])
AC_OUTPUT
echo "------------------------------------------"
echo "Configuration choices:"
echo "* Debugging enabled : $enable_debug"
echo "* Paranoiac compiler options : $enable_paranoia"
echo "* Base installation directory : $prefix"
echo ""
echo "Now type 'make' to build $PACKAGE_NAME"