source: trunk/configure.ac @ 10435

Last change on this file since 10435 was 10435, checked in by charles, 11 years ago

(trunk) #3109 "configure: option name doesn't match description" -- fixed in trunk for 2.00

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.92+])
7m4_define([peer_id_prefix],[-TR192Z-])
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.15.4
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 getpagesize posix_memalign])
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_gconf2=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([GCONF2],
336                      [gconf-2.0 >= $GCONF2_MINIMUM],
337                      [have_gconf2=yes],
338                      [have_gconf2=no])
339    AC_ARG_ENABLE([gconf2],
340                  AS_HELP_STRING([--enable-gconf2],[enable GConf support]),,
341                  [enable_gconf2=yes])
342    if test "x$enable_gconf2" = "xyes" ; then
343        if test "x$have_gconf2" = "xyes"; then
344            use_gconf2=yes
345            AC_DEFINE([HAVE_GCONF2], 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.35.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
395AC_SUBST(INTLLIBS)
396
397
398dnl ----------------------------------------------------------------------------
399dnl
400dnl  platform-specific stuff.
401
402AC_CANONICAL_HOST
403have_darwin="no"
404have_msw="no"
405case $host_os in
406
407   *mingw32*)
408     have_msw="yes"
409     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
410     CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
411     LIBS="$LIBS -lshell32 -lws2_32"
412     transmissionlocaledir="locale"
413     if test -z "$host_alias"; then
414       hostaliaswindres=
415     else
416       hostaliaswindres="$host_alias-windres";
417     fi
418     AC_CHECK_TOOL(WINDRES, windres)
419     ;;
420
421  *darwin*)
422    have_darwin="yes"
423    CFLAGS="-DMACOSX $CFLAGS"
424    ;;
425
426esac
427
428AC_ARG_ENABLE([cli],
429              [AS_HELP_STRING([--enable-cli],[build command-line client])],
430              [build_cli=${enableval}],
431              [build_cli="yes"])
432AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
433
434AC_ARG_ENABLE([mac],
435              [AS_HELP_STRING([--enable-mac],[build Mac client])],
436              [build_mac=${enableval}],
437              [build_mac=${have_darwin}])
438AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
439
440AC_ARG_ENABLE([daemon],
441              [AS_HELP_STRING([--enable-daemon],[build daemon])],
442              [build_daemon=${enableval}],
443              [build_daemon="yes"])
444AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
445
446
447if test "x$build_mac" = "xyes" ; then
448    # Make sure the proper Mac SDK is installed
449    if test ! -d /Developer/SDKs/MacOSX10.5.sdk; then
450      cat << EOF
451You need to install the Mac OS X 10.5 SDK in order to build Transmission
452with --enable-mac:
453  Get your Xcode CD or package
454  Restart the install
455  When it gets to "Installation Type", select "Customize"
456  Select "Mac OS X 10.5 SDK" under "Cross Development"
457  Finish the install.
458EOF
459      exit 1
460    fi
461fi
462if test "x$have_darwin" = "xyes"; then
463    AC_DEFINE([HAVE_DARWIN], 1)
464fi
465if test "x$have_msw" = "xyes"; then
466    AC_DEFINE([HAVE_MSW], 1)
467fi
468AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
469
470dnl ----------------------------------------------------------------------------
471dnl
472dnl  Generate the output
473
474AC_CONFIG_FILES([Makefile
475                 transmission.spec
476                 cli/Makefile
477                 daemon/Makefile
478                 doc/Makefile
479                 libtransmission/Makefile
480                 third-party/Makefile
481                 third-party/miniupnp/Makefile
482                 third-party/libnatpmp/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_configure_args="$ac_configure_args --enable-static --disable-shared -q"
498AC_OUTPUT
499
500echo "
501
502Configuration:
503
504   Source code location:                              ${srcdir}
505   Compiler:                                          ${CXX}
506   System or bundled libevent:                        ${libevent_source}
507
508   Build Command-Line client:                         ${build_cli}
509
510   Build GTK+ client:                                 ${build_gtk}
511
512      dbus support:                                   ${use_dbus_glib}
513      gio for watchdir support:                       ${use_gio}
514      libnotify for 'download completed' popups:      ${use_libnotify}
515      libcanberra for 'download completed' sounds:    ${use_canberra}
516      gconf2 to tell GNOME we handle magnet links:    ${use_gconf2}
517      libappindicator for Ubuntu-style system tray:   ${use_libappindicator}
518
519      THESE ARE ALL OPTIONAL. If you're a packager
520      or user who doesn't want these dependencies,
521      use the ones you want and skip all the rest.
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.