source: trunk/configure.ac @ 6532

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

Enable checking of deprecated GTK usage (in beta/unstable releases only)

File size: 9.9 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
169fi
170
171AC_CHECK_HEADERS([libintl.h])
172IT_PROG_INTLTOOL([0.23],[no-xml])
173GETTEXT_PACKAGE=transmission
174AC_SUBST(GETTEXT_PACKAGE)
175AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
176AM_GLIB_GNU_GETTEXT
177transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
178AC_SUBST(transmissionlocaledir)
179
180
181dnl ----------------------------------------------------------------------------
182dnl
183dnl  wxWidgets detection for the wxWidgets client
184
185AM_OPTIONS_WXCONFIG
186AM_PATH_WXCONFIG($WX_MINIMUM,[have_wx=yes],[have_wx=no])
187AC_ARG_ENABLE([wx],
188              AC_HELP_STRING([--enable-wx],[build wxWidgets client]),
189              [want_wx=${enableval}],
190              [want_wx=no])
191build_wx=no
192if test "x$want_wx" = "xyes" ; then
193    if test "x$have_wx" = "xyes"; then
194      build_wx=yes
195    else
196      AC_MSG_ERROR("wxWidgets not found!")
197    fi
198fi
199AM_CONDITIONAL([BUILD_WX],[test "x$build_wx" = "xyes"])
200
201
202
203dnl ----------------------------------------------------------------------------
204dnl
205dnl  platform-specific stuff.
206
207AC_CANONICAL_HOST
208have_beos="no"
209have_darwin="no"
210have_msw="no"
211case $host_os in
212
213   *cygwin|*mingw32*)
214     have_msw="yes"
215     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
216     CPPFLAGS="$CPPFLAGS -DWIN32 -DWIN32_LEAN_AND_MEAN"
217     LIBS="$LIBS -lshell32 -lws2_32"
218     transmissionlocaledir="locale"
219     if test -z "$host_alias"; then
220       hostaliaswindres=
221     else
222       hostaliaswindres="$host_alias-windres";
223     fi
224     AC_PATH_PROGS([WINDRES], [windres $hostaliaswindres $host_os-windres])
225     if test "x$WINDRES" = "x"; then
226       AC_MSG_ERROR([windres could not be found within your path.])
227     fi
228     AC_SUBST(WINDRES)
229     ;;
230
231  *beos*)
232    have_beos="yes"
233    RELEASE=`uname -r`
234    case $RELEASE in
235      6.*|5.0.4) # Zeta or R5 / BONE beta 7
236        ;;
237      5.0*)       # R5 / net_server
238        CPPFLAGS="$CPPFLAGS -DBEOS_NETSERVER"
239        ;;
240      *)
241        AC_MSG_ERROR("Unsupported BeOS version")
242        ;;
243    esac
244    GCCVER=`$CC -dumpversion`
245    case $GCCVER in
246      2.95.3*|3*|4*)
247        ;;
248      2.9*)
249        BEOS_OLDCC=yes
250        ;;
251      *)
252        AC_MSG_ERROR("Unsupported gcc version")
253        ;;
254    esac
255    ;;
256
257  *darwin*)
258    have_darwin="yes"
259    # Make sure the Universal SDK is installed
260    if test ! -d /Developer/SDKs/MacOSX10.4u.sdk; then
261      cat << EOF
262You need to install the Universal SDK in order to build Transmission:
263  Get your Xcode CD or package
264  Restart the install
265  When it gets to "Installation Type", select "Customize"
266  Select "Mac OS X 10.4 (Universal) SDK" under "Cross Development"
267  Finish the install.
268EOF
269      exit 1
270    fi
271    ;;
272
273esac
274
275AC_ARG_ENABLE([beos],
276              [AC_HELP_STRING([--enable-beos],[build OS X client])],
277              [build_beos=${enableval}],
278              [build_beos=${have_beos}])
279AM_CONDITIONAL([BUILD_BEOS],[test "x$build_beos" = "xyes"])
280
281AC_ARG_ENABLE([cli],
282              [AC_HELP_STRING([--enable-cli],[build command-line client])],
283              [build_cli=${enableval}],
284              [build_cli="yes"])
285AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
286
287AC_ARG_ENABLE([darwin],
288              [AC_HELP_STRING([--enable-darwin],[build OS X client])],
289              [build_darwin=${enableval}],
290              [build_darwin=${have_darwin}])
291AM_CONDITIONAL([BUILD_DARWIN],[test "x$build_darwin" = "xyes"])
292
293AC_ARG_ENABLE([daemon],
294              [AC_HELP_STRING([--enable-daemon],[build daemon])],
295              [build_daemon=${enableval}],
296              [build_daemon="yes"])
297AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
298
299
300if test "x$have_beos" = "xyes"; then
301    AC_DEFINE([HAVE_BEOS], 1)
302fi
303if test "x$have_darwin" = "xyes"; then
304    AC_DEFINE([HAVE_DARWIN], 1)
305fi
306if test "x$have_msw" = "xyes"; then
307    AC_DEFINE([HAVE_MSW], 1)
308fi
309
310
311dnl ----------------------------------------------------------------------------
312dnl
313dnl  Generate the output
314
315AC_CONFIG_FILES([Makefile
316                 transmission.spec
317                 beos/Makefile
318                 cli/Makefile
319                 daemon/Makefile
320                 doc/Makefile
321                 libtransmission/Makefile
322                 third-party/Makefile
323                 third-party/miniupnp/Makefile
324                 third-party/libnatpmp/Makefile
325                 third-party/shttpd/Makefile
326                 macosx/Makefile
327                 wx/Makefile
328                 wx/images/Makefile
329                 gtk/Makefile
330                 gtk/icons/Makefile
331                 po/Makefile.in])
332
333ac_configure_args="$ac_configure_args --enable-static --disable-shared -q"
334AC_OUTPUT
335
336echo "
337
338Configuration:
339
340        Source code location:       ${srcdir}
341        Compiler:                   ${CXX}
342        Build Command-Line client:  ${build_cli}
343        Build Daemon:               ${build_daemon}
344        Build BeOS client:          ${build_beos}
345        Build GTK+ client:          ${build_gtk}
346          ... gio support:          ${use_gio}
347          ... dbus-glib support:    ${use_dbus_glib}
348          ... libnotify support:    ${use_libnotify}
349        Build OS X client:          ${build_darwin}
350        Build wxWidgets client:     ${build_wx}
351
352"
Note: See TracBrowser for help on using the repository browser.