source: trunk/configure.ac @ 6562

Last change on this file since 6562 was 6562, checked in by muks, 13 years ago

Use dbus even if the binding tool is not found

The bindings are shipped anyway.

File size: 10.2 KB
Line 
1AC_PREREQ(2.54)
2
3m4_define([tr_version_major], [1])
4m4_define([tr_version_minor], [32])
5m4_define([tr_version_suffix], [+])
6m4_define([tr_version], [tr_version_major.tr_version_minor])
7
8AC_INIT([Transmission], [tr_version], [http://trac.transmissionbt.com/newticket], [transmission])
9
10TR_VERSION_MAJOR=tr_version_major
11TR_VERSION_MINOR=tr_version_minor
12TR_VERSION_SUFFIX=tr_version_suffix
13TR_VERSION=tr_version
14
15dnl Someone still needs to hook this up to the system above
16PEERID_PREFIX="-TR132Z-"
17
18USERAGENT_PREFIX=$TR_VERSION$TR_VERSION_SUFFIX
19
20AC_SUBST(PEERID_PREFIX,[$PEERID_PREFIX])
21AC_SUBST(USERAGENT_PREFIX,[$USERAGENT_PREFIX])
22
23dnl AM_CONFIG_HEADER(config.h)
24AC_CONFIG_SRCDIR(libtransmission/transmission.h)
25AM_INIT_AUTOMAKE([1.9 tar-ustar])
26AC_PROG_LIBTOOL
27
28if test "x$TR_VERSION_SUFFIX" = "x+"; then
29  AC_DEFINE(TR_UNSTABLE, 1,
30            [Define to 1 if this is an unstable version of Transmission])
31  TR_UNSTABLE=yes
32fi
33AM_CONDITIONAL(TR_UNSTABLE, test "x$TR_UNSTABLE" = "xyes")
34
35OPENSSL_MINIMUM=0.9.4
36CURL_MINIMUM=7.15.0
37GIO_MINIMUM=2.15.5
38GLIB_MINIMUM=2.6.0
39GTK_MINIMUM=2.6.0
40WX_MINIMUM=2.6.0
41LIBNOTIFY_MINIMUM=0.4.4
42DBUS_GLIB_MINIMUM=0.70
43AC_SUBST(OPENSSL_MINIMUM)
44AC_SUBST(CURL_MINIMUM)
45AC_SUBST(GIO_MINIMUM)
46AC_SUBST(GLIB_MINIMUM)
47AC_SUBST(GTK_MINIMUM)
48AC_SUBST(WX_MINIMUM)
49AC_SUBST(LIBNOTIFY_MINIMUM)
50AC_SUBST(DBUS_GLIB_MINIMUM)
51
52AC_PROG_CC
53AC_PROG_CXX
54if test "x$GCC" = "xyes" ; then
55    CFLAGS="-g -Wall -W -Wmissing-prototypes -Wdeclaration-after-statement -O3 -funroll-loops"
56    CXXFLAGS="-g -Wall -W -O3 -funroll-loops"
57fi
58
59AC_HEADER_STDC
60AC_HEADER_TIME
61AC_CHECK_FUNCS([lrintf strlcpy daemon dirname basename daemon strcasecmp])
62AC_CHECK_SIZEOF([void*])
63AC_PROG_INSTALL
64AC_PROG_MAKE_SET
65ACX_PTHREAD
66
67AC_SEARCH_LIBS([socket], [socket net])
68AC_SEARCH_LIBS([gethostbyname], [nsl bind])
69PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM])
70PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM])
71
72AC_SYS_LARGEFILE
73
74dnl ----------------------------------------------------------------------------
75dnl
76dnl va_copy
77
78AC_MSG_CHECKING([how to copy va_list])
79AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);],
80    AC_MSG_RESULT([va_copy]),
81        [ AH_TEMPLATE([va_copy], [define if va_copy is not available])
82        AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);],
83        [ AC_DEFINE([va_copy], [__va_copy])
84        AC_MSG_RESULT([__va_copy])],
85        [ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))])
86        AC_MSG_RESULT([memcpy])]
87    )
88])
89
90
91dnl ----------------------------------------------------------------------------
92dnl
93dnl  libevent fun
94
95AC_CONFIG_SUBDIRS([third-party/libevent])
96AC_MSG_NOTICE([invoking libevent's configure script])
97LIBEVENT_CPPFLAGS="-I\$(top_srcdir)/third-party/libevent"
98AC_SUBST(LIBEVENT_CPPFLAGS)
99
100
101dnl ----------------------------------------------------------------------------
102dnl
103dnl  detection for the GTK+ client
104
105PKG_CHECK_MODULES(GTK,
106                  [gtk+-2.0 >= $GTK_MINIMUM
107                   glib-2.0 >= $GLIB_MINIMUM
108                   gmodule-2.0 >= $GLIB_MINIMUM
109                   gthread-2.0 >= $GLIB_MINIMUM],
110                  [have_gtk=yes],
111                  [have_gtk=no])
112AC_ARG_ENABLE([gtk],
113              AC_HELP_STRING([--enable-gtk],[build gtk client]),
114              [want_gtk=${enableval}],
115              [want_gtk=${have_gtk}])
116build_gtk=no
117use_gio=no
118use_libnotify=no
119use_dbus_glib=no
120if test "x$want_gtk" = "xyes" ; then
121    if test "x$have_gtk" = "xyes"; then
122      build_gtk=yes
123    else
124      AC_MSG_ERROR("GTK+ not found!")
125    fi
126fi
127AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"])
128AC_SUBST(GTK_LIBS)
129AC_SUBST(GTK_CFLAGS)
130
131if test "x$build_gtk" = "xyes"; then
132
133    PKG_CHECK_MODULES([GIO],
134                      [gio-2.0 >= $GIO_MINIMUM],
135                      [use_gio=yes],
136                      [use_gio=no])
137    AC_SUBST(GIO_LIBS)
138    AC_SUBST(GIO_CFLAGS)
139    if test "x$use_gio" = "xyes"; then
140        AC_DEFINE([HAVE_GIO], 1)
141    fi
142
143    PKG_CHECK_MODULES([LIBNOTIFY],
144                      [libnotify >= $LIBNOTIFY_MINIMUM],
145                      [have_libnotify=yes],
146                      [have_libnotify=no])
147    AC_ARG_ENABLE([libnotify],
148                  AS_HELP_STRING([--enable-libnotify],[enable notifications]),,
149                  [enable_libnotify=yes])
150    use_libnotify=no
151    if test "x$enable_libnotify" = "xyes" ; then
152        if test "x$have_libnotify" = "xyes"; then
153            use_libnotify=yes
154            AC_SUBST(LIBNOTIFY_LIBS)
155            AC_SUBST(LIBNOTIFY_CFLAGS)
156            AC_DEFINE([HAVE_LIBNOTIFY], 1)
157        fi
158    fi
159
160    PKG_CHECK_MODULES([DBUS_GLIB],
161                      [dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
162                      [use_dbus_glib=yes],
163                      [use_dbus_glib=no])
164    AC_SUBST(DBUS_GLIB_LIBS)
165    AC_SUBST(DBUS_GLIB_CFLAGS)
166    if test "x$use_dbus_glib" = "xyes"; then
167        AC_DEFINE([HAVE_DBUS_GLIB], 1)
168    fi
169    if test "x$use_dbus_glib" = "xyes"; then
170        AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
171        if test "x$DBUS_BINDING_TOOL" = xno; then
172          AC_MSG_WARN([Cannot find dbus-binding-tool])
173          use_dbus_glib="no (dbus-binding-tool not found)"
174        fi
175    fi
176fi
177
178AC_CHECK_HEADERS([libintl.h])
179IT_PROG_INTLTOOL([0.23],[no-xml])
180GETTEXT_PACKAGE=transmission
181AC_SUBST(GETTEXT_PACKAGE)
182AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
183AM_GLIB_GNU_GETTEXT
184transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
185AC_SUBST(transmissionlocaledir)
186
187
188dnl ----------------------------------------------------------------------------
189dnl
190dnl  wxWidgets detection for the wxWidgets client
191
192AM_OPTIONS_WXCONFIG
193AM_PATH_WXCONFIG($WX_MINIMUM,[have_wx=yes],[have_wx=no])
194AC_ARG_ENABLE([wx],
195              AC_HELP_STRING([--enable-wx],[build wxWidgets client]),
196              [want_wx=${enableval}],
197              [want_wx=no])
198build_wx=no
199if test "x$want_wx" = "xyes" ; then
200    if test "x$have_wx" = "xyes"; then
201      build_wx=yes
202    else
203      AC_MSG_ERROR("wxWidgets not found!")
204    fi
205fi
206AM_CONDITIONAL([BUILD_WX],[test "x$build_wx" = "xyes"])
207
208
209
210dnl ----------------------------------------------------------------------------
211dnl
212dnl  platform-specific stuff.
213
214AC_CANONICAL_HOST
215have_beos="no"
216have_darwin="no"
217have_msw="no"
218case $host_os in
219
220   *cygwin|*mingw32*)
221     have_msw="yes"
222     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
223     CPPFLAGS="$CPPFLAGS -DWIN32 -DWIN32_LEAN_AND_MEAN"
224     LIBS="$LIBS -lshell32 -lws2_32"
225     transmissionlocaledir="locale"
226     if test -z "$host_alias"; then
227       hostaliaswindres=
228     else
229       hostaliaswindres="$host_alias-windres";
230     fi
231     AC_PATH_PROGS([WINDRES], [windres $hostaliaswindres $host_os-windres])
232     if test "x$WINDRES" = "x"; then
233       AC_MSG_ERROR([windres could not be found within your path.])
234     fi
235     AC_SUBST(WINDRES)
236     ;;
237
238  *beos*)
239    have_beos="yes"
240    RELEASE=`uname -r`
241    case $RELEASE in
242      6.*|5.0.4) # Zeta or R5 / BONE beta 7
243        ;;
244      5.0*)       # R5 / net_server
245        CPPFLAGS="$CPPFLAGS -DBEOS_NETSERVER"
246        ;;
247      *)
248        AC_MSG_ERROR("Unsupported BeOS version")
249        ;;
250    esac
251    GCCVER=`$CC -dumpversion`
252    case $GCCVER in
253      2.95.3*|3*|4*)
254        ;;
255      2.9*)
256        BEOS_OLDCC=yes
257        ;;
258      *)
259        AC_MSG_ERROR("Unsupported gcc version")
260        ;;
261    esac
262    ;;
263
264  *darwin*)
265    have_darwin="yes"
266    # Make sure the Universal SDK is installed
267    if test ! -d /Developer/SDKs/MacOSX10.4u.sdk; then
268      cat << EOF
269You need to install the Universal SDK in order to build Transmission:
270  Get your Xcode CD or package
271  Restart the install
272  When it gets to "Installation Type", select "Customize"
273  Select "Mac OS X 10.4 (Universal) SDK" under "Cross Development"
274  Finish the install.
275EOF
276      exit 1
277    fi
278    ;;
279
280esac
281
282AC_ARG_ENABLE([beos],
283              [AC_HELP_STRING([--enable-beos],[build OS X client])],
284              [build_beos=${enableval}],
285              [build_beos=${have_beos}])
286AM_CONDITIONAL([BUILD_BEOS],[test "x$build_beos" = "xyes"])
287
288AC_ARG_ENABLE([cli],
289              [AC_HELP_STRING([--enable-cli],[build command-line client])],
290              [build_cli=${enableval}],
291              [build_cli="yes"])
292AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
293
294AC_ARG_ENABLE([mac],
295              [AC_HELP_STRING([--enable-mac],[build OS X client])],
296              [build_mac=${enableval}],
297              [build_mac=${have_darwin}])
298AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
299
300AC_ARG_ENABLE([daemon],
301              [AC_HELP_STRING([--enable-daemon],[build daemon])],
302              [build_daemon=${enableval}],
303              [build_daemon="yes"])
304AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
305
306
307if test "x$have_beos" = "xyes"; then
308    AC_DEFINE([HAVE_BEOS], 1)
309fi
310if test "x$have_darwin" = "xyes"; then
311    AC_DEFINE([HAVE_DARWIN], 1)
312fi
313if test "x$have_msw" = "xyes"; then
314    AC_DEFINE([HAVE_MSW], 1)
315fi
316
317
318dnl ----------------------------------------------------------------------------
319dnl
320dnl  Generate the output
321
322AC_CONFIG_FILES([Makefile
323                 transmission.spec
324                 beos/Makefile
325                 cli/Makefile
326                 daemon/Makefile
327                 doc/Makefile
328                 libtransmission/Makefile
329                 third-party/Makefile
330                 third-party/miniupnp/Makefile
331                 third-party/libnatpmp/Makefile
332                 third-party/shttpd/Makefile
333                 macosx/Makefile
334                 wx/Makefile
335                 wx/images/Makefile
336                 gtk/Makefile
337                 gtk/icons/Makefile
338                 po/Makefile.in])
339
340ac_configure_args="$ac_configure_args --enable-static --disable-shared -q"
341AC_OUTPUT
342
343echo "
344
345Configuration:
346
347        Source code location:       ${srcdir}
348        Compiler:                   ${CXX}
349        Build Command-Line client:  ${build_cli}
350        Build Daemon:               ${build_daemon}
351        Build BeOS client:          ${build_beos}
352        Build GTK+ client:          ${build_gtk}
353          ... gio support:          ${use_gio}
354          ... dbus-glib support:    ${use_dbus_glib}
355          ... libnotify support:    ${use_libnotify}
356        Build OS X client:          ${build_mac}
357        Build wxWidgets client:     ${build_wx}
358
359"
Note: See TracBrowser for help on using the repository browser.