1 | dnl convention: -TR MAJOR MINOR MAINT STATUS - (each a single char) |
---|
2 | dnl STATUS: "X" for prerelease test 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.41) |
---|
7 | m4_define([peer_id_prefix],-TR1410-) |
---|
8 | |
---|
9 | AC_INIT([transmission],[user_agent_prefix],[http://trac.transmissionbt.com/newticket]) |
---|
10 | AC_SUBST(USERAGENT_PREFIX,[user_agent_prefix]) |
---|
11 | AC_SUBST(PEERID_PREFIX,[peer_id_prefix]) |
---|
12 | |
---|
13 | AC_CONFIG_MACRO_DIR([m4]) |
---|
14 | |
---|
15 | dnl AM_CONFIG_HEADER(config.h) |
---|
16 | AC_CONFIG_SRCDIR(libtransmission/transmission.h) |
---|
17 | AM_INIT_AUTOMAKE([1.9 tar-ustar]) |
---|
18 | AC_PROG_LIBTOOL |
---|
19 | |
---|
20 | if test m4_substr(peer_id_prefix,6,1) = "Z"; then |
---|
21 | AC_DEFINE(TR_UNSTABLE, 1, [Define to 1 if this is an unstable version of Transmission]) |
---|
22 | TR_UNSTABLE=yes |
---|
23 | fi |
---|
24 | AM_CONDITIONAL(TR_UNSTABLE, test "x$TR_UNSTABLE" = "xyes") |
---|
25 | |
---|
26 | OPENSSL_MINIMUM=0.9.4 |
---|
27 | CURL_MINIMUM=7.16.3 |
---|
28 | GIO_MINIMUM=2.15.5 |
---|
29 | GLIB_MINIMUM=2.6.0 |
---|
30 | GTK_MINIMUM=2.6.0 |
---|
31 | WX_MINIMUM=2.6.0 |
---|
32 | LIBNOTIFY_MINIMUM=0.4.4 |
---|
33 | DBUS_GLIB_MINIMUM=0.70 |
---|
34 | AC_SUBST(OPENSSL_MINIMUM) |
---|
35 | AC_SUBST(CURL_MINIMUM) |
---|
36 | AC_SUBST(GIO_MINIMUM) |
---|
37 | AC_SUBST(GLIB_MINIMUM) |
---|
38 | AC_SUBST(GTK_MINIMUM) |
---|
39 | AC_SUBST(WX_MINIMUM) |
---|
40 | AC_SUBST(LIBNOTIFY_MINIMUM) |
---|
41 | AC_SUBST(DBUS_GLIB_MINIMUM) |
---|
42 | |
---|
43 | AC_PROG_CC |
---|
44 | AC_PROG_CXX |
---|
45 | if test "x$GCC" = "xyes" ; then |
---|
46 | CFLAGS="-g -Wall -Wformat-security -W -Wmissing-prototypes -Wdeclaration-after-statement -O3 -funroll-loops" |
---|
47 | CXXFLAGS="-g -Wall -Wformat-security -W -O3 -funroll-loops" |
---|
48 | fi |
---|
49 | |
---|
50 | AC_HEADER_STDC |
---|
51 | AC_HEADER_TIME |
---|
52 | |
---|
53 | AC_MSG_CHECKING([for fallocate]) |
---|
54 | AC_TRY_LINK([#include <linux/falloc.h>], |
---|
55 | [return fallocate(-1,0,0,0);], |
---|
56 | [AC_DEFINE([HAVE_FALLOCATE],[1],[Defined if fallocate() exists]) |
---|
57 | AC_MSG_RESULT([yes])], |
---|
58 | [AC_MSG_RESULT([no])]) |
---|
59 | AC_CHECK_FUNCS([lrintf strlcpy daemon dirname basename daemon strcasecmp localtime_r posix_fallocate]) |
---|
60 | AC_PROG_INSTALL |
---|
61 | AC_PROG_MAKE_SET |
---|
62 | ACX_PTHREAD |
---|
63 | |
---|
64 | AC_SEARCH_LIBS([socket], [socket net]) |
---|
65 | AC_SEARCH_LIBS([gethostbyname], [nsl bind]) |
---|
66 | PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM], , [CHECK_SSL()]) |
---|
67 | PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM]) |
---|
68 | AC_PATH_ZLIB |
---|
69 | |
---|
70 | AC_SYS_LARGEFILE |
---|
71 | |
---|
72 | dnl ---------------------------------------------------------------------------- |
---|
73 | dnl |
---|
74 | dnl va_copy |
---|
75 | |
---|
76 | AC_MSG_CHECKING([how to copy va_list]) |
---|
77 | AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);], |
---|
78 | AC_MSG_RESULT([va_copy]), |
---|
79 | [ AH_TEMPLATE([va_copy], [define if va_copy is not available]) |
---|
80 | AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);], |
---|
81 | [ AC_DEFINE([va_copy], [__va_copy]) |
---|
82 | AC_MSG_RESULT([__va_copy])], |
---|
83 | [ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))]) |
---|
84 | AC_MSG_RESULT([memcpy])] |
---|
85 | ) |
---|
86 | ]) |
---|
87 | |
---|
88 | |
---|
89 | dnl ---------------------------------------------------------------------------- |
---|
90 | dnl |
---|
91 | dnl libevent fun |
---|
92 | |
---|
93 | AC_CONFIG_SUBDIRS([third-party/libevent]) |
---|
94 | AC_MSG_NOTICE([invoking libevent's configure script]) |
---|
95 | LIBEVENT_CPPFLAGS="-I\$(top_srcdir)/third-party/libevent" |
---|
96 | AC_SUBST(LIBEVENT_CPPFLAGS) |
---|
97 | |
---|
98 | |
---|
99 | dnl ---------------------------------------------------------------------------- |
---|
100 | dnl |
---|
101 | dnl detection for the GTK+ client |
---|
102 | |
---|
103 | PKG_CHECK_MODULES(GTK, |
---|
104 | [gtk+-2.0 >= $GTK_MINIMUM |
---|
105 | glib-2.0 >= $GLIB_MINIMUM |
---|
106 | gmodule-2.0 >= $GLIB_MINIMUM |
---|
107 | gthread-2.0 >= $GLIB_MINIMUM], |
---|
108 | [have_gtk=yes], |
---|
109 | [have_gtk=no]) |
---|
110 | AC_ARG_ENABLE([gtk], |
---|
111 | AC_HELP_STRING([--enable-gtk],[build gtk client]), |
---|
112 | [want_gtk=${enableval}], |
---|
113 | [want_gtk=${have_gtk}]) |
---|
114 | build_gtk=no |
---|
115 | use_gio=no |
---|
116 | use_libnotify=no |
---|
117 | use_dbus_glib=no |
---|
118 | if test "x$want_gtk" = "xyes" ; then |
---|
119 | if test "x$have_gtk" = "xyes"; then |
---|
120 | build_gtk=yes |
---|
121 | else |
---|
122 | AC_MSG_ERROR("GTK+ not found!") |
---|
123 | fi |
---|
124 | fi |
---|
125 | AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"]) |
---|
126 | AC_SUBST(GTK_LIBS) |
---|
127 | AC_SUBST(GTK_CFLAGS) |
---|
128 | |
---|
129 | if test "x$build_gtk" = "xyes"; then |
---|
130 | |
---|
131 | PKG_CHECK_MODULES([GIO], |
---|
132 | [gio-2.0 >= $GIO_MINIMUM], |
---|
133 | [use_gio=yes], |
---|
134 | [use_gio=no]) |
---|
135 | AC_SUBST(GIO_LIBS) |
---|
136 | AC_SUBST(GIO_CFLAGS) |
---|
137 | if test "x$use_gio" = "xyes"; then |
---|
138 | AC_DEFINE([HAVE_GIO], 1) |
---|
139 | fi |
---|
140 | |
---|
141 | PKG_CHECK_MODULES([LIBNOTIFY], |
---|
142 | [libnotify >= $LIBNOTIFY_MINIMUM], |
---|
143 | [have_libnotify=yes], |
---|
144 | [have_libnotify=no]) |
---|
145 | AC_ARG_ENABLE([libnotify], |
---|
146 | AS_HELP_STRING([--enable-libnotify],[enable notifications]),, |
---|
147 | [enable_libnotify=yes]) |
---|
148 | use_libnotify=no |
---|
149 | if test "x$enable_libnotify" = "xyes" ; then |
---|
150 | if test "x$have_libnotify" = "xyes"; then |
---|
151 | use_libnotify=yes |
---|
152 | AC_SUBST(LIBNOTIFY_LIBS) |
---|
153 | AC_SUBST(LIBNOTIFY_CFLAGS) |
---|
154 | AC_DEFINE([HAVE_LIBNOTIFY], 1) |
---|
155 | fi |
---|
156 | fi |
---|
157 | |
---|
158 | PKG_CHECK_MODULES([DBUS_GLIB], |
---|
159 | [dbus-glib-1 >= $DBUS_GLIB_MINIMUM], |
---|
160 | [use_dbus_glib=yes], |
---|
161 | [use_dbus_glib=no]) |
---|
162 | AC_SUBST(DBUS_GLIB_LIBS) |
---|
163 | AC_SUBST(DBUS_GLIB_CFLAGS) |
---|
164 | if test "x$use_dbus_glib" = "xyes"; then |
---|
165 | AC_DEFINE([HAVE_DBUS_GLIB], 1) |
---|
166 | fi |
---|
167 | if test "x$use_dbus_glib" = "xyes"; then |
---|
168 | AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no) |
---|
169 | if test "x$DBUS_BINDING_TOOL" = xno; then |
---|
170 | AC_MSG_WARN([Cannot find dbus-binding-tool]) |
---|
171 | use_dbus_glib="no (dbus-binding-tool not found)" |
---|
172 | fi |
---|
173 | fi |
---|
174 | fi |
---|
175 | |
---|
176 | AC_CHECK_HEADERS([libintl.h]) |
---|
177 | IT_PROG_INTLTOOL([0.23],[no-xml]) |
---|
178 | GETTEXT_PACKAGE=transmission |
---|
179 | AC_SUBST(GETTEXT_PACKAGE) |
---|
180 | AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package]) |
---|
181 | AM_GLIB_GNU_GETTEXT |
---|
182 | transmissionlocaledir='${prefix}/${DATADIRNAME}/locale' |
---|
183 | AC_SUBST(transmissionlocaledir) |
---|
184 | |
---|
185 | |
---|
186 | dnl ---------------------------------------------------------------------------- |
---|
187 | dnl |
---|
188 | dnl wxWidgets detection for the wxWidgets client |
---|
189 | |
---|
190 | build_wx=no |
---|
191 | AC_ARG_ENABLE([wx], |
---|
192 | AC_HELP_STRING([--enable-wx],[build wxWidgets client]), |
---|
193 | [want_wx=${enableval}], |
---|
194 | [want_wx=maybe]) |
---|
195 | if test "x$want_wx" != "xno"; then |
---|
196 | AM_OPTIONS_WXCONFIG |
---|
197 | AM_PATH_WXCONFIG($WX_MINIMUM,[have_wx=yes],[have_wx=no]) |
---|
198 | if test "x$have_wx" = "xyes"; then |
---|
199 | build_wx=yes |
---|
200 | elif test "x$want_wx" = "xyes"; then |
---|
201 | AC_MSG_ERROR("wxWidgets not found!") |
---|
202 | fi |
---|
203 | fi |
---|
204 | AM_CONDITIONAL([BUILD_WX],[test "x$build_wx" = "xyes"]) |
---|
205 | |
---|
206 | |
---|
207 | |
---|
208 | dnl ---------------------------------------------------------------------------- |
---|
209 | dnl |
---|
210 | dnl platform-specific stuff. |
---|
211 | |
---|
212 | AC_CANONICAL_HOST |
---|
213 | have_beos="no" |
---|
214 | have_darwin="no" |
---|
215 | have_msw="no" |
---|
216 | case $host_os in |
---|
217 | |
---|
218 | *cygwin|*mingw32*) |
---|
219 | have_msw="yes" |
---|
220 | CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows" |
---|
221 | CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN" |
---|
222 | LIBS="$LIBS -lshell32 -lws2_32" |
---|
223 | transmissionlocaledir="locale" |
---|
224 | if test -z "$host_alias"; then |
---|
225 | hostaliaswindres= |
---|
226 | else |
---|
227 | hostaliaswindres="$host_alias-windres"; |
---|
228 | fi |
---|
229 | AC_CHECK_TOOL(WINDRES, windres) |
---|
230 | ;; |
---|
231 | |
---|
232 | *beos*) |
---|
233 | have_beos="yes" |
---|
234 | RELEASE=`uname -r` |
---|
235 | case $RELEASE in |
---|
236 | 6.*|5.0.4) # Zeta or R5 / BONE beta 7 |
---|
237 | ;; |
---|
238 | 5.0*) # R5 / net_server |
---|
239 | CPPFLAGS="$CPPFLAGS -DBEOS_NETSERVER" |
---|
240 | ;; |
---|
241 | *) |
---|
242 | AC_MSG_ERROR("Unsupported BeOS version") |
---|
243 | ;; |
---|
244 | esac |
---|
245 | GCCVER=`$CC -dumpversion` |
---|
246 | case $GCCVER in |
---|
247 | 2.95.3*|3*|4*) |
---|
248 | ;; |
---|
249 | 2.9*) |
---|
250 | BEOS_OLDCC=yes |
---|
251 | ;; |
---|
252 | *) |
---|
253 | AC_MSG_ERROR("Unsupported gcc version") |
---|
254 | ;; |
---|
255 | esac |
---|
256 | ;; |
---|
257 | |
---|
258 | *darwin*) |
---|
259 | have_darwin="yes" |
---|
260 | # Make sure the Universal SDK is installed |
---|
261 | if test ! -d /Developer/SDKs/MacOSX10.4u.sdk; then |
---|
262 | cat << EOF |
---|
263 | You need to install the Universal SDK in order to build Transmission: |
---|
264 | Get your Xcode CD or package |
---|
265 | Restart the install |
---|
266 | When it gets to "Installation Type", select "Customize" |
---|
267 | Select "Mac OS X 10.4 (Universal) SDK" under "Cross Development" |
---|
268 | Finish the install. |
---|
269 | EOF |
---|
270 | exit 1 |
---|
271 | fi |
---|
272 | ;; |
---|
273 | |
---|
274 | esac |
---|
275 | |
---|
276 | AC_ARG_ENABLE([beos], |
---|
277 | [AC_HELP_STRING([--enable-beos],[build OS X client])], |
---|
278 | [build_beos=${enableval}], |
---|
279 | [build_beos=${have_beos}]) |
---|
280 | AM_CONDITIONAL([BUILD_BEOS],[test "x$build_beos" = "xyes"]) |
---|
281 | |
---|
282 | AC_ARG_ENABLE([cli], |
---|
283 | [AC_HELP_STRING([--enable-cli],[build command-line client])], |
---|
284 | [build_cli=${enableval}], |
---|
285 | [build_cli="yes"]) |
---|
286 | AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"]) |
---|
287 | |
---|
288 | AC_ARG_ENABLE([mac], |
---|
289 | [AC_HELP_STRING([--enable-mac],[build OS X client])], |
---|
290 | [build_mac=${enableval}], |
---|
291 | [build_mac=${have_darwin}]) |
---|
292 | AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"]) |
---|
293 | |
---|
294 | AC_ARG_ENABLE([daemon], |
---|
295 | [AC_HELP_STRING([--enable-daemon],[build daemon])], |
---|
296 | [build_daemon=${enableval}], |
---|
297 | [build_daemon="yes"]) |
---|
298 | AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"]) |
---|
299 | |
---|
300 | |
---|
301 | if test "x$have_beos" = "xyes"; then |
---|
302 | AC_DEFINE([HAVE_BEOS], 1) |
---|
303 | fi |
---|
304 | if test "x$have_darwin" = "xyes"; then |
---|
305 | AC_DEFINE([HAVE_DARWIN], 1) |
---|
306 | fi |
---|
307 | if test "x$have_msw" = "xyes"; then |
---|
308 | AC_DEFINE([HAVE_MSW], 1) |
---|
309 | fi |
---|
310 | AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes") |
---|
311 | |
---|
312 | dnl ---------------------------------------------------------------------------- |
---|
313 | dnl |
---|
314 | dnl Generate the output |
---|
315 | |
---|
316 | AC_CONFIG_FILES([Makefile |
---|
317 | transmission.spec |
---|
318 | beos/Makefile |
---|
319 | cli/Makefile |
---|
320 | daemon/Makefile |
---|
321 | doc/Makefile |
---|
322 | libtransmission/Makefile |
---|
323 | third-party/Makefile |
---|
324 | third-party/miniupnp/Makefile |
---|
325 | third-party/libnatpmp/Makefile |
---|
326 | macosx/Makefile |
---|
327 | wx/Makefile |
---|
328 | wx/images/Makefile |
---|
329 | gtk/Makefile |
---|
330 | gtk/icons/Makefile |
---|
331 | po/Makefile.in]) |
---|
332 | |
---|
333 | ac_configure_args="$ac_configure_args --enable-static --disable-shared -q" |
---|
334 | AC_OUTPUT |
---|
335 | |
---|
336 | echo " |
---|
337 | |
---|
338 | Configuration: |
---|
339 | |
---|
340 | Source code location: ${srcdir} |
---|
341 | Compiler: ${CXX} |
---|
342 | Build Command-Line client: ${build_cli} |
---|
343 | Build Daemon: ${build_daemon} |
---|
344 | Build BeOS client: ${build_beos} |
---|
345 | Build GTK+ client: ${build_gtk} |
---|
346 | ... gio support: ${use_gio} |
---|
347 | ... dbus-glib support: ${use_dbus_glib} |
---|
348 | ... libnotify support: ${use_libnotify} |
---|
349 | Build OS X client: ${build_mac} |
---|
350 | Build wxWidgets client: ${build_wx} |
---|
351 | |
---|
352 | " |
---|