source: trunk/configure.ac @ 7424

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

use -g unconditionally

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