source: trunk/configure.ac @ 7497

Last change on this file since 7497 was 7497, checked in by livings124, 13 years ago

#1626 update group rules sheet to use NSPredicateEditor - main commit in r7493

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