2014-04-20 03:47:08 +08:00
|
|
|
AC_INIT([qbittorrent], [v3.2.0alpha], [bugs.qbittorrent.org], [], [http://www.qbittorrent.org/])
|
|
|
|
AC_CONFIG_AUX_DIR([build-aux])
|
|
|
|
AC_CONFIG_MACRO_DIR([m4])
|
|
|
|
AC_PROG_CC
|
|
|
|
AC_PROG_CXX
|
2014-11-24 01:56:16 +08:00
|
|
|
AC_PROG_SED
|
2014-04-20 03:47:08 +08:00
|
|
|
AC_LANG(C++)
|
|
|
|
AC_CANONICAL_HOST
|
|
|
|
AM_INIT_AUTOMAKE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Define --wth-* and --enable-* arguments
|
|
|
|
|
2015-11-23 03:43:33 +08:00
|
|
|
AC_ARG_WITH(qt4,
|
|
|
|
[AS_HELP_STRING([--with-qt4],
|
|
|
|
[Compile using Qt4 (default=no)])],
|
2014-04-20 03:47:08 +08:00
|
|
|
[],
|
2015-11-23 03:43:33 +08:00
|
|
|
[with_qt4=no])
|
2014-11-12 19:06:05 +08:00
|
|
|
|
2014-04-20 03:47:08 +08:00
|
|
|
AC_ARG_WITH(qtsingleapplication,
|
|
|
|
[AS_HELP_STRING([--with-qtsingleapplication=@<:@system|shipped@:>@],
|
|
|
|
[Use the shipped qtsingleapplication library or the system one (default=shipped)])],
|
|
|
|
[],
|
|
|
|
[with_qtsingleapplication=shipped])
|
2014-11-12 19:06:05 +08:00
|
|
|
|
2015-04-12 06:02:13 +08:00
|
|
|
AC_ARG_WITH(qjson,
|
|
|
|
[AS_HELP_STRING([--with-qjson=@<:@system|shipped@:>@],
|
2015-05-11 05:27:46 +08:00
|
|
|
[Use the shipped qjson library or the system one (default=shipped) (Qt4 only)])],
|
2015-04-12 06:02:13 +08:00
|
|
|
[],
|
|
|
|
[with_qjson=shipped])
|
|
|
|
|
2014-04-20 03:47:08 +08:00
|
|
|
AC_ARG_ENABLE(debug,
|
|
|
|
[AS_HELP_STRING([--enable-debug],
|
|
|
|
[Enable debug build])],
|
|
|
|
[],
|
|
|
|
[enable_debug=no])
|
2014-11-12 19:06:05 +08:00
|
|
|
|
2014-04-20 03:47:08 +08:00
|
|
|
AC_ARG_ENABLE(gui,
|
|
|
|
[AS_HELP_STRING([--disable-gui],
|
|
|
|
[Disable the GUI for headless running. Disables QtDBus and the GeoIP Database.])],
|
|
|
|
[],
|
|
|
|
[enable_gui=yes])
|
2014-11-12 19:06:05 +08:00
|
|
|
|
2015-04-05 20:12:36 +08:00
|
|
|
AC_ARG_ENABLE(systemd,
|
|
|
|
[AS_HELP_STRING([--enable-systemd],
|
2015-05-03 04:51:51 +08:00
|
|
|
[Install the systemd service file (headless only).])],
|
2015-04-05 20:12:36 +08:00
|
|
|
[],
|
|
|
|
[enable_systemd=no])
|
|
|
|
|
2015-01-18 20:13:06 +08:00
|
|
|
AC_ARG_ENABLE(webui,
|
|
|
|
[AS_HELP_STRING([--disable-webui],
|
|
|
|
[Disable the WebUI.])],
|
|
|
|
[],
|
|
|
|
[enable_webui=yes])
|
|
|
|
|
2014-04-20 03:47:08 +08:00
|
|
|
AC_ARG_ENABLE(qt-dbus,
|
|
|
|
[AS_HELP_STRING([--disable-qt-dbus],
|
|
|
|
[Disable use of QtDBus (GUI only)])],
|
|
|
|
[],
|
|
|
|
[enable_qt_dbus=yes])
|
|
|
|
|
|
|
|
# Detect OS
|
|
|
|
AC_MSG_CHECKING([whether OS is FreeBSD])
|
2015-05-11 05:25:32 +08:00
|
|
|
AS_IF([expr "$host_os" : ".*freebsd.*" > /dev/null],
|
2014-04-20 03:47:08 +08:00
|
|
|
[AC_MSG_RESULT([yes])
|
|
|
|
LIBS="-lexecinfo $LIBS"],
|
|
|
|
[AC_MSG_RESULT([no])])
|
|
|
|
|
2015-04-05 19:17:22 +08:00
|
|
|
# Require 0.23 pkg-config
|
|
|
|
PKG_PROG_PKG_CONFIG([0.23])
|
2014-11-12 19:06:05 +08:00
|
|
|
AS_IF([test "x$PKG_CONFIG" = "x"],
|
2014-04-20 03:47:08 +08:00
|
|
|
[AC_MSG_ERROR([Could not find pkg-config])])
|
|
|
|
|
|
|
|
# Check which arguments were set and act accordingly
|
|
|
|
AC_MSG_CHECKING([whether to enable the Debug build])
|
2014-11-12 19:06:05 +08:00
|
|
|
AS_CASE(["x$enable_debug"],
|
2014-04-20 03:47:08 +08:00
|
|
|
["xno"],
|
|
|
|
[AC_MSG_RESULT([no])
|
|
|
|
QBT_ADD_CONFIG="$QBT_ADD_CONFIG release"
|
|
|
|
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG debug"],
|
|
|
|
["xyes"],
|
|
|
|
[AC_MSG_RESULT([yes])
|
|
|
|
QBT_ADD_CONFIG="$QBT_ADD_CONFIG debug"
|
|
|
|
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG release"],
|
|
|
|
[AC_MSG_RESULT([$enable_debug])
|
|
|
|
AC_MSG_ERROR([Unknown option "$enable_debug". Use either "yes" or "no".])])
|
2014-11-12 19:06:05 +08:00
|
|
|
|
2014-04-20 03:47:08 +08:00
|
|
|
AC_MSG_CHECKING([whether to enable the GUI])
|
|
|
|
AS_CASE(["x$enable_gui"],
|
|
|
|
["xyes"],
|
|
|
|
[AC_MSG_RESULT([yes])
|
2015-04-05 20:12:36 +08:00
|
|
|
enable_systemd=[no]
|
2015-01-18 20:13:06 +08:00
|
|
|
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG nogui"],
|
2014-04-20 03:47:08 +08:00
|
|
|
["xno"],
|
|
|
|
[AC_MSG_RESULT([no])
|
|
|
|
enable_qt_dbus=[no]
|
2015-01-18 20:13:06 +08:00
|
|
|
QBT_ADD_CONFIG="$QBT_ADD_CONFIG nogui"],
|
2014-04-20 03:47:08 +08:00
|
|
|
[AC_MSG_RESULT([$enable_gui])
|
|
|
|
AC_MSG_ERROR([Unknown option "$enable_gui". Use either "yes" or "no".])])
|
|
|
|
|
2015-04-05 20:12:36 +08:00
|
|
|
AC_MSG_CHECKING([whether to install the systemd service file])
|
|
|
|
AS_CASE(["x$enable_systemd"],
|
|
|
|
["xyes"],
|
|
|
|
[AC_MSG_RESULT([yes])
|
|
|
|
QBT_ADD_CONFIG="$QBT_ADD_CONFIG systemd"],
|
|
|
|
["xno"],
|
|
|
|
[AC_MSG_RESULT([no])
|
|
|
|
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG systemd"],
|
|
|
|
[AC_MSG_RESULT([$enable_systemd])
|
|
|
|
AC_MSG_ERROR([Unknown option "$enable_systemd". Use either "yes" or "no".])])
|
|
|
|
|
2015-01-18 20:13:06 +08:00
|
|
|
AC_MSG_CHECKING([whether to enable the WebUI])
|
|
|
|
AS_CASE(["x$enable_webui"],
|
|
|
|
["xyes"],
|
|
|
|
[AC_MSG_RESULT([yes])
|
|
|
|
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG nowebui"],
|
|
|
|
["xno"],
|
|
|
|
[AC_MSG_RESULT([no])
|
|
|
|
QBT_ADD_CONFIG="$QBT_ADD_CONFIG nowebui"],
|
|
|
|
[AC_MSG_RESULT([$enable_webui])
|
|
|
|
AC_MSG_ERROR([Unknown option "$enable_webui". Use either "yes" or "no".])])
|
|
|
|
|
2015-11-23 03:43:33 +08:00
|
|
|
AC_MSG_CHECKING([whether Qt4 should be enabled])
|
|
|
|
AS_CASE(["x$with_qt4"],
|
2014-04-20 03:47:08 +08:00
|
|
|
["xno"],
|
|
|
|
[AC_MSG_RESULT([no])
|
2015-11-23 03:43:33 +08:00
|
|
|
FIND_QT5()],
|
2014-04-20 03:47:08 +08:00
|
|
|
["xyes"],
|
|
|
|
[AC_MSG_RESULT([yes])
|
2015-11-23 03:43:33 +08:00
|
|
|
FIND_QT4()],
|
|
|
|
[AC_MSG_RESULT([$with_qt4])
|
|
|
|
AC_MSG_ERROR([Unknown option "$with_qt4". Use either "yes" or "no".])])
|
2014-11-12 19:06:05 +08:00
|
|
|
AS_IF([test "x$QT_QMAKE" = "x"],
|
2014-04-20 03:47:08 +08:00
|
|
|
[AC_MSG_ERROR([Could not find qmake])
|
|
|
|
])
|
2014-11-12 19:06:05 +08:00
|
|
|
|
2014-04-20 03:47:08 +08:00
|
|
|
AC_MSG_CHECKING([whether QtDBus should be enabled])
|
|
|
|
AS_CASE(["x$enable_qt_dbus"],
|
|
|
|
["xyes"],
|
|
|
|
[AC_MSG_RESULT([yes])
|
|
|
|
FIND_QTDBUS()
|
2014-11-12 19:06:05 +08:00
|
|
|
AS_IF([test "x$HAVE_QTDBUS" = "xfalse"],
|
2014-04-20 03:47:08 +08:00
|
|
|
[AC_MSG_ERROR([Could not find QtDBus])],
|
|
|
|
[QBT_ADD_CONFIG="$QBT_ADD_CONFIG dbus"]
|
|
|
|
)],
|
|
|
|
["xno"],
|
|
|
|
[AC_MSG_RESULT([no])
|
|
|
|
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG dbus"],
|
|
|
|
[AC_MSG_RESULT([$enable_qt_dbus])
|
|
|
|
AC_MSG_ERROR([Unknown option "$enable_qt_dbus". Use either "yes" or "no".])])
|
|
|
|
|
2014-11-12 19:06:05 +08:00
|
|
|
|
2014-04-20 03:47:08 +08:00
|
|
|
AX_BOOST_BASE([1.35])
|
|
|
|
# HAVE_BOOST is set to an empty value when Boost is found. I don't know
|
|
|
|
# how to test for a set vs unset variable.
|
2014-11-12 19:06:05 +08:00
|
|
|
AS_IF([test "x$BOOST_CPPFLAGS" = "x"],
|
2014-04-20 03:47:08 +08:00
|
|
|
[AC_MSG_ERROR([Could not find Boost])],
|
2016-01-21 01:47:53 +08:00
|
|
|
[AC_MSG_NOTICE([Boost CPPFLAGS: $BOOST_CPPFLAGS])
|
2014-11-12 19:06:05 +08:00
|
|
|
CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
|
|
|
|
LDFLAGS="$BOOST_LDFLAGS $LDFLAGS"])
|
2014-04-20 03:47:08 +08:00
|
|
|
|
|
|
|
AX_BOOST_SYSTEM()
|
|
|
|
# HAVE_BOOST_SYSTEM is set to an empty value when Boost.System is found.
|
|
|
|
# I don't know how to test for a set vs unset variable.
|
2014-11-12 19:06:05 +08:00
|
|
|
AS_IF([test "x$BOOST_SYSTEM_LIB" = "x"],
|
2014-04-20 03:47:08 +08:00
|
|
|
[AC_MSG_ERROR([Could not find Boost.System])],
|
2014-11-12 19:06:05 +08:00
|
|
|
[AC_MSG_NOTICE([Boost.System LIB: $BOOST_SYSTEM_LIB])
|
|
|
|
LIBS="$BOOST_SYSTEM_LIB $LIBS"])
|
2014-04-20 03:47:08 +08:00
|
|
|
|
|
|
|
AC_MSG_CHECKING([which qtsingleapplication to use])
|
|
|
|
AS_CASE(["x$with_qtsingleapplication"],
|
|
|
|
["xshipped"],
|
|
|
|
[AC_MSG_RESULT([shipped])
|
|
|
|
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG usesystemqtsingleapplication"],
|
|
|
|
["xsystem"],
|
|
|
|
[AC_MSG_RESULT([system])
|
|
|
|
QBT_ADD_CONFIG="$QBT_ADD_CONFIG usesystemqtsingleapplication"],
|
|
|
|
[AC_MSG_RESULT([$with_qtsingleapplication])
|
|
|
|
AC_MSG_ERROR([Unknown option "$with_qtsingleapplication". Use either "system" or "shipped".])])
|
|
|
|
|
2015-11-23 03:43:33 +08:00
|
|
|
AS_IF([test "x$with_qt4" = "xyes"],
|
2015-04-12 06:02:13 +08:00
|
|
|
[AC_MSG_CHECKING([which qjson to use])
|
|
|
|
AS_CASE(["x$with_qjson"],
|
|
|
|
["xshipped"],
|
|
|
|
[AC_MSG_RESULT([shipped])
|
|
|
|
QBT_REMOVE_CONFIG="$QBT_REMOVE_CONFIG usesystemqjson"],
|
|
|
|
["xsystem"],
|
|
|
|
[AC_MSG_RESULT([system])
|
|
|
|
PKG_CHECK_MODULES(qjson,
|
|
|
|
[QJson >= 0.8.1],
|
|
|
|
[CPPFLAGS="$qjson_CFLAGS $CPPFLAGS"
|
|
|
|
LIBS="$qjson_LIBS $LIBS"])
|
|
|
|
QBT_ADD_CONFIG="$QBT_ADD_CONFIG usesystemqjson"],
|
|
|
|
[AC_MSG_RESULT([$with_qjson])
|
|
|
|
AC_MSG_ERROR([Unknown option "$with_qjson". Use either "system" or "shipped".])])
|
|
|
|
])
|
|
|
|
|
2015-07-25 20:40:15 +08:00
|
|
|
PKG_CHECK_MODULES(libtorrent,
|
2015-08-01 04:26:51 +08:00
|
|
|
[libtorrent-rasterbar >= 1.0.6],
|
2015-07-25 20:40:15 +08:00
|
|
|
[CPPFLAGS="$libtorrent_CFLAGS $CPPFLAGS"
|
|
|
|
LIBS="$libtorrent_LIBS $LIBS"])
|
|
|
|
|
2014-04-20 03:47:08 +08:00
|
|
|
PKG_CHECK_MODULES(zlib,
|
|
|
|
[zlib],
|
|
|
|
[CPPFLAGS="$zlib_CFLAGS $CPPFLAGS"
|
|
|
|
LIBS="$zlib_LIBS $LIBS"])
|
|
|
|
|
|
|
|
# These are required because autoconf doesn't expand these **particular**
|
2014-11-12 19:06:05 +08:00
|
|
|
# vars automatically. And qmake cannot autoexpand them.
|
2014-04-20 03:47:08 +08:00
|
|
|
AX_DEFINE_DIR([EXPAND_PREFIX], [prefix])
|
|
|
|
AX_DEFINE_DIR([EXPAND_BINDIR], [bindir])
|
|
|
|
AX_DEFINE_DIR([EXPAND_DATADIR], [datadir])
|
|
|
|
AX_DEFINE_DIR([EXPAND_MANDIR], [mandir])
|
|
|
|
|
2014-11-20 23:47:31 +08:00
|
|
|
# Original extract() function contributed by pmzqla
|
|
|
|
# $*: Strings to parse
|
2015-05-11 19:48:13 +08:00
|
|
|
# Set $QBT_CONF_DEFINES, $QBT_CONF_INCLUDES, $QBT_CONF_EXTRA_CFLAGS
|
2014-11-20 23:47:31 +08:00
|
|
|
extract() {
|
|
|
|
if [[ -z "$*" ]]; then
|
|
|
|
echo "Input string required"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2015-08-07 04:08:11 +08:00
|
|
|
# BSD sed needs an actual newline character in the substitute command
|
|
|
|
new_line='
|
|
|
|
'
|
2015-05-11 19:48:13 +08:00
|
|
|
# Convert " -" to "\n" if not between quotes and remove possible leading white spaces
|
2015-08-07 04:08:11 +08:00
|
|
|
string=$(echo " $*" | $SED -e "s: -:\\${new_line}:g" -e 's:"\(.*\)\n\(.*\)":\"\1 -\2":g' -e "s:'\(.*\)\n\(.*\)':\'\1 -\2':g" -e 's/^[[:space:]]*//')
|
2014-11-20 23:47:31 +08:00
|
|
|
SAVEIFS=$IFS
|
|
|
|
IFS=$(printf "\n\b")
|
|
|
|
for i in $string; do
|
|
|
|
case "$(echo "$i" | cut -c1)" in
|
|
|
|
'') ;;
|
|
|
|
D) QBT_CONF_DEFINES="$(echo $i | cut -c2-) $QBT_CONF_DEFINES";;
|
|
|
|
I) QBT_CONF_INCLUDES="$(echo $i | cut -c2-) $QBT_CONF_INCLUDES";;
|
|
|
|
*) QBT_CONF_EXTRA_CFLAGS="-$i $QBT_CONF_EXTRA_CFLAGS";;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
IFS=$SAVEIFS
|
|
|
|
}
|
|
|
|
|
|
|
|
extract $CPPFLAGS
|
|
|
|
QBT_ADD_DEFINES="$QBT_ADD_DEFINES $QBT_CONF_DEFINES"
|
|
|
|
QBT_CONF_EXTRA_CFLAGS="$QBT_CONF_EXTRA_CFLAGS $CXXFLAGS"
|
|
|
|
|
2014-04-20 03:47:08 +08:00
|
|
|
# Substitute the values of these vars in conf.pri.in
|
2014-11-20 23:47:31 +08:00
|
|
|
AC_SUBST(QBT_CONF_INCLUDES)
|
|
|
|
AC_SUBST(QBT_CONF_EXTRA_CFLAGS)
|
2014-04-20 03:47:08 +08:00
|
|
|
AC_SUBST(QBT_ADD_CONFIG)
|
|
|
|
AC_SUBST(QBT_REMOVE_CONFIG)
|
|
|
|
AC_SUBST(QBT_ADD_DEFINES)
|
|
|
|
AC_SUBST(QBT_REMOVE_DEFINES)
|
|
|
|
|
|
|
|
AC_OUTPUT(conf.pri)
|
2015-05-03 04:38:40 +08:00
|
|
|
AS_IF([test "x$enable_systemd" = "xyes"],
|
|
|
|
[AC_OUTPUT(dist/unix/systemd/qbittorrent-nox.service)])
|
2014-04-20 03:47:08 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AC_MSG_NOTICE([Running qmake to generate the makefile...])
|
2014-05-08 05:51:23 +08:00
|
|
|
CONFDIR="$( cd "$( dirname "$0" )" && pwd )"
|
2014-04-20 03:47:08 +08:00
|
|
|
|
2015-04-06 01:21:06 +08:00
|
|
|
$QT_QMAKE -r [$CONFDIR]/qbittorrent.pro
|
2014-04-20 03:47:08 +08:00
|
|
|
|
|
|
|
ret="$?"
|
|
|
|
|
|
|
|
AS_ECHO()
|
2014-11-12 19:06:05 +08:00
|
|
|
AS_IF([test "x$ret" = "x0"],
|
2014-04-20 03:47:08 +08:00
|
|
|
[AC_MSG_NOTICE([Good, your configure finished.])],
|
|
|
|
[AC_MSG_ERROR([Failed running $QT_QMAKE to generate the makefile])])
|
|
|
|
AS_ECHO()
|
|
|
|
|