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.51+]) |
---|
7 | m4_define([peer_id_prefix],[-TR151Z-]) |
---|
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 -funroll-loops " |
---|
26 | CXXFLAGS="$CXXFLAGS -g -O3 -funroll-loops " |
---|
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 | WX_MINIMUM=2.6.0 |
---|
49 | LIBNOTIFY_MINIMUM=0.4.3 |
---|
50 | DBUS_GLIB_MINIMUM=0.70 |
---|
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(WX_MINIMUM) |
---|
57 | AC_SUBST(LIBNOTIFY_MINIMUM) |
---|
58 | AC_SUBST(DBUS_GLIB_MINIMUM) |
---|
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_MSG_CHECKING([for fallocate]) |
---|
85 | AC_TRY_LINK([#include <linux/falloc.h>], |
---|
86 | [return fallocate(-1,0,0,0);], |
---|
87 | [AC_DEFINE([HAVE_FALLOCATE],[1],[Defined if fallocate() exists]) |
---|
88 | AC_MSG_RESULT([yes])], |
---|
89 | [AC_MSG_RESULT([no])]) |
---|
90 | AC_CHECK_FUNCS([lrintf strlcpy daemon dirname basename daemon strcasecmp localtime_r posix_fallocate]) |
---|
91 | AC_PROG_INSTALL |
---|
92 | AC_PROG_MAKE_SET |
---|
93 | ACX_PTHREAD |
---|
94 | |
---|
95 | AC_SEARCH_LIBS([socket], [socket net]) |
---|
96 | AC_SEARCH_LIBS([gethostbyname], [nsl bind]) |
---|
97 | PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM], , [CHECK_SSL()]) |
---|
98 | PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM]) |
---|
99 | AC_PATH_ZLIB |
---|
100 | |
---|
101 | AC_SYS_LARGEFILE |
---|
102 | |
---|
103 | |
---|
104 | dnl ---------------------------------------------------------------------------- |
---|
105 | dnl |
---|
106 | dnl posix_fadvise |
---|
107 | |
---|
108 | dnl can posix_fadvise be used |
---|
109 | AC_CHECK_DECLS(posix_fadvise, [], [], [ |
---|
110 | #define _XOPEN_SOURCE 600 |
---|
111 | #include <fcntl.h>]) |
---|
112 | AC_CHECK_FUNCS([posix_fadvise]) |
---|
113 | |
---|
114 | |
---|
115 | dnl ---------------------------------------------------------------------------- |
---|
116 | dnl |
---|
117 | dnl file monitoring for the daemon |
---|
118 | |
---|
119 | AC_CHECK_HEADER([sys/inotify.h], |
---|
120 | [AC_CHECK_FUNC([inotify_init],[have_inotify="yes"],[have_inotify="no"])], |
---|
121 | [have_inotify="no"]) |
---|
122 | AC_ARG_WITH([inotify], |
---|
123 | [AS_HELP_STRING([--with-inotify],[Enable inotify support (default=auto)])], |
---|
124 | [want_inotify=${enableval}], |
---|
125 | [want_inotify=${have_inotify}]) |
---|
126 | if test "x$want_inotify" = "xyes" ; then |
---|
127 | if test "x$have_inotify" = "xyes"; then |
---|
128 | AC_DEFINE([WITH_INOTIFY],[1]) |
---|
129 | else |
---|
130 | AC_MSG_ERROR("inotify not found!") |
---|
131 | fi |
---|
132 | fi |
---|
133 | |
---|
134 | AC_CHECK_HEADER([sys/event.h], |
---|
135 | [AC_CHECK_FUNC([kqueue],[have_kqueue="yes"],[have_kqueue="no"])], |
---|
136 | [have_kqueue="no"]) |
---|
137 | AC_ARG_WITH([kqueue], |
---|
138 | [AS_HELP_STRING([--with-kqueue],[Enable kqueue support (default=auto)])], |
---|
139 | [want_kqueue=${enableval}], |
---|
140 | [want_kqueue=${have_kqueue}]) |
---|
141 | if test "x$want_kqueue" = "xyes" ; then |
---|
142 | if test "x$have_kqueue" = "xyes"; then |
---|
143 | AC_DEFINE([WITH_KQUEUE],[1]) |
---|
144 | else |
---|
145 | AC_MSG_ERROR("kqueue not found!") |
---|
146 | fi |
---|
147 | fi |
---|
148 | |
---|
149 | AC_CHECK_HEADERS([xfs/xfs.h]) |
---|
150 | |
---|
151 | |
---|
152 | dnl ---------------------------------------------------------------------------- |
---|
153 | dnl |
---|
154 | dnl va_copy |
---|
155 | |
---|
156 | AC_MSG_CHECKING([how to copy va_list]) |
---|
157 | AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);], |
---|
158 | AC_MSG_RESULT([va_copy]), |
---|
159 | [ AH_TEMPLATE([va_copy], [define if va_copy is not available]) |
---|
160 | AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);], |
---|
161 | [ AC_DEFINE([va_copy], [__va_copy]) |
---|
162 | AC_MSG_RESULT([__va_copy])], |
---|
163 | [ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))]) |
---|
164 | AC_MSG_RESULT([memcpy])] |
---|
165 | ) |
---|
166 | ]) |
---|
167 | |
---|
168 | dnl ---------------------------------------------------------------------------- |
---|
169 | dnl |
---|
170 | dnl libevent fun |
---|
171 | |
---|
172 | AC_CONFIG_SUBDIRS([third-party/libevent]) |
---|
173 | AC_MSG_NOTICE([invoking libevent's configure script]) |
---|
174 | LIBEVENT_CPPFLAGS="-I\$(top_srcdir)/third-party/libevent" |
---|
175 | AC_SUBST(LIBEVENT_CPPFLAGS) |
---|
176 | |
---|
177 | |
---|
178 | dnl ---------------------------------------------------------------------------- |
---|
179 | dnl |
---|
180 | dnl detection for the GTK+ client |
---|
181 | |
---|
182 | PKG_CHECK_MODULES(GTK, |
---|
183 | [gtk+-2.0 >= $GTK_MINIMUM |
---|
184 | glib-2.0 >= $GLIB_MINIMUM |
---|
185 | gmodule-2.0 >= $GLIB_MINIMUM |
---|
186 | gthread-2.0 >= $GLIB_MINIMUM], |
---|
187 | [have_gtk=yes], |
---|
188 | [have_gtk=no]) |
---|
189 | AC_ARG_ENABLE([gtk], |
---|
190 | AS_HELP_STRING([--enable-gtk],[build gtk client]), |
---|
191 | [want_gtk=${enableval}], |
---|
192 | [want_gtk=${have_gtk}]) |
---|
193 | build_gtk=no |
---|
194 | use_gio=no |
---|
195 | use_libnotify=no |
---|
196 | use_dbus_glib=no |
---|
197 | if test "x$want_gtk" = "xyes" ; then |
---|
198 | if test "x$have_gtk" = "xyes"; then |
---|
199 | build_gtk=yes |
---|
200 | else |
---|
201 | AC_MSG_ERROR("GTK+ not found!") |
---|
202 | fi |
---|
203 | fi |
---|
204 | AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"]) |
---|
205 | AC_SUBST(GTK_LIBS) |
---|
206 | AC_SUBST(GTK_CFLAGS) |
---|
207 | |
---|
208 | if test "x$build_gtk" = "xyes"; then |
---|
209 | |
---|
210 | PKG_CHECK_MODULES([GIO], |
---|
211 | [gio-2.0 >= $GIO_MINIMUM], |
---|
212 | [use_gio=yes], |
---|
213 | [use_gio=no]) |
---|
214 | AC_SUBST(GIO_LIBS) |
---|
215 | AC_SUBST(GIO_CFLAGS) |
---|
216 | if test "x$use_gio" = "xyes"; then |
---|
217 | AC_DEFINE([HAVE_GIO], 1) |
---|
218 | fi |
---|
219 | |
---|
220 | PKG_CHECK_MODULES([LIBNOTIFY], |
---|
221 | [libnotify >= $LIBNOTIFY_MINIMUM], |
---|
222 | [have_libnotify=yes], |
---|
223 | [have_libnotify=no]) |
---|
224 | AC_ARG_ENABLE([libnotify], |
---|
225 | AS_HELP_STRING([--enable-libnotify],[enable notifications]),, |
---|
226 | [enable_libnotify=yes]) |
---|
227 | use_libnotify=no |
---|
228 | if test "x$enable_libnotify" = "xyes" ; then |
---|
229 | if test "x$have_libnotify" = "xyes"; then |
---|
230 | use_libnotify=yes |
---|
231 | AC_SUBST(LIBNOTIFY_LIBS) |
---|
232 | AC_SUBST(LIBNOTIFY_CFLAGS) |
---|
233 | AC_DEFINE([HAVE_LIBNOTIFY], 1) |
---|
234 | fi |
---|
235 | fi |
---|
236 | |
---|
237 | PKG_CHECK_MODULES([DBUS_GLIB], |
---|
238 | [dbus-glib-1 >= $DBUS_GLIB_MINIMUM], |
---|
239 | [use_dbus_glib=yes], |
---|
240 | [use_dbus_glib=no]) |
---|
241 | AC_SUBST(DBUS_GLIB_LIBS) |
---|
242 | AC_SUBST(DBUS_GLIB_CFLAGS) |
---|
243 | if test "x$use_dbus_glib" = "xyes"; then |
---|
244 | AC_DEFINE([HAVE_DBUS_GLIB], 1) |
---|
245 | fi |
---|
246 | if test "x$use_dbus_glib" = "xyes"; then |
---|
247 | AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no) |
---|
248 | if test "x$DBUS_BINDING_TOOL" = xno; then |
---|
249 | AC_MSG_WARN([Cannot find dbus-binding-tool]) |
---|
250 | use_dbus_glib="no (dbus-binding-tool not found)" |
---|
251 | fi |
---|
252 | fi |
---|
253 | fi |
---|
254 | |
---|
255 | AC_ARG_ENABLE([nls], |
---|
256 | AS_HELP_STRING([--enable-nls],[enable native language support]),, |
---|
257 | [enable_nls=yes]) |
---|
258 | |
---|
259 | if test "x$build_gtk" = "xyes" -a "x$enable_nls" = "xno" ; then |
---|
260 | AC_MSG_ERROR("The gtk client cannot be built without nls support. Try adding either --enable-nls or --disable-gtk" ) |
---|
261 | fi |
---|
262 | |
---|
263 | use_nls=no |
---|
264 | if test "x$enable_nls" = "xyes" ; then |
---|
265 | use_nls=yes |
---|
266 | IT_PROG_INTLTOOL([0.23],[no-xml]) |
---|
267 | AC_CHECK_HEADERS([libintl.h]) |
---|
268 | GETTEXT_PACKAGE=transmission |
---|
269 | AC_SUBST(GETTEXT_PACKAGE) |
---|
270 | AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package]) |
---|
271 | AM_GLIB_GNU_GETTEXT |
---|
272 | transmissionlocaledir='${prefix}/${DATADIRNAME}/locale' |
---|
273 | AC_SUBST(transmissionlocaledir) |
---|
274 | fi |
---|
275 | |
---|
276 | |
---|
277 | dnl ---------------------------------------------------------------------------- |
---|
278 | dnl |
---|
279 | dnl platform-specific stuff. |
---|
280 | |
---|
281 | AC_CANONICAL_HOST |
---|
282 | have_darwin="no" |
---|
283 | have_msw="no" |
---|
284 | case $host_os in |
---|
285 | |
---|
286 | *cygwin|*mingw32*) |
---|
287 | have_msw="yes" |
---|
288 | CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows" |
---|
289 | CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN" |
---|
290 | LIBS="$LIBS -lshell32 -lws2_32" |
---|
291 | transmissionlocaledir="locale" |
---|
292 | if test -z "$host_alias"; then |
---|
293 | hostaliaswindres= |
---|
294 | else |
---|
295 | hostaliaswindres="$host_alias-windres"; |
---|
296 | fi |
---|
297 | AC_CHECK_TOOL(WINDRES, windres) |
---|
298 | ;; |
---|
299 | |
---|
300 | *darwin*) |
---|
301 | have_darwin="yes" |
---|
302 | # Make sure the Universal SDK is installed |
---|
303 | if test ! -d /Developer/SDKs/MacOSX10.4u.sdk; then |
---|
304 | cat << EOF |
---|
305 | You need to install the Universal SDK in order to build Transmission: |
---|
306 | Get your Xcode CD or package |
---|
307 | Restart the install |
---|
308 | When it gets to "Installation Type", select "Customize" |
---|
309 | Select "Mac OS X 10.4 (Universal) SDK" under "Cross Development" |
---|
310 | Finish the install. |
---|
311 | EOF |
---|
312 | exit 1 |
---|
313 | fi |
---|
314 | ;; |
---|
315 | |
---|
316 | esac |
---|
317 | |
---|
318 | AC_ARG_ENABLE([cli], |
---|
319 | [AS_HELP_STRING([--enable-cli],[build command-line client])], |
---|
320 | [build_cli=${enableval}], |
---|
321 | [build_cli="yes"]) |
---|
322 | AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"]) |
---|
323 | |
---|
324 | AC_ARG_ENABLE([mac], |
---|
325 | [AS_HELP_STRING([--enable-mac],[build OS X client])], |
---|
326 | [build_mac=${enableval}], |
---|
327 | [build_mac=${have_darwin}]) |
---|
328 | AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"]) |
---|
329 | |
---|
330 | AC_ARG_ENABLE([daemon], |
---|
331 | [AS_HELP_STRING([--enable-daemon],[build daemon])], |
---|
332 | [build_daemon=${enableval}], |
---|
333 | [build_daemon="yes"]) |
---|
334 | AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"]) |
---|
335 | |
---|
336 | |
---|
337 | if test "x$have_darwin" = "xyes"; then |
---|
338 | AC_DEFINE([HAVE_DARWIN], 1) |
---|
339 | fi |
---|
340 | if test "x$have_msw" = "xyes"; then |
---|
341 | AC_DEFINE([HAVE_MSW], 1) |
---|
342 | fi |
---|
343 | AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes") |
---|
344 | |
---|
345 | dnl ---------------------------------------------------------------------------- |
---|
346 | dnl |
---|
347 | dnl Generate the output |
---|
348 | |
---|
349 | AC_CONFIG_FILES([Makefile |
---|
350 | transmission.spec |
---|
351 | cli/Makefile |
---|
352 | daemon/Makefile |
---|
353 | doc/Makefile |
---|
354 | libtransmission/Makefile |
---|
355 | third-party/Makefile |
---|
356 | third-party/miniupnp/Makefile |
---|
357 | third-party/libnatpmp/Makefile |
---|
358 | macosx/Makefile |
---|
359 | gtk/Makefile |
---|
360 | gtk/icons/Makefile |
---|
361 | po/Makefile.in]) |
---|
362 | |
---|
363 | ac_configure_args="$ac_configure_args --enable-static --disable-shared -q" |
---|
364 | AC_OUTPUT |
---|
365 | |
---|
366 | echo " |
---|
367 | |
---|
368 | Configuration: |
---|
369 | |
---|
370 | Source code location: ${srcdir} |
---|
371 | Compiler: ${CXX} |
---|
372 | Build Command-Line client: ${build_cli} |
---|
373 | Build Daemon: ${build_daemon} |
---|
374 | Build GTK+ client: ${build_gtk} |
---|
375 | ... gio support: ${use_gio} |
---|
376 | ... dbus-glib support: ${use_dbus_glib} |
---|
377 | ... libnotify support: ${use_libnotify} |
---|
378 | Build OS X client: ${build_mac} |
---|
379 | |
---|
380 | " |
---|