source: trunk/configure.ac @ 14256

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

(trunk) #5612 'transmission incorrectly determines CXX when ccache is used' -- fixed with patch from patrickdepinguin

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