source: trunk/configure.ac @ 6881

Last change on this file since 6881 was 6881, checked in by charles, 14 years ago

add -Wformat-security to autoconf

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