source: trunk/configure.ac @ 13649

Last change on this file since 13649 was 13649, checked in by jordan, 8 years ago

bump to 2.74+

File size: 16.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.74+])
7m4_define([peer_id_prefix],[-TR274Z-])
8
9AC_INIT([transmission],[user_agent_prefix],[http://trac.transmissionbt.com/newticket])
10AC_SUBST(USERAGENT_PREFIX,[user_agent_prefix])
11AC_SUBST(PEERID_PREFIX,[peer_id_prefix])
12
13m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
14
15AC_CONFIG_MACRO_DIR([m4])
16
17dnl AM_CONFIG_HEADER(config.h)
18AC_CONFIG_SRCDIR(libtransmission/transmission.h)
19AM_INIT_AUTOMAKE([1.9 tar-pax])
20LT_INIT
21
22if test m4_substr(peer_id_prefix,6,1) = "0"; then
23  supported_build=yes
24  CPPFLAGS="$CPPFLAGS -DNDEBUG"
25else
26  supported_build=no
27  if test "x$GCC" = "xyes" ; then
28    CFLAGS="$CFLAGS -g -O0"
29    CXXFLAGS="$CXXFLAGS -g -O0"
30  fi
31fi
32AM_CONDITIONAL(TR_UNSTABLE, test "x$supported_build" = "xno")
33
34##
35##
36##   MANDATORY for everything
37##
38##
39CURL_MINIMUM=7.15.4
40AC_SUBST(CURL_MINIMUM)
41LIBEVENT_MINIMUM=2.0.10
42AC_SUBST(LIBEVENT_MINIUM)
43OPENSSL_MINIMUM=0.9.4
44AC_SUBST(OPENSSL_MINIMUM)
45
46##
47##
48##   MANDATORY for the GTK+ client
49##
50##
51
52GTK_MINIMUM=3.4.0
53AC_SUBST(GTK_MINIMUM)
54GLIB_MINIMUM=2.32.0
55AC_SUBST(GLIB_MINIMUM)
56GIO_MINIMUM=2.26.0
57AC_SUBST(GIO_MINIMUM)
58
59##
60##
61##   OPTIONAL for the GTK+ client
62##
63##
64
65# create the tray icon with AppIndicator
66LIBAPPINDICATOR_MINIMUM=0.4.90
67AC_SUBST(LIBAPPINDICATOR_MINIMUM)
68
69
70AC_PROG_CC
71AC_PROG_CXX
72if test "x$CXX" != "x"; then # CXX is set...
73  if test -f "$CXX"; then # maybe it's an absolute path passed in env variables...
74    AC_MSG_CHECKING([for $CXX])
75    HAVE_CXX="yes"
76    AC_MSG_RESULT([$HAVE_CXX])
77  else
78    AC_CHECK_PROG([HAVE_CXX],[$CXX],[yes],[no])
79  fi
80fi
81AC_C_INLINE
82if test "x$GCC" = "xyes" ; then
83
84    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"
85
86    dnl figure out gcc version
87    AC_MSG_CHECKING([gcc version])
88    GCC_VERSION=`$CC -dumpversion`
89    GCC_MAJOR=`echo $GCC_VERSION | cut -d . -f1`
90    GCC_MINOR=`echo $GCC_VERSION | cut -d . -f2`
91    GCC_VERSION_NUM=`(expr $GCC_MAJOR "*" 100 + $GCC_MINOR) 2>/dev/null`
92
93    AC_MSG_RESULT($GCC_VERSION)
94    if test $GCC_VERSION_NUM -ge 304; then
95        dnl these were added in 3.4
96        CFLAGS="$CFLAGS -Wextra -Wdeclaration-after-statement -Winit-self"
97    fi
98    if test $GCC_VERSION_NUM -ge 403; then
99        dnl these were added in 4.3
100        CFLAGS="$CFLAGS -Wvariadic-macros"
101    fi
102fi
103
104AC_HEADER_STDC
105AC_HEADER_TIME
106
107AC_CHECK_HEADERS([stdbool.h])
108AC_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 mkdtemp])
109AC_PROG_INSTALL
110AC_PROG_MAKE_SET
111ACX_PTHREAD
112
113if test "x$ac_cv_func_strtold" != "xyes" ; then
114    CPPFLAGS="$CPPFLAGS -Dstrtold=strtod"
115fi
116
117AC_SEARCH_LIBS(cos, [m])
118AC_SEARCH_LIBS([socket], [socket net])
119AC_SEARCH_LIBS([gethostbyname], [nsl bind])
120PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM], , [CHECK_SSL()])
121PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM])
122PKG_CHECK_MODULES(LIBEVENT, [libevent >= $LIBEVENT_MINIMUM])
123AC_PATH_ZLIB
124
125AC_SYS_LARGEFILE
126AC_CHECK_FUNCS([lseek64])
127
128
129dnl ----------------------------------------------------------------------------
130dnl
131dnl posix_fadvise
132
133dnl can posix_fadvise be used
134AC_CHECK_DECLS(posix_fadvise, [], [], [
135#define _XOPEN_SOURCE 600
136#include <fcntl.h>])
137AC_CHECK_FUNCS([posix_fadvise])
138
139
140dnl ----------------------------------------------------------------------------
141dnl
142dnl file monitoring for the daemon
143
144AC_CHECK_HEADER([sys/inotify.h],
145                [AC_CHECK_FUNC([inotify_init],[have_inotify="yes"],[have_inotify="no"])],
146                [have_inotify="no"])
147AC_ARG_WITH([inotify],
148            [AS_HELP_STRING([--with-inotify],[Enable inotify support (default=auto)])],
149            [want_inotify=${withval}],
150            [want_inotify=${have_inotify}])
151if test "x$want_inotify" = "xyes" ; then
152    if test "x$have_inotify" = "xyes"; then
153      AC_DEFINE([WITH_INOTIFY],[1])
154    else
155      AC_MSG_ERROR("inotify not found!")
156    fi
157fi
158
159AC_CHECK_HEADER([sys/event.h],
160                [AC_CHECK_FUNC([kqueue],[have_kqueue="yes"],[have_kqueue="no"])],
161                [have_kqueue="no"])
162AC_ARG_WITH([kqueue],
163            [AS_HELP_STRING([--with-kqueue],[Enable kqueue support (default=auto)])],
164            [want_kqueue=${withval}],
165            [want_kqueue=${have_kqueue}])
166if test "x$want_kqueue" = "xyes" ; then
167    if test "x$have_kqueue" = "xyes"; then
168      AC_DEFINE([WITH_KQUEUE],[1])
169    else
170      AC_MSG_ERROR("kqueue not found!")
171    fi
172fi
173
174AC_CHECK_HEADERS([sys/statvfs.h \
175                  xfs/xfs.h])
176
177
178dnl ----------------------------------------------------------------------------
179dnl
180dnl  dht
181
182DHT_CFLAGS="-I\$(top_srcdir)/third-party/dht"
183DHT_LIBS="\$(top_builddir)/third-party/dht/libdht.a"
184AC_SUBST(DHT_CFLAGS)
185AC_SUBST(DHT_LIBS)
186
187
188dnl ----------------------------------------------------------------------------
189dnl
190dnl  utp
191
192AC_CHECK_LIB([rt],
193             [clock_gettime],
194             [libutp_extra_libs="-lrt"],
195             [libutp_extra_libs=""])
196
197AC_MSG_CHECKING([µTP])
198build_utp="no"
199if test "x$HAVE_CXX" = "xyes" ; then
200    have_utp="yes"
201else
202    have_utp="no"
203fi
204AC_ARG_ENABLE([utp],
205              AS_HELP_STRING([--enable-utp],[build µTP support]),
206              [want_utp=${enableval}],
207              [want_utp=${have_utp}])
208if test "x$want_utp" = "xyes" ; then
209    if test "x$have_utp" = "xyes"; then
210        LIBUTP_CFLAGS="-I\$(top_srcdir)/third-party/"
211        LIBUTP_LIBS="\$(top_builddir)/third-party/libutp/libutp.a"
212        LIBUTP_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/libutp/libutp.a"
213        if test "x$libutp_extra_libs" != "x" ; then
214            LIBUTP_LIBS="$LIBUTP_LIBS $libutp_extra_libs"
215            LIBUTP_LIBS_QT="$LIBUTP_LIBS_QT $libutp_extra_libs"
216        fi
217        AC_DEFINE([WITH_UTP],[1])
218        build_utp="yes"
219    else
220      AC_MSG_ERROR("Unable to build uTP support -- C++ compiler not found")
221    fi
222fi
223AC_SUBST(LIBUTP_CFLAGS)
224AC_SUBST(LIBUTP_LIBS)
225AC_SUBST(LIBUTP_LIBS_QT)
226AM_CONDITIONAL([BUILD_UTP],[test "x$build_utp" = "xyes"])
227AC_MSG_RESULT([$build_utp])
228
229
230dnl
231dnl  look for preinstalled miniupnpc...
232dnl
233
234AC_MSG_CHECKING([supported miniupnp library])
235upnp_version="none"
236ac_save_LIBS="$LIBS"
237LIBS="-lminiupnpc"
238# See if the OS has its miniupnp 1.5 installed
239AC_LINK_IFELSE([AC_LANG_PROGRAM([[
240    #include <stdlib.h>
241    #include <miniupnpc/miniupnpc.h>
242    #include <miniupnpc/upnpcommands.h>
243]], [[
244    struct UPNPDev * devlist;
245    struct UPNPUrls    urls;
246    struct IGDdatas    data;
247    char lanaddr[16];
248    char portStr[8];
249    char intPort[8];
250    char intClient[16];
251    upnpDiscover( 2000, NULL, NULL, 0 );
252    UPNP_GetValidIGD( devlist, &urls, &data, lanaddr, sizeof( lanaddr ) );
253    UPNP_GetSpecificPortMappingEntry( urls.controlURL, data.first.servicetype,
254                        portStr, "TCP", intClient, intPort );
255]])],[
256AC_DEFINE(HAVE_MINIUPNP_15, 1, [Define to 1 if you have miniupnpc version 1.5])
257upnp_version="1.5"],[])
258
259# See if the OS has its miniupnp 1.6 installed
260AC_LINK_IFELSE([AC_LANG_PROGRAM([[
261    #include <stdlib.h>
262    #include <errno.h>
263    #include <miniupnpc/miniupnpc.h>
264    #include <miniupnpc/upnpcommands.h>
265]], [[
266    struct UPNPDev * devlist;
267    struct UPNPUrls    urls;
268    struct IGDdatas    data;
269    char lanaddr[16];
270    char portStr[8];
271    char intPort[8];
272    char intClient[16];
273    upnpDiscover( 2000, NULL, NULL, 0, 0, &errno );
274    UPNP_GetValidIGD( devlist, &urls, &data, lanaddr, sizeof( lanaddr ) );
275    UPNP_GetSpecificPortMappingEntry( urls.controlURL, data.first.servicetype,
276                        portStr, "TCP", intClient, intPort, NULL, NULL, NULL );
277]])],[
278AC_DEFINE(HAVE_MINIUPNP_16, 1, [Define to 1 if you have miniupnpc version 1.6])
279upnp_version="1.6"],[])
280
281# ... and the results of our tests
282LIBS="$ac_save_LIBS"
283AC_MSG_RESULT([$upnp_version])
284AM_CONDITIONAL([BUILD_MINIUPNP],[test "x$upnp_version" = "xnone"])
285if test "x$upnp_version" = "xnone" ; then
286    LIBUPNP_CFLAGS="-I\$(top_srcdir)/third-party/"
287    LIBUPNP_LIBS="\$(top_builddir)/third-party/miniupnp/libminiupnp.a"
288    LIBUPNP_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/miniupnp/libminiupnp.a"
289    dnl because this is the version that we bundle...
290    AC_DEFINE(HAVE_MINIUPNP_16, 1, [Define to 1 if you have miniupnpc version 1.6])
291else
292    AC_DEFINE([SYSTEM_MINIUPNP])
293    LIBUPNP_CFLAGS=""
294    LIBUPNP_LIBS="-lminiupnpc"
295    LIBUPNP_LIBS_QT="-lminiupnpc"
296fi
297AC_SUBST(LIBUPNP_CFLAGS)
298AC_SUBST(LIBUPNP_LIBS)
299AC_SUBST(LIBUPNP_LIBS_QT)
300
301
302 
303
304dnl ----------------------------------------------------------------------------
305dnl
306dnl  Allow usage of system natpmp library
307
308LIBNATPMP_CFLAGS="-I\$(top_srcdir)/third-party/libnatpmp/"
309LIBNATPMP_LIBS="\$(top_builddir)/third-party/libnatpmp/libnatpmp.a"
310LIBNATPMP_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/libnatpmp/libnatpmp.a"
311build_bundled_natpmp="yes"
312AC_ARG_ENABLE([external-natpmp],
313              AS_HELP_STRING([--enable-external-natpmp],[Use system external-natpmp]),
314              [want_external_natpmp=${enableval}],
315              [want_external_natpmp=no])
316if test "x$want_external_natpmp" != "xno" ; then
317        dnl Would be lovely if it had pkgconfig
318        LIBNATPMP_CFLAGS="" 
319        LIBNATPMP_LIBS="-lnatpmp"
320        LIBNATPMP_LIBS_QT="-lnatpmp"
321        build_bundled_natpmp="no"
322fi
323AM_CONDITIONAL([BUILD_NATPMP],[test "x$build_bundled_natpmp" = "xyes"])
324AC_SUBST(LIBNATPMP_CFLAGS)
325AC_SUBST(LIBNATPMP_LIBS)
326AC_SUBST(LIBNATPMP_LIBS_QT)
327
328
329dnl ----------------------------------------------------------------------------
330dnl
331dnl  detection for the GTK+ client
332
333AC_ARG_ENABLE([nls],
334              [AS_HELP_STRING([--enable-nls],[enable native language support])],,
335              [enable_nls=yes])
336PKG_CHECK_EXISTS([gtk+-3.0 >= $GTK_MINIMUM
337                  glib-2.0 >= $GLIB_MINIMUM
338                  gio-2.0 >= $GIO_MINIMUM,
339                  gmodule-2.0 >= $GLIB_MINIMUM
340                  gthread-2.0 >= $GLIB_MINIMUM],
341                 [have_gtk=yes],
342                 [have_gtk=no])
343AC_ARG_WITH([gtk], AS_HELP_STRING([--with-gtk],[with Gtk]),
344            [with_gtk=$withval],
345            [with_gtk=$have_gtk])
346AM_CONDITIONAL([BUILD_GTK],[test "x$with_gtk" = "xyes"])
347use_libappindicator=no
348if test "x$with_gtk" = "xyes" ; then
349
350    if test "x$enable_nls" = "xno" ; then
351        AC_MSG_ERROR("The gtk client cannot be built without nls support.  Try adding either --enable-nls or --without-gtk" )
352    fi
353
354    PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= $GTK_MINIMUM
355                              glib-2.0 >= $GLIB_MINIMUM
356                              gio-2.0 >= $GIO_MINIMUM,
357                              gmodule-2.0 >= $GLIB_MINIMUM
358                              gthread-2.0 >= $GLIB_MINIMUM])
359    PKG_CHECK_MODULES([LIBAPPINDICATOR],
360                      [appindicator3-0.1 >= $LIBAPPINDICATOR_MINIMUM],
361                      [have_libappindicator=yes],
362                      [have_libappindicator=no])
363    if test "x$have_libappindicator" = "xyes"; then
364        use_libappindicator=yes
365        AC_DEFINE([HAVE_LIBAPPINDICATOR], 1)
366    else
367        LIBAPPINDICATOR_CFLAGS=
368        LIBAPPINDICATOR_LIBS=
369    fi
370fi
371
372dnl This section is only used for internationalization.
373dnl If you don't need translations and this section gives you trouble --
374dnl such as if you're building for a headless system --
375dnl it's okay to tear this section out and re-build the configure script.
376dnl
377dnl Note to packagers: the bump to intltool 0.40 was made to fix
378dnl a "make check" failure on some systems.  if upgrading to 0.40 is
379dnl a problem and the old version was working fine for you,
380dnl it should be safe to re-edit 0.40 back down to 0.23
381
382use_nls=no
383if test "x$enable_nls" = "xyes" ; then
384    use_nls=yes
385    m4_ifdef([IT_PROG_INTLTOOL],
386             [IT_PROG_INTLTOOL([0.35.0],[no-xml])],
387             [AC_MSG_ERROR("--enable-nls requires intltool to be installed.")])
388    AC_CHECK_HEADERS([libintl.h])
389    GETTEXT_PACKAGE=transmission-gtk
390    AC_SUBST(GETTEXT_PACKAGE)
391    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
392    AM_GLIB_GNU_GETTEXT
393    transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
394    AC_SUBST(transmissionlocaledir)
395fi
396AC_SUBST(INTLLIBS)
397
398
399dnl ----------------------------------------------------------------------------
400dnl
401dnl  platform-specific stuff.
402
403AC_CANONICAL_HOST
404have_darwin="no"
405have_msw="no"
406case $host_os in
407
408   *mingw32*)
409     have_msw="yes"
410     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
411     CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
412     LIBS="$LIBS -liphlpapi -lshell32 -lws2_32"
413     transmissionlocaledir="locale"
414     if test -z "$host_alias"; then
415       hostaliaswindres=
416     else
417       hostaliaswindres="$host_alias-windres";
418     fi
419     AC_CHECK_TOOL(WINDRES, windres)
420     ;;
421
422  *darwin*)
423    have_darwin="yes"
424    CFLAGS="-DMACOSX $CFLAGS"
425    ;;
426
427esac
428
429AC_ARG_ENABLE([lightweight],
430              AS_HELP_STRING([--enable-lightweight],[optimize libtransmission for low-resource systems: smaller cache size, prefer unencrypted peer connections, etc.]),
431              [enable_lightweight=${enableval}],
432              [enable_lightweight="no"])
433if test "x$enable_lightweight" = "xyes" ; then
434  AC_DEFINE([TR_LIGHTWEIGHT],[1],[optimize libtransmission for low-resource systems])
435fi
436
437AC_ARG_ENABLE([cli],
438              [AS_HELP_STRING([--enable-cli],[build command-line client])],
439              [build_cli=${enableval}],
440              [build_cli="yes"])
441AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
442
443AC_ARG_ENABLE([mac],
444              [AS_HELP_STRING([--enable-mac],[build Mac client])],
445              [build_mac=${enableval}],
446              [build_mac=${have_darwin}])
447AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
448
449AC_ARG_ENABLE([daemon],
450              [AS_HELP_STRING([--enable-daemon],[build daemon])],
451              [build_daemon=${enableval}],
452              [build_daemon="yes"])
453AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
454
455
456if test "x$build_mac" = "xyes" ; then
457    # Make sure the proper Mac SDK is installed
458    if test ! -d /Developer/SDKs/MacOSX10.5.sdk; then
459      cat << EOF
460You need to install the Mac OS X 10.5 SDK in order to build Transmission
461with --enable-mac:
462  Get your Xcode CD or package
463  Restart the install
464  When it gets to "Installation Type", select "Customize"
465  Select "Mac OS X 10.5 SDK" under "Cross Development"
466  Finish the install.
467EOF
468      exit 1
469    fi
470fi
471if test "x$have_darwin" = "xyes"; then
472    AC_DEFINE([HAVE_DARWIN], 1)
473fi
474if test "x$have_msw" = "xyes"; then
475    AC_DEFINE([HAVE_MSW], 1)
476fi
477AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
478
479dnl ----------------------------------------------------------------------------
480dnl
481dnl  Generate the output
482
483AC_CONFIG_FILES([Makefile
484                 transmission-gtk.spec
485                 cli/Makefile
486                 daemon/Makefile
487                 extras/Makefile
488                 libtransmission/Makefile
489                 utils/Makefile
490                 third-party/Makefile
491                 third-party/dht/Makefile
492                 third-party/libutp/Makefile
493                 third-party/libnatpmp/Makefile
494                 third-party/miniupnp/Makefile
495                 macosx/Makefile
496                 gtk/Makefile
497                 gtk/icons/Makefile
498                 qt/config.pri
499                 web/Makefile
500                 web/images/Makefile
501                 web/style/Makefile
502                 web/style/jqueryui/Makefile
503                 web/style/jqueryui/images/Makefile
504                 web/style/transmission/Makefile
505                 web/style/transmission/images/Makefile
506                 web/style/transmission/images/buttons/Makefile
507                 web/javascript/Makefile
508                 web/javascript/jquery/Makefile
509                 po/Makefile.in])
510
511AC_OUTPUT
512
513echo "
514
515Configuration:
516
517   Source code location:                              ${srcdir}
518   Compiler:                                          ${CXX}
519
520   Build libtransmission:                             yes
521      * optimized for low-resource systems:           ${enable_lightweight}
522      * µTP enabled:                                  ${build_utp}
523
524   Build Command-Line client:                         ${build_cli}
525
526   Build GTK+ client:                                 ${with_gtk}
527      * libappindicator for an Ubuntu-style tray:     ${use_libappindicator}
528
529   Build Daemon:                                      ${build_daemon}
530
531   Build Mac client:                                  ${build_mac}
532
533"
Note: See TracBrowser for help on using the repository browser.