source: trunk/configure.ac @ 5776

Last change on this file since 5776 was 5776, checked in by charles, 15 years ago

#922: No need to check on gio, libnotify and dbus if gtk disabled.

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