source: trunk/configure.ac @ 8665

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

(trunk) make the cross-compile libevent warning a little louder

File size: 12.6 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.71])
7m4_define([peer_id_prefix],[-TR1710-])
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_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 memmem])
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 file monitoring for the daemon
118
119AC_CHECK_HEADER([sys/inotify.h],
120                [AC_CHECK_FUNC([inotify_init],[have_inotify="yes"],[have_inotify="no"])],
121                [have_inotify="no"])
122AC_ARG_WITH([inotify],
123            [AS_HELP_STRING([--with-inotify],[Enable inotify support (default=auto)])],
124            [want_inotify=${enableval}],
125            [want_inotify=${have_inotify}])
126if test "x$want_inotify" = "xyes" ; then
127    if test "x$have_inotify" = "xyes"; then
128      AC_DEFINE([WITH_INOTIFY],[1])
129    else
130      AC_MSG_ERROR("inotify not found!")
131    fi
132fi
133 
134AC_CHECK_HEADER([sys/event.h],
135                [AC_CHECK_FUNC([kqueue],[have_kqueue="yes"],[have_kqueue="no"])],
136                [have_kqueue="no"])
137AC_ARG_WITH([kqueue],
138            [AS_HELP_STRING([--with-kqueue],[Enable kqueue support (default=auto)])],
139            [want_kqueue=${enableval}],
140            [want_kqueue=${have_kqueue}])
141if test "x$want_kqueue" = "xyes" ; then
142    if test "x$have_kqueue" = "xyes"; then
143      AC_DEFINE([WITH_KQUEUE],[1])
144    else
145      AC_MSG_ERROR("kqueue not found!")
146    fi
147fi
148
149AC_CHECK_HEADERS([xfs/xfs.h])
150
151
152dnl ----------------------------------------------------------------------------
153dnl
154dnl va_copy
155
156AC_MSG_CHECKING([how to copy va_list])
157AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);],
158    AC_MSG_RESULT([va_copy]),
159        [ AH_TEMPLATE([va_copy], [define if va_copy is not available])
160        AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);],
161        [ AC_DEFINE([va_copy], [__va_copy])
162        AC_MSG_RESULT([__va_copy])],
163        [ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))])
164        AC_MSG_RESULT([memcpy])]
165    )
166])
167
168
169dnl build our copy of libevent whether we use it or not,
170dnl because "make dist" needs its Makefiles to exist, and
171dnl AM_CONDITIONAL + AC_CONFIG_SUBDIRS don't seem to play nice
172AC_CONFIG_SUBDIRS([third-party/libevent])
173libevent_source=bundled
174AC_CHECK_LIB([event],[evutil_vsnprintf],
175             [libevent_found=yes],
176             [libevent_found=no],
177             [-levent])
178AC_CHECK_HEADER([event-config.h],
179                [libevent_headers_found=yes],
180                [libevent_headers_found=no])
181libevent_source=bundled
182if test "x$libevent_found" = "xyes" ; then
183    if test "x$libevent_headers_found" = "xyes"; then
184      libevent_source=system
185    fi
186fi
187if test "x$libevent_source" = "xbundled"; then
188    AC_MSG_WARN([using our own libevent from third-party/libevent/])
189    AC_MSG_WARN([if you are cross-compiling this is probably NOT what you want.])
190    LIBEVENT_CPPFLAGS="-I\$(top_srcdir)/third-party/libevent -I\$(top_builddir)/third-party/libevent"
191    LIBEVENT_LIBS="\$(top_builddir)/third-party/libevent/libevent.la"
192else
193    LIBEVENT_CPPFLAGS=""
194    LIBEVENT_LIBS="-levent -lrt"
195fi
196AC_SUBST(LIBEVENT_CPPFLAGS)
197AC_SUBST(LIBEVENT_LIBS)
198
199
200dnl ----------------------------------------------------------------------------
201dnl
202dnl  detection for the GTK+ client
203
204PKG_CHECK_MODULES(GTK,
205                  [gtk+-2.0 >= $GTK_MINIMUM
206                   glib-2.0 >= $GLIB_MINIMUM
207                   gmodule-2.0 >= $GLIB_MINIMUM
208                   gthread-2.0 >= $GLIB_MINIMUM],
209                  [have_gtk=yes],
210                  [have_gtk=no])
211AC_ARG_ENABLE([gtk],
212              AS_HELP_STRING([--enable-gtk],[build gtk client]),
213              [want_gtk=${enableval}],
214              [want_gtk=${have_gtk}])
215build_gtk=no
216use_gio=no
217use_libnotify=no
218use_dbus_glib=no
219if test "x$want_gtk" = "xyes" ; then
220    if test "x$have_gtk" = "xyes"; then
221      build_gtk=yes
222    else
223      AC_MSG_ERROR("GTK+ not found!")
224    fi
225fi
226AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"])
227AC_SUBST(GTK_LIBS)
228AC_SUBST(GTK_CFLAGS)
229
230if test "x$build_gtk" = "xyes"; then
231
232    PKG_CHECK_MODULES([GIO],
233                      [gio-2.0 >= $GIO_MINIMUM],
234                      [use_gio=yes],
235                      [use_gio=no])
236    AC_SUBST(GIO_LIBS)
237    AC_SUBST(GIO_CFLAGS)
238    if test "x$use_gio" = "xyes"; then
239        AC_DEFINE([HAVE_GIO], 1)
240    fi
241
242    PKG_CHECK_MODULES([LIBNOTIFY],
243                      [libnotify >= $LIBNOTIFY_MINIMUM],
244                      [have_libnotify=yes],
245                      [have_libnotify=no])
246    AC_ARG_ENABLE([libnotify],
247                  AS_HELP_STRING([--enable-libnotify],[enable notifications]),,
248                  [enable_libnotify=yes])
249    use_libnotify=no
250    if test "x$enable_libnotify" = "xyes" ; then
251        if test "x$have_libnotify" = "xyes"; then
252            use_libnotify=yes
253            AC_SUBST(LIBNOTIFY_LIBS)
254            AC_SUBST(LIBNOTIFY_CFLAGS)
255            AC_DEFINE([HAVE_LIBNOTIFY], 1)
256        fi
257    fi
258
259    PKG_CHECK_MODULES([DBUS_GLIB],
260                      [dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
261                      [use_dbus_glib=yes],
262                      [use_dbus_glib=no])
263    AC_SUBST(DBUS_GLIB_LIBS)
264    AC_SUBST(DBUS_GLIB_CFLAGS)
265    if test "x$use_dbus_glib" = "xyes"; then
266        AC_DEFINE([HAVE_DBUS_GLIB], 1)
267    fi
268    if test "x$use_dbus_glib" = "xyes"; then
269        AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
270        if test "x$DBUS_BINDING_TOOL" = xno; then
271          AC_MSG_WARN([Cannot find dbus-binding-tool])
272          use_dbus_glib="no (dbus-binding-tool not found)"
273        fi
274    fi
275fi
276
277AC_ARG_ENABLE([nls],
278              AS_HELP_STRING([--enable-nls],[enable native language support]),,
279              [enable_nls=yes])
280
281if test "x$build_gtk" = "xyes" -a  "x$enable_nls" = "xno" ; then
282    AC_MSG_ERROR("The gtk client cannot be built without nls support.  Try adding either --enable-nls or --disable-gtk" )
283fi
284
285use_nls=no
286if test "x$enable_nls" = "xyes" ; then
287    use_nls=yes
288    IT_PROG_INTLTOOL([0.40.0],[no-xml])
289    AC_CHECK_HEADERS([libintl.h])
290    GETTEXT_PACKAGE=transmission
291    AC_SUBST(GETTEXT_PACKAGE)
292    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
293    AM_GLIB_GNU_GETTEXT
294    transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
295    AC_SUBST(transmissionlocaledir)
296fi
297
298
299dnl ----------------------------------------------------------------------------
300dnl
301dnl  platform-specific stuff.
302
303AC_CANONICAL_HOST
304have_darwin="no"
305have_msw="no"
306case $host_os in
307
308   *cygwin|*mingw32*)
309     have_msw="yes"
310     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
311     CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
312     LIBS="$LIBS -lshell32 -lws2_32"
313     transmissionlocaledir="locale"
314     if test -z "$host_alias"; then
315       hostaliaswindres=
316     else
317       hostaliaswindres="$host_alias-windres";
318     fi
319     AC_CHECK_TOOL(WINDRES, windres)
320     ;;
321
322  *darwin*)
323    have_darwin="yes"
324    # Make sure the Universal SDK is installed
325    if test ! -d /Developer/SDKs/MacOSX10.4u.sdk; then
326      cat << EOF
327You need to install the Universal SDK in order to build Transmission:
328  Get your Xcode CD or package
329  Restart the install
330  When it gets to "Installation Type", select "Customize"
331  Select "Mac OS X 10.4 (Universal) SDK" under "Cross Development"
332  Finish the install.
333EOF
334      exit 1
335    fi
336    ;;
337
338esac
339
340AC_ARG_ENABLE([cli],
341              [AS_HELP_STRING([--enable-cli],[build command-line client])],
342              [build_cli=${enableval}],
343              [build_cli="yes"])
344AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
345
346AC_ARG_ENABLE([mac],
347              [AS_HELP_STRING([--enable-mac],[build OS X client])],
348              [build_mac=${enableval}],
349              [build_mac=${have_darwin}])
350AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
351
352AC_ARG_ENABLE([daemon],
353              [AS_HELP_STRING([--enable-daemon],[build daemon])],
354              [build_daemon=${enableval}],
355              [build_daemon="yes"])
356AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
357
358
359if test "x$have_darwin" = "xyes"; then
360    AC_DEFINE([HAVE_DARWIN], 1)
361fi
362if test "x$have_msw" = "xyes"; then
363    AC_DEFINE([HAVE_MSW], 1)
364fi
365AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
366
367dnl ----------------------------------------------------------------------------
368dnl
369dnl  Generate the output
370
371AC_CONFIG_FILES([Makefile
372                 transmission.spec
373                 cli/Makefile
374                 daemon/Makefile
375                 doc/Makefile
376                 libtransmission/Makefile
377                 third-party/Makefile
378                 third-party/miniupnp/Makefile
379                 third-party/libnatpmp/Makefile
380                 third-party/dht/Makefile
381                 macosx/Makefile
382                 gtk/Makefile
383                 gtk/icons/Makefile
384                 po/Makefile.in])
385
386ac_configure_args="$ac_configure_args --enable-static --disable-shared -q"
387AC_OUTPUT
388
389echo "
390
391Configuration:
392
393        Source code location:          ${srcdir}
394        Compiler:                      ${CXX}
395        System or bundled libevent:    ${libevent_source}
396
397        Build OS X client:             ${build_mac}
398        Build GTK+ client:             ${build_gtk}
399          ... with gio support:        ${use_gio}
400          ... with dbus-glib support:  ${use_dbus_glib}
401          ... with libnotify support:  ${use_libnotify}
402        Build Command-Line client:     ${build_cli}
403        Build Daemon:                  ${build_daemon}
404
405"
Note: See TracBrowser for help on using the repository browser.