source: trunk/configure.ac @ 6925

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

add localtime_r to AC_CHECK_FUNCS for libtransmisson/util.c's #ifdef HAVE_LOCALTIME_R

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.16.3
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 localtime_r])
63AC_PROG_INSTALL
64AC_PROG_MAKE_SET
65ACX_PTHREAD
66
67AC_SEARCH_LIBS([socket], [socket net])
68AC_SEARCH_LIBS([gethostbyname], [nsl bind])
69PKG_CHECK_MODULES(OPENSSL, [openssl >= $OPENSSL_MINIMUM], , [CHECK_SSL()])
70PKG_CHECK_MODULES(LIBCURL, [libcurl >= $CURL_MINIMUM])
71CHECK_ZLIB()
72
73AC_SYS_LARGEFILE
74
75dnl ----------------------------------------------------------------------------
76dnl
77dnl va_copy
78
79AC_MSG_CHECKING([how to copy va_list])
80AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);],
81    AC_MSG_RESULT([va_copy]),
82        [ AH_TEMPLATE([va_copy], [define if va_copy is not available])
83        AC_TRY_LINK([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);],
84        [ AC_DEFINE([va_copy], [__va_copy])
85        AC_MSG_RESULT([__va_copy])],
86        [ AC_DEFINE([va_copy(dest,src)], [memcpy(&dest,&src,sizeof(va_list))])
87        AC_MSG_RESULT([memcpy])]
88    )
89])
90
91
92dnl ----------------------------------------------------------------------------
93dnl
94dnl  libevent fun
95
96AC_CONFIG_SUBDIRS([third-party/libevent])
97AC_MSG_NOTICE([invoking libevent's configure script])
98LIBEVENT_CPPFLAGS="-I\$(top_srcdir)/third-party/libevent"
99AC_SUBST(LIBEVENT_CPPFLAGS)
100
101
102dnl ----------------------------------------------------------------------------
103dnl
104dnl  detection for the GTK+ client
105
106PKG_CHECK_MODULES(GTK,
107                  [gtk+-2.0 >= $GTK_MINIMUM
108                   glib-2.0 >= $GLIB_MINIMUM
109                   gmodule-2.0 >= $GLIB_MINIMUM
110                   gthread-2.0 >= $GLIB_MINIMUM],
111                  [have_gtk=yes],
112                  [have_gtk=no])
113AC_ARG_ENABLE([gtk],
114              AC_HELP_STRING([--enable-gtk],[build gtk client]),
115              [want_gtk=${enableval}],
116              [want_gtk=${have_gtk}])
117build_gtk=no
118use_gio=no
119use_libnotify=no
120use_dbus_glib=no
121if test "x$want_gtk" = "xyes" ; then
122    if test "x$have_gtk" = "xyes"; then
123      build_gtk=yes
124    else
125      AC_MSG_ERROR("GTK+ not found!")
126    fi
127fi
128AM_CONDITIONAL([BUILD_GTK],[test "x$build_gtk" = "xyes"])
129AC_SUBST(GTK_LIBS)
130AC_SUBST(GTK_CFLAGS)
131
132if test "x$build_gtk" = "xyes"; then
133
134    PKG_CHECK_MODULES([GIO],
135                      [gio-2.0 >= $GIO_MINIMUM],
136                      [use_gio=yes],
137                      [use_gio=no])
138    AC_SUBST(GIO_LIBS)
139    AC_SUBST(GIO_CFLAGS)
140    if test "x$use_gio" = "xyes"; then
141        AC_DEFINE([HAVE_GIO], 1)
142    fi
143
144    PKG_CHECK_MODULES([LIBNOTIFY],
145                      [libnotify >= $LIBNOTIFY_MINIMUM],
146                      [have_libnotify=yes],
147                      [have_libnotify=no])
148    AC_ARG_ENABLE([libnotify],
149                  AS_HELP_STRING([--enable-libnotify],[enable notifications]),,
150                  [enable_libnotify=yes])
151    use_libnotify=no
152    if test "x$enable_libnotify" = "xyes" ; then
153        if test "x$have_libnotify" = "xyes"; then
154            use_libnotify=yes
155            AC_SUBST(LIBNOTIFY_LIBS)
156            AC_SUBST(LIBNOTIFY_CFLAGS)
157            AC_DEFINE([HAVE_LIBNOTIFY], 1)
158        fi
159    fi
160
161    PKG_CHECK_MODULES([DBUS_GLIB],
162                      [dbus-glib-1 >= $DBUS_GLIB_MINIMUM],
163                      [use_dbus_glib=yes],
164                      [use_dbus_glib=no])
165    AC_SUBST(DBUS_GLIB_LIBS)
166    AC_SUBST(DBUS_GLIB_CFLAGS)
167    if test "x$use_dbus_glib" = "xyes"; then
168        AC_DEFINE([HAVE_DBUS_GLIB], 1)
169    fi
170    if test "x$use_dbus_glib" = "xyes"; then
171        AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
172        if test "x$DBUS_BINDING_TOOL" = xno; then
173          AC_MSG_WARN([Cannot find dbus-binding-tool])
174          use_dbus_glib="no (dbus-binding-tool not found)"
175        fi
176    fi
177fi
178
179AC_CHECK_HEADERS([libintl.h])
180IT_PROG_INTLTOOL([0.23],[no-xml])
181GETTEXT_PACKAGE=transmission
182AC_SUBST(GETTEXT_PACKAGE)
183AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
184AM_GLIB_GNU_GETTEXT
185transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
186AC_SUBST(transmissionlocaledir)
187
188
189dnl ----------------------------------------------------------------------------
190dnl
191dnl  wxWidgets detection for the wxWidgets client
192
193AM_OPTIONS_WXCONFIG
194AM_PATH_WXCONFIG($WX_MINIMUM,[have_wx=yes],[have_wx=no])
195AC_ARG_ENABLE([wx],
196              AC_HELP_STRING([--enable-wx],[build wxWidgets client]),
197              [want_wx=${enableval}],
198              [want_wx=no])
199build_wx=no
200if test "x$want_wx" = "xyes" ; then
201    if test "x$have_wx" = "xyes"; then
202      build_wx=yes
203    else
204      AC_MSG_ERROR("wxWidgets not found!")
205    fi
206fi
207AM_CONDITIONAL([BUILD_WX],[test "x$build_wx" = "xyes"])
208
209
210
211dnl ----------------------------------------------------------------------------
212dnl
213dnl  platform-specific stuff.
214
215AC_CANONICAL_HOST
216have_beos="no"
217have_darwin="no"
218have_msw="no"
219case $host_os in
220
221   *cygwin|*mingw32*)
222     have_msw="yes"
223     CXXFLAGS="$CXXFLAGS -mms-bitfields -mwin32 -mwindows"
224     CPPFLAGS="$CPPFLAGS -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN"
225     LIBS="$LIBS -lshell32 -lws2_32"
226     transmissionlocaledir="locale"
227     if test -z "$host_alias"; then
228       hostaliaswindres=
229     else
230       hostaliaswindres="$host_alias-windres";
231     fi
232     AC_CHECK_TOOL(WINDRES, windres)
233     ;;
234
235  *beos*)
236    have_beos="yes"
237    RELEASE=`uname -r`
238    case $RELEASE in
239      6.*|5.0.4) # Zeta or R5 / BONE beta 7
240        ;;
241      5.0*)       # R5 / net_server
242        CPPFLAGS="$CPPFLAGS -DBEOS_NETSERVER"
243        ;;
244      *)
245        AC_MSG_ERROR("Unsupported BeOS version")
246        ;;
247    esac
248    GCCVER=`$CC -dumpversion`
249    case $GCCVER in
250      2.95.3*|3*|4*)
251        ;;
252      2.9*)
253        BEOS_OLDCC=yes
254        ;;
255      *)
256        AC_MSG_ERROR("Unsupported gcc version")
257        ;;
258    esac
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([beos],
280              [AC_HELP_STRING([--enable-beos],[build OS X client])],
281              [build_beos=${enableval}],
282              [build_beos=${have_beos}])
283AM_CONDITIONAL([BUILD_BEOS],[test "x$build_beos" = "xyes"])
284
285AC_ARG_ENABLE([cli],
286              [AC_HELP_STRING([--enable-cli],[build command-line client])],
287              [build_cli=${enableval}],
288              [build_cli="yes"])
289AM_CONDITIONAL([BUILD_CLI],[test "x$build_cli" = "xyes"])
290
291AC_ARG_ENABLE([mac],
292              [AC_HELP_STRING([--enable-mac],[build OS X client])],
293              [build_mac=${enableval}],
294              [build_mac=${have_darwin}])
295AM_CONDITIONAL([BUILD_MAC],[test "x$build_mac" = "xyes"])
296
297AC_ARG_ENABLE([daemon],
298              [AC_HELP_STRING([--enable-daemon],[build daemon])],
299              [build_daemon=${enableval}],
300              [build_daemon="yes"])
301AM_CONDITIONAL([BUILD_DAEMON],[test "x$build_daemon" = "xyes"])
302
303
304if test "x$have_beos" = "xyes"; then
305    AC_DEFINE([HAVE_BEOS], 1)
306fi
307if test "x$have_darwin" = "xyes"; then
308    AC_DEFINE([HAVE_DARWIN], 1)
309fi
310if test "x$have_msw" = "xyes"; then
311    AC_DEFINE([HAVE_MSW], 1)
312fi
313AM_CONDITIONAL(WIN32, test "x$have_msw" = "xyes")
314
315dnl ----------------------------------------------------------------------------
316dnl
317dnl  Generate the output
318
319AC_CONFIG_FILES([Makefile
320                 transmission.spec
321                 beos/Makefile
322                 cli/Makefile
323                 daemon/Makefile
324                 doc/Makefile
325                 libtransmission/Makefile
326                 third-party/Makefile
327                 third-party/miniupnp/Makefile
328                 third-party/libnatpmp/Makefile
329                 macosx/Makefile
330                 wx/Makefile
331                 wx/images/Makefile
332                 gtk/Makefile
333                 gtk/icons/Makefile
334                 po/Makefile.in])
335
336ac_configure_args="$ac_configure_args --enable-static --disable-shared -q"
337AC_OUTPUT
338
339echo "
340
341Configuration:
342
343        Source code location:       ${srcdir}
344        Compiler:                   ${CXX}
345        Build Command-Line client:  ${build_cli}
346        Build Daemon:               ${build_daemon}
347        Build BeOS client:          ${build_beos}
348        Build GTK+ client:          ${build_gtk}
349          ... gio support:          ${use_gio}
350          ... dbus-glib support:    ${use_dbus_glib}
351          ... libnotify support:    ${use_libnotify}
352        Build OS X client:          ${build_mac}
353        Build wxWidgets client:     ${build_wx}
354
355"
Note: See TracBrowser for help on using the repository browser.