source: trunk/configure.ac @ 11548

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

(trunk) #3836 "libevent2 support" -- bump libevent2 requirement to 2.0.10. This will break the Mac build for a minute intil BMW applies his Mac patch

File size: 15.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],[2.13+])
7m4_define([peer_id_prefix],[-TR213Z-])
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  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# register the GTK+ client as a magnet link handler...
70GCONF2_MINIMUM=2.20.0
71AC_SUBST(GCONF2_MINIMUM)
72# implement "watch" directories to use new .torrent files...
73GIO_MINIMUM=2.15.5
74AC_SUBST(GIO_MINIMUM)
75# pop up a "download done" notice...
76LIBNOTIFY_MINIMUM=0.4.3
77AC_SUBST(LIBNOTIFY_MINIMUM)
78# create the tray icon with AppIndicator
79LIBAPPINDICATOR_MINIMUM=0.0.11
80  AC_SUBST(LIBAPPINDICATOR_MINIMUM)
81
82
83AC_PROG_CC
84AC_PROG_CXX
85AC_C_INLINE
86if test "x$GCC" = "xyes" ; then
87
88    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"
89
90    dnl figure out gcc version
91    AC_MSG_CHECKING([gcc version])
92    GCC_VERSION=`$CC -dumpversion`
93    GCC_MAJOR=`echo $GCC_VERSION | cut -d . -f1`
94    GCC_MINOR=`echo $GCC_VERSION | cut -d . -f2`
95    GCC_VERSION_NUM=`(expr $GCC_MAJOR "*" 100 + $GCC_MINOR) 2>/dev/null`
96
97    AC_MSG_RESULT($GCC_VERSION)
98    if test $GCC_VERSION_NUM -ge 304; then
99        dnl these were added in 3.4
100        CFLAGS="$CFLAGS -Wextra -Wdeclaration-after-statement -Winit-self"
101    fi
102    if test $GCC_VERSION_NUM -ge 403; then
103        dnl these were added in 4.3
104        CFLAGS="$CFLAGS -Wvariadic-macros"
105    fi
106fi
107
108AC_HEADER_STDC
109AC_HEADER_TIME
110
111AC_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])
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])
125PKG_CHECK_MODULES(LIBEVENT, [libevent >= $LIBEVENT_MINIMUM])
126AC_PATH_ZLIB
127
128AC_SYS_LARGEFILE
129AC_CHECK_FUNCS([lseek64])
130
131
132dnl ----------------------------------------------------------------------------
133dnl
134dnl posix_fadvise
135
136dnl can posix_fadvise be used
137AC_CHECK_DECLS(posix_fadvise, [], [], [
138#define _XOPEN_SOURCE 600
139#include <fcntl.h>])
140AC_CHECK_FUNCS([posix_fadvise])
141
142
143dnl ----------------------------------------------------------------------------
144dnl
145dnl file monitoring for the daemon
146
147AC_CHECK_HEADER([sys/inotify.h],
148                [AC_CHECK_FUNC([inotify_init],[have_inotify="yes"],[have_inotify="no"])],
149                [have_inotify="no"])
150AC_ARG_WITH([inotify],
151            [AS_HELP_STRING([--with-inotify],[Enable inotify support (default=auto)])],
152            [want_inotify=${withval}],
153            [want_inotify=${have_inotify}])
154if test "x$want_inotify" = "xyes" ; then
155    if test "x$have_inotify" = "xyes"; then
156      AC_DEFINE([WITH_INOTIFY],[1])
157    else
158      AC_MSG_ERROR("inotify not found!")
159    fi
160fi
161 
162AC_CHECK_HEADER([sys/event.h],
163                [AC_CHECK_FUNC([kqueue],[have_kqueue="yes"],[have_kqueue="no"])],
164                [have_kqueue="no"])
165AC_ARG_WITH([kqueue],
166            [AS_HELP_STRING([--with-kqueue],[Enable kqueue support (default=auto)])],
167            [want_kqueue=${withval}],
168            [want_kqueue=${have_kqueue}])
169if test "x$want_kqueue" = "xyes" ; then
170    if test "x$have_kqueue" = "xyes"; then
171      AC_DEFINE([WITH_KQUEUE],[1])
172    else
173      AC_MSG_ERROR("kqueue not found!")
174    fi
175fi
176
177AC_CHECK_HEADERS([xfs/xfs.h])
178
179
180dnl ----------------------------------------------------------------------------
181dnl
182dnl va_copy
183
184AC_MSG_CHECKING([how to copy va_list])
185AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);],
186    AC_MSG_RESULT([va_copy]),
187        [ AH_TEMPLATE([va_copy], [define if va_copy is not available])
188        AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);],
189        [ AC_DEFINE([va_copy], [__va_copy])
190        AC_MSG_RESULT([__va_copy])],
191        [ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))])
192        AC_MSG_RESULT([memcpy])]
193    )
194])
195
196
197dnl libevent likes to link against librt if possible
198dnl for clock_gettime() and clock_settime()
199dnl TODO(libevent2): this can probably be removed after
200dnl we switch to libevent2, since it will have PKG_CONFIG
201AC_CHECK_LIB([rt],
202             [clock_gettime],
203             [libevent_extra_libs="-lrt"],
204             [libevent_extra_libs=""])
205
206
207dnl ----------------------------------------------------------------------------
208dnl
209dnl  dht
210
211DHT_CFLAGS="-I\$(top_srcdir)/third-party/dht"
212DHT_LIBS="\$(top_builddir)/third-party/dht/libdht.a"
213AC_SUBST(DHT_CFLAGS)
214AC_SUBST(DHT_LIBS)
215
216
217dnl ----------------------------------------------------------------------------
218dnl
219dnl  detection for the GTK+ client
220
221PKG_CHECK_MODULES(GTK,
222                  [gtk+-2.0 >= $GTK_MINIMUM
223                   glib-2.0 >= $GLIB_MINIMUM
224                   gmodule-2.0 >= $GLIB_MINIMUM
225                   gthread-2.0 >= $GLIB_MINIMUM],
226                  [have_gtk=yes],
227                  [have_gtk=no])
228AC_ARG_ENABLE([gtk],
229              AS_HELP_STRING([--enable-gtk],[build gtk client]),
230              [want_gtk=${enableval}],
231              [want_gtk=${have_gtk}])
232build_gtk=no
233use_gio=no
234use_libappindicator=no
235use_libnotify=no
236use_dbus_glib=no
237use_canberra=no
238use_gconf2=no
239if test "x$want_gtk" = "xyes" ; then
240    if test "x$have_gtk" = "xyes"; then
241      build_gtk=yes
242    else
243      AC_MSG_ERROR("GTK+ not found!")
244    fi
245fi
246AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"])
247
248if test "x$build_gtk" = "xyes"; then
249
250    PKG_CHECK_MODULES([GIO],
251                      [gio-2.0 >= $GIO_MINIMUM],
252                      [use_gio=yes],
253                      [use_gio=no])
254    if test "x$use_gio" = "xyes"; then
255        AC_DEFINE([HAVE_GIO], 1)
256    fi
257
258    PKG_CHECK_MODULES([LIBNOTIFY],
259                      [libnotify >= $LIBNOTIFY_MINIMUM],
260                      [have_libnotify=yes],
261                      [have_libnotify=no])
262    AC_ARG_ENABLE([libnotify],
263                  AS_HELP_STRING([--enable-libnotify],[enable notifications]),,
264                  [enable_libnotify=yes])
265    use_libnotify=no
266    if test "x$have_libnotify" = "xyes"; then
267        if test "x$enable_libnotify" = "xyes" ; then
268            use_libnotify=yes
269            AC_DEFINE([HAVE_LIBNOTIFY], 1)
270        else
271            LIBNOTIFY_CFLAGS=
272            LIBNOTIFY_LIBS=
273        fi
274    fi
275
276    PKG_CHECK_MODULES([LIBAPPINDICATOR],
277                      [appindicator-0.1 >= $LIBAPPINDICATOR_MINIMUM],
278                      [have_libappindicator=yes],
279                      [have_libappindicator=no])
280
281    AC_ARG_ENABLE([libappindicator],
282                  AS_HELP_STRING([--enable-libappindicator],[enable AppIndicator support]),,
283                  [enable_libappindicator=yes])
284    use_libappindicator=no
285    if test "x$have_libappindicator" = "xyes"; then
286        if test "x$enable_libappindicator" = "xyes" ; then
287            use_libappindicator=yes
288            AC_DEFINE([HAVE_LIBAPPINDICATOR], 1)
289        else
290            LIBAPPINDICATOR_CFLAGS=
291            LIBAPPINDICATOR_LIBS=
292        fi
293    fi
294
295    PKG_CHECK_MODULES([LIBCANBERRA],
296                      [libcanberra-gtk >= $CANBERRA_MINIMUM],
297                      [have_libcanberra=yes],
298                      [have_libcanberra=no])
299    AC_ARG_ENABLE([libcanberra],
300                  AS_HELP_STRING([--enable-libcanberra],[enable sounds]),,
301                  [enable_libcanberra=yes])
302    if test "x$have_libcanberra" = "xyes"; then
303        if test "x$enable_libcanberra" = "xyes" ; then
304            use_canberra=yes
305            AC_DEFINE([HAVE_LIBCANBERRA], 1)
306        else
307            LIBCANBERRA_CFLAGS=
308            LIBCANBERRA_LIBS=
309        fi
310    fi
311
312    PKG_CHECK_MODULES([GCONF2],
313                      [gconf-2.0 >= $GCONF2_MINIMUM],
314                      [have_gconf2=yes],
315                      [have_gconf2=no])
316    AC_ARG_ENABLE([gconf2],
317                  AS_HELP_STRING([--enable-gconf2],[enable GConf support]),,
318                  [enable_gconf2=yes])
319    if test "x$have_gconf2" = "xyes"; then
320        if test "x$enable_gconf2" = "xyes" ; then
321            use_gconf2=yes
322            AC_DEFINE([HAVE_GCONF2], 1)
323        else
324            GCONF2_CFLAGS=
325            GCONF2_LIBS=
326        fi
327    fi
328
329    PKG_CHECK_MODULES([DBUS_GLIB],
330                      [dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
331                      [use_dbus_glib=yes],
332                      [use_dbus_glib=no])
333    if test "x$use_dbus_glib" = "xyes"; then
334        AC_DEFINE([HAVE_DBUS_GLIB], 1)
335    fi
336    if test "x$use_dbus_glib" = "xyes"; then
337        AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
338        if test "x$DBUS_BINDING_TOOL" = xno; then
339          AC_MSG_WARN([Cannot find dbus-binding-tool])
340          use_dbus_glib="no (dbus-binding-tool not found)"
341        fi
342    fi
343fi
344
345AC_ARG_ENABLE([nls],
346              AS_HELP_STRING([--enable-nls],[enable native language support]),,
347              [enable_nls=yes])
348
349if test "x$build_gtk" = "xyes" -a  "x$enable_nls" = "xno" ; then
350    AC_MSG_ERROR("The gtk client cannot be built without nls support.  Try adding either --enable-nls or --disable-gtk" )
351fi
352
353dnl This section is only used for internationalization.
354dnl If you don't need translations and this section gives you trouble --
355dnl such as if you're building for a headless system --
356dnl it's okay to tear this section out and re-build the configure script.
357dnl
358dnl Note to packagers: the bump to intltool 0.40 was made to fix
359dnl a "make check" failure on some systems.  if upgrading to 0.40 is
360dnl a problem and the old version was working fine for you,
361dnl it should be safe to re-edit 0.40 back down to 0.23
362
363use_nls=no
364if test "x$enable_nls" = "xyes" ; then
365    use_nls=yes
366    IT_PROG_INTLTOOL([0.35.0],[no-xml])
367    AC_CHECK_HEADERS([libintl.h])
368    GETTEXT_PACKAGE=transmission-gtk
369    AC_SUBST(GETTEXT_PACKAGE)
370    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
371    AM_GLIB_GNU_GETTEXT
372    transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
373    AC_SUBST(transmissionlocaledir)
374fi
375AC_SUBST(INTLLIBS)
376
377
378dnl ----------------------------------------------------------------------------
379dnl
380dnl  platform-specific stuff.
381
382AC_CANONICAL_HOST
383have_darwin="no"
384have_msw="no"
385case $host_os in
386
387   *mingw32*)
388     have_msw="yes"
389     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
390     CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
391     LIBS="$LIBS -liphlpapi -lshell32 -lws2_32"
392     transmissionlocaledir="locale"
393     if test -z "$host_alias"; then
394       hostaliaswindres=
395     else
396       hostaliaswindres="$host_alias-windres";
397     fi
398     AC_CHECK_TOOL(WINDRES, windres)
399     ;;
400
401  *darwin*)
402    have_darwin="yes"
403    CFLAGS="-DMACOSX $CFLAGS"
404    ;;
405
406esac
407
408AC_ARG_ENABLE([cli],
409              [AS_HELP_STRING([--enable-cli],[build command-line client])],
410              [build_cli=${enableval}],
411              [build_cli="yes"])
412AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
413
414AC_ARG_ENABLE([mac],
415              [AS_HELP_STRING([--enable-mac],[build Mac client])],
416              [build_mac=${enableval}],
417              [build_mac=${have_darwin}])
418AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
419
420AC_ARG_ENABLE([daemon],
421              [AS_HELP_STRING([--enable-daemon],[build daemon])],
422              [build_daemon=${enableval}],
423              [build_daemon="yes"])
424AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
425
426
427if test "x$build_mac" = "xyes" ; then
428    # Make sure the proper Mac SDK is installed
429    if test ! -d /Developer/SDKs/MacOSX10.5.sdk; then
430      cat << EOF
431You need to install the Mac OS X 10.5 SDK in order to build Transmission
432with --enable-mac:
433  Get your Xcode CD or package
434  Restart the install
435  When it gets to "Installation Type", select "Customize"
436  Select "Mac OS X 10.5 SDK" under "Cross Development"
437  Finish the install.
438EOF
439      exit 1
440    fi
441fi
442if test "x$have_darwin" = "xyes"; then
443    AC_DEFINE([HAVE_DARWIN], 1)
444fi
445if test "x$have_msw" = "xyes"; then
446    AC_DEFINE([HAVE_MSW], 1)
447fi
448AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
449
450dnl ----------------------------------------------------------------------------
451dnl
452dnl  Generate the output
453
454AC_CONFIG_FILES([Makefile
455                 transmission-gtk.spec
456                 cli/Makefile
457                 daemon/Makefile
458                 extras/Makefile
459                 libtransmission/Makefile
460                 utils/Makefile
461                 third-party/Makefile
462                 third-party/miniupnp/Makefile
463                 third-party/libnatpmp/Makefile
464                 third-party/dht/Makefile
465                 macosx/Makefile
466                 gtk/Makefile
467                 gtk/icons/Makefile
468                 web/Makefile
469                 web/images/Makefile
470                 web/images/buttons/Makefile
471                 web/images/graphics/Makefile
472                 web/images/progress/Makefile
473                 web/javascript/Makefile
474                 web/javascript/jquery/Makefile
475                 web/stylesheets/Makefile
476                 po/Makefile.in])
477
478ac_configure_args="$ac_configure_args --enable-static --disable-shared -q"
479AC_OUTPUT
480
481echo "
482
483Configuration:
484
485   Source code location:                              ${srcdir}
486   Compiler:                                          ${CXX}
487
488   Build Command-Line client:                         ${build_cli}
489
490   Build GTK+ client:                                 ${build_gtk}
491
492     Optional dependencies for GTK+ client:
493
494      * dbus support:                                 ${use_dbus_glib}
495      * gio for watchdir support:                     ${use_gio}
496      * libnotify for 'download completed' popups:    ${use_libnotify}
497      * libcanberra for 'download completed' sounds:  ${use_canberra}
498      * gconf2 to register as a magnet link handler:  ${use_gconf2}
499      * libappindicator for an Ubuntu-style tray:     ${use_libappindicator}
500
501   Build Daemon:                                      ${build_daemon}
502
503   Build Mac client:                                  ${build_mac}
504
505"
Note: See TracBrowser for help on using the repository browser.