source: trunk/configure.ac @ 10005

Last change on this file since 10005 was 10005, checked in by livings124, 12 years ago

1.82+

File size: 15.1 KB
Line 
1dnl convention: -TR MAJOR MINOR MAINT STATUS - (each a single char)
2dnl STATUS: "X" for prerelease beta builds,
3dnl         "Z" for unsupported trunk builds,
4dnl         "0" for stable, supported releases
5dnl these should be the only two lines you need to change
6m4_define([user_agent_prefix],[1.82+])
7m4_define([peer_id_prefix],[-TR182Z-])
8
9AC_INIT([transmission],
10        [user_agent_prefix],
11        [http://trac.transmissionbt.com/newticket])
12AC_SUBST(USERAGENT_PREFIX,[user_agent_prefix])
13AC_SUBST(PEERID_PREFIX,[peer_id_prefix])
14
15m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
16
17AC_CONFIG_MACRO_DIR([m4])
18
19dnl AM_CONFIG_HEADER(config.h)
20AC_CONFIG_SRCDIR(libtransmission/transmission.h)
21AM_INIT_AUTOMAKE([1.9 tar-ustar])
22AC_PROG_LIBTOOL
23
24if test m4_substr(peer_id_prefix,6,1) = "0"; then
25  supported_build=yes
26  if test "x$GCC" = "xyes" ; then
27    CFLAGS="$CFLAGS -g -O3 "
28    CXXFLAGS="$CXXFLAGS -g -O3 "
29  fi
30  CPPFLAGS="$CPPFLAGS -DNDEBUG"
31else
32  supported_build=no
33  if test "x$GCC" = "xyes" ; then
34    CFLAGS="$CFLAGS -g -O0"
35    CXXFLAGS="$CXXFLAGS -g -O0"
36  fi
37fi
38AM_CONDITIONAL(TR_UNSTABLE, test "x$supported_build" = "xno")
39
40# MANDATORY for libtransmission
41CURL_MINIMUM=7.16.3
42AC_SUBST(CURL_MINIMUM)
43LIBEVENT_MINIMUM=1.4.5
44AC_SUBST(LIBEVENT_MINIUM)
45OPENSSL_MINIMUM=0.9.4
46AC_SUBST(OPENSSL_MINIMUM)
47
48# MANDATORY for the GTK+ client
49GLIB_MINIMUM=2.6.0
50AC_SUBST(GLIB_MINIMUM)
51GTK_MINIMUM=2.6.0
52AC_SUBST(GTK_MINIMUM)
53
54# OPTIONAL for the GTK+ client
55# play the XDG "download done" sound...
56CANBERRA_MINIMUM=0.10
57AC_SUBST(CANBERRA_MINIMUM)
58# inhibit hibernation when a torrent is active...
59DBUS_GLIB_MINIMUM=0.70
60AC_SUBST(DBUS_GLIB_MINIMUM)
61# register the GTK+ client as a magnet link handler...
62GCONF2_MINIMUM=2.20.0
63AC_SUBST(GCONF2_MINIMUM)
64# implement "watch" directories to use new .torrent files...
65GIO_MINIMUM=2.15.5
66AC_SUBST(GIO_MINIMUM)
67# pop up a "download done" notice...
68LIBNOTIFY_MINIMUM=0.4.3
69AC_SUBST(LIBNOTIFY_MINIMUM)
70
71
72AC_PROG_CC
73AC_PROG_CXX
74AC_C_INLINE
75if test "x$GCC" = "xyes" ; then
76
77    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"
78
79    dnl figure out gcc version
80    AC_MSG_CHECKING([gcc version])
81    GCC_VERSION=`$CC -dumpversion`
82    GCC_MAJOR=`echo $GCC_VERSION | cut -d . -f1`
83    GCC_MINOR=`echo $GCC_VERSION | cut -d . -f2`
84    GCC_VERSION_NUM=`(expr $GCC_MAJOR "*" 100 + $GCC_MINOR) 2>/dev/null`
85
86    AC_MSG_RESULT($GCC_VERSION)
87    if test $GCC_VERSION_NUM -ge 304; then
88        dnl these were added in 3.4
89        CFLAGS="$CFLAGS -Wextra -Wdeclaration-after-statement -Winit-self"
90    fi
91fi
92
93AC_HEADER_STDC
94AC_HEADER_TIME
95
96AC_CHECK_FUNCS([pread pwrite lrintf strlcpy daemon dirname basename strcasecmp localtime_r posix_fallocate memmem strtold syslog])
97AC_PROG_INSTALL
98AC_PROG_MAKE_SET
99ACX_PTHREAD
100
101if test "x$ac_cv_func_strtold" != "xyes" ; then
102    CPPFLAGS="$CPPFLAGS -Dstrtold=strtod"
103fi
104
105AC_SEARCH_LIBS(cos, [m])
106AC_SEARCH_LIBS([socket], [socket net])
107AC_SEARCH_LIBS([gethostbyname], [nsl bind])
108PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM], , [CHECK_SSL()])
109PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM])
110AC_PATH_ZLIB
111
112AC_SYS_LARGEFILE
113AC_CHECK_FUNCS([lseek64])
114
115
116dnl ----------------------------------------------------------------------------
117dnl
118dnl posix_fadvise
119
120dnl can posix_fadvise be used
121AC_CHECK_DECLS(posix_fadvise, [], [], [
122#define _XOPEN_SOURCE 600
123#include <fcntl.h>])
124AC_CHECK_FUNCS([posix_fadvise])
125
126
127dnl ----------------------------------------------------------------------------
128dnl
129dnl file monitoring for the daemon
130
131AC_CHECK_HEADER([sys/inotify.h],
132                [AC_CHECK_FUNC([inotify_init],[have_inotify="yes"],[have_inotify="no"])],
133                [have_inotify="no"])
134AC_ARG_WITH([inotify],
135            [AS_HELP_STRING([--with-inotify],[Enable inotify support (default=auto)])],
136            [want_inotify=${enableval}],
137            [want_inotify=${have_inotify}])
138if test "x$want_inotify" = "xyes" ; then
139    if test "x$have_inotify" = "xyes"; then
140      AC_DEFINE([WITH_INOTIFY],[1])
141    else
142      AC_MSG_ERROR("inotify not found!")
143    fi
144fi
145 
146AC_CHECK_HEADER([sys/event.h],
147                [AC_CHECK_FUNC([kqueue],[have_kqueue="yes"],[have_kqueue="no"])],
148                [have_kqueue="no"])
149AC_ARG_WITH([kqueue],
150            [AS_HELP_STRING([--with-kqueue],[Enable kqueue support (default=auto)])],
151            [want_kqueue=${enableval}],
152            [want_kqueue=${have_kqueue}])
153if test "x$want_kqueue" = "xyes" ; then
154    if test "x$have_kqueue" = "xyes"; then
155      AC_DEFINE([WITH_KQUEUE],[1])
156    else
157      AC_MSG_ERROR("kqueue not found!")
158    fi
159fi
160
161AC_CHECK_HEADERS([xfs/xfs.h])
162
163
164dnl ----------------------------------------------------------------------------
165dnl
166dnl va_copy
167
168AC_MSG_CHECKING([how to copy va_list])
169AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);],
170    AC_MSG_RESULT([va_copy]),
171        [ AH_TEMPLATE([va_copy], [define if va_copy is not available])
172        AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);],
173        [ AC_DEFINE([va_copy], [__va_copy])
174        AC_MSG_RESULT([__va_copy])],
175        [ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))])
176        AC_MSG_RESULT([memcpy])]
177    )
178])
179
180
181dnl libevent likes to link against librt if possible
182dnl for clock_gettime() and clock_settime()
183dnl TODO(libevent2): this can probably be removed after
184dnl we switch to libevent2, since it will have PKG_CONFIG
185AC_CHECK_LIB([rt],
186             [clock_gettime],
187             [libevent_extra_libs="-lrt"],
188             [libevent_extra_libs=""])
189
190dnl build our copy of libevent whether we use it or not,
191dnl because "make dist" needs its Makefiles to exist, and
192dnl AM_CONDITIONAL + AC_CONFIG_SUBDIRS don't seem to play nice
193AC_CONFIG_SUBDIRS([third-party/libevent])
194libevent_source=bundled
195AC_CHECK_LIB([event],[evutil_vsnprintf],
196             [libevent_found=yes],
197             [libevent_found=no],
198             [$libevent_extra_libs])
199AC_CHECK_HEADER([event-config.h],
200                [libevent_headers_found=yes],
201                [libevent_headers_found=no])
202libevent_source=bundled
203if test "x$libevent_found" = "xyes" ; then
204    if test "x$libevent_headers_found" = "xyes"; then
205        libevent_source=system
206    fi
207fi
208if test "x$libevent_source" = "xbundled"; then
209    AC_MSG_WARN([using our own libevent from third-party/libevent/])
210    AC_MSG_WARN([if you are cross-compiling this is probably NOT what you want.])
211    LIBEVENT_CFLAGS="-I\$(top_srcdir)/third-party/libevent -I\$(top_builddir)/third-party/libevent"
212    LIBEVENT_LIBS="\$(top_builddir)/third-party/libevent/libevent.la"
213else
214    LIBEVENT_CFLAGS=""
215    LIBEVENT_LIBS="-levent $libevent_extra_libs"
216fi
217AC_ARG_VAR([LIBEVENT_CFLAGS], [C compiler flags for LIBEVENT, overriding pkg-config])dnl
218AC_ARG_VAR([LIBEVENT_LIBS], [linker flags for LIBEVENT, overriding pkg-config])dnl
219
220
221
222dnl ----------------------------------------------------------------------------
223dnl
224dnl  dht
225
226DHT_CFLAGS="-I\$(top_srcdir)/third-party/dht"
227DHT_LIBS="\$(top_builddir)/third-party/dht/libdht.a"
228AC_SUBST(DHT_CFLAGS)
229AC_SUBST(DHT_LIBS)
230
231
232dnl ----------------------------------------------------------------------------
233dnl
234dnl  detection for the GTK+ client
235
236PKG_CHECK_MODULES(GTK,
237                  [gtk+-2.0 >= $GTK_MINIMUM
238                   glib-2.0 >= $GLIB_MINIMUM
239                   gmodule-2.0 >= $GLIB_MINIMUM
240                   gthread-2.0 >= $GLIB_MINIMUM],
241                  [have_gtk=yes],
242                  [have_gtk=no])
243AC_ARG_ENABLE([gtk],
244              AS_HELP_STRING([--enable-gtk],[build gtk client]),
245              [want_gtk=${enableval}],
246              [want_gtk=${have_gtk}])
247build_gtk=no
248use_gio=no
249use_libnotify=no
250use_dbus_glib=no
251if test "x$want_gtk" = "xyes" ; then
252    if test "x$have_gtk" = "xyes"; then
253      build_gtk=yes
254    else
255      AC_MSG_ERROR("GTK+ not found!")
256    fi
257fi
258AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"])
259
260if test "x$build_gtk" = "xyes"; then
261
262    PKG_CHECK_MODULES([GIO],
263                      [gio-2.0 >= $GIO_MINIMUM],
264                      [use_gio=yes],
265                      [use_gio=no])
266    if test "x$use_gio" = "xyes"; then
267        AC_DEFINE([HAVE_GIO], 1)
268    fi
269
270    PKG_CHECK_MODULES([LIBNOTIFY],
271                      [libnotify >= $LIBNOTIFY_MINIMUM],
272                      [have_libnotify=yes],
273                      [have_libnotify=no])
274    AC_ARG_ENABLE([libnotify],
275                  AS_HELP_STRING([--enable-libnotify],[enable notifications]),,
276                  [enable_libnotify=yes])
277    use_libnotify=no
278    if test "x$enable_libnotify" = "xyes" ; then
279        if test "x$have_libnotify" = "xyes"; then
280            use_libnotify=yes
281            AC_DEFINE([HAVE_LIBNOTIFY], 1)
282        fi
283    fi
284
285    PKG_CHECK_MODULES([LIBCANBERRA],
286                      [libcanberra-gtk >= $CANBERRA_MINIMUM],
287                      [have_libcanberra=yes],
288                      [have_libcanberra=no])
289    AC_ARG_ENABLE([libcanberra],
290                  AS_HELP_STRING([--enable-libcanberra],[enable sounds]),,
291                  [enable_libcanberra=yes])
292    use_canberra=no
293    if test "x$enable_libcanberra" = "xyes" ; then
294        if test "x$have_libcanberra" = "xyes"; then
295            use_canberra=yes
296            AC_DEFINE([HAVE_LIBCANBERRA], 1)
297        fi
298    fi
299
300    PKG_CHECK_MODULES([LIBGCONF],
301                      [gconf-2.0 >= $GCONF2_MINIMUM],
302                      [have_libgconf=yes],
303                      [have_libgconf=no])
304    AC_ARG_ENABLE([gconf2],
305                  AS_HELP_STRING([--enable-libgconf],[enable GConf support]),,
306                  [enable_libgconf=yes])
307    use_libgconf=no
308    if test "x$enable_libgconf" = "xyes" ; then
309        if test "x$have_libgconf" = "xyes"; then
310            use_libgconf=yes
311            AC_DEFINE([HAVE_LIBGCONF], 1)
312        fi
313    fi
314
315    PKG_CHECK_MODULES([DBUS_GLIB],
316                      [dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
317                      [use_dbus_glib=yes],
318                      [use_dbus_glib=no])
319    if test "x$use_dbus_glib" = "xyes"; then
320        AC_DEFINE([HAVE_DBUS_GLIB], 1)
321    fi
322    if test "x$use_dbus_glib" = "xyes"; then
323        AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
324        if test "x$DBUS_BINDING_TOOL" = xno; then
325          AC_MSG_WARN([Cannot find dbus-binding-tool])
326          use_dbus_glib="no (dbus-binding-tool not found)"
327        fi
328    fi
329fi
330
331AC_ARG_ENABLE([nls],
332              AS_HELP_STRING([--enable-nls],[enable native language support]),,
333              [enable_nls=yes])
334
335if test "x$build_gtk" = "xyes" -a  "x$enable_nls" = "xno" ; then
336    AC_MSG_ERROR("The gtk client cannot be built without nls support.  Try adding either --enable-nls or --disable-gtk" )
337fi
338
339dnl This section is only used for internationalization.
340dnl If you don't need translations and this section gives you trouble --
341dnl such as if you're building for a headless system --
342dnl it's okay to tear this section out and re-build the configure script.
343dnl
344dnl Note to packagers: the bump to intltool 0.40 was made to fix
345dnl a "make check" failure on some systems.  if upgrading to 0.40 is
346dnl a problem and the old version was working fine for you,
347dnl it should be safe to re-edit 0.40 back down to 0.23
348
349use_nls=no
350if test "x$enable_nls" = "xyes" ; then
351    use_nls=yes
352    IT_PROG_INTLTOOL([0.40.0],[no-xml])
353    AC_CHECK_HEADERS([libintl.h])
354    GETTEXT_PACKAGE=transmission
355    AC_SUBST(GETTEXT_PACKAGE)
356    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
357    AM_GLIB_GNU_GETTEXT
358    transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
359    AC_SUBST(transmissionlocaledir)
360fi
361
362
363dnl ----------------------------------------------------------------------------
364dnl
365dnl  platform-specific stuff.
366
367AC_CANONICAL_HOST
368have_darwin="no"
369have_msw="no"
370case $host_os in
371
372   *mingw32*)
373     have_msw="yes"
374     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
375     CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
376     LIBS="$LIBS -lshell32 -lws2_32"
377     transmissionlocaledir="locale"
378     if test -z "$host_alias"; then
379       hostaliaswindres=
380     else
381       hostaliaswindres="$host_alias-windres";
382     fi
383     AC_CHECK_TOOL(WINDRES, windres)
384     ;;
385
386  *darwin*)
387    have_darwin="yes"
388    # Make sure the proper Mac SDK is installed
389    if test ! -d /Developer/SDKs/MacOSX10.5.sdk; then
390      cat << EOF
391You need to install the Mac OS X 10.5 SDK in order to build Transmission:
392  Get your Xcode CD or package
393  Restart the install
394  When it gets to "Installation Type", select "Customize"
395  Select "Mac OS X 10.5 SDK" under "Cross Development"
396  Finish the install.
397EOF
398      exit 1
399    fi
400    ;;
401
402esac
403
404AC_ARG_ENABLE([cli],
405              [AS_HELP_STRING([--enable-cli],[build command-line client])],
406              [build_cli=${enableval}],
407              [build_cli="yes"])
408AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
409
410AC_ARG_ENABLE([mac],
411              [AS_HELP_STRING([--enable-mac],[build Mac client])],
412              [build_mac=${enableval}],
413              [build_mac=${have_darwin}])
414AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
415
416AC_ARG_ENABLE([daemon],
417              [AS_HELP_STRING([--enable-daemon],[build daemon])],
418              [build_daemon=${enableval}],
419              [build_daemon="yes"])
420AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
421
422
423if test "x$have_darwin" = "xyes"; then
424    AC_DEFINE([HAVE_DARWIN], 1)
425fi
426if test "x$have_msw" = "xyes"; then
427    AC_DEFINE([HAVE_MSW], 1)
428fi
429AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
430
431dnl ----------------------------------------------------------------------------
432dnl
433dnl  Generate the output
434
435AC_CONFIG_FILES([Makefile
436                 transmission.spec
437                 cli/Makefile
438                 daemon/Makefile
439                 doc/Makefile
440                 libtransmission/Makefile
441                 third-party/Makefile
442                 third-party/miniupnp/Makefile
443                 third-party/libnatpmp/Makefile
444                 third-party/dht/Makefile
445                 macosx/Makefile
446                 gtk/Makefile
447                 gtk/icons/Makefile
448                 web/Makefile
449                 web/images/Makefile
450                 web/images/buttons/Makefile
451                 web/images/graphics/Makefile
452                 web/images/progress/Makefile
453                 web/javascript/Makefile
454                 web/javascript/jquery/Makefile
455                 web/stylesheets/Makefile
456                 po/Makefile.in])
457
458ac_configure_args="$ac_configure_args --enable-static --disable-shared -q"
459AC_OUTPUT
460
461echo "
462
463Configuration:
464
465        Source code location:          ${srcdir}
466        Compiler:                      ${CXX}
467        System or bundled libevent:    ${libevent_source}
468
469        Build Mac client:              ${build_mac}
470        Build GTK+ client:             ${build_gtk}
471          ... with canberra support:   ${use_canberra}
472          ... with gio support:        ${use_gio}
473          ... with dbus-glib support:  ${use_dbus_glib}
474          ... with libgconf support:   ${use_libgconf}
475          ... with libnotify support:  ${use_libnotify}
476        Build Command-Line client:     ${build_cli}
477        Build Daemon:                  ${build_daemon}
478
479"
Note: See TracBrowser for help on using the repository browser.