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