1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Use AS_IF macro in configure.ac

This commit is contained in:
James Booth 2016-09-13 00:26:32 +01:00
parent 8e1481660e
commit dae8a89849

View File

@ -29,19 +29,14 @@ AS_CASE([$host_os],
PACKAGE_STATUS="development" PACKAGE_STATUS="development"
### Get git branch and revision if in development ### Get git branch and revision if in development
if test "x$PACKAGE_STATUS" = xdevelopment; then AS_IF([test "x$PACKAGE_STATUS" = xdevelopment],
AM_CONDITIONAL([INCLUDE_GIT_VERSION], [true]) [AM_CONDITIONAL([INCLUDE_GIT_VERSION], [true]) AC_DEFINE([HAVE_GIT_VERSION], [1], [Include git info])],
AC_DEFINE([HAVE_GIT_VERSION], [1], [Include git info]) [AM_CONDITIONAL([INCLUDE_GIT_VERSION], [false])])
else
AM_CONDITIONAL([INCLUDE_GIT_VERSION], [false])
fi
AC_DEFINE_UNQUOTED([PACKAGE_STATUS], ["$PACKAGE_STATUS"], [Status of this build]) AC_DEFINE_UNQUOTED([PACKAGE_STATUS], ["$PACKAGE_STATUS"], [Status of this build])
AS_IF([test "x$PLATFORM" = xcygwin], AS_IF([test "x$PLATFORM" = xcygwin], [AC_DEFINE([PLATFORM_CYGWIN], [1], [Cygwin])])
[AC_DEFINE([PLATFORM_CYGWIN], [1], [Cygwin])]) AS_IF([test "x$PLATFORM" = xosx], [AC_DEFINE([PLATFORM_OSX], [1], [OSx])])
AS_IF([test "x$PLATFORM" = xosx],
[AC_DEFINE([PLATFORM_OSX], [1], [OSx])])
### Environment variables ### Environment variables
AC_ARG_VAR([PYTHON_FRAMEWORK], [Set base directory for Python Framework]) AC_ARG_VAR([PYTHON_FRAMEWORK], [Set base directory for Python Framework])
@ -69,51 +64,48 @@ AC_ARG_ENABLE([icons],
### plugins ### plugins
# python # python
if test "x$enable_plugins" = xno; then AS_IF(
AM_CONDITIONAL([BUILD_PYTHON_API], [false]) [test "x$enable_plugins" = xno],
elif test "x$enable_python_plugins" != xno; then [AM_CONDITIONAL([BUILD_PYTHON_API], [false])],
AS_IF([test "x$PLATFORM" = xosx], [ [test "x$enable_python_plugins" != xno],
AS_IF([test "x$PYTHON_FRAMEWORK" = x], [ PYTHON_FRAMEWORK="/Library/Frameworks/Python.framework" ]) [AS_IF(
[test "x$PLATFORM" = xosx],
[AS_IF([test "x$PYTHON_FRAMEWORK" = x], [ PYTHON_FRAMEWORK="/Library/Frameworks/Python.framework" ])
AC_MSG_NOTICE([Symlinking Python.framework to $PYTHON_FRAMEWORK]) AC_MSG_NOTICE([Symlinking Python.framework to $PYTHON_FRAMEWORK])
rm -f Python.framework rm -f Python.framework
ln -s $PYTHON_FRAMEWORK Python.framework ]) ln -s $PYTHON_FRAMEWORK Python.framework ])
AC_CHECK_PROG(PYTHON_CONFIG_EXISTS, python-config, yes, no) AC_CHECK_PROG(PYTHON_CONFIG_EXISTS, python-config, yes, no)
if test "$PYTHON_CONFIG_EXISTS" == "yes"; then AS_IF(
AX_PYTHON_DEVEL [test "$PYTHON_CONFIG_EXISTS" == "yes"],
AM_CONDITIONAL([BUILD_PYTHON_API], [true]) [AX_PYTHON_DEVEL
AC_DEFINE([HAVE_PYTHON], [1], [Python support]) AM_CONDITIONAL([BUILD_PYTHON_API], [true])
else AC_DEFINE([HAVE_PYTHON], [1], [Python support])],
if test "x$enable_python_plugins" = xyes; then [AS_IF(
AC_MSG_ERROR([Python not found, cannot enable Python plugins.]) [test "x$enable_python_plugins" = xyes],
else [AC_MSG_ERROR([Python not found, cannot enable Python plugins.])],
AM_CONDITIONAL([BUILD_PYTHON_API], [false]) [AM_CONDITIONAL([BUILD_PYTHON_API], [false])
AC_MSG_NOTICE([Python development package not found, Python plugin support disabled.]) AC_MSG_NOTICE([Python development package not found, Python plugin support disabled.])]
fi )])
fi AS_IF([test "x$PLATFORM" = xosx], [rm -f Python.framework])],
AS_IF([test "x$PLATFORM" = xosx], [rm -f Python.framework]) [AM_CONDITIONAL([BUILD_PYTHON_API], [false])])
else
AM_CONDITIONAL([BUILD_PYTHON_API], [false])
fi
# c # c
if test "x$PLATFORM" = xcygwin; then AS_IF(
AM_CONDITIONAL([BUILD_C_API], [false]) [test "x$PLATFORM" = xcygwin],
else [AM_CONDITIONAL([BUILD_C_API], [false])],
LT_INIT [LT_INIT
if test "x$enable_plugins" = xno; then AS_IF(
AM_CONDITIONAL([BUILD_C_API], [false]) [test "x$enable_plugins" = xno],
elif test "x$enable_c_plugins" != xno; then [AM_CONDITIONAL([BUILD_C_API], [false])],
AC_CHECK_LIB([dl], [main], [test "x$enable_c_plugins" != xno],
[AM_CONDITIONAL([BUILD_C_API], [true]) LIBS="$LIBS -ldl" AC_DEFINE([HAVE_C], [1], [C support])], [AC_CHECK_LIB([dl], [main],
[AS_IF( [AM_CONDITIONAL([BUILD_C_API], [true]) LIBS="$LIBS -ldl" AC_DEFINE([HAVE_C], [1], [C support])],
[test "x$enable_c_plugins" = xyes], [AS_IF(
[AC_MSG_ERROR([dl library needed to run C plugins])], [test "x$enable_c_plugins" = xyes],
[AM_CONDITIONAL([BUILD_C_API], [false])]) [AC_MSG_ERROR([dl library needed to run C plugins])],
]) [AM_CONDITIONAL([BUILD_C_API], [false])])
else ])],
AM_CONDITIONAL([BUILD_C_API], [false]) [AM_CONDITIONAL([BUILD_C_API], [false])])])
fi
fi
# threading # threading
ACX_PTHREAD([], [AC_MSG_ERROR([pthread is required])]) ACX_PTHREAD([], [AC_MSG_ERROR([pthread is required])])
@ -204,22 +196,22 @@ AS_IF([test "x$PLATFORM" = xosx],
[AC_MSG_ERROR([libnotify is required but does not exist])], [AC_MSG_ERROR([libnotify is required but does not exist])],
[AC_MSG_NOTICE([libnotify support will be disabled])])])])]) [AC_MSG_NOTICE([libnotify support will be disabled])])])])])
# TODO: rewrite this AS_IF(
if test "x$with_xscreensaver" = xyes; then [test "x$with_xscreensaver" = xyes],
AC_CHECK_LIB([Xss], [main], [], [AC_CHECK_LIB([Xss], [main], [],
[AC_MSG_ERROR([libXss is required for x autoaway support])]) [AC_MSG_ERROR([libXss is required for x autoaway support])])
AC_CHECK_LIB([X11], [main], [], AC_CHECK_LIB([X11], [main], [],
[AC_MSG_ERROR([libX11 is required for x autoaway support])]) [AC_MSG_ERROR([libX11 is required for x autoaway support])])],
elif test "x$with_xscreensaver" = x; then [test "x$with_xscreensaver" = x],
AC_CHECK_LIB([Xss], [main], [], [AC_CHECK_LIB([Xss], [main], [],
[AC_MSG_NOTICE([libXss not found, falling back to profanity auto-away])]) [AC_MSG_NOTICE([libXss not found, falling back to profanity auto-away])])
AC_CHECK_LIB([X11], [main], [], AC_CHECK_LIB([X11], [main], [],
[AC_MSG_NOTICE([libX11 not found, falling back to profanity auto-away])]) [AC_MSG_NOTICE([libX11 not found, falling back to profanity auto-away])])])
fi
AM_CONDITIONAL([BUILD_PGP], [false]) AM_CONDITIONAL([BUILD_PGP], [false])
if test "x$enable_pgp" != xno; then AS_IF(
AC_CHECK_LIB([gpgme], [main], [test "x$enable_pgp" != xno],
[AC_CHECK_LIB([gpgme], [main],
[AM_CONDITIONAL([BUILD_PGP], [true]) [AM_CONDITIONAL([BUILD_PGP], [true])
AC_DEFINE([HAVE_LIBGPGME], [1], [Have libgpgme]) AC_DEFINE([HAVE_LIBGPGME], [1], [Have libgpgme])
AC_PATH_PROG([GPGME_CONFIG], [gpgme-config], ["failed"]) AC_PATH_PROG([GPGME_CONFIG], [gpgme-config], ["failed"])
@ -228,14 +220,14 @@ if test "x$enable_pgp" != xno; then
[LIBS="`$GPGME_CONFIG --libs` $LIBS" AM_CPPFLAGS="`$GPGME_CONFIG --cflags` $AM_CPPFLAGS"])], [LIBS="`$GPGME_CONFIG --libs` $LIBS" AM_CPPFLAGS="`$GPGME_CONFIG --cflags` $AM_CPPFLAGS"])],
[AS_IF([test "x$enable_pgp" = xyes], [AS_IF([test "x$enable_pgp" = xyes],
[AC_MSG_ERROR([libgpgme is required for pgp support])], [AC_MSG_ERROR([libgpgme is required for pgp support])],
[AC_MSG_NOTICE([libgpgme not found, pgp support not enabled])])]) [AC_MSG_NOTICE([libgpgme not found, pgp support not enabled])])])])
fi
AM_CONDITIONAL([BUILD_OTR], [false]) AM_CONDITIONAL([BUILD_OTR], [false])
AM_CONDITIONAL([BUILD_OTR3], [false]) AM_CONDITIONAL([BUILD_OTR3], [false])
AM_CONDITIONAL([BUILD_OTR4], [false]) AM_CONDITIONAL([BUILD_OTR4], [false])
if test "x$enable_otr" != xno; then AS_IF(
AC_SEARCH_LIBS([otrl_init], [otr], [test "x$enable_otr" != xno],
[AC_SEARCH_LIBS([otrl_init], [otr],
[AC_COMPILE_IFELSE( [AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[ [AC_LANG_PROGRAM([[
#include <libotr/version.h> #include <libotr/version.h>
@ -250,8 +242,7 @@ if test "x$enable_otr" != xno; then
[AM_CONDITIONAL([BUILD_OTR], [true]) AM_CONDITIONAL([BUILD_OTR3], [true]) AC_DEFINE([HAVE_LIBOTR], [1], [Have libotr])])], [AM_CONDITIONAL([BUILD_OTR], [true]) AM_CONDITIONAL([BUILD_OTR3], [true]) AC_DEFINE([HAVE_LIBOTR], [1], [Have libotr])])],
[AS_IF([test "x$enable_otr" = xyes], [AS_IF([test "x$enable_otr" = xyes],
[AC_MSG_ERROR([libotr is required for otr encryption support])], [AC_MSG_ERROR([libotr is required for otr encryption support])],
[AC_MSG_NOTICE([libotr not found, otr encryption support not enabled])])]) [AC_MSG_NOTICE([libotr not found, otr encryption support not enabled])])])])
fi
AS_IF([test "x$with_themes" = xno], AS_IF([test "x$with_themes" = xno],
[THEMES_INSTALL="false"], [THEMES_INSTALL="false"],