source: trunk/configure.ac @ 9116

Last change on this file since 9116 was 9116, checked in by livings124, 13 years ago

(trunk) update to 1.75; transfer NEWS and appcast from 1.7x branch

File size: 13.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.75+])
7m4_define([peer_id_prefix],[-TR175Z-])
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  CPPFLAGS="$CPPFLAGS -DNDEBUG"
29else
30  supported_build=no
31  if test "x$GCC" = "xyes" ; then
32    CFLAGS="$CFLAGS -g -O0"
33    CXXFLAGS="$CXXFLAGS -g -O0"
34  fi
35fi
36AM_CONDITIONAL(TR_UNSTABLE, test "x$supported_build" = "xno")
37
38OPENSSL_MINIMUM=0.9.4
39CURL_MINIMUM=7.16.3
40GIO_MINIMUM=2.15.5
41GLIB_MINIMUM=2.6.0
42GTK_MINIMUM=2.6.0
43LIBNOTIFY_MINIMUM=0.4.3
44DBUS_GLIB_MINIMUM=0.70
45LIBEVENT_MINIMUM=1.4.5
46AC_SUBST(OPENSSL_MINIMUM)
47AC_SUBST(CURL_MINIMUM)
48AC_SUBST(GIO_MINIMUM)
49AC_SUBST(GLIB_MINIMUM)
50AC_SUBST(GTK_MINIMUM)
51AC_SUBST(LIBNOTIFY_MINIMUM)
52AC_SUBST(DBUS_GLIB_MINIMUM)
53AC_SUBST(LIBEVENT_MINIUM)
54
55AC_PROG_CC
56AC_PROG_CXX
57AC_C_INLINE
58if test "x$GCC" = "xyes" ; then
59
60    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"
61
62    dnl figure out gcc version
63    AC_MSG_CHECKING([gcc version])
64    GCC_VERSION=`$CC -dumpversion`
65    GCC_MAJOR=`echo $GCC_VERSION | cut -d . -f1`
66    GCC_MINOR=`echo $GCC_VERSION | cut -d . -f2`
67    GCC_VERSION_NUM=`(expr $GCC_MAJOR "*" 100 + $GCC_MINOR) 2>/dev/null`
68
69    AC_MSG_RESULT($GCC_VERSION)
70    if test $GCC_VERSION_NUM -ge 304; then
71        dnl these were added in 3.4
72        CFLAGS="$CFLAGS -Wextra -Wdeclaration-after-statement -Winit-self"
73    fi
74fi
75
76AC_HEADER_STDC
77AC_HEADER_TIME
78
79AC_CHECK_FUNCS([lrintf strlcpy daemon dirname basename strcasecmp localtime_r posix_fallocate memmem strtold])
80AC_PROG_INSTALL
81AC_PROG_MAKE_SET
82ACX_PTHREAD
83
84if test "x$ac_cv_func_strtold" != "xyes" ; then
85    CPPFLAGS="$CPPFLAGS -Dstrtold=strtod"
86fi
87
88AC_SEARCH_LIBS(cos, [m])
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
96AC_CHECK_FUNCS([lseek64])
97
98
99dnl ----------------------------------------------------------------------------
100dnl
101dnl posix_fadvise
102
103dnl can posix_fadvise be used
104AC_CHECK_DECLS(posix_fadvise, [], [], [
105#define _XOPEN_SOURCE 600
106#include <fcntl.h>])
107AC_CHECK_FUNCS([posix_fadvise])
108
109
110dnl ----------------------------------------------------------------------------
111dnl
112dnl file monitoring for the daemon
113
114AC_CHECK_HEADER([sys/inotify.h],
115                [AC_CHECK_FUNC([inotify_init],[have_inotify="yes"],[have_inotify="no"])],
116                [have_inotify="no"])
117AC_ARG_WITH([inotify],
118            [AS_HELP_STRING([--with-inotify],[Enable inotify support (default=auto)])],
119            [want_inotify=${enableval}],
120            [want_inotify=${have_inotify}])
121if test "x$want_inotify" = "xyes" ; then
122    if test "x$have_inotify" = "xyes"; then
123      AC_DEFINE([WITH_INOTIFY],[1])
124    else
125      AC_MSG_ERROR("inotify not found!")
126    fi
127fi
128 
129AC_CHECK_HEADER([sys/event.h],
130                [AC_CHECK_FUNC([kqueue],[have_kqueue="yes"],[have_kqueue="no"])],
131                [have_kqueue="no"])
132AC_ARG_WITH([kqueue],
133            [AS_HELP_STRING([--with-kqueue],[Enable kqueue support (default=auto)])],
134            [want_kqueue=${enableval}],
135            [want_kqueue=${have_kqueue}])
136if test "x$want_kqueue" = "xyes" ; then
137    if test "x$have_kqueue" = "xyes"; then
138      AC_DEFINE([WITH_KQUEUE],[1])
139    else
140      AC_MSG_ERROR("kqueue not found!")
141    fi
142fi
143
144AC_CHECK_HEADERS([xfs/xfs.h])
145
146
147dnl ----------------------------------------------------------------------------
148dnl
149dnl va_copy
150
151AC_MSG_CHECKING([how to copy va_list])
152AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);],
153    AC_MSG_RESULT([va_copy]),
154        [ AH_TEMPLATE([va_copy], [define if va_copy is not available])
155        AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);],
156        [ AC_DEFINE([va_copy], [__va_copy])
157        AC_MSG_RESULT([__va_copy])],
158        [ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))])
159        AC_MSG_RESULT([memcpy])]
160    )
161])
162
163
164dnl libevent likes to link against librt if possible
165dnl for clock_gettime() and clock_settime()
166dnl TODO(libevent2): this can probably be removed after
167dnl we switch to libevent2, since it will have PKG_CONFIG
168AC_CHECK_LIB([rt],
169             [clock_gettime],
170             [libevent_extra_libs="-lrt"],
171             [libevent_extra_libs=""])
172
173dnl build our copy of libevent whether we use it or not,
174dnl because "make dist" needs its Makefiles to exist, and
175dnl AM_CONDITIONAL + AC_CONFIG_SUBDIRS don't seem to play nice
176AC_CONFIG_SUBDIRS([third-party/libevent])
177libevent_source=bundled
178AC_CHECK_LIB([event],[evutil_vsnprintf],
179             [libevent_found=yes],
180             [libevent_found=no],
181             [$libevent_extra_libs])
182AC_CHECK_HEADER([event-config.h],
183                [libevent_headers_found=yes],
184                [libevent_headers_found=no])
185libevent_source=bundled
186if test "x$libevent_found" = "xyes" ; then
187    if test "x$libevent_headers_found" = "xyes"; then
188      libevent_source=system
189    fi
190fi
191if test "x$libevent_source" = "xbundled"; then
192    AC_MSG_WARN([using our own libevent from third-party/libevent/])
193    AC_MSG_WARN([if you are cross-compiling this is probably NOT what you want.])
194    LIBEVENT_CFLAGS="-I\$(top_srcdir)/third-party/libevent -I\$(top_builddir)/third-party/libevent"
195    LIBEVENT_LIBS="\$(top_builddir)/third-party/libevent/libevent.la"
196else
197    LIBEVENT_CFLAGS=""
198    LIBEVENT_LIBS="-levent $libevent_extra_libs"
199fi
200AC_SUBST(LIBEVENT_CFLAGS)
201AC_SUBST(LIBEVENT_LIBS)
202
203
204dnl ----------------------------------------------------------------------------
205dnl
206dnl  dht
207
208
209AC_ARG_ENABLE([dht],
210              AS_HELP_STRING([--disable-dht],[omit DHT support]),
211              [enable_dht=${enableval}],
212              [enable_dht=yes])
213if test "x$enable_dht" = "xno" ; then
214    AC_DEFINE([WITHOUT_DHT], 1)
215    DHT_CFLAGS=""
216    DHT_LIBS=""
217else
218    DHT_CFLAGS="-I\$(top_srcdir)/third-party/dht"
219    DHT_LIBS="\$(top_builddir)/third-party/dht/libdht.a"
220fi
221AM_CONDITIONAL(DHT, test "x$enable_dht" = "xyes")
222AC_SUBST(DHT_CFLAGS)
223AC_SUBST(DHT_LIBS)
224
225
226dnl ----------------------------------------------------------------------------
227dnl
228dnl  detection for the GTK+ client
229
230PKG_CHECK_MODULES(GTK,
231                  [gtk+-2.0 >= $GTK_MINIMUM
232                   glib-2.0 >= $GLIB_MINIMUM
233                   gmodule-2.0 >= $GLIB_MINIMUM
234                   gthread-2.0 >= $GLIB_MINIMUM],
235                  [have_gtk=yes],
236                  [have_gtk=no])
237AC_ARG_ENABLE([gtk],
238              AS_HELP_STRING([--enable-gtk],[build gtk client]),
239              [want_gtk=${enableval}],
240              [want_gtk=${have_gtk}])
241build_gtk=no
242use_gio=no
243use_libnotify=no
244use_dbus_glib=no
245if test "x$want_gtk" = "xyes" ; then
246    if test "x$have_gtk" = "xyes"; then
247      build_gtk=yes
248    else
249      AC_MSG_ERROR("GTK+ not found!")
250    fi
251fi
252AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"])
253AC_SUBST(GTK_LIBS)
254AC_SUBST(GTK_CFLAGS)
255
256if test "x$build_gtk" = "xyes"; then
257
258    PKG_CHECK_MODULES([GIO],
259                      [gio-2.0 >= $GIO_MINIMUM],
260                      [use_gio=yes],
261                      [use_gio=no])
262    AC_SUBST(GIO_LIBS)
263    AC_SUBST(GIO_CFLAGS)
264    if test "x$use_gio" = "xyes"; then
265        AC_DEFINE([HAVE_GIO], 1)
266    fi
267
268    PKG_CHECK_MODULES([LIBNOTIFY],
269                      [libnotify >= $LIBNOTIFY_MINIMUM],
270                      [have_libnotify=yes],
271                      [have_libnotify=no])
272    AC_ARG_ENABLE([libnotify],
273                  AS_HELP_STRING([--enable-libnotify],[enable notifications]),,
274                  [enable_libnotify=yes])
275    use_libnotify=no
276    if test "x$enable_libnotify" = "xyes" ; then
277        if test "x$have_libnotify" = "xyes"; then
278            use_libnotify=yes
279            AC_SUBST(LIBNOTIFY_LIBS)
280            AC_SUBST(LIBNOTIFY_CFLAGS)
281            AC_DEFINE([HAVE_LIBNOTIFY], 1)
282        fi
283    fi
284
285    PKG_CHECK_MODULES([DBUS_GLIB],
286                      [dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
287                      [use_dbus_glib=yes],
288                      [use_dbus_glib=no])
289    AC_SUBST(DBUS_GLIB_LIBS)
290    AC_SUBST(DBUS_GLIB_CFLAGS)
291    if test "x$use_dbus_glib" = "xyes"; then
292        AC_DEFINE([HAVE_DBUS_GLIB], 1)
293    fi
294    if test "x$use_dbus_glib" = "xyes"; then
295        AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
296        if test "x$DBUS_BINDING_TOOL" = xno; then
297          AC_MSG_WARN([Cannot find dbus-binding-tool])
298          use_dbus_glib="no (dbus-binding-tool not found)"
299        fi
300    fi
301fi
302
303AC_ARG_ENABLE([nls],
304              AS_HELP_STRING([--enable-nls],[enable native language support]),,
305              [enable_nls=yes])
306
307if test "x$build_gtk" = "xyes" -a  "x$enable_nls" = "xno" ; then
308    AC_MSG_ERROR("The gtk client cannot be built without nls support.  Try adding either --enable-nls or --disable-gtk" )
309fi
310
311dnl This section is only used for internationalization.
312dnl If you don't need translations and this section gives you trouble --
313dnl such as if you're building for a headless system --
314dnl it's okay to tear this section out and re-build the configure script.
315dnl
316dnl Note to packagers: the bump to intltool 0.40 was made to fix
317dnl a "make check" failure on some systems.  if upgrading to 0.40 is
318dnl a problem and the old version was working fine for you,
319dnl it should be safe to re-edit 0.40 back down to 0.23
320
321use_nls=no
322if test "x$enable_nls" = "xyes" ; then
323    use_nls=yes
324    IT_PROG_INTLTOOL([0.40.0],[no-xml])
325    AC_CHECK_HEADERS([libintl.h])
326    GETTEXT_PACKAGE=transmission
327    AC_SUBST(GETTEXT_PACKAGE)
328    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
329    AM_GLIB_GNU_GETTEXT
330    transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
331    AC_SUBST(transmissionlocaledir)
332fi
333
334
335dnl ----------------------------------------------------------------------------
336dnl
337dnl  platform-specific stuff.
338
339AC_CANONICAL_HOST
340have_darwin="no"
341have_msw="no"
342case $host_os in
343
344   *mingw32*)
345     have_msw="yes"
346     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
347     CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
348     LIBS="$LIBS -lshell32 -lws2_32"
349     transmissionlocaledir="locale"
350     if test -z "$host_alias"; then
351       hostaliaswindres=
352     else
353       hostaliaswindres="$host_alias-windres";
354     fi
355     AC_CHECK_TOOL(WINDRES, windres)
356     ;;
357
358  *darwin*)
359    have_darwin="yes"
360    # Make sure the proper Mac SDK is installed
361    if test ! -d /Developer/SDKs/MacOSX10.5.sdk; then
362      cat << EOF
363You need to install the Mac OS X 10.5 SDK in order to build Transmission:
364  Get your Xcode CD or package
365  Restart the install
366  When it gets to "Installation Type", select "Customize"
367  Select "Mac OS X 10.5 SDK" under "Cross Development"
368  Finish the install.
369EOF
370      exit 1
371    fi
372    ;;
373
374esac
375
376AC_ARG_ENABLE([cli],
377              [AS_HELP_STRING([--enable-cli],[build command-line client])],
378              [build_cli=${enableval}],
379              [build_cli="yes"])
380AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
381
382AC_ARG_ENABLE([mac],
383              [AS_HELP_STRING([--enable-mac],[build Mac client])],
384              [build_mac=${enableval}],
385              [build_mac=${have_darwin}])
386AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
387
388AC_ARG_ENABLE([daemon],
389              [AS_HELP_STRING([--enable-daemon],[build daemon])],
390              [build_daemon=${enableval}],
391              [build_daemon="yes"])
392AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
393
394
395if test "x$have_darwin" = "xyes"; then
396    AC_DEFINE([HAVE_DARWIN], 1)
397fi
398if test "x$have_msw" = "xyes"; then
399    AC_DEFINE([HAVE_MSW], 1)
400fi
401AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
402
403dnl ----------------------------------------------------------------------------
404dnl
405dnl  Generate the output
406
407AC_CONFIG_FILES([Makefile
408                 transmission.spec
409                 cli/Makefile
410                 daemon/Makefile
411                 doc/Makefile
412                 libtransmission/Makefile
413                 third-party/Makefile
414                 third-party/miniupnp/Makefile
415                 third-party/libnatpmp/Makefile
416                 third-party/dht/Makefile
417                 macosx/Makefile
418                 gtk/Makefile
419                 gtk/icons/Makefile
420                 po/Makefile.in])
421
422ac_configure_args="$ac_configure_args --enable-static --disable-shared -q"
423AC_OUTPUT
424
425echo "
426
427Configuration:
428
429        Source code location:          ${srcdir}
430        Compiler:                      ${CXX}
431        System or bundled libevent:    ${libevent_source}
432        DHT support:                   ${enable_dht}
433
434        Build Mac client:              ${build_mac}
435        Build GTK+ client:             ${build_gtk}
436          ... with gio support:        ${use_gio}
437          ... with dbus-glib support:  ${use_dbus_glib}
438          ... with libnotify support:  ${use_libnotify}
439        Build Command-Line client:     ${build_cli}
440        Build Daemon:                  ${build_daemon}
441
442"
Note: See TracBrowser for help on using the repository browser.