source: trunk/configure.ac @ 6431

Last change on this file since 6431 was 6431, checked in by livings124, 13 years ago

ready for 1.30

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