source: trunk/configure.ac @ 8744

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

(trunk configure.ac) add a note about intltool 0.40

File size: 13.4 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],[-TR172Z-])
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  dht
197
198
199AC_ARG_ENABLE([dht],
200              AS_HELP_STRING([--disable-dht],[omit DHT support]),
201              [enable_dht=${enableval}],
202              [enable_dht=yes])
203if test "x$enable_dht" = "xno" ; then
204    AC_DEFINE([WITHOUT_DHT], 1)
205    DHT_CFLAGS=""
206    DHT_LIBS=""
207else
208    DHT_CFLAGS="-I\$(top_srcdir)/third-party/dht"
209    DHT_LIBS="\$(top_builddir)/third-party/dht/libdht.a"
210fi
211AM_CONDITIONAL(DHT, test "x$enable_dht" = "xyes")
212AC_SUBST(DHT_CFLAGS)
213AC_SUBST(DHT_LIBS)
214
215
216dnl ----------------------------------------------------------------------------
217dnl
218dnl  detection for the GTK+ client
219
220PKG_CHECK_MODULES(GTK,
221                  [gtk+-2.0 >= $GTK_MINIMUM
222                   glib-2.0 >= $GLIB_MINIMUM
223                   gmodule-2.0 >= $GLIB_MINIMUM
224                   gthread-2.0 >= $GLIB_MINIMUM],
225                  [have_gtk=yes],
226                  [have_gtk=no])
227AC_ARG_ENABLE([gtk],
228              AS_HELP_STRING([--enable-gtk],[build gtk client]),
229              [want_gtk=${enableval}],
230              [want_gtk=${have_gtk}])
231build_gtk=no
232use_gio=no
233use_libnotify=no
234use_dbus_glib=no
235if test "x$want_gtk" = "xyes" ; then
236    if test "x$have_gtk" = "xyes"; then
237      build_gtk=yes
238    else
239      AC_MSG_ERROR("GTK+ not found!")
240    fi
241fi
242AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"])
243AC_SUBST(GTK_LIBS)
244AC_SUBST(GTK_CFLAGS)
245
246if test "x$build_gtk" = "xyes"; then
247
248    PKG_CHECK_MODULES([GIO],
249                      [gio-2.0 >= $GIO_MINIMUM],
250                      [use_gio=yes],
251                      [use_gio=no])
252    AC_SUBST(GIO_LIBS)
253    AC_SUBST(GIO_CFLAGS)
254    if test "x$use_gio" = "xyes"; then
255        AC_DEFINE([HAVE_GIO], 1)
256    fi
257
258    PKG_CHECK_MODULES([LIBNOTIFY],
259                      [libnotify >= $LIBNOTIFY_MINIMUM],
260                      [have_libnotify=yes],
261                      [have_libnotify=no])
262    AC_ARG_ENABLE([libnotify],
263                  AS_HELP_STRING([--enable-libnotify],[enable notifications]),,
264                  [enable_libnotify=yes])
265    use_libnotify=no
266    if test "x$enable_libnotify" = "xyes" ; then
267        if test "x$have_libnotify" = "xyes"; then
268            use_libnotify=yes
269            AC_SUBST(LIBNOTIFY_LIBS)
270            AC_SUBST(LIBNOTIFY_CFLAGS)
271            AC_DEFINE([HAVE_LIBNOTIFY], 1)
272        fi
273    fi
274
275    PKG_CHECK_MODULES([DBUS_GLIB],
276                      [dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
277                      [use_dbus_glib=yes],
278                      [use_dbus_glib=no])
279    AC_SUBST(DBUS_GLIB_LIBS)
280    AC_SUBST(DBUS_GLIB_CFLAGS)
281    if test "x$use_dbus_glib" = "xyes"; then
282        AC_DEFINE([HAVE_DBUS_GLIB], 1)
283    fi
284    if test "x$use_dbus_glib" = "xyes"; then
285        AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
286        if test "x$DBUS_BINDING_TOOL" = xno; then
287          AC_MSG_WARN([Cannot find dbus-binding-tool])
288          use_dbus_glib="no (dbus-binding-tool not found)"
289        fi
290    fi
291fi
292
293AC_ARG_ENABLE([nls],
294              AS_HELP_STRING([--enable-nls],[enable native language support]),,
295              [enable_nls=yes])
296
297if test "x$build_gtk" = "xyes" -a  "x$enable_nls" = "xno" ; then
298    AC_MSG_ERROR("The gtk client cannot be built without nls support.  Try adding either --enable-nls or --disable-gtk" )
299fi
300
301dnl This section is only used for internationalization.
302dnl If you don't need translations and this section gives you trouble --
303dnl such as if you're building for a headless system --
304dnl it's okay to tear this section out and re-build the configure script.
305dnl
306dnl Note to packagers: the bump to intltool 0.40 was made to fix
307dnl a "make check" failure on some systems.  if upgrading to 0.40 is
308dnl a problem and the old version was working fine for you,
309dnl it should be safe to re-edit 0.40 back down to 0.23
310
311use_nls=no
312if test "x$enable_nls" = "xyes" ; then
313    use_nls=yes
314    IT_PROG_INTLTOOL([0.40.0],[no-xml])
315    AC_CHECK_HEADERS([libintl.h])
316    GETTEXT_PACKAGE=transmission
317    AC_SUBST(GETTEXT_PACKAGE)
318    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
319    AM_GLIB_GNU_GETTEXT
320    transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
321    AC_SUBST(transmissionlocaledir)
322fi
323
324
325dnl ----------------------------------------------------------------------------
326dnl
327dnl  platform-specific stuff.
328
329AC_CANONICAL_HOST
330have_darwin="no"
331have_msw="no"
332case $host_os in
333
334   *cygwin|*mingw32*)
335     have_msw="yes"
336     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
337     CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
338     LIBS="$LIBS -lshell32 -lws2_32"
339     transmissionlocaledir="locale"
340     if test -z "$host_alias"; then
341       hostaliaswindres=
342     else
343       hostaliaswindres="$host_alias-windres";
344     fi
345     AC_CHECK_TOOL(WINDRES, windres)
346     ;;
347
348  *darwin*)
349    have_darwin="yes"
350    # Make sure the Universal SDK is installed
351    if test ! -d /Developer/SDKs/MacOSX10.4u.sdk; then
352      cat << EOF
353You need to install the Universal SDK in order to build Transmission:
354  Get your Xcode CD or package
355  Restart the install
356  When it gets to "Installation Type", select "Customize"
357  Select "Mac OS X 10.4 (Universal) SDK" under "Cross Development"
358  Finish the install.
359EOF
360      exit 1
361    fi
362    ;;
363
364esac
365
366AC_ARG_ENABLE([cli],
367              [AS_HELP_STRING([--enable-cli],[build command-line client])],
368              [build_cli=${enableval}],
369              [build_cli="yes"])
370AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
371
372AC_ARG_ENABLE([mac],
373              [AS_HELP_STRING([--enable-mac],[build OS X client])],
374              [build_mac=${enableval}],
375              [build_mac=${have_darwin}])
376AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
377
378AC_ARG_ENABLE([daemon],
379              [AS_HELP_STRING([--enable-daemon],[build daemon])],
380              [build_daemon=${enableval}],
381              [build_daemon="yes"])
382AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
383
384
385if test "x$have_darwin" = "xyes"; then
386    AC_DEFINE([HAVE_DARWIN], 1)
387fi
388if test "x$have_msw" = "xyes"; then
389    AC_DEFINE([HAVE_MSW], 1)
390fi
391AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
392
393dnl ----------------------------------------------------------------------------
394dnl
395dnl  Generate the output
396
397AC_CONFIG_FILES([Makefile
398                 transmission.spec
399                 cli/Makefile
400                 daemon/Makefile
401                 doc/Makefile
402                 libtransmission/Makefile
403                 third-party/Makefile
404                 third-party/miniupnp/Makefile
405                 third-party/libnatpmp/Makefile
406                 third-party/dht/Makefile
407                 macosx/Makefile
408                 gtk/Makefile
409                 gtk/icons/Makefile
410                 po/Makefile.in])
411
412ac_configure_args="$ac_configure_args --enable-static --disable-shared -q"
413AC_OUTPUT
414
415echo "
416
417Configuration:
418
419        Source code location:          ${srcdir}
420        Compiler:                      ${CXX}
421        System or bundled libevent:    ${libevent_source}
422        DHT support:                   ${enable_dht}
423
424        Build OS X client:             ${build_mac}
425        Build GTK+ client:             ${build_gtk}
426          ... with gio support:        ${use_gio}
427          ... with dbus-glib support:  ${use_dbus_glib}
428          ... with libnotify support:  ${use_libnotify}
429        Build Command-Line client:     ${build_cli}
430        Build Daemon:                  ${build_daemon}
431
432"
Note: See TracBrowser for help on using the repository browser.