source: trunk/configure.ac @ 13985

Last change on this file since 13985 was 13985, checked in by livings124, 9 years ago

(trunk) #5279 Typo in configure.ac

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