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

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

(1.5x) #1847: Non-GCC compilers are not happy with -O options

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