source: trunk/configure.ac @ 7726

Last change on this file since 7726 was 7726, checked in by charles, 13 years ago

(trunk) sync xcode & autoconf idioms for determining if a build is stable, beta, or nightly

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