source: branches/2.4x/configure.ac @ 13005

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

(2.4x) backport #4990 "Transmission 2.40b1 fails to build: undefined references"

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