source: trunk/configure.ac @ 8700

Last change on this file since 8700 was 8700, checked in by charles, 13 years ago

(trunk) bump for 1.72

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