source: trunk/configure.ac @ 7258

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

#916: Make native language support (gettext) optional

File size: 9.7 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
182use_nls=no
183if test "x$enable_nls" = "xyes" ; then
184    use_nls=yes
185    IT_PROG_INTLTOOL([0.23],[no-xml])
186    AC_CHECK_HEADERS([libintl.h])
187    GETTEXT_PACKAGE=transmission
188    AC_SUBST(GETTEXT_PACKAGE)
189    AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
190    AM_GLIB_GNU_GETTEXT
191    transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
192    AC_SUBST(transmissionlocaledir)
193fi
194
195dnl ----------------------------------------------------------------------------
196dnl
197dnl  wxWidgets detection for the wxWidgets client
198
199build_wx=no
200AC_ARG_ENABLE([wx],
201              AC_HELP_STRING([--enable-wx],[build wxWidgets client]),
202              [want_wx=${enableval}],
203              [want_wx=no])
204if test "x$want_wx" != "xno"; then
205    AM_OPTIONS_WXCONFIG
206    AM_PATH_WXCONFIG($WX_MINIMUM,[have_wx=yes],[have_wx=no])
207    if test "x$have_wx" = "xyes"; then
208        build_wx=yes
209    elif test "x$want_wx" = "xyes"; then
210        AC_MSG_ERROR("wxWidgets not found!")
211    fi
212fi
213AM_CONDITIONAL([BUILD_WX],[test "x$build_wx" = "xyes"])
214
215
216
217dnl ----------------------------------------------------------------------------
218dnl
219dnl  platform-specific stuff.
220
221AC_CANONICAL_HOST
222have_darwin="no"
223have_msw="no"
224case $host_os in
225
226   *cygwin|*mingw32*)
227     have_msw="yes"
228     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
229     CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
230     LIBS="$LIBS -lshell32 -lws2_32"
231     transmissionlocaledir="locale"
232     if test -z "$host_alias"; then
233       hostaliaswindres=
234     else
235       hostaliaswindres="$host_alias-windres";
236     fi
237     AC_CHECK_TOOL(WINDRES, windres)
238     ;;
239
240  *darwin*)
241    have_darwin="yes"
242    # Make sure the Universal SDK is installed
243    if test ! -d /Developer/SDKs/MacOSX10.4u.sdk; then
244      cat << EOF
245You need to install the Universal SDK in order to build Transmission:
246  Get your Xcode CD or package
247  Restart the install
248  When it gets to "Installation Type", select "Customize"
249  Select "Mac OS X 10.4 (Universal) SDK" under "Cross Development"
250  Finish the install.
251EOF
252      exit 1
253    fi
254    ;;
255
256esac
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([mac],
265              [AC_HELP_STRING([--enable-mac],[build OS X client])],
266              [build_mac=${enableval}],
267              [build_mac=${have_darwin}])
268AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "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_darwin" = "xyes"; then
278    AC_DEFINE([HAVE_DARWIN], 1)
279fi
280if test "x$have_msw" = "xyes"; then
281    AC_DEFINE([HAVE_MSW], 1)
282fi
283AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
284
285dnl ----------------------------------------------------------------------------
286dnl
287dnl  Generate the output
288
289AC_CONFIG_FILES([Makefile
290                 transmission.spec
291                 cli/Makefile
292                 daemon/Makefile
293                 doc/Makefile
294                 libtransmission/Makefile
295                 third-party/Makefile
296                 third-party/miniupnp/Makefile
297                 third-party/libnatpmp/Makefile
298                 macosx/Makefile
299                 wx/Makefile
300                 wx/images/Makefile
301                 gtk/Makefile
302                 gtk/icons/Makefile
303                 po/Makefile.in])
304
305ac_configure_args="$ac_configure_args --enable-static --disable-shared -q"
306AC_OUTPUT
307
308echo "
309
310Configuration:
311
312        Source code location:       ${srcdir}
313        Compiler:                   ${CXX}
314        Build Command-Line client:  ${build_cli}
315        Build Daemon:               ${build_daemon}
316        Build GTK+ client:          ${build_gtk}
317          ... gio support:          ${use_gio}
318          ... dbus-glib support:    ${use_dbus_glib}
319          ... libnotify support:    ${use_libnotify}
320        Build OS X client:          ${build_mac}
321        Build wxWidgets client:     ${build_wx}
322
323"
Note: See TracBrowser for help on using the repository browser.