source: trunk/configure.ac @ 8551

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

(trunk) fix "make distcheck" issue raised by a libevent cleanup in 1.4.11

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