source: branches/1.5x/configure.ac @ 7895

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

(1.5x) local CFLAGS and CXXFLAGS environment variables are clobbered

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