source: branches/1.4x/configure.ac @ 7455

Last change on this file since 7455 was 7455, checked in by charles, 12 years ago

(1.4x libT) backport handshake, peer, bandwidth, peer-io to 1.4x.

File size: 10.3 KB
Line 
1dnl convention: -TR MAJOR MINOR MAINT STATUS - (each a single char)
2dnl STATUS: "X" for prerelease test 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.41b4])
7m4_define([peer_id_prefix],[-TR141X-])
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
13AC_CONFIG_MACRO_DIR([m4])
14
15dnl AM_CONFIG_HEADER(config.h)
16AC_CONFIG_SRCDIR(libtransmission/transmission.h)
17AM_INIT_AUTOMAKE([1.9 tar-ustar])
18AC_PROG_LIBTOOL
19
20if test m4_substr(peer_id_prefix,6,1) = "Z"; then
21  AC_DEFINE(TR_UNSTABLE, 1, [Define to 1 if this is an unstable version of Transmission])
22  TR_UNSTABLE=yes
23fi
24AM_CONDITIONAL(TR_UNSTABLE, test "x$TR_UNSTABLE" = "xyes")
25
26OPENSSL_MINIMUM=0.9.4
27CURL_MINIMUM=7.16.3
28GIO_MINIMUM=2.15.5
29GLIB_MINIMUM=2.6.0
30GTK_MINIMUM=2.6.0
31WX_MINIMUM=2.6.0
32LIBNOTIFY_MINIMUM=0.4.4
33DBUS_GLIB_MINIMUM=0.70
34AC_SUBST(OPENSSL_MINIMUM)
35AC_SUBST(CURL_MINIMUM)
36AC_SUBST(GIO_MINIMUM)
37AC_SUBST(GLIB_MINIMUM)
38AC_SUBST(GTK_MINIMUM)
39AC_SUBST(WX_MINIMUM)
40AC_SUBST(LIBNOTIFY_MINIMUM)
41AC_SUBST(DBUS_GLIB_MINIMUM)
42
43AC_PROG_CC
44AC_PROG_CXX
45if test "x$GCC" = "xyes" ; then
46    CFLAGS="-g -Wall -Wformat-security -W -Wmissing-prototypes -Wdeclaration-after-statement -O3 -funroll-loops"
47    CXXFLAGS="-g -Wall -Wformat-security -W -O3 -funroll-loops"
48fi
49
50AC_HEADER_STDC
51AC_HEADER_TIME
52
53AC_MSG_CHECKING([for fallocate])
54AC_TRY_LINK([#include <linux/falloc.h>],
55            [return fallocate(-1,0,0,0);],
56            [AC_DEFINE([HAVE_FALLOCATE],[1],[Defined if fallocate() exists])
57             AC_MSG_RESULT([yes])],
58            [AC_MSG_RESULT([no])])
59AC_CHECK_FUNCS([lrintf strlcpy daemon dirname basename daemon strcasecmp localtime_r posix_fallocate])
60AC_PROG_INSTALL
61AC_PROG_MAKE_SET
62ACX_PTHREAD
63
64AC_SEARCH_LIBS([socket], [socket net])
65AC_SEARCH_LIBS([gethostbyname], [nsl bind])
66PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM], , [CHECK_SSL()])
67PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM])
68AC_PATH_ZLIB
69
70AC_SYS_LARGEFILE
71
72dnl ----------------------------------------------------------------------------
73dnl
74dnl va_copy
75
76AC_MSG_CHECKING([how to copy va_list])
77AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);],
78    AC_MSG_RESULT([va_copy]),
79        [ AH_TEMPLATE([va_copy], [define if va_copy is not available])
80        AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);],
81        [ AC_DEFINE([va_copy], [__va_copy])
82        AC_MSG_RESULT([__va_copy])],
83        [ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))])
84        AC_MSG_RESULT([memcpy])]
85    )
86])
87
88
89dnl ----------------------------------------------------------------------------
90dnl
91dnl  libevent fun
92
93AC_CONFIG_SUBDIRS([third-party/libevent])
94AC_MSG_NOTICE([invoking libevent's configure script])
95LIBEVENT_CPPFLAGS="-I\$(top_srcdir)/third-party/libevent"
96AC_SUBST(LIBEVENT_CPPFLAGS)
97
98
99dnl ----------------------------------------------------------------------------
100dnl
101dnl  detection for the GTK+ client
102
103PKG_CHECK_MODULES(GTK,
104                  [gtk+-2.0 >= $GTK_MINIMUM
105                   glib-2.0 >= $GLIB_MINIMUM
106                   gmodule-2.0 >= $GLIB_MINIMUM
107                   gthread-2.0 >= $GLIB_MINIMUM],
108                  [have_gtk=yes],
109                  [have_gtk=no])
110AC_ARG_ENABLE([gtk],
111              AC_HELP_STRING([--enable-gtk],[build gtk client]),
112              [want_gtk=${enableval}],
113              [want_gtk=${have_gtk}])
114build_gtk=no
115use_gio=no
116use_libnotify=no
117use_dbus_glib=no
118if test "x$want_gtk" = "xyes" ; then
119    if test "x$have_gtk" = "xyes"; then
120      build_gtk=yes
121    else
122      AC_MSG_ERROR("GTK+ not found!")
123    fi
124fi
125AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"])
126AC_SUBST(GTK_LIBS)
127AC_SUBST(GTK_CFLAGS)
128
129if test "x$build_gtk" = "xyes"; then
130
131    PKG_CHECK_MODULES([GIO],
132                      [gio-2.0 >= $GIO_MINIMUM],
133                      [use_gio=yes],
134                      [use_gio=no])
135    AC_SUBST(GIO_LIBS)
136    AC_SUBST(GIO_CFLAGS)
137    if test "x$use_gio" = "xyes"; then
138        AC_DEFINE([HAVE_GIO], 1)
139    fi
140
141    PKG_CHECK_MODULES([LIBNOTIFY],
142                      [libnotify >= $LIBNOTIFY_MINIMUM],
143                      [have_libnotify=yes],
144                      [have_libnotify=no])
145    AC_ARG_ENABLE([libnotify],
146                  AS_HELP_STRING([--enable-libnotify],[enable notifications]),,
147                  [enable_libnotify=yes])
148    use_libnotify=no
149    if test "x$enable_libnotify" = "xyes" ; then
150        if test "x$have_libnotify" = "xyes"; then
151            use_libnotify=yes
152            AC_SUBST(LIBNOTIFY_LIBS)
153            AC_SUBST(LIBNOTIFY_CFLAGS)
154            AC_DEFINE([HAVE_LIBNOTIFY], 1)
155        fi
156    fi
157
158    PKG_CHECK_MODULES([DBUS_GLIB],
159                      [dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
160                      [use_dbus_glib=yes],
161                      [use_dbus_glib=no])
162    AC_SUBST(DBUS_GLIB_LIBS)
163    AC_SUBST(DBUS_GLIB_CFLAGS)
164    if test "x$use_dbus_glib" = "xyes"; then
165        AC_DEFINE([HAVE_DBUS_GLIB], 1)
166    fi
167    if test "x$use_dbus_glib" = "xyes"; then
168        AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
169        if test "x$DBUS_BINDING_TOOL" = xno; then
170          AC_MSG_WARN([Cannot find dbus-binding-tool])
171          use_dbus_glib="no (dbus-binding-tool not found)"
172        fi
173    fi
174fi
175
176AC_CHECK_HEADERS([libintl.h])
177IT_PROG_INTLTOOL([0.23],[no-xml])
178GETTEXT_PACKAGE=transmission
179AC_SUBST(GETTEXT_PACKAGE)
180AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
181AM_GLIB_GNU_GETTEXT
182transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
183AC_SUBST(transmissionlocaledir)
184
185
186dnl ----------------------------------------------------------------------------
187dnl
188dnl  wxWidgets detection for the wxWidgets client
189
190build_wx=no
191AC_ARG_ENABLE([wx],
192              AC_HELP_STRING([--enable-wx],[build wxWidgets client]),
193              [want_wx=${enableval}],
194              [want_wx=maybe])
195if test "x$want_wx" != "xno"; then
196    AM_OPTIONS_WXCONFIG
197    AM_PATH_WXCONFIG($WX_MINIMUM,[have_wx=yes],[have_wx=no])
198    if test "x$have_wx" = "xyes"; then
199        build_wx=yes
200    elif test "x$want_wx" = "xyes"; then
201        AC_MSG_ERROR("wxWidgets not found!")
202    fi
203fi
204AM_CONDITIONAL([BUILD_WX],[test "x$build_wx" = "xyes"])
205
206
207
208dnl ----------------------------------------------------------------------------
209dnl
210dnl  platform-specific stuff.
211
212AC_CANONICAL_HOST
213have_beos="no"
214have_darwin="no"
215have_msw="no"
216case $host_os in
217
218   *cygwin|*mingw32*)
219     have_msw="yes"
220     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
221     CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
222     LIBS="$LIBS -lshell32 -lws2_32"
223     transmissionlocaledir="locale"
224     if test -z "$host_alias"; then
225       hostaliaswindres=
226     else
227       hostaliaswindres="$host_alias-windres";
228     fi
229     AC_CHECK_TOOL(WINDRES, windres)
230     ;;
231
232  *beos*)
233    have_beos="yes"
234    RELEASE=`uname -r`
235    case $RELEASE in
236      6.*|5.0.4) # Zeta or R5 / BONE beta 7
237        ;;
238      5.0*)       # R5 / net_server
239        CPPFLAGS="$CPPFLAGS -DBEOS_NETSERVER"
240        ;;
241      *)
242        AC_MSG_ERROR("Unsupported BeOS version")
243        ;;
244    esac
245    GCCVER=`$CC -dumpversion`
246    case $GCCVER in
247      2.95.3*|3*|4*)
248        ;;
249      2.9*)
250        BEOS_OLDCC=yes
251        ;;
252      *)
253        AC_MSG_ERROR("Unsupported gcc version")
254        ;;
255    esac
256    ;;
257
258  *darwin*)
259    have_darwin="yes"
260    # Make sure the Universal SDK is installed
261    if test ! -d /Developer/SDKs/MacOSX10.4u.sdk; then
262      cat << EOF
263You need to install the Universal SDK in order to build Transmission:
264  Get your Xcode CD or package
265  Restart the install
266  When it gets to "Installation Type", select "Customize"
267  Select "Mac OS X 10.4 (Universal) SDK" under "Cross Development"
268  Finish the install.
269EOF
270      exit 1
271    fi
272    ;;
273
274esac
275
276AC_ARG_ENABLE([beos],
277              [AC_HELP_STRING([--enable-beos],[build OS X client])],
278              [build_beos=${enableval}],
279              [build_beos=${have_beos}])
280AM_CONDITIONAL([BUILD_BEOS],[test "x$build_beos" = "xyes"])
281
282AC_ARG_ENABLE([cli],
283              [AC_HELP_STRING([--enable-cli],[build command-line client])],
284              [build_cli=${enableval}],
285              [build_cli="yes"])
286AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
287
288AC_ARG_ENABLE([mac],
289              [AC_HELP_STRING([--enable-mac],[build OS X client])],
290              [build_mac=${enableval}],
291              [build_mac=${have_darwin}])
292AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
293
294AC_ARG_ENABLE([daemon],
295              [AC_HELP_STRING([--enable-daemon],[build daemon])],
296              [build_daemon=${enableval}],
297              [build_daemon="yes"])
298AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
299
300
301if test "x$have_beos" = "xyes"; then
302    AC_DEFINE([HAVE_BEOS], 1)
303fi
304if test "x$have_darwin" = "xyes"; then
305    AC_DEFINE([HAVE_DARWIN], 1)
306fi
307if test "x$have_msw" = "xyes"; then
308    AC_DEFINE([HAVE_MSW], 1)
309fi
310AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
311
312dnl ----------------------------------------------------------------------------
313dnl
314dnl  Generate the output
315
316AC_CONFIG_FILES([Makefile
317                 transmission.spec
318                 beos/Makefile
319                 cli/Makefile
320                 daemon/Makefile
321                 doc/Makefile
322                 libtransmission/Makefile
323                 third-party/Makefile
324                 third-party/miniupnp/Makefile
325                 third-party/libnatpmp/Makefile
326                 macosx/Makefile
327                 wx/Makefile
328                 wx/images/Makefile
329                 gtk/Makefile
330                 gtk/icons/Makefile
331                 po/Makefile.in])
332
333ac_configure_args="$ac_configure_args --enable-static --disable-shared -q"
334AC_OUTPUT
335
336echo "
337
338Configuration:
339
340        Source code location:       ${srcdir}
341        Compiler:                   ${CXX}
342        Build Command-Line client:  ${build_cli}
343        Build Daemon:               ${build_daemon}
344        Build BeOS client:          ${build_beos}
345        Build GTK+ client:          ${build_gtk}
346          ... gio support:          ${use_gio}
347          ... dbus-glib support:    ${use_dbus_glib}
348          ... libnotify support:    ${use_libnotify}
349        Build OS X client:          ${build_mac}
350        Build wxWidgets client:     ${build_wx}
351
352"
Note: See TracBrowser for help on using the repository browser.