1 | dnl convention: -TR MAJOR MINOR MAINT STATUS - (each a single char) |
---|
2 | dnl STATUS: "X" for prerelease beta builds, |
---|
3 | dnl "Z" for unsupported trunk builds, |
---|
4 | dnl "0" for stable, supported releases |
---|
5 | dnl these should be the only two lines you need to change |
---|
6 | m4_define([user_agent_prefix],[1.72+]) |
---|
7 | m4_define([peer_id_prefix],[-TR172Z-]) |
---|
8 | |
---|
9 | AC_INIT([transmission], |
---|
10 | [user_agent_prefix], |
---|
11 | [http://trac.transmissionbt.com/newticket]) |
---|
12 | AC_SUBST(USERAGENT_PREFIX,[user_agent_prefix]) |
---|
13 | AC_SUBST(PEERID_PREFIX,[peer_id_prefix]) |
---|
14 | |
---|
15 | AC_CONFIG_MACRO_DIR([m4]) |
---|
16 | |
---|
17 | dnl AM_CONFIG_HEADER(config.h) |
---|
18 | AC_CONFIG_SRCDIR(libtransmission/transmission.h) |
---|
19 | AM_INIT_AUTOMAKE([1.9 tar-ustar]) |
---|
20 | AC_PROG_LIBTOOL |
---|
21 | |
---|
22 | if test m4_substr(peer_id_prefix,6,1) = "0"; then |
---|
23 | supported_build=yes |
---|
24 | if test "x$GCC" = "xyes" ; then |
---|
25 | CFLAGS="$CFLAGS -g -O3 " |
---|
26 | CXXFLAGS="$CXXFLAGS -g -O3 " |
---|
27 | fi |
---|
28 | AC_DEFINE(TR_STABLE_RELEASE, 1, [Define to 1 if this is a stable release of Transmission]) |
---|
29 | else |
---|
30 | supported_build=no |
---|
31 | if test "x$GCC" = "xyes" ; then |
---|
32 | CFLAGS="$CFLAGS -g -O0" |
---|
33 | CXXFLAGS="$CXXFLAGS -g -O0" |
---|
34 | fi |
---|
35 | if test m4_substr(peer_id_prefix,6,1) = "X"; then |
---|
36 | AC_DEFINE(TR_BETA_RELEASE, 1, [Define to 1 if this is a beta release of Transmission]) |
---|
37 | else |
---|
38 | AC_DEFINE(TR_NIGHTLY_RELEASE, 1, [Define to 1 if this is a nightly release of Transmission]) |
---|
39 | fi |
---|
40 | fi |
---|
41 | AM_CONDITIONAL(TR_UNSTABLE, test "x$supported_build" = "xno") |
---|
42 | |
---|
43 | OPENSSL_MINIMUM=0.9.4 |
---|
44 | CURL_MINIMUM=7.16.3 |
---|
45 | GIO_MINIMUM=2.15.5 |
---|
46 | GLIB_MINIMUM=2.6.0 |
---|
47 | GTK_MINIMUM=2.6.0 |
---|
48 | LIBNOTIFY_MINIMUM=0.4.3 |
---|
49 | DBUS_GLIB_MINIMUM=0.70 |
---|
50 | LIBEVENT_MINIMUM=1.4.5 |
---|
51 | AC_SUBST(OPENSSL_MINIMUM) |
---|
52 | AC_SUBST(CURL_MINIMUM) |
---|
53 | AC_SUBST(GIO_MINIMUM) |
---|
54 | AC_SUBST(GLIB_MINIMUM) |
---|
55 | AC_SUBST(GTK_MINIMUM) |
---|
56 | AC_SUBST(LIBNOTIFY_MINIMUM) |
---|
57 | AC_SUBST(DBUS_GLIB_MINIMUM) |
---|
58 | AC_SUBST(LIBEVENT_MINIUM) |
---|
59 | |
---|
60 | AC_PROG_CC |
---|
61 | AC_PROG_CXX |
---|
62 | AC_C_INLINE |
---|
63 | if test "x$GCC" = "xyes" ; then |
---|
64 | |
---|
65 | CFLAGS="$CFLAGS -std=gnu99 -ggdb3 -Wall -W -Wpointer-arith -Wformat-security -Wcast-align -Wundef -Wcast-align -Wstrict-prototypes -Wmissing-declarations -Wmissing-format-attribute -Wredundant-decls -Wnested-externs -Wunused-parameter -Wwrite-strings" |
---|
66 | |
---|
67 | dnl figure out gcc version |
---|
68 | AC_MSG_CHECKING([gcc version]) |
---|
69 | GCC_VERSION=`$CC -dumpversion` |
---|
70 | GCC_MAJOR=`echo $GCC_VERSION | cut -d . -f1` |
---|
71 | GCC_MINOR=`echo $GCC_VERSION | cut -d . -f2` |
---|
72 | GCC_VERSION_NUM=`(expr $GCC_MAJOR "*" 100 + $GCC_MINOR) 2>/dev/null` |
---|
73 | |
---|
74 | AC_MSG_RESULT($GCC_VERSION) |
---|
75 | if test $GCC_VERSION_NUM -ge 304; then |
---|
76 | dnl these were added in 3.4 |
---|
77 | CFLAGS="$CFLAGS -Wextra -Wdeclaration-after-statement -Winit-self" |
---|
78 | fi |
---|
79 | fi |
---|
80 | |
---|
81 | AC_HEADER_STDC |
---|
82 | AC_HEADER_TIME |
---|
83 | |
---|
84 | AC_CHECK_FUNCS([lrintf strlcpy daemon dirname basename daemon strcasecmp localtime_r posix_fallocate memmem]) |
---|
85 | AC_PROG_INSTALL |
---|
86 | AC_PROG_MAKE_SET |
---|
87 | ACX_PTHREAD |
---|
88 | |
---|
89 | AC_SEARCH_LIBS([socket], [socket net]) |
---|
90 | AC_SEARCH_LIBS([gethostbyname], [nsl bind]) |
---|
91 | PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM], , [CHECK_SSL()]) |
---|
92 | PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM]) |
---|
93 | AC_PATH_ZLIB |
---|
94 | |
---|
95 | AC_SYS_LARGEFILE |
---|
96 | |
---|
97 | |
---|
98 | dnl ---------------------------------------------------------------------------- |
---|
99 | dnl |
---|
100 | dnl posix_fadvise |
---|
101 | |
---|
102 | dnl can posix_fadvise be used |
---|
103 | AC_CHECK_DECLS(posix_fadvise, [], [], [ |
---|
104 | #define _XOPEN_SOURCE 600 |
---|
105 | #include <fcntl.h>]) |
---|
106 | AC_CHECK_FUNCS([posix_fadvise]) |
---|
107 | |
---|
108 | |
---|
109 | dnl ---------------------------------------------------------------------------- |
---|
110 | dnl |
---|
111 | dnl file monitoring for the daemon |
---|
112 | |
---|
113 | AC_CHECK_HEADER([sys/inotify.h], |
---|
114 | [AC_CHECK_FUNC([inotify_init],[have_inotify="yes"],[have_inotify="no"])], |
---|
115 | [have_inotify="no"]) |
---|
116 | AC_ARG_WITH([inotify], |
---|
117 | [AS_HELP_STRING([--with-inotify],[Enable inotify support (default=auto)])], |
---|
118 | [want_inotify=${enableval}], |
---|
119 | [want_inotify=${have_inotify}]) |
---|
120 | if test "x$want_inotify" = "xyes" ; then |
---|
121 | if test "x$have_inotify" = "xyes"; then |
---|
122 | AC_DEFINE([WITH_INOTIFY],[1]) |
---|
123 | else |
---|
124 | AC_MSG_ERROR("inotify not found!") |
---|
125 | fi |
---|
126 | fi |
---|
127 | |
---|
128 | AC_CHECK_HEADER([sys/event.h], |
---|
129 | [AC_CHECK_FUNC([kqueue],[have_kqueue="yes"],[have_kqueue="no"])], |
---|
130 | [have_kqueue="no"]) |
---|
131 | AC_ARG_WITH([kqueue], |
---|
132 | [AS_HELP_STRING([--with-kqueue],[Enable kqueue support (default=auto)])], |
---|
133 | [want_kqueue=${enableval}], |
---|
134 | [want_kqueue=${have_kqueue}]) |
---|
135 | if test "x$want_kqueue" = "xyes" ; then |
---|
136 | if test "x$have_kqueue" = "xyes"; then |
---|
137 | AC_DEFINE([WITH_KQUEUE],[1]) |
---|
138 | else |
---|
139 | AC_MSG_ERROR("kqueue not found!") |
---|
140 | fi |
---|
141 | fi |
---|
142 | |
---|
143 | AC_CHECK_HEADERS([xfs/xfs.h]) |
---|
144 | |
---|
145 | |
---|
146 | dnl ---------------------------------------------------------------------------- |
---|
147 | dnl |
---|
148 | dnl va_copy |
---|
149 | |
---|
150 | AC_MSG_CHECKING([how to copy va_list]) |
---|
151 | AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);], |
---|
152 | AC_MSG_RESULT([va_copy]), |
---|
153 | [ AH_TEMPLATE([va_copy], [define if va_copy is not available]) |
---|
154 | AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);], |
---|
155 | [ AC_DEFINE([va_copy], [__va_copy]) |
---|
156 | AC_MSG_RESULT([__va_copy])], |
---|
157 | [ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))]) |
---|
158 | AC_MSG_RESULT([memcpy])] |
---|
159 | ) |
---|
160 | ]) |
---|
161 | |
---|
162 | |
---|
163 | dnl build our copy of libevent whether we use it or not, |
---|
164 | dnl because "make dist" needs its Makefiles to exist, and |
---|
165 | dnl AM_CONDITIONAL + AC_CONFIG_SUBDIRS don't seem to play nice |
---|
166 | AC_CONFIG_SUBDIRS([third-party/libevent]) |
---|
167 | libevent_source=bundled |
---|
168 | AC_CHECK_LIB([event],[evutil_vsnprintf], |
---|
169 | [libevent_found=yes], |
---|
170 | [libevent_found=no], |
---|
171 | [-levent]) |
---|
172 | AC_CHECK_HEADER([event-config.h], |
---|
173 | [libevent_headers_found=yes], |
---|
174 | [libevent_headers_found=no]) |
---|
175 | libevent_source=bundled |
---|
176 | if test "x$libevent_found" = "xyes" ; then |
---|
177 | if test "x$libevent_headers_found" = "xyes"; then |
---|
178 | libevent_source=system |
---|
179 | fi |
---|
180 | fi |
---|
181 | if test "x$libevent_source" = "xbundled"; then |
---|
182 | AC_MSG_WARN([using our own libevent from third-party/libevent/]) |
---|
183 | AC_MSG_WARN([if you are cross-compiling this is probably NOT what you want.]) |
---|
184 | LIBEVENT_CFLAGS="-I\$(top_srcdir)/third-party/libevent -I\$(top_builddir)/third-party/libevent" |
---|
185 | LIBEVENT_LIBS="\$(top_builddir)/third-party/libevent/libevent.la" |
---|
186 | else |
---|
187 | LIBEVENT_CFLAGS="" |
---|
188 | LIBEVENT_LIBS="-levent -lrt" |
---|
189 | fi |
---|
190 | AC_SUBST(LIBEVENT_CFLAGS) |
---|
191 | AC_SUBST(LIBEVENT_LIBS) |
---|
192 | |
---|
193 | |
---|
194 | dnl ---------------------------------------------------------------------------- |
---|
195 | dnl |
---|
196 | dnl dht |
---|
197 | |
---|
198 | |
---|
199 | AC_ARG_ENABLE([dht], |
---|
200 | AS_HELP_STRING([--disable-dht],[omit DHT support]), |
---|
201 | [enable_dht=${enableval}], |
---|
202 | [enable_dht=yes]) |
---|
203 | if test "x$enable_dht" = "xno" ; then |
---|
204 | AC_DEFINE([WITHOUT_DHT], 1) |
---|
205 | DHT_CFLAGS="" |
---|
206 | DHT_LIBS="" |
---|
207 | else |
---|
208 | DHT_CFLAGS="-I\$(top_srcdir)/third-party/dht" |
---|
209 | DHT_LIBS="\$(top_builddir)/third-party/dht/libdht.a" |
---|
210 | fi |
---|
211 | AM_CONDITIONAL(DHT, test "x$enable_dht" = "xyes") |
---|
212 | AC_SUBST(DHT_CFLAGS) |
---|
213 | AC_SUBST(DHT_LIBS) |
---|
214 | |
---|
215 | |
---|
216 | dnl ---------------------------------------------------------------------------- |
---|
217 | dnl |
---|
218 | dnl detection for the GTK+ client |
---|
219 | |
---|
220 | PKG_CHECK_MODULES(GTK, |
---|
221 | [gtk+-2.0 >= $GTK_MINIMUM |
---|
222 | glib-2.0 >= $GLIB_MINIMUM |
---|
223 | gmodule-2.0 >= $GLIB_MINIMUM |
---|
224 | gthread-2.0 >= $GLIB_MINIMUM], |
---|
225 | [have_gtk=yes], |
---|
226 | [have_gtk=no]) |
---|
227 | AC_ARG_ENABLE([gtk], |
---|
228 | AS_HELP_STRING([--enable-gtk],[build gtk client]), |
---|
229 | [want_gtk=${enableval}], |
---|
230 | [want_gtk=${have_gtk}]) |
---|
231 | build_gtk=no |
---|
232 | use_gio=no |
---|
233 | use_libnotify=no |
---|
234 | use_dbus_glib=no |
---|
235 | if test "x$want_gtk" = "xyes" ; then |
---|
236 | if test "x$have_gtk" = "xyes"; then |
---|
237 | build_gtk=yes |
---|
238 | else |
---|
239 | AC_MSG_ERROR("GTK+ not found!") |
---|
240 | fi |
---|
241 | fi |
---|
242 | AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"]) |
---|
243 | AC_SUBST(GTK_LIBS) |
---|
244 | AC_SUBST(GTK_CFLAGS) |
---|
245 | |
---|
246 | if test "x$build_gtk" = "xyes"; then |
---|
247 | |
---|
248 | PKG_CHECK_MODULES([GIO], |
---|
249 | [gio-2.0 >= $GIO_MINIMUM], |
---|
250 | [use_gio=yes], |
---|
251 | [use_gio=no]) |
---|
252 | AC_SUBST(GIO_LIBS) |
---|
253 | AC_SUBST(GIO_CFLAGS) |
---|
254 | if test "x$use_gio" = "xyes"; then |
---|
255 | AC_DEFINE([HAVE_GIO], 1) |
---|
256 | fi |
---|
257 | |
---|
258 | PKG_CHECK_MODULES([LIBNOTIFY], |
---|
259 | [libnotify >= $LIBNOTIFY_MINIMUM], |
---|
260 | [have_libnotify=yes], |
---|
261 | [have_libnotify=no]) |
---|
262 | AC_ARG_ENABLE([libnotify], |
---|
263 | AS_HELP_STRING([--enable-libnotify],[enable notifications]),, |
---|
264 | [enable_libnotify=yes]) |
---|
265 | use_libnotify=no |
---|
266 | if test "x$enable_libnotify" = "xyes" ; then |
---|
267 | if test "x$have_libnotify" = "xyes"; then |
---|
268 | use_libnotify=yes |
---|
269 | AC_SUBST(LIBNOTIFY_LIBS) |
---|
270 | AC_SUBST(LIBNOTIFY_CFLAGS) |
---|
271 | AC_DEFINE([HAVE_LIBNOTIFY], 1) |
---|
272 | fi |
---|
273 | fi |
---|
274 | |
---|
275 | PKG_CHECK_MODULES([DBUS_GLIB], |
---|
276 | [dbus-glib-1 >= $DBUS_GLIB_MINIMUM], |
---|
277 | [use_dbus_glib=yes], |
---|
278 | [use_dbus_glib=no]) |
---|
279 | AC_SUBST(DBUS_GLIB_LIBS) |
---|
280 | AC_SUBST(DBUS_GLIB_CFLAGS) |
---|
281 | if test "x$use_dbus_glib" = "xyes"; then |
---|
282 | AC_DEFINE([HAVE_DBUS_GLIB], 1) |
---|
283 | fi |
---|
284 | if test "x$use_dbus_glib" = "xyes"; then |
---|
285 | AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no) |
---|
286 | if test "x$DBUS_BINDING_TOOL" = xno; then |
---|
287 | AC_MSG_WARN([Cannot find dbus-binding-tool]) |
---|
288 | use_dbus_glib="no (dbus-binding-tool not found)" |
---|
289 | fi |
---|
290 | fi |
---|
291 | fi |
---|
292 | |
---|
293 | AC_ARG_ENABLE([nls], |
---|
294 | AS_HELP_STRING([--enable-nls],[enable native language support]),, |
---|
295 | [enable_nls=yes]) |
---|
296 | |
---|
297 | if test "x$build_gtk" = "xyes" -a "x$enable_nls" = "xno" ; then |
---|
298 | AC_MSG_ERROR("The gtk client cannot be built without nls support. Try adding either --enable-nls or --disable-gtk" ) |
---|
299 | fi |
---|
300 | |
---|
301 | dnl This section is only used for internationalization. |
---|
302 | dnl If you don't need translations and this section gives you trouble -- |
---|
303 | dnl such as if you're building for a headless system -- |
---|
304 | dnl it's okay to tear this section out and re-build the configure script. |
---|
305 | use_nls=no |
---|
306 | if test "x$enable_nls" = "xyes" ; then |
---|
307 | use_nls=yes |
---|
308 | IT_PROG_INTLTOOL([0.40.0],[no-xml]) |
---|
309 | AC_CHECK_HEADERS([libintl.h]) |
---|
310 | GETTEXT_PACKAGE=transmission |
---|
311 | AC_SUBST(GETTEXT_PACKAGE) |
---|
312 | AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package]) |
---|
313 | AM_GLIB_GNU_GETTEXT |
---|
314 | transmissionlocaledir='${prefix}/${DATADIRNAME}/locale' |
---|
315 | AC_SUBST(transmissionlocaledir) |
---|
316 | fi |
---|
317 | |
---|
318 | |
---|
319 | dnl ---------------------------------------------------------------------------- |
---|
320 | dnl |
---|
321 | dnl platform-specific stuff. |
---|
322 | |
---|
323 | AC_CANONICAL_HOST |
---|
324 | have_darwin="no" |
---|
325 | have_msw="no" |
---|
326 | case $host_os in |
---|
327 | |
---|
328 | *cygwin|*mingw32*) |
---|
329 | have_msw="yes" |
---|
330 | CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows" |
---|
331 | CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN" |
---|
332 | LIBS="$LIBS -lshell32 -lws2_32" |
---|
333 | transmissionlocaledir="locale" |
---|
334 | if test -z "$host_alias"; then |
---|
335 | hostaliaswindres= |
---|
336 | else |
---|
337 | hostaliaswindres="$host_alias-windres"; |
---|
338 | fi |
---|
339 | AC_CHECK_TOOL(WINDRES, windres) |
---|
340 | ;; |
---|
341 | |
---|
342 | *darwin*) |
---|
343 | have_darwin="yes" |
---|
344 | # Make sure the Universal SDK is installed |
---|
345 | if test ! -d /Developer/SDKs/MacOSX10.4u.sdk; then |
---|
346 | cat << EOF |
---|
347 | You need to install the Universal SDK in order to build Transmission: |
---|
348 | Get your Xcode CD or package |
---|
349 | Restart the install |
---|
350 | When it gets to "Installation Type", select "Customize" |
---|
351 | Select "Mac OS X 10.4 (Universal) SDK" under "Cross Development" |
---|
352 | Finish the install. |
---|
353 | EOF |
---|
354 | exit 1 |
---|
355 | fi |
---|
356 | ;; |
---|
357 | |
---|
358 | esac |
---|
359 | |
---|
360 | AC_ARG_ENABLE([cli], |
---|
361 | [AS_HELP_STRING([--enable-cli],[build command-line client])], |
---|
362 | [build_cli=${enableval}], |
---|
363 | [build_cli="yes"]) |
---|
364 | AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"]) |
---|
365 | |
---|
366 | AC_ARG_ENABLE([mac], |
---|
367 | [AS_HELP_STRING([--enable-mac],[build OS X client])], |
---|
368 | [build_mac=${enableval}], |
---|
369 | [build_mac=${have_darwin}]) |
---|
370 | AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"]) |
---|
371 | |
---|
372 | AC_ARG_ENABLE([daemon], |
---|
373 | [AS_HELP_STRING([--enable-daemon],[build daemon])], |
---|
374 | [build_daemon=${enableval}], |
---|
375 | [build_daemon="yes"]) |
---|
376 | AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"]) |
---|
377 | |
---|
378 | |
---|
379 | if test "x$have_darwin" = "xyes"; then |
---|
380 | AC_DEFINE([HAVE_DARWIN], 1) |
---|
381 | fi |
---|
382 | if test "x$have_msw" = "xyes"; then |
---|
383 | AC_DEFINE([HAVE_MSW], 1) |
---|
384 | fi |
---|
385 | AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes") |
---|
386 | |
---|
387 | dnl ---------------------------------------------------------------------------- |
---|
388 | dnl |
---|
389 | dnl Generate the output |
---|
390 | |
---|
391 | AC_CONFIG_FILES([Makefile |
---|
392 | transmission.spec |
---|
393 | cli/Makefile |
---|
394 | daemon/Makefile |
---|
395 | doc/Makefile |
---|
396 | libtransmission/Makefile |
---|
397 | third-party/Makefile |
---|
398 | third-party/miniupnp/Makefile |
---|
399 | third-party/libnatpmp/Makefile |
---|
400 | third-party/dht/Makefile |
---|
401 | macosx/Makefile |
---|
402 | gtk/Makefile |
---|
403 | gtk/icons/Makefile |
---|
404 | po/Makefile.in]) |
---|
405 | |
---|
406 | ac_configure_args="$ac_configure_args --enable-static --disable-shared -q" |
---|
407 | AC_OUTPUT |
---|
408 | |
---|
409 | echo " |
---|
410 | |
---|
411 | Configuration: |
---|
412 | |
---|
413 | Source code location: ${srcdir} |
---|
414 | Compiler: ${CXX} |
---|
415 | System or bundled libevent: ${libevent_source} |
---|
416 | DHT support: ${enable_dht} |
---|
417 | |
---|
418 | Build OS X client: ${build_mac} |
---|
419 | Build GTK+ client: ${build_gtk} |
---|
420 | ... with gio support: ${use_gio} |
---|
421 | ... with dbus-glib support: ${use_dbus_glib} |
---|
422 | ... with libnotify support: ${use_libnotify} |
---|
423 | Build Command-Line client: ${build_cli} |
---|
424 | Build Daemon: ${build_daemon} |
---|
425 | |
---|
426 | " |
---|