source: trunk/configure.ac @ 12562

Last change on this file since 12562 was 12562, checked in by jordan, 11 years ago

(trunk gtk) #4366 "Use GAppInfo, rather than GConf2, for mime-type registration" -- done.

File size: 16.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],[2.32+])
7m4_define([peer_id_prefix],[-TR232Z-])
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-pax])
22AC_PROG_LIBTOOL
23
24if test m4_substr(peer_id_prefix,6,1) = "0"; then
25  supported_build=yes
26  CPPFLAGS="$CPPFLAGS -DNDEBUG"
27else
28  supported_build=no
29  if test "x$GCC" = "xyes" ; then
30    CFLAGS="$CFLAGS -g -O0"
31    CXXFLAGS="$CXXFLAGS -g -O0"
32  fi
33fi
34AM_CONDITIONAL(TR_UNSTABLE, test "x$supported_build" = "xno")
35
36##
37##
38##   MANDATORY for everything
39##
40##
41CURL_MINIMUM=7.15.4
42AC_SUBST(CURL_MINIMUM)
43LIBEVENT_MINIMUM=2.0.10
44AC_SUBST(LIBEVENT_MINIUM)
45OPENSSL_MINIMUM=0.9.4
46AC_SUBST(OPENSSL_MINIMUM)
47
48##
49##
50##   MANDATORY for the GTK+ client
51##
52##
53GLIB_MINIMUM=2.8.0
54AC_SUBST(GLIB_MINIMUM)
55GTK_MINIMUM=2.8.0
56AC_SUBST(GTK_MINIMUM)
57
58##
59##
60##   OPTIONAL for the GTK+ client
61##
62##
63# play the XDG "download done" sound...
64CANBERRA_MINIMUM=0.10
65AC_SUBST(CANBERRA_MINIMUM)
66# inhibit hibernation when a torrent is active...
67DBUS_GLIB_MINIMUM=0.70
68AC_SUBST(DBUS_GLIB_MINIMUM)
69# implement "watch" directories to use new .torrent files...
70GIO_MINIMUM=2.15.5
71AC_SUBST(GIO_MINIMUM)
72# pop up a "download done" notice...
73LIBNOTIFY_MINIMUM=0.4.3
74AC_SUBST(LIBNOTIFY_MINIMUM)
75# create the tray icon with AppIndicator
76LIBAPPINDICATOR_MINIMUM=0.0.11
77  AC_SUBST(LIBAPPINDICATOR_MINIMUM)
78
79
80AC_PROG_CC
81AC_PROG_CXX
82AC_C_INLINE
83if test "x$GCC" = "xyes" ; then
84
85    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 -Winline -Wfloat-equal"
86
87    dnl figure out gcc version
88    AC_MSG_CHECKING([gcc version])
89    GCC_VERSION=`$CC -dumpversion`
90    GCC_MAJOR=`echo $GCC_VERSION | cut -d . -f1`
91    GCC_MINOR=`echo $GCC_VERSION | cut -d . -f2`
92    GCC_VERSION_NUM=`(expr $GCC_MAJOR "*" 100 + $GCC_MINOR) 2>/dev/null`
93
94    AC_MSG_RESULT($GCC_VERSION)
95    if test $GCC_VERSION_NUM -ge 304; then
96        dnl these were added in 3.4
97        CFLAGS="$CFLAGS -Wextra -Wdeclaration-after-statement -Winit-self"
98    fi
99    if test $GCC_VERSION_NUM -ge 403; then
100        dnl these were added in 4.3
101        CFLAGS="$CFLAGS -Wvariadic-macros"
102    fi
103fi
104
105AC_HEADER_STDC
106AC_HEADER_TIME
107
108AC_CHECK_HEADERS([stdbool.h])
109AC_CHECK_FUNCS([iconv_open pread pwrite lrintf strlcpy daemon dirname basename strcasecmp localtime_r fallocate64 posix_fallocate memmem strsep strtold syslog valloc getpagesize posix_memalign statvfs htonll ntohll])
110AC_PROG_INSTALL
111AC_PROG_MAKE_SET
112ACX_PTHREAD
113
114if test "x$ac_cv_func_strtold" != "xyes" ; then
115    CPPFLAGS="$CPPFLAGS -Dstrtold=strtod"
116fi
117
118AC_SEARCH_LIBS(cos, [m])
119AC_SEARCH_LIBS([socket], [socket net])
120AC_SEARCH_LIBS([gethostbyname], [nsl bind])
121PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM], , [CHECK_SSL()])
122PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM])
123PKG_CHECK_MODULES(LIBEVENT, [libevent >= $LIBEVENT_MINIMUM])
124AC_PATH_ZLIB
125
126AC_SYS_LARGEFILE
127AC_CHECK_FUNCS([lseek64])
128
129
130dnl ----------------------------------------------------------------------------
131dnl
132dnl posix_fadvise
133
134dnl can posix_fadvise be used
135AC_CHECK_DECLS(posix_fadvise, [], [], [
136#define _XOPEN_SOURCE 600
137#include <fcntl.h>])
138AC_CHECK_FUNCS([posix_fadvise])
139
140
141dnl ----------------------------------------------------------------------------
142dnl
143dnl file monitoring for the daemon
144
145AC_CHECK_HEADER([sys/inotify.h],
146                [AC_CHECK_FUNC([inotify_init],[have_inotify="yes"],[have_inotify="no"])],
147                [have_inotify="no"])
148AC_ARG_WITH([inotify],
149            [AS_HELP_STRING([--with-inotify],[Enable inotify support (default=auto)])],
150            [want_inotify=${withval}],
151            [want_inotify=${have_inotify}])
152if test "x$want_inotify" = "xyes" ; then
153    if test "x$have_inotify" = "xyes"; then
154      AC_DEFINE([WITH_INOTIFY],[1])
155    else
156      AC_MSG_ERROR("inotify not found!")
157    fi
158fi
159 
160AC_CHECK_HEADER([sys/event.h],
161                [AC_CHECK_FUNC([kqueue],[have_kqueue="yes"],[have_kqueue="no"])],
162                [have_kqueue="no"])
163AC_ARG_WITH([kqueue],
164            [AS_HELP_STRING([--with-kqueue],[Enable kqueue support (default=auto)])],
165            [want_kqueue=${withval}],
166            [want_kqueue=${have_kqueue}])
167if test "x$want_kqueue" = "xyes" ; then
168    if test "x$have_kqueue" = "xyes"; then
169      AC_DEFINE([WITH_KQUEUE],[1])
170    else
171      AC_MSG_ERROR("kqueue not found!")
172    fi
173fi
174
175AC_CHECK_HEADERS([sys/statvfs.h \
176                  xfs/xfs.h])
177
178
179dnl ----------------------------------------------------------------------------
180dnl
181dnl va_copy
182
183AC_MSG_CHECKING([how to copy va_list])
184AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);],
185    AC_MSG_RESULT([va_copy]),
186        [ AH_TEMPLATE([va_copy], [define if va_copy is not available])
187        AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);],
188        [ AC_DEFINE([va_copy], [__va_copy])
189        AC_MSG_RESULT([__va_copy])],
190        [ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))])
191        AC_MSG_RESULT([memcpy])]
192    )
193])
194
195
196dnl ----------------------------------------------------------------------------
197dnl
198dnl  dht
199
200DHT_CFLAGS="-I\$(top_srcdir)/third-party/dht"
201DHT_LIBS="\$(top_builddir)/third-party/dht/libdht.a"
202AC_SUBST(DHT_CFLAGS)
203AC_SUBST(DHT_LIBS)
204
205
206dnl ----------------------------------------------------------------------------
207dnl
208dnl  utp
209
210AC_CHECK_LIB([rt],
211             [clock_gettime],
212             [libutp_extra_libs="-lrt"],
213             [libutp_extra_libs=""])
214
215AC_MSG_CHECKING([µTP])
216build_utp="no"
217if test "x$CXX" = "x" ; then
218    have_utp="no"
219else
220    have_utp="yes"
221fi
222AC_ARG_ENABLE([utp],
223              AS_HELP_STRING([--enable-utp],[build µTP support]),
224              [want_utp=${enableval}],
225              [want_utp=${have_utp}])
226if test "x$want_utp" = "xyes" ; then
227    if test "x$have_utp" = "xyes"; then
228        LIBUTP_CFLAGS="-I\$(top_srcdir)/third-party/"
229        LIBUTP_LIBS="\$(top_builddir)/third-party/libutp/libutp.a"
230        if test "x$libutp_extra_libs" != "x" ; then
231           LIBUTP_LIBS="$LIBUTP_LIBS $libutp_extra_libs"
232        fi
233        AC_DEFINE([WITH_UTP],[1])
234        build_utp="yes"
235    else
236      AC_MSG_ERROR("Unable to build uTP support -- C++ compiler not found")
237    fi
238fi
239AC_SUBST(LIBUTP_CFLAGS)
240AC_SUBST(LIBUTP_LIBS)
241AM_CONDITIONAL([BUILD_UTP],[test "x$build_utp" = "xyes"])
242AC_MSG_RESULT([$build_utp])
243
244
245dnl ----------------------------------------------------------------------------
246dnl
247dnl  detection for the GTK+ client
248
249PKG_CHECK_MODULES(GTK,
250                  [gtk+-2.0 >= $GTK_MINIMUM
251                   glib-2.0 >= $GLIB_MINIMUM
252                   gmodule-2.0 >= $GLIB_MINIMUM
253                   gthread-2.0 >= $GLIB_MINIMUM],
254                  [have_gtk=yes],
255                  [have_gtk=no])
256AC_ARG_ENABLE([gtk],
257              AS_HELP_STRING([--enable-gtk],[build gtk client]),
258              [want_gtk=${enableval}],
259              [want_gtk=${have_gtk}])
260build_gtk=no
261use_gio=no
262use_libappindicator=no
263use_libnotify=no
264use_dbus_glib=no
265use_canberra=no
266if test "x$want_gtk" = "xyes" ; then
267    if test "x$have_gtk" = "xyes"; then
268      build_gtk=yes
269    else
270      AC_MSG_ERROR("GTK+ not found!")
271    fi
272fi
273AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"])
274
275if test "x$build_gtk" = "xyes"; then
276
277    PKG_CHECK_MODULES([GIO],
278                      [gio-2.0 >= $GIO_MINIMUM],
279                      [use_gio=yes],
280                      [use_gio=no])
281    if test "x$use_gio" = "xyes"; then
282        AC_DEFINE([HAVE_GIO], 1)
283    fi
284
285    PKG_CHECK_MODULES([LIBNOTIFY],
286                      [libnotify >= $LIBNOTIFY_MINIMUM],
287                      [have_libnotify=yes],
288                      [have_libnotify=no])
289    AC_ARG_ENABLE([libnotify],
290                  AS_HELP_STRING([--enable-libnotify],[enable notifications]),,
291                  [enable_libnotify=yes])
292    use_libnotify=no
293    if test "x$have_libnotify" = "xyes"; then
294        if test "x$enable_libnotify" = "xyes" ; then
295            use_libnotify=yes
296            AC_DEFINE([HAVE_LIBNOTIFY], 1)
297        else
298            LIBNOTIFY_CFLAGS=
299            LIBNOTIFY_LIBS=
300        fi
301    fi
302
303    PKG_CHECK_MODULES([LIBAPPINDICATOR],
304                      [appindicator-0.1 >= $LIBAPPINDICATOR_MINIMUM],
305                      [have_libappindicator=yes],
306                      [have_libappindicator=no])
307
308    AC_ARG_ENABLE([libappindicator],
309                  AS_HELP_STRING([--enable-libappindicator],[enable AppIndicator support]),,
310                  [enable_libappindicator=yes])
311    use_libappindicator=no
312    if test "x$have_libappindicator" = "xyes"; then
313        if test "x$enable_libappindicator" = "xyes" ; then
314            use_libappindicator=yes
315            AC_DEFINE([HAVE_LIBAPPINDICATOR], 1)
316        else
317            LIBAPPINDICATOR_CFLAGS=
318            LIBAPPINDICATOR_LIBS=
319        fi
320    fi
321
322    PKG_CHECK_MODULES([LIBCANBERRA],
323                      [libcanberra-gtk >= $CANBERRA_MINIMUM],
324                      [have_libcanberra=yes],
325                      [have_libcanberra=no])
326    AC_ARG_ENABLE([libcanberra],
327                  AS_HELP_STRING([--enable-libcanberra],[enable sounds]),,
328                  [enable_libcanberra=yes])
329    if test "x$have_libcanberra" = "xyes"; then
330        if test "x$enable_libcanberra" = "xyes" ; then
331            use_canberra=yes
332            AC_DEFINE([HAVE_LIBCANBERRA], 1)
333        else
334            LIBCANBERRA_CFLAGS=
335            LIBCANBERRA_LIBS=
336        fi
337    fi
338
339    PKG_CHECK_MODULES([DBUS_GLIB],
340                      [dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
341                      [use_dbus_glib=yes],
342                      [use_dbus_glib=no])
343    if test "x$use_dbus_glib" = "xyes"; then
344        AC_DEFINE([HAVE_DBUS_GLIB], 1)
345    fi
346    if test "x$use_dbus_glib" = "xyes"; then
347        AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
348        if test "x$DBUS_BINDING_TOOL" = xno; then
349          AC_MSG_WARN([Cannot find dbus-binding-tool])
350          use_dbus_glib="no (dbus-binding-tool not found)"
351        fi
352    fi
353fi
354
355AC_ARG_ENABLE([nls],
356              AS_HELP_STRING([--enable-nls],[enable native language support]),,
357              [enable_nls=yes])
358
359if test "x$build_gtk" = "xyes" -a  "x$enable_nls" = "xno" ; then
360    AC_MSG_ERROR("The gtk client cannot be built without nls support.  Try adding either --enable-nls or --disable-gtk" )
361fi
362
363dnl This section is only used for internationalization.
364dnl If you don't need translations and this section gives you trouble --
365dnl such as if you're building for a headless system --
366dnl it's okay to tear this section out and re-build the configure script.
367dnl
368dnl Note to packagers: the bump to intltool 0.40 was made to fix
369dnl a "make check" failure on some systems.  if upgrading to 0.40 is
370dnl a problem and the old version was working fine for you,
371dnl it should be safe to re-edit 0.40 back down to 0.23
372
373use_nls=no
374if test "x$enable_nls" = "xyes" ; then
375    use_nls=yes
376    IT_PROG_INTLTOOL([0.35.0],[no-xml])
377    AC_CHECK_HEADERS([libintl.h])
378    GETTEXT_PACKAGE=transmission-gtk
379    AC_SUBST(GETTEXT_PACKAGE)
380    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
381    AM_GLIB_GNU_GETTEXT
382    transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
383    AC_SUBST(transmissionlocaledir)
384fi
385AC_SUBST(INTLLIBS)
386
387
388dnl ----------------------------------------------------------------------------
389dnl
390dnl  platform-specific stuff.
391
392AC_CANONICAL_HOST
393have_darwin="no"
394have_msw="no"
395case $host_os in
396
397   *mingw32*)
398     have_msw="yes"
399     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
400     CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
401     LIBS="$LIBS -liphlpapi -lshell32 -lws2_32"
402     transmissionlocaledir="locale"
403     if test -z "$host_alias"; then
404       hostaliaswindres=
405     else
406       hostaliaswindres="$host_alias-windres";
407     fi
408     AC_CHECK_TOOL(WINDRES, windres)
409     ;;
410
411  *darwin*)
412    have_darwin="yes"
413    CFLAGS="-DMACOSX $CFLAGS"
414    ;;
415
416esac
417
418AC_ARG_ENABLE([lightweight],
419              AS_HELP_STRING([--enable-lightweight],[optimize libtransmission for low-resource systems: smaller cache size, prefer unencrypted peer connections, etc.]),
420              [enable_lightweight=${enableval}],
421              [enable_lightweight="no"])
422if test "x$enable_lightweight" = "xyes" ; then
423  AC_DEFINE([TR_LIGHTWEIGHT],[1],[optimize libtransmission for low-resource systems])
424fi
425
426AC_ARG_ENABLE([cli],
427              [AS_HELP_STRING([--enable-cli],[build command-line client])],
428              [build_cli=${enableval}],
429              [build_cli="yes"])
430AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
431
432AC_ARG_ENABLE([mac],
433              [AS_HELP_STRING([--enable-mac],[build Mac client])],
434              [build_mac=${enableval}],
435              [build_mac=${have_darwin}])
436AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
437
438AC_ARG_ENABLE([daemon],
439              [AS_HELP_STRING([--enable-daemon],[build daemon])],
440              [build_daemon=${enableval}],
441              [build_daemon="yes"])
442AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
443
444
445if test "x$build_mac" = "xyes" ; then
446    # Make sure the proper Mac SDK is installed
447    if test ! -d /Developer/SDKs/MacOSX10.5.sdk; then
448      cat << EOF
449You need to install the Mac OS X 10.5 SDK in order to build Transmission
450with --enable-mac:
451  Get your Xcode CD or package
452  Restart the install
453  When it gets to "Installation Type", select "Customize"
454  Select "Mac OS X 10.5 SDK" under "Cross Development"
455  Finish the install.
456EOF
457      exit 1
458    fi
459fi
460if test "x$have_darwin" = "xyes"; then
461    AC_DEFINE([HAVE_DARWIN], 1)
462fi
463if test "x$have_msw" = "xyes"; then
464    AC_DEFINE([HAVE_MSW], 1)
465fi
466AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
467
468dnl ----------------------------------------------------------------------------
469dnl
470dnl  Generate the output
471
472AC_CONFIG_FILES([Makefile
473                 transmission-gtk.spec
474                 cli/Makefile
475                 daemon/Makefile
476                 extras/Makefile
477                 libtransmission/Makefile
478                 utils/Makefile
479                 third-party/Makefile
480                 third-party/miniupnp/Makefile
481                 third-party/libnatpmp/Makefile
482                 third-party/libutp/Makefile
483                 third-party/dht/Makefile
484                 macosx/Makefile
485                 gtk/Makefile
486                 gtk/icons/Makefile
487                 web/Makefile
488                 web/images/Makefile
489                 web/images/buttons/Makefile
490                 web/images/graphics/Makefile
491                 web/images/progress/Makefile
492                 web/javascript/Makefile
493                 web/javascript/jquery/Makefile
494                 web/stylesheets/Makefile
495                 po/Makefile.in])
496
497AC_OUTPUT
498
499echo "
500
501Configuration:
502
503   Source code location:                              ${srcdir}
504   Compiler:                                          ${CXX}
505
506   Build libtransmission:                             yes
507
508      * optimized for low-resource systems:           ${enable_lightweight}
509      * µTP enabled:                                  ${build_utp}
510
511   Build Command-Line client:                         ${build_cli}
512
513   Build GTK+ client:                                 ${build_gtk}
514
515     Optional dependencies for GTK+ client:
516
517      * dbus support:                                 ${use_dbus_glib}
518      * gio for watchdir and mime-type support:       ${use_gio}
519      * libnotify for 'download completed' popups:    ${use_libnotify}
520      * libcanberra for 'download completed' sounds:  ${use_canberra}
521      * libappindicator for an Ubuntu-style tray:     ${use_libappindicator}
522
523   Build Daemon:                                      ${build_daemon}
524
525   Build Mac client:                                  ${build_mac}
526
527"
Note: See TracBrowser for help on using the repository browser.