-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
286 lines (229 loc) · 6.36 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# -*- Autoconf -*-
# $Id$
#
# Top-level configure.ac file for djmount
#
# Process this file with autoconf to produce a configure script.
#
# (C) Copyright 2005 Rémi Turboult <[email protected]>
#
AC_PREREQ(2.59)
AC_INIT(djmount, 0.71, [email protected])
# share auxiliary files with sub-configure in "libupnp"
AC_CONFIG_AUX_DIR(config.aux)
AC_CONFIG_MACRO_DIR(m4)
AC_CONFIG_MACRO_DIR(gl/m4)
AC_CONFIG_SRCDIR(djmount/djfs.c)
AM_INIT_AUTOMAKE([1.9 -Wall std-options gnu])
AC_CONFIG_HEADERS(config.h)
AC_COPYRIGHT([Copyright (C) 2005 Rémi Turboult])
AC_REVISION([$Revision$])
#
# --enable-FEATURE flags
# ----------------------
#
RT_BOOL_ARG_ENABLE([debug], [yes], [extra debugging code])
if test x"$enable_debug" = xyes; then
AC_DEFINE([DEBUG],1,[Define to 1 to compile debug code])
fi
RT_BOOL_ARG_ENABLE([charset], [yes],
[charset conversion code and -o iocharset option (assume all UTF-8 when disabled)])
if test x"$enable_charset" = xyes; then
AC_DEFINE([HAVE_CHARSET],1,
[Define to 1 to have charset conversion code])
fi
#
# Checks for programs
#
AC_PROG_CC
gl_EARLY
# build static libraries by default (for bundled libupnp and talloc)
AC_DISABLE_SHARED
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LN_S
AC_PATH_PROG(PERL,perl)
# for pkg_config
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
#
# Default compilation flags
#
if test x"$enable_debug" = xyes; then
# AC_PROG_CC already sets CFLAGS to "-g -O2" by default
:
else
# add optimise for size
AX_CFLAGS_GCC_OPTION([-Os])
fi
AX_CFLAGS_WARN_ALL
# Arrange for large-file support / large off_t
# Define _FILE_OFFSET_BITS and _LARGE_FILES if necessary
# See also http://unix.freshmeat.net/articles/view/709/
AC_SYS_LARGEFILE
#
# Checks for header files
#
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([inttypes.h stddef.h stdint.h stdarg.h])
if test x"$enable_charset" = xyes; then
AC_CHECK_HEADERS([locale.h langinfo.h])
fi
#
# Checks for typedefs, structures, and compiler characteristics
#
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
#
# Checks for library functions
#
AC_CHECK_FUNCS([setxattr mktime])
if test x"$enable_charset" = xyes; then
AC_CHECK_FUNCS([setlocale])
fi
AC_FUNC_FSEEKO
# Optional GNU extensions
AH_TEMPLATE([_GNU_SOURCE],[Define to 1 to get GNU extensions])
AC_CHECK_FUNCS([open_memstream], [AC_DEFINE([_GNU_SOURCE])])
#
# gnulib
# ------
# Configuration for imported modules.
# Use "gnulib-tool --import" to update the modules :
# see http://lists.gnu.org/archive/html/bug-gnulib/2005-08/msg00241.html
gl_INIT
#
# talloc
# ------
#
AC_MSG_CHECKING([whether to use external talloc])
AC_ARG_WITH([external-talloc],
AS_HELP_STRING([--with-external-talloc],
[use external talloc library @<:@enforced: yes@:>@]))
AS_IF([test x$with_external_talloc = xno],
AC_MSG_ERROR([internal talloc is not supported any more]))
AC_MSG_RESULT([yes])
# Find the library. This macro handles the TALLOC_CFLAGS and _LIBS,
# the --with-talloc-prefix arg, and pkg-config (if any).
RT_PACKAGE_FIND([talloc], [], [-ltalloc], [talloc >= 2.0],
[
/* those include are currently missing from "talloc.h" */
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_STDARG_H
# include <stdarg.h>
#else
# include <varargs.h>
#endif
#include "talloc.h"
],
[
/* test for recent talloc functions */
(void) talloc_get_size (talloc_autofree_context());
],
[],[AC_MSG_ERROR([
** Can't find external talloc library (or it is too old).
** Try to configure again --without-external-talloc (this is the default) to
** use the internal bundled library.
** Or $TALLOC_MSG_ERRORS
])])
#
# readline (option)
# -----------------
# Checks for readline and history compatible libraries
#
VL_LIB_READLINE
#
# iconv & langinfo
# ----------------
#
if test x"$enable_charset" = xyes; then
# Checks for function in C library or libiconv
# (AM macros from "gettext" package)
AM_ICONV
AM_LANGINFO_CODESET
# TBD print warning if no setlocale or nl_langinfo(CODESET) implemented
fi
AM_CONDITIONAL(WANT_ICONV,
test x"$enable_charset" = xyes && test x"$am_cv_func_iconv" = xyes)
#
# POSIX Threads
# -------------
#
ACX_PTHREAD([],[AC_MSG_ERROR([POSIX threads are required to build this program])])
# We are only building threads programs so we add the pthread flags directly
# to the default compilation variables. This will also allow the tests below
# (fuse, libupnp, ...) to pick these flags.
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"
#
# FUSE
# ----
#
# Find the library. This macro handles the FUSE_CFLAGS and FUSE_LIBS,
# the --with-fuse-prefix arg, and pkg-config (if any).
RT_PACKAGE_FIND([fuse], [-D_FILE_OFFSET_BITS=64], [-lfuse], [fuse >= 2.2],
[
/* must request latest API (25) else don't work when using FUSE 2.5 */
#define FUSE_USE_VERSION 25
#include <fuse.h>
/* Missing in earlier FUSE versions e.g. 2.2 */
#ifndef FUSE_VERSION
# define FUSE_VERSION (FUSE_MAJOR_VERSION * 10 + FUSE_MINOR_VERSION)
#endif
#if FUSE_VERSION < 22
# error FUSE version is too old
#endif
],
[ fuse_destroy(0) ],
[],[AC_MSG_ERROR([
** Can't find fuse library (or it is too old).
** $FUSE_MSG_ERRORS
])])
FUSE_CFLAGS="$FUSE_CFLAGS -DFUSE_USE_VERSION=22"
#
# libupnp
# -------
#
AC_MSG_CHECKING([whether to use external libupnp])
AC_ARG_WITH([external-libupnp],
AS_HELP_STRING([--with-external-libupnp],
[use external libupnp library (at least 1.3.1) @<:@enforced: yes@:>@]))
AS_IF([test x"$with_external_libupnp" = xno],
AC_MSG_ERROR([internal libupnp is not supported any more]))
AC_MSG_RESULT([yes])
# Find the library. This macro handles the LIBUPNP_CFLAGS and _LIBS,
# the --with-libupnp-prefix arg, and pkg-config (if any).
RT_PACKAGE_FIND([libupnp], [], [-lupnp -lthreadutil -lixml],
[libupnp >= 1.3.1],
[
# include <upnp/ixml.h>
# include <upnp/upnp.h>
# include <upnp/upnptools.h>
#if (!defined UPNP_VERSION) || (UPNP_VERSION < 10301)
# error libupnp version is too old
#endif
],
[
UpnpResolveURL (NULL, NULL, NULL);
/* test for functions added after libupnp-1.2.1a */
ixmlRelaxParser (0);
UpnpSetMaxContentLength (0);
],
[],[AC_MSG_ERROR([
** Can't find external libupnp library (or it is too old).
** Try to configure again --without-external-libupnp (this is the default) to
** use the internal bundled library.
** Or $LIBUPNP_MSG_ERRORS
])])
#
# Output Makefiles
#
AC_CONFIG_FILES([Makefile
gl/Makefile
djmount/Makefile
])
AC_OUTPUT