source: trunk/configure.ac @ 10204

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

(trunk) tweak the configure script's "options" display to emphasise that the optional libraries are optional

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