source: trunk/configure.ac @ 7347

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

(trunk) #1581: resolve ambiguity between --enable-gtk and --disable-nls

File size: 9.8 KB
Line 
1dnl convention: -TR MAJOR MINOR MAINT STATUS - (each a single char)
2dnl STATUS: "X" for prerelease test 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.40+])
7m4_define([peer_id_prefix],[-TR140Z-])
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) = "Z"; then
23  AC_DEFINE(TR_UNSTABLE, 1, [Define to 1 if this is an unstable version of Transmission])
24  TR_UNSTABLE=yes
25fi
26AM_CONDITIONAL(TR_UNSTABLE, test "x$TR_UNSTABLE" = "xyes")
27
28OPENSSL_MINIMUM=0.9.4
29CURL_MINIMUM=7.16.3
30GIO_MINIMUM=2.15.5
31GLIB_MINIMUM=2.6.0
32GTK_MINIMUM=2.6.0
33WX_MINIMUM=2.6.0
34LIBNOTIFY_MINIMUM=0.4.4
35DBUS_GLIB_MINIMUM=0.70
36AC_SUBST(OPENSSL_MINIMUM)
37AC_SUBST(CURL_MINIMUM)
38AC_SUBST(GIO_MINIMUM)
39AC_SUBST(GLIB_MINIMUM)
40AC_SUBST(GTK_MINIMUM)
41AC_SUBST(WX_MINIMUM)
42AC_SUBST(LIBNOTIFY_MINIMUM)
43AC_SUBST(DBUS_GLIB_MINIMUM)
44
45AC_PROG_CC
46AC_PROG_CXX
47if test "x$GCC" = "xyes" ; then
48    CFLAGS="-g -Wall -Wformat-security -W -Wmissing-prototypes -Wdeclaration-after-statement -O3 -funroll-loops"
49    CXXFLAGS="-g -Wall -Wformat-security -W -O3 -funroll-loops"
50fi
51
52AC_HEADER_STDC
53AC_HEADER_TIME
54
55AC_MSG_CHECKING([for fallocate])
56AC_TRY_LINK([#include <linux/falloc.h>],
57            [return fallocate(-1,0,0,0);],
58            [AC_DEFINE([HAVE_FALLOCATE],[1],[Defined if fallocate() exists])
59             AC_MSG_RESULT([yes])],
60            [AC_MSG_RESULT([no])])
61AC_CHECK_FUNCS([lrintf strlcpy daemon dirname basename daemon strcasecmp localtime_r posix_fallocate])
62AC_PROG_INSTALL
63AC_PROG_MAKE_SET
64ACX_PTHREAD
65
66AC_SEARCH_LIBS([socket], [socket net])
67AC_SEARCH_LIBS([gethostbyname], [nsl bind])
68PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM], , [CHECK_SSL()])
69PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM])
70AC_PATH_ZLIB
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_ARG_ENABLE([nls],
179              AS_HELP_STRING([--enable-nls],[enable native language support]),,
180              [enable_nls=yes])
181
182if test "x$build_gtk" = "xyes" -a  "x$enable_nls" = "xno" ; then
183    AC_MSG_ERROR("The gtk client cannot be built without nls support.  Try adding either --enable-nls or --disable-gtk" )
184fi
185
186use_nls=no
187if test "x$enable_nls" = "xyes" ; then
188    use_nls=yes
189    IT_PROG_INTLTOOL([0.23],[no-xml])
190    AC_CHECK_HEADERS([libintl.h])
191    GETTEXT_PACKAGE=transmission
192    AC_SUBST(GETTEXT_PACKAGE)
193    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
194    AM_GLIB_GNU_GETTEXT
195    transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
196    AC_SUBST(transmissionlocaledir)
197fi
198
199dnl ----------------------------------------------------------------------------
200dnl
201dnl  wxWidgets detection for the wxWidgets client
202
203build_wx=no
204AC_ARG_ENABLE([wx],
205              AC_HELP_STRING([--enable-wx],[build wxWidgets client]),
206              [want_wx=${enableval}],
207              [want_wx=no])
208if test "x$want_wx" != "xno"; then
209    AM_OPTIONS_WXCONFIG
210    AM_PATH_WXCONFIG($WX_MINIMUM,[have_wx=yes],[have_wx=no])
211    if test "x$have_wx" = "xyes"; then
212        build_wx=yes
213    elif test "x$want_wx" = "xyes"; then
214        AC_MSG_ERROR("wxWidgets not found!")
215    fi
216fi
217AM_CONDITIONAL([BUILD_WX],[test "x$build_wx" = "xyes"])
218
219
220
221dnl ----------------------------------------------------------------------------
222dnl
223dnl  platform-specific stuff.
224
225AC_CANONICAL_HOST
226have_darwin="no"
227have_msw="no"
228case $host_os in
229
230   *cygwin|*mingw32*)
231     have_msw="yes"
232     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
233     CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
234     LIBS="$LIBS -lshell32 -lws2_32"
235     transmissionlocaledir="locale"
236     if test -z "$host_alias"; then
237       hostaliaswindres=
238     else
239       hostaliaswindres="$host_alias-windres";
240     fi
241     AC_CHECK_TOOL(WINDRES, windres)
242     ;;
243
244  *darwin*)
245    have_darwin="yes"
246    # Make sure the Universal SDK is installed
247    if test ! -d /Developer/SDKs/MacOSX10.4u.sdk; then
248      cat << EOF
249You need to install the Universal SDK in order to build Transmission:
250  Get your Xcode CD or package
251  Restart the install
252  When it gets to "Installation Type", select "Customize"
253  Select "Mac OS X 10.4 (Universal) SDK" under "Cross Development"
254  Finish the install.
255EOF
256      exit 1
257    fi
258    ;;
259
260esac
261
262AC_ARG_ENABLE([cli],
263              [AC_HELP_STRING([--enable-cli],[build command-line client])],
264              [build_cli=${enableval}],
265              [build_cli="yes"])
266AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
267
268AC_ARG_ENABLE([mac],
269              [AC_HELP_STRING([--enable-mac],[build OS X client])],
270              [build_mac=${enableval}],
271              [build_mac=${have_darwin}])
272AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
273
274AC_ARG_ENABLE([daemon],
275              [AC_HELP_STRING([--enable-daemon],[build daemon])],
276              [build_daemon=${enableval}],
277              [build_daemon="yes"])
278AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
279
280
281if test "x$have_darwin" = "xyes"; then
282    AC_DEFINE([HAVE_DARWIN], 1)
283fi
284if test "x$have_msw" = "xyes"; then
285    AC_DEFINE([HAVE_MSW], 1)
286fi
287AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
288
289dnl ----------------------------------------------------------------------------
290dnl
291dnl  Generate the output
292
293AC_CONFIG_FILES([Makefile
294                 transmission.spec
295                 cli/Makefile
296                 daemon/Makefile
297                 doc/Makefile
298                 libtransmission/Makefile
299                 third-party/Makefile
300                 third-party/miniupnp/Makefile
301                 third-party/libnatpmp/Makefile
302                 macosx/Makefile
303                 wx/Makefile
304                 wx/images/Makefile
305                 gtk/Makefile
306                 gtk/icons/Makefile
307                 po/Makefile.in])
308
309ac_configure_args="$ac_configure_args --enable-static --disable-shared -q"
310AC_OUTPUT
311
312echo "
313
314Configuration:
315
316        Source code location:       ${srcdir}
317        Compiler:                   ${CXX}
318        Build Command-Line client:  ${build_cli}
319        Build Daemon:               ${build_daemon}
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_mac}
325        Build wxWidgets client:     ${build_wx}
326
327"
Note: See TracBrowser for help on using the repository browser.