source: trunk/configure.ac @ 9047

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

(trunk libT) disable the sorted ptrArray assertions in non-mac release builds

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