source: trunk/configure.ac @ 7617

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

ensure that -ggdb3 is used if we're using gcc

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