source: trunk/configure.ac @ 8835

Last change on this file since 8835 was 8835, checked in by livings124, 12 years ago

update to 1.73+

File size: 13.5 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],[1.73+])
7m4_define([peer_id_prefix],[-TR173Z-])
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
15AC_CONFIG_MACRO_DIR([m4])
16
17dnl AM_CONFIG_HEADER(config.h)
18AC_CONFIG_SRCDIR(libtransmission/transmission.h)
19AM_INIT_AUTOMAKE([1.9 tar-ustar])
20AC_PROG_LIBTOOL
21
22if test m4_substr(peer_id_prefix,6,1) = "0"; then
23  supported_build=yes
24  if test "x$GCC" = "xyes" ; then
25    CFLAGS="$CFLAGS -g -O3 "
26    CXXFLAGS="$CXXFLAGS -g -O3 "
27  fi
28else
29  supported_build=no
30  if test "x$GCC" = "xyes" ; then
31    CFLAGS="$CFLAGS -g -O0"
32    CXXFLAGS="$CXXFLAGS -g -O0"
33  fi
34fi
35AM_CONDITIONAL(TR_UNSTABLE, test "x$supported_build" = "xno")
36
37OPENSSL_MINIMUM=0.9.4
38CURL_MINIMUM=7.16.3
39GIO_MINIMUM=2.15.5
40GLIB_MINIMUM=2.6.0
41GTK_MINIMUM=2.6.0
42LIBNOTIFY_MINIMUM=0.4.3
43DBUS_GLIB_MINIMUM=0.70
44LIBEVENT_MINIMUM=1.4.5
45AC_SUBST(OPENSSL_MINIMUM)
46AC_SUBST(CURL_MINIMUM)
47AC_SUBST(GIO_MINIMUM)
48AC_SUBST(GLIB_MINIMUM)
49AC_SUBST(GTK_MINIMUM)
50AC_SUBST(LIBNOTIFY_MINIMUM)
51AC_SUBST(DBUS_GLIB_MINIMUM)
52AC_SUBST(LIBEVENT_MINIUM)
53
54AC_PROG_CC
55AC_PROG_CXX
56AC_C_INLINE
57if test "x$GCC" = "xyes" ; then
58
59    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"
60
61    dnl figure out gcc version
62    AC_MSG_CHECKING([gcc version])
63    GCC_VERSION=`$CC -dumpversion`
64    GCC_MAJOR=`echo $GCC_VERSION | cut -d . -f1`
65    GCC_MINOR=`echo $GCC_VERSION | cut -d . -f2`
66    GCC_VERSION_NUM=`(expr $GCC_MAJOR "*" 100 + $GCC_MINOR) 2>/dev/null`
67
68    AC_MSG_RESULT($GCC_VERSION)
69    if test $GCC_VERSION_NUM -ge 304; then
70        dnl these were added in 3.4
71        CFLAGS="$CFLAGS -Wextra -Wdeclaration-after-statement -Winit-self"
72    fi
73fi
74
75AC_HEADER_STDC
76AC_HEADER_TIME
77
78AC_CHECK_FUNCS([lrintf strlcpy daemon dirname basename strcasecmp localtime_r posix_fallocate memmem])
79AC_PROG_INSTALL
80AC_PROG_MAKE_SET
81ACX_PTHREAD
82
83AC_SEARCH_LIBS(cos, [m])
84AC_SEARCH_LIBS([socket], [socket net])
85AC_SEARCH_LIBS([gethostbyname], [nsl bind])
86PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM], , [CHECK_SSL()])
87PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM])
88AC_PATH_ZLIB
89
90AC_SYS_LARGEFILE
91
92
93dnl ----------------------------------------------------------------------------
94dnl
95dnl posix_fadvise
96
97dnl can posix_fadvise be used
98AC_CHECK_DECLS(posix_fadvise, [], [], [
99#define _XOPEN_SOURCE 600
100#include <fcntl.h>])
101AC_CHECK_FUNCS([posix_fadvise])
102
103
104dnl ----------------------------------------------------------------------------
105dnl
106dnl file monitoring for the daemon
107
108AC_CHECK_HEADER([sys/inotify.h],
109                [AC_CHECK_FUNC([inotify_init],[have_inotify="yes"],[have_inotify="no"])],
110                [have_inotify="no"])
111AC_ARG_WITH([inotify],
112            [AS_HELP_STRING([--with-inotify],[Enable inotify support (default=auto)])],
113            [want_inotify=${enableval}],
114            [want_inotify=${have_inotify}])
115if test "x$want_inotify" = "xyes" ; then
116    if test "x$have_inotify" = "xyes"; then
117      AC_DEFINE([WITH_INOTIFY],[1])
118    else
119      AC_MSG_ERROR("inotify not found!")
120    fi
121fi
122 
123AC_CHECK_HEADER([sys/event.h],
124                [AC_CHECK_FUNC([kqueue],[have_kqueue="yes"],[have_kqueue="no"])],
125                [have_kqueue="no"])
126AC_ARG_WITH([kqueue],
127            [AS_HELP_STRING([--with-kqueue],[Enable kqueue support (default=auto)])],
128            [want_kqueue=${enableval}],
129            [want_kqueue=${have_kqueue}])
130if test "x$want_kqueue" = "xyes" ; then
131    if test "x$have_kqueue" = "xyes"; then
132      AC_DEFINE([WITH_KQUEUE],[1])
133    else
134      AC_MSG_ERROR("kqueue not found!")
135    fi
136fi
137
138AC_CHECK_HEADERS([xfs/xfs.h])
139
140
141dnl ----------------------------------------------------------------------------
142dnl
143dnl va_copy
144
145AC_MSG_CHECKING([how to copy va_list])
146AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);],
147    AC_MSG_RESULT([va_copy]),
148        [ AH_TEMPLATE([va_copy], [define if va_copy is not available])
149        AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);],
150        [ AC_DEFINE([va_copy], [__va_copy])
151        AC_MSG_RESULT([__va_copy])],
152        [ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))])
153        AC_MSG_RESULT([memcpy])]
154    )
155])
156
157
158dnl libevent likes to link against librt if possible
159dnl for clock_gettime() and clock_settime()
160dnl TODO(libevent2): this can probably be removed after
161dnl we switch to libevent2, since it will have PKG_CONFIG
162AC_CHECK_LIB([rt],
163             [clock_gettime],
164             [libevent_extra_libs="-lrt"],
165             [libevent_extra_libs=""])
166
167dnl build our copy of libevent whether we use it or not,
168dnl because "make dist" needs its Makefiles to exist, and
169dnl AM_CONDITIONAL + AC_CONFIG_SUBDIRS don't seem to play nice
170AC_CONFIG_SUBDIRS([third-party/libevent])
171libevent_source=bundled
172AC_CHECK_LIB([event],[evutil_vsnprintf],
173             [libevent_found=yes],
174             [libevent_found=no],
175             [$libevent_extra_libs])
176AC_CHECK_HEADER([event-config.h],
177                [libevent_headers_found=yes],
178                [libevent_headers_found=no])
179libevent_source=bundled
180if test "x$libevent_found" = "xyes" ; then
181    if test "x$libevent_headers_found" = "xyes"; then
182      libevent_source=system
183    fi
184fi
185if test "x$libevent_source" = "xbundled"; then
186    AC_MSG_WARN([using our own libevent from third-party/libevent/])
187    AC_MSG_WARN([if you are cross-compiling this is probably NOT what you want.])
188    LIBEVENT_CFLAGS="-I\$(top_srcdir)/third-party/libevent -I\$(top_builddir)/third-party/libevent"
189    LIBEVENT_LIBS="\$(top_builddir)/third-party/libevent/libevent.la"
190else
191    LIBEVENT_CFLAGS=""
192    LIBEVENT_LIBS="-levent $libevent_extra_libs"
193fi
194AC_SUBST(LIBEVENT_CFLAGS)
195AC_SUBST(LIBEVENT_LIBS)
196
197
198dnl ----------------------------------------------------------------------------
199dnl
200dnl  dht
201
202
203AC_ARG_ENABLE([dht],
204              AS_HELP_STRING([--disable-dht],[omit DHT support]),
205              [enable_dht=${enableval}],
206              [enable_dht=yes])
207if test "x$enable_dht" = "xno" ; then
208    AC_DEFINE([WITHOUT_DHT], 1)
209    DHT_CFLAGS=""
210    DHT_LIBS=""
211else
212    DHT_CFLAGS="-I\$(top_srcdir)/third-party/dht"
213    DHT_LIBS="\$(top_builddir)/third-party/dht/libdht.a"
214fi
215AM_CONDITIONAL(DHT, test "x$enable_dht" = "xyes")
216AC_SUBST(DHT_CFLAGS)
217AC_SUBST(DHT_LIBS)
218
219
220dnl ----------------------------------------------------------------------------
221dnl
222dnl  detection for the GTK+ client
223
224PKG_CHECK_MODULES(GTK,
225                  [gtk+-2.0 >= $GTK_MINIMUM
226                   glib-2.0 >= $GLIB_MINIMUM
227                   gmodule-2.0 >= $GLIB_MINIMUM
228                   gthread-2.0 >= $GLIB_MINIMUM],
229                  [have_gtk=yes],
230                  [have_gtk=no])
231AC_ARG_ENABLE([gtk],
232              AS_HELP_STRING([--enable-gtk],[build gtk client]),
233              [want_gtk=${enableval}],
234              [want_gtk=${have_gtk}])
235build_gtk=no
236use_gio=no
237use_libnotify=no
238use_dbus_glib=no
239if test "x$want_gtk" = "xyes" ; then
240    if test "x$have_gtk" = "xyes"; then
241      build_gtk=yes
242    else
243      AC_MSG_ERROR("GTK+ not found!")
244    fi
245fi
246AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"])
247AC_SUBST(GTK_LIBS)
248AC_SUBST(GTK_CFLAGS)
249
250if test "x$build_gtk" = "xyes"; then
251
252    PKG_CHECK_MODULES([GIO],
253                      [gio-2.0 >= $GIO_MINIMUM],
254                      [use_gio=yes],
255                      [use_gio=no])
256    AC_SUBST(GIO_LIBS)
257    AC_SUBST(GIO_CFLAGS)
258    if test "x$use_gio" = "xyes"; then
259        AC_DEFINE([HAVE_GIO], 1)
260    fi
261
262    PKG_CHECK_MODULES([LIBNOTIFY],
263                      [libnotify >= $LIBNOTIFY_MINIMUM],
264                      [have_libnotify=yes],
265                      [have_libnotify=no])
266    AC_ARG_ENABLE([libnotify],
267                  AS_HELP_STRING([--enable-libnotify],[enable notifications]),,
268                  [enable_libnotify=yes])
269    use_libnotify=no
270    if test "x$enable_libnotify" = "xyes" ; then
271        if test "x$have_libnotify" = "xyes"; then
272            use_libnotify=yes
273            AC_SUBST(LIBNOTIFY_LIBS)
274            AC_SUBST(LIBNOTIFY_CFLAGS)
275            AC_DEFINE([HAVE_LIBNOTIFY], 1)
276        fi
277    fi
278
279    PKG_CHECK_MODULES([DBUS_GLIB],
280                      [dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
281                      [use_dbus_glib=yes],
282                      [use_dbus_glib=no])
283    AC_SUBST(DBUS_GLIB_LIBS)
284    AC_SUBST(DBUS_GLIB_CFLAGS)
285    if test "x$use_dbus_glib" = "xyes"; then
286        AC_DEFINE([HAVE_DBUS_GLIB], 1)
287    fi
288    if test "x$use_dbus_glib" = "xyes"; then
289        AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
290        if test "x$DBUS_BINDING_TOOL" = xno; then
291          AC_MSG_WARN([Cannot find dbus-binding-tool])
292          use_dbus_glib="no (dbus-binding-tool not found)"
293        fi
294    fi
295fi
296
297AC_ARG_ENABLE([nls],
298              AS_HELP_STRING([--enable-nls],[enable native language support]),,
299              [enable_nls=yes])
300
301if test "x$build_gtk" = "xyes" -a  "x$enable_nls" = "xno" ; then
302    AC_MSG_ERROR("The gtk client cannot be built without nls support.  Try adding either --enable-nls or --disable-gtk" )
303fi
304
305dnl This section is only used for internationalization.
306dnl If you don't need translations and this section gives you trouble --
307dnl such as if you're building for a headless system --
308dnl it's okay to tear this section out and re-build the configure script.
309dnl
310dnl Note to packagers: the bump to intltool 0.40 was made to fix
311dnl a "make check" failure on some systems.  if upgrading to 0.40 is
312dnl a problem and the old version was working fine for you,
313dnl it should be safe to re-edit 0.40 back down to 0.23
314
315use_nls=no
316if test "x$enable_nls" = "xyes" ; then
317    use_nls=yes
318    IT_PROG_INTLTOOL([0.40.0],[no-xml])
319    AC_CHECK_HEADERS([libintl.h])
320    GETTEXT_PACKAGE=transmission
321    AC_SUBST(GETTEXT_PACKAGE)
322    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
323    AM_GLIB_GNU_GETTEXT
324    transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
325    AC_SUBST(transmissionlocaledir)
326fi
327
328
329dnl ----------------------------------------------------------------------------
330dnl
331dnl  platform-specific stuff.
332
333AC_CANONICAL_HOST
334have_darwin="no"
335have_msw="no"
336case $host_os in
337
338   *cygwin|*mingw32*)
339     have_msw="yes"
340     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
341     CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
342     LIBS="$LIBS -lshell32 -lws2_32"
343     transmissionlocaledir="locale"
344     if test -z "$host_alias"; then
345       hostaliaswindres=
346     else
347       hostaliaswindres="$host_alias-windres";
348     fi
349     AC_CHECK_TOOL(WINDRES, windres)
350     ;;
351
352  *darwin*)
353    have_darwin="yes"
354    # Make sure the proper Mac SDK is installed
355    if test ! -d /Developer/SDKs/MacOSX10.5.sdk; then
356      cat << EOF
357You need to install the Mac OS X 10.5 SDK in order to build Transmission:
358  Get your Xcode CD or package
359  Restart the install
360  When it gets to "Installation Type", select "Customize"
361  Select "Mac OS X 10.5 SDK" under "Cross Development"
362  Finish the install.
363EOF
364      exit 1
365    fi
366    ;;
367
368esac
369
370AC_ARG_ENABLE([cli],
371              [AS_HELP_STRING([--enable-cli],[build command-line client])],
372              [build_cli=${enableval}],
373              [build_cli="yes"])
374AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
375
376AC_ARG_ENABLE([mac],
377              [AS_HELP_STRING([--enable-mac],[build Mac client])],
378              [build_mac=${enableval}],
379              [build_mac=${have_darwin}])
380AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
381
382AC_ARG_ENABLE([daemon],
383              [AS_HELP_STRING([--enable-daemon],[build daemon])],
384              [build_daemon=${enableval}],
385              [build_daemon="yes"])
386AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
387
388
389if test "x$have_darwin" = "xyes"; then
390    AC_DEFINE([HAVE_DARWIN], 1)
391fi
392if test "x$have_msw" = "xyes"; then
393    AC_DEFINE([HAVE_MSW], 1)
394fi
395AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
396
397dnl ----------------------------------------------------------------------------
398dnl
399dnl  Generate the output
400
401AC_CONFIG_FILES([Makefile
402                 transmission.spec
403                 cli/Makefile
404                 daemon/Makefile
405                 doc/Makefile
406                 libtransmission/Makefile
407                 third-party/Makefile
408                 third-party/miniupnp/Makefile
409                 third-party/libnatpmp/Makefile
410                 third-party/dht/Makefile
411                 macosx/Makefile
412                 gtk/Makefile
413                 gtk/icons/Makefile
414                 po/Makefile.in])
415
416ac_configure_args="$ac_configure_args --enable-static --disable-shared -q"
417AC_OUTPUT
418
419echo "
420
421Configuration:
422
423        Source code location:          ${srcdir}
424        Compiler:                      ${CXX}
425        System or bundled libevent:    ${libevent_source}
426        DHT support:                   ${enable_dht}
427
428        Build Mac client:              ${build_mac}
429        Build GTK+ client:             ${build_gtk}
430          ... with gio support:        ${use_gio}
431          ... with dbus-glib support:  ${use_dbus_glib}
432          ... with libnotify support:  ${use_libnotify}
433        Build Command-Line client:     ${build_cli}
434        Build Daemon:                  ${build_daemon}
435
436"
Note: See TracBrowser for help on using the repository browser.