source: trunk/configure.ac @ 12578

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

(trunk gtk) #4372 "make notification and system sounds configurable" -- fixed.

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