source: trunk/configure.ac @ 12918

Last change on this file since 12918 was 12906, checked in by jordan, 10 years ago

bump version to 2.40 beta 2

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