Description: Make configure.ac cross compile safe. Author: Mike Gabriel --- a/configure.ac +++ b/configure.ac @@ -23,14 +23,11 @@ GTK_DOC_CHECK(1.9) MATE_COMMON_INIT MATE_COMPILE_WARNINGS -# Check for pkgconfig first -AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no) -AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - +PKG_PROG_PKG_CONFIG # Give error and exit if we dont have pkgconfig -if test "x$HAVE_PKGCONFIG" = "xno"; then +AS_IF([test "x$PKG_CONFIG" = "x"],[ AC_MSG_ERROR([you need to have pkgconfig installed !]) -fi +]) GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0` AC_SUBST(GLIB_GENMARSHAL) @@ -63,14 +60,14 @@ AC_ARG_ENABLE([image-converter], [enable_image_converter=$enableval], [enable_image_converter=yes]) -if test "x$enable_image-converter" = "xyes"; then +AS_IF([test "x$enable_image-converter" = "xyes"],[ PKG_CHECK_MODULES(IMAGE_CONVERTER, gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED gio-2.0 >= $GLIB_REQUIRED) AC_SUBST(IMAGE_CONVERTER_CFLAGS) AC_SUBST(IMAGE_CONVERTER_LIBS) -fi +]) AM_CONDITIONAL(ENABLE_IMAGE_CONVERTER, test x"$enable_image_converter" = "xyes") @@ -80,13 +77,13 @@ AC_ARG_ENABLE([open-terminal], [enable_open_terminal=$enableval], [enable_open_terminal=yes]) -if test "x$enable_open_terminal" = "xyes"; then +AS_IF([test "x$enable_open_terminal" = "xyes"],[ PKG_CHECK_MODULES(OPENTERMINAL, glib-2.0 >= $GLIB_REQUIRED mate-desktop-2.0 >= $LIBMATE_DESKTOP_REQUIRED) AC_SUBST(OPENTERMINAL_CFLAGS) AC_SUBST(OPENTERMINAL_LIBS) -fi +]) AM_CONDITIONAL(ENABLE_OPEN_TERMINAL, test x"$enable_open_terminal" = "xyes") @@ -96,7 +93,7 @@ AC_ARG_ENABLE([sendto], [enable_sendto=$enableval], [enable_sendto=yes]) -if test "x$enable_sendto" = "xyes"; then +AS_IF([test "x$enable_sendto" = "xyes"],[ GTHREAD_REQUIRED=2.6.0 DBUS_REQUIRED=1.0 DBUS_GLIB_REQUIRED=0.60 @@ -115,11 +112,11 @@ if test "x$enable_sendto" = "xyes"; then sendto_plugin_error_or_ignore() { - if test "${error_on_bad_sendto_plugin}" = "1" ; then + AS_IF([test "${error_on_bad_sendto_plugin}" = "1"],[ AC_MSG_ERROR([$1]) - else + ],[ AC_MSG_WARN([$1 (disabling sendto plugin)]) - fi + ]) } AC_ARG_WITH([sendto-plugins], @@ -129,15 +126,15 @@ if test "x$enable_sendto" = "xyes"; then used_sendto_plugins="" used_sendto_plugins2="" - if test "x${with_sendto_plugins}" = "xautodetect" ; then + AS_IF([test "x${with_sendto_plugins}" = "xautodetect"],[ # Default to all plugins and just ignore them if they won't compile with_sendto_plugins="all" error_on_bad_sendto_plugin="0" - else + ],[ # Clean up the plugin list and error if a plugin won't compile with_sendto_plugins=`echo ,"${with_sendto_plugins}", | sed -e 's/[[ ,]][[ ,]]*/ /g' -e 's/,$//'` error_on_bad_sendto_plugin="1" - fi + ]) # Iterate through the wanted plugins and weed out bad ones (or error) for wanted_sendto_plugin in ${with_sendto_plugins}; do @@ -235,9 +232,9 @@ if test "x$enable_sendto" = "xyes"; then SENDTO_PLUGINS=$used_sendto_plugins2 dnl Error out if no plugins will be built - if test -z "${SENDTO_PLUGINS}" ; then + AS_IF([test -z "${SENDTO_PLUGINS}"],[ AC_MSG_ERROR([No sendto plugins will be built, and caja-sendto requires at least one]) - fi + ]) AC_MSG_CHECKING([which sendto plugins to compile]) AC_MSG_RESULT([$SENDTO_PLUGINS]) @@ -250,12 +247,12 @@ if test "x$enable_sendto" = "xyes"; then dnl For the GIO based plugins enable_nst_common=no - if test "x$enable_burn" = "xyes" -o "x$enable_removable" = "xyes"; then + AS_IF([test "x$enable_burn" = "xyes" -o "x$enable_removable" = "xyes"],[ enable_nst_common=yes - fi + ]) AM_CONDITIONAL(HAVE_GIO, test "x$enable_nst_common" = "xyes") - if test "x${SENDTO_PLUGINS}" != "x" ; then + AS_IF([test "x${SENDTO_PLUGINS}" != "x"],[ for allowed_sendto_plugin in ${ALL_SENDTO_PLUGINS}; do for sendto_plugin in ${SENDTO_PLUGINS}; do case ${allowed_sendto_plugin} in @@ -268,10 +265,10 @@ if test "x$enable_sendto" = "xyes"; then done AC_MSG_NOTICE([ ${allowed_sendto_plugin} sendto plugin disabled]) done - else + ],[ AC_MSG_NOTICE([ No caja-sendto plugins enabled]) - fi -fi + ]) +]) AM_CONDITIONAL(ENABLE_SENDTO, test x"$enable_sendto" = "xyes") # share extension @@ -280,12 +277,12 @@ AC_ARG_ENABLE([share], [enable_share=$enableval], [enable_share=yes]) -if test "x$enable_share" = "xyes"; then +AS_IF([test "x$enable_share" = "xyes"],[ PKG_CHECK_MODULES(SHARE, glib-2.0 >= $GLIB_REQUIRED) AC_SUBST(SHARE_CFLAGS) AC_SUBST(SHARE_LIBS) -fi +]) AM_CONDITIONAL(ENABLE_SHARE, test x"$enable_share" = "xyes") @@ -318,9 +315,9 @@ AC_ARG_WITH(cajadir, AS_HELP_STRING([--with-cajadir=DIR],[Installation path for Caja extension @<:@auto@:>@]), [ac_with_cajadir=$withval], [ac_with_cajadir=""]) -if test "${ac_with_cajadir}" = ""; then +AS_IF([test "${ac_with_cajadir}" = ""],[ ac_with_cajadir=`$PKG_CONFIG --variable=extensiondir libcaja-extension` -fi +]) AC_MSG_NOTICE([Installing caja plugins in ${ac_with_cajadir}]) AC_SUBST([CAJA_EXTENSION_DIR],[${ac_with_cajadir}])