source: trunk/configure.ac @ 10927

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

(trunk) remove -Wvla. But, since it will [irk](http://www.thefreedictionary.com/irk) klapaucjusz, don't exmplain why.

File size: 16.1 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],[2.01+])
7m4_define([peer_id_prefix],[-TR201Z-])
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
15m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
16
17AC_CONFIG_MACRO_DIR([m4])
18
19dnl AM_CONFIG_HEADER(config.h)
20AC_CONFIG_SRCDIR(libtransmission/transmission.h)
21AM_INIT_AUTOMAKE([1.9 tar-ustar])
22AC_PROG_LIBTOOL
23
24if test m4_substr(peer_id_prefix,6,1) = "0"; then
25  supported_build=yes
26  CPPFLAGS="$CPPFLAGS -DNDEBUG"
27else
28  supported_build=no
29  if test "x$GCC" = "xyes" ; then
30    CFLAGS="$CFLAGS -g -O0"
31    CXXFLAGS="$CXXFLAGS -g -O0"
32  fi
33fi
34AM_CONDITIONAL(TR_UNSTABLE, test "x$supported_build" = "xno")
35
36##
37##
38##   MANDATORY for everything
39##
40##
41CURL_MINIMUM=7.15.4
42AC_SUBST(CURL_MINIMUM)
43LIBEVENT_MINIMUM=1.4.9
44AC_SUBST(LIBEVENT_MINIUM)
45OPENSSL_MINIMUM=0.9.4
46AC_SUBST(OPENSSL_MINIMUM)
47
48##
49##
50##   MANDATORY for the GTK+ client
51##
52##
53GLIB_MINIMUM=2.6.0
54AC_SUBST(GLIB_MINIMUM)
55GTK_MINIMUM=2.6.0
56AC_SUBST(GTK_MINIMUM)
57
58##
59##
60##   OPTIONAL for the GTK+ client
61##
62##
63# play the XDG "download done" sound...
64CANBERRA_MINIMUM=0.10
65AC_SUBST(CANBERRA_MINIMUM)
66# inhibit hibernation when a torrent is active...
67DBUS_GLIB_MINIMUM=0.70
68AC_SUBST(DBUS_GLIB_MINIMUM)
69# register the GTK+ client as a magnet link handler...
70GCONF2_MINIMUM=2.20.0
71AC_SUBST(GCONF2_MINIMUM)
72# implement "watch" directories to use new .torrent files...
73GIO_MINIMUM=2.15.5
74AC_SUBST(GIO_MINIMUM)
75# pop up a "download done" notice...
76LIBNOTIFY_MINIMUM=0.4.3
77AC_SUBST(LIBNOTIFY_MINIMUM)
78# create the tray icon with AppIndicator
79LIBAPPINDICATOR_MINIMUM=0.0.11
80  AC_SUBST(LIBAPPINDICATOR_MINIMUM)
81
82
83AC_PROG_CC
84AC_PROG_CXX
85AC_C_INLINE
86if test "x$GCC" = "xyes" ; then
87
88    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 -Wvariadic-macros -Waggregate-return -Winline -Wfloat-equal"
89
90    dnl figure out gcc version
91    AC_MSG_CHECKING([gcc version])
92    GCC_VERSION=`$CC -dumpversion`
93    GCC_MAJOR=`echo $GCC_VERSION | cut -d . -f1`
94    GCC_MINOR=`echo $GCC_VERSION | cut -d . -f2`
95    GCC_VERSION_NUM=`(expr $GCC_MAJOR "*" 100 + $GCC_MINOR) 2>/dev/null`
96
97    AC_MSG_RESULT($GCC_VERSION)
98    if test $GCC_VERSION_NUM -ge 304; then
99        dnl these were added in 3.4
100        CFLAGS="$CFLAGS -Wextra -Wdeclaration-after-statement -Winit-self"
101    fi
102fi
103
104AC_HEADER_STDC
105AC_HEADER_TIME
106
107AC_CHECK_FUNCS([pread pwrite lrintf strlcpy daemon dirname basename strcasecmp localtime_r fallocate64 posix_fallocate memmem strtold syslog valloc getpagesize posix_memalign clearenv])
108AC_PROG_INSTALL
109AC_PROG_MAKE_SET
110ACX_PTHREAD
111
112if test "x$ac_cv_func_strtold" != "xyes" ; then
113    CPPFLAGS="$CPPFLAGS -Dstrtold=strtod"
114fi
115
116AC_SEARCH_LIBS(cos, [m])
117AC_SEARCH_LIBS([socket], [socket net])
118AC_SEARCH_LIBS([gethostbyname], [nsl bind])
119PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM], , [CHECK_SSL()])
120PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM])
121AC_PATH_ZLIB
122
123AC_SYS_LARGEFILE
124AC_CHECK_FUNCS([lseek64])
125
126
127dnl ----------------------------------------------------------------------------
128dnl
129dnl posix_fadvise
130
131dnl can posix_fadvise be used
132AC_CHECK_DECLS(posix_fadvise, [], [], [
133#define _XOPEN_SOURCE 600
134#include <fcntl.h>])
135AC_CHECK_FUNCS([posix_fadvise])
136
137
138dnl ----------------------------------------------------------------------------
139dnl
140dnl file monitoring for the daemon
141
142AC_CHECK_HEADER([sys/inotify.h],
143                [AC_CHECK_FUNC([inotify_init],[have_inotify="yes"],[have_inotify="no"])],
144                [have_inotify="no"])
145AC_ARG_WITH([inotify],
146            [AS_HELP_STRING([--with-inotify],[Enable inotify support (default=auto)])],
147            [want_inotify=${withval}],
148            [want_inotify=${have_inotify}])
149if test "x$want_inotify" = "xyes" ; then
150    if test "x$have_inotify" = "xyes"; then
151      AC_DEFINE([WITH_INOTIFY],[1])
152    else
153      AC_MSG_ERROR("inotify not found!")
154    fi
155fi
156 
157AC_CHECK_HEADER([sys/event.h],
158                [AC_CHECK_FUNC([kqueue],[have_kqueue="yes"],[have_kqueue="no"])],
159                [have_kqueue="no"])
160AC_ARG_WITH([kqueue],
161            [AS_HELP_STRING([--with-kqueue],[Enable kqueue support (default=auto)])],
162            [want_kqueue=${withval}],
163            [want_kqueue=${have_kqueue}])
164if test "x$want_kqueue" = "xyes" ; then
165    if test "x$have_kqueue" = "xyes"; then
166      AC_DEFINE([WITH_KQUEUE],[1])
167    else
168      AC_MSG_ERROR("kqueue not found!")
169    fi
170fi
171
172AC_CHECK_HEADERS([xfs/xfs.h])
173
174
175dnl ----------------------------------------------------------------------------
176dnl
177dnl va_copy
178
179AC_MSG_CHECKING([how to copy va_list])
180AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);],
181    AC_MSG_RESULT([va_copy]),
182        [ AH_TEMPLATE([va_copy], [define if va_copy is not available])
183        AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);],
184        [ AC_DEFINE([va_copy], [__va_copy])
185        AC_MSG_RESULT([__va_copy])],
186        [ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))])
187        AC_MSG_RESULT([memcpy])]
188    )
189])
190
191
192dnl libevent likes to link against librt if possible
193dnl for clock_gettime() and clock_settime()
194dnl TODO(libevent2): this can probably be removed after
195dnl we switch to libevent2, since it will have PKG_CONFIG
196AC_CHECK_LIB([rt],
197             [clock_gettime],
198             [libevent_extra_libs="-lrt"],
199             [libevent_extra_libs=""])
200
201
202dnl libevent
203dnl if the user specified LIBEVENT_LIBS or
204if test -n "$LIBEVENT_LIBS"; then
205    user_specified_libevent=yes
206elif test -n "$LIBEVENT_CFLAGS"; then
207    user_specified_libevent=yes
208fi
209if test "x$user_specified_libevent" == "xyes"; then
210    AC_MSG_NOTICE([Using user-specified LIBEVENT_LIBS and LIBEVENT_CFLAGS])
211else
212    AC_CHECK_LIB([event],[evutil_vsnprintf],
213                 [],
214                 [AC_MSG_ERROR(libevent $LIBEVENT_MINIMUM or higher not found!)],
215                 [$libevent_extra_libs])
216    AC_CHECK_HEADER([event-config.h],[],
217                    [AC_MSG_ERROR(event-config.h not found!)])
218    LIBEVENT_CFLAGS=""
219    LIBEVENT_LIBS="-levent $libevent_extra_libs"
220fi
221AC_ARG_VAR([LIBEVENT_CFLAGS], [C compiler flags for LIBEVENT, overriding pkg-config])dnl
222AC_ARG_VAR([LIBEVENT_LIBS], [linker flags for LIBEVENT, overriding pkg-config])dnl
223
224
225
226dnl ----------------------------------------------------------------------------
227dnl
228dnl  dht
229
230DHT_CFLAGS="-I\$(top_srcdir)/third-party/dht"
231DHT_LIBS="\$(top_builddir)/third-party/dht/libdht.a"
232AC_SUBST(DHT_CFLAGS)
233AC_SUBST(DHT_LIBS)
234
235
236dnl ----------------------------------------------------------------------------
237dnl
238dnl  detection for the GTK+ client
239
240PKG_CHECK_MODULES(GTK,
241                  [gtk+-2.0 >= $GTK_MINIMUM
242                   glib-2.0 >= $GLIB_MINIMUM
243                   gmodule-2.0 >= $GLIB_MINIMUM
244                   gthread-2.0 >= $GLIB_MINIMUM],
245                  [have_gtk=yes],
246                  [have_gtk=no])
247AC_ARG_ENABLE([gtk],
248              AS_HELP_STRING([--enable-gtk],[build gtk client]),
249              [want_gtk=${enableval}],
250              [want_gtk=${have_gtk}])
251build_gtk=no
252use_gio=no
253use_libappindicator=no
254use_libnotify=no
255use_dbus_glib=no
256use_canberra=no
257use_gconf2=no
258if test "x$want_gtk" = "xyes" ; then
259    if test "x$have_gtk" = "xyes"; then
260      build_gtk=yes
261    else
262      AC_MSG_ERROR("GTK+ not found!")
263    fi
264fi
265AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"])
266
267if test "x$build_gtk" = "xyes"; then
268
269    PKG_CHECK_MODULES([GIO],
270                      [gio-2.0 >= $GIO_MINIMUM],
271                      [use_gio=yes],
272                      [use_gio=no])
273    if test "x$use_gio" = "xyes"; then
274        AC_DEFINE([HAVE_GIO], 1)
275    fi
276
277    PKG_CHECK_MODULES([LIBNOTIFY],
278                      [libnotify >= $LIBNOTIFY_MINIMUM],
279                      [have_libnotify=yes],
280                      [have_libnotify=no])
281    AC_ARG_ENABLE([libnotify],
282                  AS_HELP_STRING([--enable-libnotify],[enable notifications]),,
283                  [enable_libnotify=yes])
284    use_libnotify=no
285    if test "x$have_libnotify" = "xyes"; then
286        if test "x$enable_libnotify" = "xyes" ; then
287            use_libnotify=yes
288            AC_DEFINE([HAVE_LIBNOTIFY], 1)
289        else
290            LIBNOTIFY_CFLAGS=
291            LIBNOTIFY_LIBS=
292        fi
293    fi
294
295    PKG_CHECK_MODULES([LIBAPPINDICATOR],
296                      [appindicator-0.1 >= $LIBAPPINDICATOR_MINIMUM],
297                      [have_libappindicator=yes],
298                      [have_libappindicator=no])
299
300    AC_ARG_ENABLE([libappindicator],
301                  AS_HELP_STRING([--enable-libappindicator],[enable AppIndicator support]),,
302                  [enable_libappindicator=yes])
303    use_libappindicator=no
304    if test "x$have_libappindicator" = "xyes"; then
305        if test "x$enable_libappindicator" = "xyes" ; then
306            use_libappindicator=yes
307            AC_DEFINE([HAVE_LIBAPPINDICATOR], 1)
308        else
309            LIBAPPINDICATOR_CFLAGS=
310            LIBAPPINDICATOR_LIBS=
311        fi
312    fi
313
314    PKG_CHECK_MODULES([LIBCANBERRA],
315                      [libcanberra-gtk >= $CANBERRA_MINIMUM],
316                      [have_libcanberra=yes],
317                      [have_libcanberra=no])
318    AC_ARG_ENABLE([libcanberra],
319                  AS_HELP_STRING([--enable-libcanberra],[enable sounds]),,
320                  [enable_libcanberra=yes])
321    if test "x$have_libcanberra" = "xyes"; then
322        if test "x$enable_libcanberra" = "xyes" ; then
323            use_canberra=yes
324            AC_DEFINE([HAVE_LIBCANBERRA], 1)
325        else
326            LIBCANBERRA_CFLAGS=
327            LIBCANBERRA_LIBS=
328        fi
329    fi
330
331    PKG_CHECK_MODULES([GCONF2],
332                      [gconf-2.0 >= $GCONF2_MINIMUM],
333                      [have_gconf2=yes],
334                      [have_gconf2=no])
335    AC_ARG_ENABLE([gconf2],
336                  AS_HELP_STRING([--enable-gconf2],[enable GConf support]),,
337                  [enable_gconf2=yes])
338    if test "x$have_gconf2" = "xyes"; then
339        if test "x$enable_gconf2" = "xyes" ; then
340            use_gconf2=yes
341            AC_DEFINE([HAVE_GCONF2], 1)
342        else
343            GCONF2_CFLAGS=
344            GCONF2_LIBS=
345        fi
346    fi
347
348    PKG_CHECK_MODULES([DBUS_GLIB],
349                      [dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
350                      [use_dbus_glib=yes],
351                      [use_dbus_glib=no])
352    if test "x$use_dbus_glib" = "xyes"; then
353        AC_DEFINE([HAVE_DBUS_GLIB], 1)
354    fi
355    if test "x$use_dbus_glib" = "xyes"; then
356        AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
357        if test "x$DBUS_BINDING_TOOL" = xno; then
358          AC_MSG_WARN([Cannot find dbus-binding-tool])
359          use_dbus_glib="no (dbus-binding-tool not found)"
360        fi
361    fi
362fi
363
364AC_ARG_ENABLE([nls],
365              AS_HELP_STRING([--enable-nls],[enable native language support]),,
366              [enable_nls=yes])
367
368if test "x$build_gtk" = "xyes" -a  "x$enable_nls" = "xno" ; then
369    AC_MSG_ERROR("The gtk client cannot be built without nls support.  Try adding either --enable-nls or --disable-gtk" )
370fi
371
372dnl This section is only used for internationalization.
373dnl If you don't need translations and this section gives you trouble --
374dnl such as if you're building for a headless system --
375dnl it's okay to tear this section out and re-build the configure script.
376dnl
377dnl Note to packagers: the bump to intltool 0.40 was made to fix
378dnl a "make check" failure on some systems.  if upgrading to 0.40 is
379dnl a problem and the old version was working fine for you,
380dnl it should be safe to re-edit 0.40 back down to 0.23
381
382use_nls=no
383if test "x$enable_nls" = "xyes" ; then
384    use_nls=yes
385    IT_PROG_INTLTOOL([0.35.0],[no-xml])
386    AC_CHECK_HEADERS([libintl.h])
387    GETTEXT_PACKAGE=transmission
388    AC_SUBST(GETTEXT_PACKAGE)
389    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
390    AM_GLIB_GNU_GETTEXT
391    transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
392    AC_SUBST(transmissionlocaledir)
393fi
394AC_SUBST(INTLLIBS)
395
396
397dnl ----------------------------------------------------------------------------
398dnl
399dnl  platform-specific stuff.
400
401AC_CANONICAL_HOST
402have_darwin="no"
403have_msw="no"
404case $host_os in
405
406   *mingw32*)
407     have_msw="yes"
408     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
409     CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
410     LIBS="$LIBS -liphlpapi -lshell32 -lws2_32"
411     transmissionlocaledir="locale"
412     if test -z "$host_alias"; then
413       hostaliaswindres=
414     else
415       hostaliaswindres="$host_alias-windres";
416     fi
417     AC_CHECK_TOOL(WINDRES, windres)
418     ;;
419
420  *darwin*)
421    have_darwin="yes"
422    CFLAGS="-DMACOSX $CFLAGS"
423    ;;
424
425esac
426
427AC_ARG_ENABLE([cli],
428              [AS_HELP_STRING([--enable-cli],[build command-line client])],
429              [build_cli=${enableval}],
430              [build_cli="yes"])
431AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
432
433AC_ARG_ENABLE([mac],
434              [AS_HELP_STRING([--enable-mac],[build Mac client])],
435              [build_mac=${enableval}],
436              [build_mac=${have_darwin}])
437AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
438
439AC_ARG_ENABLE([daemon],
440              [AS_HELP_STRING([--enable-daemon],[build daemon])],
441              [build_daemon=${enableval}],
442              [build_daemon="yes"])
443AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
444
445
446if test "x$build_mac" = "xyes" ; then
447    # Make sure the proper Mac SDK is installed
448    if test ! -d /Developer/SDKs/MacOSX10.5.sdk; then
449      cat << EOF
450You need to install the Mac OS X 10.5 SDK in order to build Transmission
451with --enable-mac:
452  Get your Xcode CD or package
453  Restart the install
454  When it gets to "Installation Type", select "Customize"
455  Select "Mac OS X 10.5 SDK" under "Cross Development"
456  Finish the install.
457EOF
458      exit 1
459    fi
460fi
461if test "x$have_darwin" = "xyes"; then
462    AC_DEFINE([HAVE_DARWIN], 1)
463fi
464if test "x$have_msw" = "xyes"; then
465    AC_DEFINE([HAVE_MSW], 1)
466fi
467AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
468
469dnl ----------------------------------------------------------------------------
470dnl
471dnl  Generate the output
472
473AC_CONFIG_FILES([Makefile
474                 transmission.spec
475                 cli/Makefile
476                 daemon/Makefile
477                 doc/Makefile
478                 libtransmission/Makefile
479                 utils/Makefile
480                 third-party/Makefile
481                 third-party/miniupnp/Makefile
482                 third-party/libnatpmp/Makefile
483                 third-party/dht/Makefile
484                 macosx/Makefile
485                 gtk/Makefile
486                 gtk/icons/Makefile
487                 web/Makefile
488                 web/images/Makefile
489                 web/images/buttons/Makefile
490                 web/images/graphics/Makefile
491                 web/images/progress/Makefile
492                 web/javascript/Makefile
493                 web/javascript/jquery/Makefile
494                 web/stylesheets/Makefile
495                 po/Makefile.in])
496
497ac_configure_args="$ac_configure_args --enable-static --disable-shared -q"
498AC_OUTPUT
499
500echo "
501
502Configuration:
503
504   Source code location:                              ${srcdir}
505   Compiler:                                          ${CXX}
506
507   Build Command-Line client:                         ${build_cli}
508
509   Build GTK+ client:                                 ${build_gtk}
510
511     Optional dependencies for GTK+ client:
512
513      * dbus support:                                 ${use_dbus_glib}
514      * gio for watchdir support:                     ${use_gio}
515      * libnotify for 'download completed' popups:    ${use_libnotify}
516      * libcanberra for 'download completed' sounds:  ${use_canberra}
517      * gconf2 to register as a magnet link handler:  ${use_gconf2}
518      * libappindicator for an Ubuntu-style tray:     ${use_libappindicator}
519
520   Build Daemon:                                      ${build_daemon}
521
522   Build Mac client:                                  ${build_mac}
523
524"
Note: See TracBrowser for help on using the repository browser.