source: trunk/configure.ac @ 11290

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

(trunk) #3602 "GCC option not supported" -- only use -Wvariadic-macros if gcc >= 4.3

File size: 16.3 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.04+])
7m4_define([peer_id_prefix],[-TR204Z-])
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=1.4.9
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 -Waggregate-return -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 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
205
206dnl libevent
207dnl if the user specified LIBEVENT_LIBS or
208if test -n "$LIBEVENT_LIBS"; then
209    user_specified_libevent=yes
210elif test -n "$LIBEVENT_CFLAGS"; then
211    user_specified_libevent=yes
212fi
213if test "x$user_specified_libevent" == "xyes"; then
214    AC_MSG_NOTICE([Using user-specified LIBEVENT_LIBS and LIBEVENT_CFLAGS])
215else
216    AC_CHECK_LIB([event],[evutil_vsnprintf],
217                 [],
218                 [AC_MSG_ERROR(libevent $LIBEVENT_MINIMUM or higher not found!)],
219                 [$libevent_extra_libs])
220    AC_CHECK_HEADER([event-config.h],[],
221                    [AC_MSG_ERROR(event-config.h not found!)])
222    LIBEVENT_CFLAGS=""
223    LIBEVENT_LIBS="-levent $libevent_extra_libs"
224fi
225AC_ARG_VAR([LIBEVENT_CFLAGS], [C compiler flags for LIBEVENT, overriding pkg-config])dnl
226AC_ARG_VAR([LIBEVENT_LIBS], [linker flags for LIBEVENT, overriding pkg-config])dnl
227
228
229
230dnl ----------------------------------------------------------------------------
231dnl
232dnl  dht
233
234DHT_CFLAGS="-I\$(top_srcdir)/third-party/dht"
235DHT_LIBS="\$(top_builddir)/third-party/dht/libdht.a"
236AC_SUBST(DHT_CFLAGS)
237AC_SUBST(DHT_LIBS)
238
239
240dnl ----------------------------------------------------------------------------
241dnl
242dnl  detection for the GTK+ client
243
244PKG_CHECK_MODULES(GTK,
245                  [gtk+-2.0 >= $GTK_MINIMUM
246                   glib-2.0 >= $GLIB_MINIMUM
247                   gmodule-2.0 >= $GLIB_MINIMUM
248                   gthread-2.0 >= $GLIB_MINIMUM],
249                  [have_gtk=yes],
250                  [have_gtk=no])
251AC_ARG_ENABLE([gtk],
252              AS_HELP_STRING([--enable-gtk],[build gtk client]),
253              [want_gtk=${enableval}],
254              [want_gtk=${have_gtk}])
255build_gtk=no
256use_gio=no
257use_libappindicator=no
258use_libnotify=no
259use_dbus_glib=no
260use_canberra=no
261use_gconf2=no
262if test "x$want_gtk" = "xyes" ; then
263    if test "x$have_gtk" = "xyes"; then
264      build_gtk=yes
265    else
266      AC_MSG_ERROR("GTK+ not found!")
267    fi
268fi
269AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"])
270
271if test "x$build_gtk" = "xyes"; then
272
273    PKG_CHECK_MODULES([GIO],
274                      [gio-2.0 >= $GIO_MINIMUM],
275                      [use_gio=yes],
276                      [use_gio=no])
277    if test "x$use_gio" = "xyes"; then
278        AC_DEFINE([HAVE_GIO], 1)
279    fi
280
281    PKG_CHECK_MODULES([LIBNOTIFY],
282                      [libnotify >= $LIBNOTIFY_MINIMUM],
283                      [have_libnotify=yes],
284                      [have_libnotify=no])
285    AC_ARG_ENABLE([libnotify],
286                  AS_HELP_STRING([--enable-libnotify],[enable notifications]),,
287                  [enable_libnotify=yes])
288    use_libnotify=no
289    if test "x$have_libnotify" = "xyes"; then
290        if test "x$enable_libnotify" = "xyes" ; then
291            use_libnotify=yes
292            AC_DEFINE([HAVE_LIBNOTIFY], 1)
293        else
294            LIBNOTIFY_CFLAGS=
295            LIBNOTIFY_LIBS=
296        fi
297    fi
298
299    PKG_CHECK_MODULES([LIBAPPINDICATOR],
300                      [appindicator-0.1 >= $LIBAPPINDICATOR_MINIMUM],
301                      [have_libappindicator=yes],
302                      [have_libappindicator=no])
303
304    AC_ARG_ENABLE([libappindicator],
305                  AS_HELP_STRING([--enable-libappindicator],[enable AppIndicator support]),,
306                  [enable_libappindicator=yes])
307    use_libappindicator=no
308    if test "x$have_libappindicator" = "xyes"; then
309        if test "x$enable_libappindicator" = "xyes" ; then
310            use_libappindicator=yes
311            AC_DEFINE([HAVE_LIBAPPINDICATOR], 1)
312        else
313            LIBAPPINDICATOR_CFLAGS=
314            LIBAPPINDICATOR_LIBS=
315        fi
316    fi
317
318    PKG_CHECK_MODULES([LIBCANBERRA],
319                      [libcanberra-gtk >= $CANBERRA_MINIMUM],
320                      [have_libcanberra=yes],
321                      [have_libcanberra=no])
322    AC_ARG_ENABLE([libcanberra],
323                  AS_HELP_STRING([--enable-libcanberra],[enable sounds]),,
324                  [enable_libcanberra=yes])
325    if test "x$have_libcanberra" = "xyes"; then
326        if test "x$enable_libcanberra" = "xyes" ; then
327            use_canberra=yes
328            AC_DEFINE([HAVE_LIBCANBERRA], 1)
329        else
330            LIBCANBERRA_CFLAGS=
331            LIBCANBERRA_LIBS=
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$have_gconf2" = "xyes"; then
343        if test "x$enable_gconf2" = "xyes" ; then
344            use_gconf2=yes
345            AC_DEFINE([HAVE_GCONF2], 1)
346        else
347            GCONF2_CFLAGS=
348            GCONF2_LIBS=
349        fi
350    fi
351
352    PKG_CHECK_MODULES([DBUS_GLIB],
353                      [dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
354                      [use_dbus_glib=yes],
355                      [use_dbus_glib=no])
356    if test "x$use_dbus_glib" = "xyes"; then
357        AC_DEFINE([HAVE_DBUS_GLIB], 1)
358    fi
359    if test "x$use_dbus_glib" = "xyes"; then
360        AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
361        if test "x$DBUS_BINDING_TOOL" = xno; then
362          AC_MSG_WARN([Cannot find dbus-binding-tool])
363          use_dbus_glib="no (dbus-binding-tool not found)"
364        fi
365    fi
366fi
367
368AC_ARG_ENABLE([nls],
369              AS_HELP_STRING([--enable-nls],[enable native language support]),,
370              [enable_nls=yes])
371
372if test "x$build_gtk" = "xyes" -a  "x$enable_nls" = "xno" ; then
373    AC_MSG_ERROR("The gtk client cannot be built without nls support.  Try adding either --enable-nls or --disable-gtk" )
374fi
375
376dnl This section is only used for internationalization.
377dnl If you don't need translations and this section gives you trouble --
378dnl such as if you're building for a headless system --
379dnl it's okay to tear this section out and re-build the configure script.
380dnl
381dnl Note to packagers: the bump to intltool 0.40 was made to fix
382dnl a "make check" failure on some systems.  if upgrading to 0.40 is
383dnl a problem and the old version was working fine for you,
384dnl it should be safe to re-edit 0.40 back down to 0.23
385
386use_nls=no
387if test "x$enable_nls" = "xyes" ; then
388    use_nls=yes
389    IT_PROG_INTLTOOL([0.35.0],[no-xml])
390    AC_CHECK_HEADERS([libintl.h])
391    GETTEXT_PACKAGE=transmission-gtk
392    AC_SUBST(GETTEXT_PACKAGE)
393    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
394    AM_GLIB_GNU_GETTEXT
395    transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
396    AC_SUBST(transmissionlocaledir)
397fi
398AC_SUBST(INTLLIBS)
399
400
401dnl ----------------------------------------------------------------------------
402dnl
403dnl  platform-specific stuff.
404
405AC_CANONICAL_HOST
406have_darwin="no"
407have_msw="no"
408case $host_os in
409
410   *mingw32*)
411     have_msw="yes"
412     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
413     CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
414     LIBS="$LIBS -liphlpapi -lshell32 -lws2_32"
415     transmissionlocaledir="locale"
416     if test -z "$host_alias"; then
417       hostaliaswindres=
418     else
419       hostaliaswindres="$host_alias-windres";
420     fi
421     AC_CHECK_TOOL(WINDRES, windres)
422     ;;
423
424  *darwin*)
425    have_darwin="yes"
426    CFLAGS="-DMACOSX $CFLAGS"
427    ;;
428
429esac
430
431AC_ARG_ENABLE([cli],
432              [AS_HELP_STRING([--enable-cli],[build command-line client])],
433              [build_cli=${enableval}],
434              [build_cli="yes"])
435AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
436
437AC_ARG_ENABLE([mac],
438              [AS_HELP_STRING([--enable-mac],[build Mac client])],
439              [build_mac=${enableval}],
440              [build_mac=${have_darwin}])
441AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
442
443AC_ARG_ENABLE([daemon],
444              [AS_HELP_STRING([--enable-daemon],[build daemon])],
445              [build_daemon=${enableval}],
446              [build_daemon="yes"])
447AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
448
449
450if test "x$build_mac" = "xyes" ; then
451    # Make sure the proper Mac SDK is installed
452    if test ! -d /Developer/SDKs/MacOSX10.5.sdk; then
453      cat << EOF
454You need to install the Mac OS X 10.5 SDK in order to build Transmission
455with --enable-mac:
456  Get your Xcode CD or package
457  Restart the install
458  When it gets to "Installation Type", select "Customize"
459  Select "Mac OS X 10.5 SDK" under "Cross Development"
460  Finish the install.
461EOF
462      exit 1
463    fi
464fi
465if test "x$have_darwin" = "xyes"; then
466    AC_DEFINE([HAVE_DARWIN], 1)
467fi
468if test "x$have_msw" = "xyes"; then
469    AC_DEFINE([HAVE_MSW], 1)
470fi
471AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
472
473dnl ----------------------------------------------------------------------------
474dnl
475dnl  Generate the output
476
477AC_CONFIG_FILES([Makefile
478                 transmission-gtk.spec
479                 cli/Makefile
480                 daemon/Makefile
481                 extras/Makefile
482                 libtransmission/Makefile
483                 utils/Makefile
484                 third-party/Makefile
485                 third-party/miniupnp/Makefile
486                 third-party/libnatpmp/Makefile
487                 third-party/dht/Makefile
488                 macosx/Makefile
489                 gtk/Makefile
490                 gtk/icons/Makefile
491                 web/Makefile
492                 web/images/Makefile
493                 web/images/buttons/Makefile
494                 web/images/graphics/Makefile
495                 web/images/progress/Makefile
496                 web/javascript/Makefile
497                 web/javascript/jquery/Makefile
498                 web/stylesheets/Makefile
499                 po/Makefile.in])
500
501ac_configure_args="$ac_configure_args --enable-static --disable-shared -q"
502AC_OUTPUT
503
504echo "
505
506Configuration:
507
508   Source code location:                              ${srcdir}
509   Compiler:                                          ${CXX}
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 support:                     ${use_gio}
519      * libnotify for 'download completed' popups:    ${use_libnotify}
520      * libcanberra for 'download completed' sounds:  ${use_canberra}
521      * gconf2 to register as a magnet link handler:  ${use_gconf2}
522      * libappindicator for an Ubuntu-style tray:     ${use_libappindicator}
523
524   Build Daemon:                                      ${build_daemon}
525
526   Build Mac client:                                  ${build_mac}
527
528"
Note: See TracBrowser for help on using the repository browser.