configure: Consistently use autoconf macros for conditionals

This commit is contained in:
TingPing 2015-04-22 22:10:52 -04:00
parent 6ad9419693
commit a3c257bdb4
1 changed files with 146 additions and 146 deletions

View File

@ -57,34 +57,34 @@ AH_VERBATIM([socklen_t],[#undef socklen_t])
AH_VERBATIM([USE_DBUS],[#undef USE_DBUS])
AC_PATH_PROG(sedpath, sed)
if test "_$sedpath" = _; then
AS_IF([test "_$sedpath" = _], [
AC_MSG_ERROR(Cannot find sed: I need it!)
fi
])
AC_PATH_PROG(unamepath, uname)
if test "_$unamepath" = _; then
AS_IF([test "_$unamepath" = _], [
system="unknown"
else
], [
AC_MSG_CHECKING(system type)
system=`$unamepath -s`
AC_MSG_RESULT($system)
if test "$system" = "Linux"; then
AS_IF([test "$system" = "Linux"], [
AC_DEFINE(USING_LINUX)
fi
if test "$system" = "FreeBSD"; then
], [test "$system" = "FreeBSD"], [
AC_DEFINE(USING_FREEBSD)
fi
fi
])
])
platform_win32=no
platform_osx=no
case $host_os in
*mingw*|*cygwin*|*msys*)
platform_win32=yes;;
darwin*)
platform_osx=yes;;
*);;
esac
AS_CASE([$host_os],
[*mingw*|*cygwin*|*msys*], [
platform_win32=yes
],
[darwin*], [
platform_osx=yes
]
)
dnl *********************************************************************
dnl ** configure switches ***********************************************
@ -168,11 +168,11 @@ AC_ARG_WITH(theme-manager,
dnl *********************************************************************
dnl ** THEME-MANAGER ****************************************************
dnl *********************************************************************
if test "x$theme_manager" != "xno" ; then
if test "x$MDTOOL" = "xno"; then
AS_IF([test "x$theme_manager" != "xno"], [
AS_IF([test "x$MDTOOL" = "xno"], [
AC_MSG_ERROR([No "mdtool" found, you need to install monodevelop!])
fi
fi
])
])
dnl *********************************************************************
@ -189,27 +189,27 @@ dnl *********************************************************************
dnl ** GTK **************************************************************
dnl *********************************************************************
if test "$gtkfe" = yes ; then
AS_IF([test "$gtkfe" = yes], [
PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.24.0], [
GUI_LIBS="$GUI_LIBS $GTK_LIBS"
GUI_CFLAGS="$GUI_CFLAGS $GTK_CFLAGS -DGDK_PIXBUF_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_SINGLE_INCLUDES -DGTK_DISABLE_DEPRECATED"
], [
gtkfe=no
])
fi
])
dnl *********************************************************************
dnl ** MAC_INTEGRATION **************************************************
dnl *********************************************************************
_gdk_tgt=`$PKG_CONFIG --variable=target gdk-2.0`
if test "x$_gdk_tgt" = xquartz; then
AS_IF([test "x$_gdk_tgt" = xquartz], [
PKG_CHECK_MODULES(GTK_MAC, gtk-mac-integration-gtk2, [
GUI_LIBS="$GUI_LIBS $GTK_MAC_LIBS"
GUI_CFLAGS="$GUI_CFLAGS $GTK_MAC_CFLAGS"
AC_DEFINE(HAVE_GTK_MAC)
])
fi
])
dnl *********************************************************************
dnl ** PERL *************************************************************
@ -274,59 +274,59 @@ if test "$perl" = yes; then
perl=no
fi
fi
dnl *********************************************************************
dnl ** PYTHON ***********************************************************
dnl *********************************************************************
if test "x$python" != xno ; then
AS_IF([test "x$python" != xno], [
AC_MSG_CHECKING(for plugin interface used by Python)
if test "$plugin" = yes; then
AS_IF([test "$plugin" = yes], [
AC_MSG_RESULT([yes])
case $python in
AS_CASE([$python],
dnl set python2 default here
python2)
[python2], [
PKG_CHECK_MODULES([PY], [python-2.7],
[PY_VER="`$PKG_CONFIG --modversion python-2.7`"],
[true])
;;
],
dnl set python3 default here
python3)
[python3], [
PKG_CHECK_MODULES([PY], [python-3.4],
[PY_VER="`$PKG_CONFIG --modversion python-3.4`"],
[true])
if test "$PY_VER" = "" ; then
AS_IF([test "$PY_VER" = ""], [
PKG_CHECK_MODULES([PY], [python-3.3],
[PY_VER="`$PKG_CONFIG --modversion python-3.3`"],
[true])
fi
;;
])
],
dnl add broken versions here
python2.5|python2.6|python3.1|python3.2)
AC_MSG_WARN(Unsupported Python version ${python}!);;
python*)
[python2.5|python2.6|python3.1|python3.2], [
AC_MSG_WARN(Unsupported Python version ${python}!)
],
[python*], [
python="python-${python#python}" # stay posix compliant
PKG_CHECK_MODULES([PY], [${python}],
[PY_VER="`$PKG_CONFIG --modversion ${python}`"],
[AC_MSG_WARN(Cannot find "${python}.pc"!)])
;;
*)
],[
AC_MSG_WARN(Unsupported Python ${python}!)
esac
]
)
AC_MSG_CHECKING(Python version)
if test "$PY_VER"; then
AS_IF([test "$PY_VER"], [
AC_MSG_RESULT($PY_VER)
python="python-${PY_VER}"
else
], [
AC_MSG_RESULT(Not found)
python=no
fi
else
])
], [
AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option for Python])
python=no
fi
fi
])
])
dnl *********************************************************************
dnl ** IPv6 *************************************************************
@ -344,45 +344,40 @@ AC_CHECK_LIB(socket, select)
AC_CHECK_FUNCS(getaddrinfo, have_getaddrinfo=yes)
AC_MSG_CHECKING(whether IPv6 is supported)
if test "$have_getaddrinfo" = yes; then
AS_IF([test "$have_getaddrinfo" = yes], [
AC_MSG_RESULT(yes)
else
], [
AC_MSG_RESULT(no)
AC_MSG_ERROR(ipv6 support not found!)
fi
])
dnl *********************************************************************
dnl ** OPENSSL **********************************************************
dnl *********************************************************************
retry=no
if test "$openssl" != no; then
AS_IF([test "$openssl" != no], [
PKG_CHECK_MODULES(OPENSSL, [openssl], [
AC_DEFINE(USE_OPENSSL)
openssl=yes
COMMON_LIBS="$COMMON_LIBS $OPENSSL_LIBS"
COMMON_CFLAGS="$COMMON_CFLAGS $OPENSSL_CFLAGS"
], [
retry=yes
])
fi
if test "$retry" = "yes"; then
unset openssl_path ac_cv_lib_ssl_SSL_new ac_cv_header_openssl_ssl_h
if test "$openssl" != yes; then
AS_IF([test "$openssl" != yes], [
openssl_path=$openssl
fi
])
openssl=no
OPENSSL_LIBS="-lcrypto"
if test -n "$openssl_path"; then
AS_IF([test -n "$openssl_path"], [
OPENSSL_LIBS="-L$openssl_path/lib $OPENSSL_LIBS"
fi
])
SAVED_LIBS=$LIBS
LIBS="$LIBS $OPENSSL_LIBS"
AC_CHECK_LIB(ssl, SSL_new, [
if test -n "$openssl_path"; then
AS_IF([test -n "$openssl_path"], [
OPENSSL_CFLAGS="-I$openssl_path/include"
fi
])
SAVED_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
AC_CHECK_HEADERS(openssl/ssl.h, [
@ -396,125 +391,126 @@ if test "$retry" = "yes"; then
CFLAGS=$SAVED_CFLAGS
])
LIBS=$SAVED_LIBS
fi
])
])
dnl *********************************************************************
dnl ** LIBPROXY *********************************************************
dnl *********************************************************************
if test "x$libproxy" = "xyes" -o "x$libproxy" = "xauto" ; then
AS_IF([test "x$libproxy" = "xyes" -o "x$libproxy" = "xauto"], [
PKG_CHECK_MODULES([LIBPROXY], [libproxy-1.0], [
COMMON_LIBS="$COMMON_LIBS $LIBPROXY_LIBS"
COMMON_CFLAGS="$COMMON_CFLAGS $LIBPROXY_CFLAGS"
AC_DEFINE(USE_LIBPROXY)
libproxy=yes
], [
if test "x$libproxy" = "xyes" ; then
AS_IF([test "x$libproxy" = "xyes"], [
AC_MSG_ERROR(Cannot find libproxy!)
fi
])
libproxy=no
])
else
], [
libproxy=no
fi
])
dnl *********************************************************************
dnl ** PLUGIN ***********************************************************
dnl *********************************************************************
if test "$plugin" = yes; then
AS_IF([test "$plugin" = yes], [
AC_DEFINE(USE_PLUGIN)
PLUGIN_LDFLAGS="-avoid-version"
if test "$platform_win32" = yes; then
AS_IF([test "$platform_win32" = yes], [
PLUGIN_LDFLAGS="$PLUGIN_LDFLAGS -no-undefined"
fi
fi
])
])
dnl *********************************************************************
dnl ** Checksum *********************************************************
dnl *********************************************************************
if test "$checksum" != "no"; then
AS_IF([test "$checksum" != "no"], [
checksum=no
AC_MSG_CHECKING(for plugin interface used by Checksum)
if test "$plugin" = yes; then
AS_IF([test "$plugin" = yes], [
checksum=yes
AC_MSG_RESULT([yes])
else
], [
AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option])
fi
fi
])
])
dnl *********************************************************************
dnl ** DO AT ************************************************************
dnl *********************************************************************
if test "$doat" != "no"; then
AS_IF([test "$doat" != "no"], [
AC_MSG_CHECKING(for plugin interface used by Do At)
doat=no
if test "$plugin" = yes; then
AS_IF([test "$plugin" = yes], [
doat=yes
AC_MSG_RESULT([yes])
else
], [
AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option for Do At])
fi
fi
])
])
dnl *********************************************************************
dnl ** FiSHLiM **********************************************************
dnl *********************************************************************
if test "$fishlim" != "no"; then
AS_IF([test "$fishlim" != "no"], [
fishlim=no
AC_MSG_CHECKING(for plugin interface used by FiSHLiM)
if test "$plugin" = yes; then
AS_IF([test "$plugin" = yes], [
AC_MSG_RESULT([yes])
AC_MSG_CHECKING(for OpenSSL used by FiSHLiM)
if test "$openssl" = yes; then
AS_IF([test "$openssl" = yes], [
fishlim=yes
AC_MSG_RESULT([yes])
else
], [
AC_MSG_RESULT([OpenSSL cannot be found, use the --enable-openssl option])
fi
else
])
], [
AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option])
fi
fi
])
])
dnl *********************************************************************
dnl ** SYSINFO **********************************************************
dnl *********************************************************************
if test "$sysinfo" != "no"; then
AS_IF([test "$sysinfo" != "no"], [
AC_MSG_CHECKING(for plugin interface used by SysInfo)
if test "$plugin" = yes; then
AS_IF([test "$plugin" = yes], [
AC_MSG_RESULT([yes])
if test "$platform_osx" = yes; then
AS_IF([test "$platform_osx" = yes], [
sysinfo=yes
else
], [
PKG_CHECK_MODULES(LIBPCI, libpci >= 3.0.0, [
sysinfo=yes
AC_DEFINE(HAVE_LIBPCI)
], [sysinfo=no])
fi
else
])
], [
AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option for SysInfo])
sysinfo=no
fi
fi
])
])
dnl #######################################################################
dnl # Check for DBUS libraries
dnl #######################################################################
if test "x$dbus" = "xyes" ; then
AS_IF([test "x$dbus" = "xyes"], [
PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.60 dbus-glib-1 >= 0.60 gthread-2.0], dbus=yes, [
dbus=no
])
AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
if test "x$DBUS_BINDING_TOOL" = "xno" || test "x$dbus" = "xno" ; then
AS_IF([test "x$DBUS_BINDING_TOOL" = "xno" || test "x$dbus" = "xno"], [
dbus="no"
else
], [
COMMON_LIBS="$COMMON_LIBS $DBUS_LIBS"
COMMON_CFLAGS="$COMMON_CFLAGS $DBUS_CFLAGS"
AC_DEFINE(USE_DBUS)
@ -522,44 +518,44 @@ if test "x$dbus" = "xyes" ; then
AS_AC_EXPAND(DBUS_SERVICES_DIR, "$datadir/dbus-1/services")
AC_SUBST(DBUS_SERVICES_DIR)
AC_DEFINE_UNQUOTED(DBUS_SERVICES_DIR, "$DBUS_SERVICES_DIR", [Where services dir for DBUS is])
fi
fi
])
])
dnl *********************************************************************
dnl ** LIBNOTIFY ********************************************************
dnl *********************************************************************
if test "x$libnotify" = "xyes" ; then
AS_IF([test "x$libnotify" = "xyes"], [
PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= 0.4, [], [
libnotify=no
])
if test "$libnotify" != "no" ; then
AS_IF([test "$libnotify" != "no"], [
GUI_LIBS="$GUI_LIBS $LIBNOTIFY_LIBS"
GUI_CFLAGS="$GUI_CFLAGS $LIBNOTIFY_CFLAGS"
AC_DEFINE(USE_LIBNOTIFY)
fi
fi
])
])
dnl *********************************************************************
dnl ** LIBCANBERRA ******************************************************
dnl *********************************************************************
if test "x$libcanberra" = "xyes" ; then
AS_IF([test "x$libcanberra" = "xyes"], [
PKG_CHECK_MODULES(LIBCANBERRA, libcanberra >= 0.22, [], [
libcanberra=no
])
if test "$libcanberra" != "no" ; then
AS_IF([test "$libcanberra" != "no"], [
COMMON_LIBS="$COMMON_LIBS $LIBCANBERRA_LIBS"
COMMON_CFLAGS="$COMMON_CFLAGS $LIBCANBERRA_CFLAGS"
AC_DEFINE(USE_LIBCANBERRA)
fi
fi
])
])
dnl *********************************************************************
dnl ** SPELL ************************************************************
dnl *********************************************************************
if test "x$isocodes" = "xyes" ; then
AS_IF([test "x$isocodes" = "xyes"], [
PKG_CHECK_MODULES(ISOCODES, "iso-codes", [
iso_codes_prefix=`$PKG_CONFIG --variable=prefix iso-codes 2>/dev/null || echo /usr`
AC_MSG_NOTICE([iso-codes prefix: $iso_codes_prefix])
@ -570,18 +566,18 @@ if test "x$isocodes" = "xyes" ; then
isocodes=no
AC_MSG_WARN(iso-codes not found!)
])
fi
])
dnl *********************************************************************
dnl ** Static Analysis **************************************************
dnl *********************************************************************
if test "x$analyze" = "xyes"; then
if test "$CC" != "clang"; then
AS_IF([test "x$analyze" = "xyes"], [
AS_IF([test "$CC" != "clang"], [
AC_MSG_WARN(CC is not clang for static analysis)
analyze=no
fi
fi
])
])
dnl *********************************************************************
dnl ** CONDITIONALS *****************************************************
@ -660,9 +656,9 @@ AC_EGREP_CPP([socklen_t[^a-zA-Z_0-9]], [#include <sys/types.h>
ac_cv_type_socklen_t=yes,
ac_cv_type_socklen_t=no)
])
if test $ac_cv_type_socklen_t = no; then
AS_IF([test $ac_cv_type_socklen_t = no], [
AC_DEFINE(socklen_t, int)
fi
])
dnl Mac OS X and Darwin use lookupd, which caches DNS queries by default
AC_EGREP_CPP(lookupd, dnl
@ -693,8 +689,12 @@ AC_SUBST(PLUGIN_LDFLAGS)
m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], AC_SUBST([pkgconfigdir], ${libdir}/pkgconfig))
dnl for plugin.c and pixmaps.c
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix="$prefix"
AS_IF([test "x$prefix" = xNONE], [
prefix="$ac_default_prefix"
])
AS_IF([test "x$exec_prefix" = xNONE], [
exec_prefix="$prefix"
])
AC_DEFINE_UNQUOTED(PREFIX, "${prefix}")