source: trunk/configure.ac @ 9394

Last change on this file since 9394 was 9394, checked in by livings124, 13 years ago

(trunk) update to 1.76+

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