source: trunk/configure.ac @ 10115

Last change on this file since 10115 was 10115, checked in by charles, 12 years ago

(trunk) poke the peer_id to -TR183P for tracker testing

File size: 15.2 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.83+])
7m4_define([peer_id_prefix],[-TR183P-])
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 fallocate64 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=${withval}],
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=${withval}],
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
251use_canberra=no
252use_libgconf=no
253if test "x$want_gtk" = "xyes" ; then
254    if test "x$have_gtk" = "xyes"; then
255      build_gtk=yes
256    else
257      AC_MSG_ERROR("GTK+ not found!")
258    fi
259fi
260AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"])
261
262if test "x$build_gtk" = "xyes"; then
263
264    PKG_CHECK_MODULES([GIO],
265                      [gio-2.0 >= $GIO_MINIMUM],
266                      [use_gio=yes],
267                      [use_gio=no])
268    if test "x$use_gio" = "xyes"; then
269        AC_DEFINE([HAVE_GIO], 1)
270    fi
271
272    PKG_CHECK_MODULES([LIBNOTIFY],
273                      [libnotify >= $LIBNOTIFY_MINIMUM],
274                      [have_libnotify=yes],
275                      [have_libnotify=no])
276    AC_ARG_ENABLE([libnotify],
277                  AS_HELP_STRING([--enable-libnotify],[enable notifications]),,
278                  [enable_libnotify=yes])
279    use_libnotify=no
280    if test "x$enable_libnotify" = "xyes" ; then
281        if test "x$have_libnotify" = "xyes"; then
282            use_libnotify=yes
283            AC_DEFINE([HAVE_LIBNOTIFY], 1)
284        fi
285    fi
286
287    PKG_CHECK_MODULES([LIBCANBERRA],
288                      [libcanberra-gtk >= $CANBERRA_MINIMUM],
289                      [have_libcanberra=yes],
290                      [have_libcanberra=no])
291    AC_ARG_ENABLE([libcanberra],
292                  AS_HELP_STRING([--enable-libcanberra],[enable sounds]),,
293                  [enable_libcanberra=yes])
294    if test "x$enable_libcanberra" = "xyes" ; then
295        if test "x$have_libcanberra" = "xyes"; then
296            use_canberra=yes
297            AC_DEFINE([HAVE_LIBCANBERRA], 1)
298        fi
299    fi
300
301    PKG_CHECK_MODULES([LIBGCONF],
302                      [gconf-2.0 >= $GCONF2_MINIMUM],
303                      [have_libgconf=yes],
304                      [have_libgconf=no])
305    AC_ARG_ENABLE([gconf2],
306                  AS_HELP_STRING([--enable-libgconf],[enable GConf support]),,
307                  [enable_libgconf=yes])
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    CFLAGS="-DMACOSX $CFLAGS"
389    ;;
390
391esac
392
393AC_ARG_ENABLE([cli],
394              [AS_HELP_STRING([--enable-cli],[build command-line client])],
395              [build_cli=${enableval}],
396              [build_cli="yes"])
397AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
398
399AC_ARG_ENABLE([mac],
400              [AS_HELP_STRING([--enable-mac],[build Mac client])],
401              [build_mac=${enableval}],
402              [build_mac=${have_darwin}])
403AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
404
405AC_ARG_ENABLE([daemon],
406              [AS_HELP_STRING([--enable-daemon],[build daemon])],
407              [build_daemon=${enableval}],
408              [build_daemon="yes"])
409AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
410
411
412if test "x$build_mac" = "xyes" ; then
413    # Make sure the proper Mac SDK is installed
414    if test ! -d /Developer/SDKs/MacOSX10.5.sdk; then
415      cat << EOF
416You need to install the Mac OS X 10.5 SDK in order to build Transmission
417with --enable-mac:
418  Get your Xcode CD or package
419  Restart the install
420  When it gets to "Installation Type", select "Customize"
421  Select "Mac OS X 10.5 SDK" under "Cross Development"
422  Finish the install.
423EOF
424      exit 1
425    fi
426fi
427if test "x$have_darwin" = "xyes"; then
428    AC_DEFINE([HAVE_DARWIN], 1)
429fi
430if test "x$have_msw" = "xyes"; then
431    AC_DEFINE([HAVE_MSW], 1)
432fi
433AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
434
435dnl ----------------------------------------------------------------------------
436dnl
437dnl  Generate the output
438
439AC_CONFIG_FILES([Makefile
440                 transmission.spec
441                 cli/Makefile
442                 daemon/Makefile
443                 doc/Makefile
444                 libtransmission/Makefile
445                 third-party/Makefile
446                 third-party/miniupnp/Makefile
447                 third-party/libnatpmp/Makefile
448                 third-party/dht/Makefile
449                 macosx/Makefile
450                 gtk/Makefile
451                 gtk/icons/Makefile
452                 web/Makefile
453                 web/images/Makefile
454                 web/images/buttons/Makefile
455                 web/images/graphics/Makefile
456                 web/images/progress/Makefile
457                 web/javascript/Makefile
458                 web/javascript/jquery/Makefile
459                 web/stylesheets/Makefile
460                 po/Makefile.in])
461
462ac_configure_args="$ac_configure_args --enable-static --disable-shared -q"
463AC_OUTPUT
464
465echo "
466
467Configuration:
468
469        Source code location:          ${srcdir}
470        Compiler:                      ${CXX}
471        System or bundled libevent:    ${libevent_source}
472
473        Build Mac client:              ${build_mac}
474        Build GTK+ client:             ${build_gtk}
475          ... with canberra support:   ${use_canberra}
476          ... with gio support:        ${use_gio}
477          ... with dbus-glib support:  ${use_dbus_glib}
478          ... with libgconf support:   ${use_libgconf}
479          ... with libnotify support:  ${use_libnotify}
480        Build Command-Line client:     ${build_cli}
481        Build Daemon:                  ${build_daemon}
482
483"
Note: See TracBrowser for help on using the repository browser.