source: trunk/configure.ac @ 9643

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

(trunk) #2222 "DHT support" -- remove "DHT support enabled/disabled" line from configure.ac, since it's always enabled now.

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