source: trunk/configure.ac @ 14259

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

(trunk, libT) #5643 'quota support for NetBSD >= 6' -- patch by wiz

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