-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
172 lines (149 loc) · 5.57 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
162
163
164
165
166
167
168
169
170
171
172
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.64])
AC_INIT([TuneL client],
[0.0],
[tlclient])
AC_CONFIG_SRCDIR([src/main.c])
AC_CONFIG_AUX_DIR([build/aux])
AC_CONFIG_MACRO_DIR([build/m4])
AM_INIT_AUTOMAKE([1.11.1 -Wall -Werror foreign])
AC_CONFIG_HEADERS([config.h])
AM_PROG_AR
AM_SILENT_RULES([yes])
# Checks for programs.
LT_PREREQ([2.2.0])
LT_INIT
AC_PROG_CC
AM_PROG_CC_C_O
# 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_CLIENT_LTVERSION="0:0:0"
AC_SUBST([TL_CLIENT_LTVERSION])
pkgconfigdir="$libdir/pkgconfig"
tl_includedir="$includedir/tunel"
tl_include_dir="$tl_includedir/client"
AC_SUBST(pkgconfigdir)
AC_SUBST(tl_includedir)
AC_SUBST(tl_include_clientdir)
# 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_LIB(LIBRARY, FUNC, IF-PRESENT)
# ----------------------------
# Check presence of HEADER and exit if not present, or execute IF-PRESENT if
# prsent
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])
# Wrapper around PKG_CHECK_MODULES() that fill the TL_CLIENT_CFLAGS and
# TL_CLIENT_LIBS variables according to the PKG's CFLAGS and LIBS
AC_DEFUN([AX_PKG_CHECK_MODULES_C],
[PKG_CHECK_MODULES([$1],
[$2])
TL_CLIENT_CFLAGS="${TL_CLIENT_CFLAGS} ${$1_CFLAGS}"
TL_CLIENT_LIBS="${TL_CLIENT_LIBS} ${$1_LIBS}"
])
TL_CLIENT_CFLAGS=
TL_CLIENT_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([SCEINTERFACE], [sceinterface])
AX_PKG_CHECK_MODULES_C([SDL], [sdl])
AX_PKG_CHECK_MODULES_C([TLCOMMON], [tlcommon])
AC_SUBST([TL_CLIENT_CFLAGS])
AC_SUBST([TL_CLIENT_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_C_CONST
# Checks for library functions.
AC_CHECK_FUNCS([strchr])
# 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
# output
AC_CONFIG_FILES([Makefile
tlclient.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"