source: trunk/configure.ac @ 7974

Last change on this file since 7974 was 7974, checked in by charles, 14 years ago

(trunk daemon) another experiment: implement the watchdir with opendir() and readdir(), since those are available on every system we're on, even embedded ones...

File size: 11.1 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.51+])
7m4_define([peer_id_prefix],[-TR151Z-])
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 -funroll-loops "
26    CXXFLAGS="$CXXFLAGS -g -O3 -funroll-loops "
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
48WX_MINIMUM=2.6.0
49LIBNOTIFY_MINIMUM=0.4.3
50DBUS_GLIB_MINIMUM=0.70
51AC_SUBST(OPENSSL_MINIMUM)
52AC_SUBST(CURL_MINIMUM)
53AC_SUBST(GIO_MINIMUM)
54AC_SUBST(GLIB_MINIMUM)
55AC_SUBST(GTK_MINIMUM)
56AC_SUBST(WX_MINIMUM)
57AC_SUBST(LIBNOTIFY_MINIMUM)
58AC_SUBST(DBUS_GLIB_MINIMUM)
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_MSG_CHECKING([for fallocate])
85AC_TRY_LINK([#include <linux/falloc.h>],
86            [return fallocate(-1,0,0,0);],
87            [AC_DEFINE([HAVE_FALLOCATE],[1],[Defined if fallocate() exists])
88             AC_MSG_RESULT([yes])],
89            [AC_MSG_RESULT([no])])
90AC_CHECK_FUNCS([lrintf strlcpy daemon dirname basename daemon strcasecmp localtime_r posix_fallocate])
91AC_PROG_INSTALL
92AC_PROG_MAKE_SET
93ACX_PTHREAD
94
95AC_SEARCH_LIBS([socket], [socket net])
96AC_SEARCH_LIBS([gethostbyname], [nsl bind])
97PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM], , [CHECK_SSL()])
98PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM])
99AC_PATH_ZLIB
100
101AC_SYS_LARGEFILE
102
103
104dnl ----------------------------------------------------------------------------
105dnl
106dnl posix_fadvise
107
108dnl can posix_fadvise be used
109AC_CHECK_DECLS(posix_fadvise, [], [], [
110#define _XOPEN_SOURCE 600
111#include <fcntl.h>])
112AC_CHECK_FUNCS([posix_fadvise])
113
114
115dnl ----------------------------------------------------------------------------
116dnl
117dnl va_copy
118
119AC_MSG_CHECKING([how to copy va_list])
120AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);],
121    AC_MSG_RESULT([va_copy]),
122        [ AH_TEMPLATE([va_copy], [define if va_copy is not available])
123        AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);],
124        [ AC_DEFINE([va_copy], [__va_copy])
125        AC_MSG_RESULT([__va_copy])],
126        [ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))])
127        AC_MSG_RESULT([memcpy])]
128    )
129])
130
131dnl ----------------------------------------------------------------------------
132dnl
133dnl  libevent fun
134
135AC_CONFIG_SUBDIRS([third-party/libevent])
136AC_MSG_NOTICE([invoking libevent's configure script])
137LIBEVENT_CPPFLAGS="-I\$(top_srcdir)/third-party/libevent"
138AC_SUBST(LIBEVENT_CPPFLAGS)
139
140
141dnl ----------------------------------------------------------------------------
142dnl
143dnl  detection for the GTK+ client
144
145PKG_CHECK_MODULES(GTK,
146                  [gtk+-2.0 >= $GTK_MINIMUM
147                   glib-2.0 >= $GLIB_MINIMUM
148                   gmodule-2.0 >= $GLIB_MINIMUM
149                   gthread-2.0 >= $GLIB_MINIMUM],
150                  [have_gtk=yes],
151                  [have_gtk=no])
152AC_ARG_ENABLE([gtk],
153              AS_HELP_STRING([--enable-gtk],[build gtk client]),
154              [want_gtk=${enableval}],
155              [want_gtk=${have_gtk}])
156build_gtk=no
157use_gio=no
158use_libnotify=no
159use_dbus_glib=no
160if test "x$want_gtk" = "xyes" ; then
161    if test "x$have_gtk" = "xyes"; then
162      build_gtk=yes
163    else
164      AC_MSG_ERROR("GTK+ not found!")
165    fi
166fi
167AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"])
168AC_SUBST(GTK_LIBS)
169AC_SUBST(GTK_CFLAGS)
170
171if test "x$build_gtk" = "xyes"; then
172
173    PKG_CHECK_MODULES([GIO],
174                      [gio-2.0 >= $GIO_MINIMUM],
175                      [use_gio=yes],
176                      [use_gio=no])
177    AC_SUBST(GIO_LIBS)
178    AC_SUBST(GIO_CFLAGS)
179    if test "x$use_gio" = "xyes"; then
180        AC_DEFINE([HAVE_GIO], 1)
181    fi
182
183    PKG_CHECK_MODULES([LIBNOTIFY],
184                      [libnotify >= $LIBNOTIFY_MINIMUM],
185                      [have_libnotify=yes],
186                      [have_libnotify=no])
187    AC_ARG_ENABLE([libnotify],
188                  AS_HELP_STRING([--enable-libnotify],[enable notifications]),,
189                  [enable_libnotify=yes])
190    use_libnotify=no
191    if test "x$enable_libnotify" = "xyes" ; then
192        if test "x$have_libnotify" = "xyes"; then
193            use_libnotify=yes
194            AC_SUBST(LIBNOTIFY_LIBS)
195            AC_SUBST(LIBNOTIFY_CFLAGS)
196            AC_DEFINE([HAVE_LIBNOTIFY], 1)
197        fi
198    fi
199
200    PKG_CHECK_MODULES([DBUS_GLIB],
201                      [dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
202                      [use_dbus_glib=yes],
203                      [use_dbus_glib=no])
204    AC_SUBST(DBUS_GLIB_LIBS)
205    AC_SUBST(DBUS_GLIB_CFLAGS)
206    if test "x$use_dbus_glib" = "xyes"; then
207        AC_DEFINE([HAVE_DBUS_GLIB], 1)
208    fi
209    if test "x$use_dbus_glib" = "xyes"; then
210        AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
211        if test "x$DBUS_BINDING_TOOL" = xno; then
212          AC_MSG_WARN([Cannot find dbus-binding-tool])
213          use_dbus_glib="no (dbus-binding-tool not found)"
214        fi
215    fi
216fi
217
218AC_ARG_ENABLE([nls],
219              AS_HELP_STRING([--enable-nls],[enable native language support]),,
220              [enable_nls=yes])
221
222if test "x$build_gtk" = "xyes" -a  "x$enable_nls" = "xno" ; then
223    AC_MSG_ERROR("The gtk client cannot be built without nls support.  Try adding either --enable-nls or --disable-gtk" )
224fi
225
226use_nls=no
227if test "x$enable_nls" = "xyes" ; then
228    use_nls=yes
229    IT_PROG_INTLTOOL([0.23],[no-xml])
230    AC_CHECK_HEADERS([libintl.h])
231    GETTEXT_PACKAGE=transmission
232    AC_SUBST(GETTEXT_PACKAGE)
233    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
234    AM_GLIB_GNU_GETTEXT
235    transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
236    AC_SUBST(transmissionlocaledir)
237fi
238
239dnl ----------------------------------------------------------------------------
240dnl
241dnl  wxWidgets detection for the wxWidgets client
242
243build_wx=no
244AC_ARG_ENABLE([wx],
245              AS_HELP_STRING([--enable-wx],[build wxWidgets client]),
246              [want_wx=${enableval}],
247              [want_wx=no])
248if test "x$want_wx" != "xno"; then
249    AM_OPTIONS_WXCONFIG
250    AM_PATH_WXCONFIG($WX_MINIMUM,[have_wx=yes],[have_wx=no])
251    if test "x$have_wx" = "xyes"; then
252        build_wx=yes
253    elif test "x$want_wx" = "xyes"; then
254        AC_MSG_ERROR("wxWidgets not found!")
255    fi
256fi
257AM_CONDITIONAL([BUILD_WX],[test "x$build_wx" = "xyes"])
258
259
260
261dnl ----------------------------------------------------------------------------
262dnl
263dnl  platform-specific stuff.
264
265AC_CANONICAL_HOST
266have_darwin="no"
267have_msw="no"
268case $host_os in
269
270   *cygwin|*mingw32*)
271     have_msw="yes"
272     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
273     CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
274     LIBS="$LIBS -lshell32 -lws2_32"
275     transmissionlocaledir="locale"
276     if test -z "$host_alias"; then
277       hostaliaswindres=
278     else
279       hostaliaswindres="$host_alias-windres";
280     fi
281     AC_CHECK_TOOL(WINDRES, windres)
282     ;;
283
284  *darwin*)
285    have_darwin="yes"
286    # Make sure the Universal SDK is installed
287    if test ! -d /Developer/SDKs/MacOSX10.4u.sdk; then
288      cat << EOF
289You need to install the Universal SDK in order to build Transmission:
290  Get your Xcode CD or package
291  Restart the install
292  When it gets to "Installation Type", select "Customize"
293  Select "Mac OS X 10.4 (Universal) SDK" under "Cross Development"
294  Finish the install.
295EOF
296      exit 1
297    fi
298    ;;
299
300esac
301
302AC_ARG_ENABLE([cli],
303              [AS_HELP_STRING([--enable-cli],[build command-line client])],
304              [build_cli=${enableval}],
305              [build_cli="yes"])
306AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
307
308AC_ARG_ENABLE([mac],
309              [AS_HELP_STRING([--enable-mac],[build OS X client])],
310              [build_mac=${enableval}],
311              [build_mac=${have_darwin}])
312AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
313
314AC_ARG_ENABLE([daemon],
315              [AS_HELP_STRING([--enable-daemon],[build daemon])],
316              [build_daemon=${enableval}],
317              [build_daemon="yes"])
318AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
319
320
321if test "x$have_darwin" = "xyes"; then
322    AC_DEFINE([HAVE_DARWIN], 1)
323fi
324if test "x$have_msw" = "xyes"; then
325    AC_DEFINE([HAVE_MSW], 1)
326fi
327AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
328
329dnl ----------------------------------------------------------------------------
330dnl
331dnl  Generate the output
332
333AC_CONFIG_FILES([Makefile
334                 transmission.spec
335                 cli/Makefile
336                 daemon/Makefile
337                 doc/Makefile
338                 libtransmission/Makefile
339                 third-party/Makefile
340                 third-party/miniupnp/Makefile
341                 third-party/libnatpmp/Makefile
342                 macosx/Makefile
343                 wx/Makefile
344                 wx/images/Makefile
345                 gtk/Makefile
346                 gtk/icons/Makefile
347                 po/Makefile.in])
348
349ac_configure_args="$ac_configure_args --enable-static --disable-shared -q"
350AC_OUTPUT
351
352echo "
353
354Configuration:
355
356        Source code location:       ${srcdir}
357        Compiler:                   ${CXX}
358        Build Command-Line client:  ${build_cli}
359        Build Daemon:               ${build_daemon}
360        Build GTK+ client:          ${build_gtk}
361          ... gio support:          ${use_gio}
362          ... dbus-glib support:    ${use_dbus_glib}
363          ... libnotify support:    ${use_libnotify}
364        Build OS X client:          ${build_mac}
365        Build wxWidgets client:     ${build_wx}
366
367"
Note: See TracBrowser for help on using the repository browser.