source: trunk/configure.ac @ 7033

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

simplify the configure script a little

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