summaryrefslogtreecommitdiff
path: root/m4macros
diff options
context:
space:
mode:
authorBenedikt Meurer <benny@xfce.org>2005-01-26 21:34:18 +0000
committerBenedikt Meurer <benny@xfce.org>2005-01-26 21:34:18 +0000
commit9ed3a6cabc28be37c3d08bb263b363593129e5cb (patch)
tree3ae8eeeac68b8f0d5bd9e61b537b5b87b0bb0edc /m4macros
parent9cc8112bc0b41e8dad311a2c3345b187cec8c0ba (diff)
downloadxfce4-dev-tools-9ed3a6cabc28be37c3d08bb263b363593129e5cb.tar.gz
Initial revisionBMEURER_20050126
(Old svn revision: 2260)
Diffstat (limited to 'm4macros')
-rw-r--r--m4macros/Makefile.am19
-rw-r--r--m4macros/xdt-depends.m4413
-rw-r--r--m4macros/xdt-features.m4120
-rw-r--r--m4macros/xdt-i18n.m4407
-rw-r--r--m4macros/xdt-xfce.m4111
5 files changed, 1070 insertions, 0 deletions
diff --git a/m4macros/Makefile.am b/m4macros/Makefile.am
new file mode 100644
index 0000000..3a2df31
--- /dev/null
+++ b/m4macros/Makefile.am
@@ -0,0 +1,19 @@
+# $Id$
+#
+# Copyright (c) 2002-2005
+# The Xfce development team. All rights reserved.
+#
+# Written for Xfce by Benedikt Meurer <benny@xfce.org>.
+#
+
+macrodir = $(datadir)/xfce4/dev-tools/m4macros
+macro_DATA = \
+ xdt-depends.m4 \
+ xdt-features.m4 \
+ xdt-i18n.m4 \
+ xdt-xfce.m4
+
+EXTRA_DIST = \
+ $(macro_DATA)
+
+# vi:set ts=8 sw=8 noet ai:
diff --git a/m4macros/xdt-depends.m4 b/m4macros/xdt-depends.m4
new file mode 100644
index 0000000..b7152cd
--- /dev/null
+++ b/m4macros/xdt-depends.m4
@@ -0,0 +1,413 @@
+dnl $Id$
+dnl
+dnl Copyright (c) 2002-2005
+dnl The Xfce development team. All rights reserved.
+dnl
+dnl Written for Xfce by Benedikt Meurer <benny@xfce.org>.
+dnl
+dnl xdt-depends
+dnl -----------
+dnl Contains M4 macros to check for software dependencies.
+dnl Partly based on prior work of the XDG contributors.
+dnl
+
+
+
+dnl We need recent a autoconf version
+AC_PREREQ([2.53])
+
+
+
+dnl XDT_PROG_PKG_CONFIG()
+dnl
+dnl Checks for the freedesktop.org pkg-config
+dnl utility and sets the PKG_CONFIG environment
+dnl variable to the full path if found.
+dnl
+AC_DEFUN([XDT_PROG_PKG_CONFIG],
+[
+ # minimum supported version of pkg-config
+ xdt_cv_PKG_CONFIG_MIN_VERSION=0.9.0
+
+ # lookup pkg-config utility
+ if test x"$PKG_CONFIG" = x""; then
+ AC_PATH_PROG([PKG_CONFIG], [pkg-config], [no])
+
+ if test x"$PKG_CONFIG" = x"no"; then
+ echo "*** The pkg-config utility could not be found on your system."
+ echo "*** Make sure it is in your path, or set the PKG_CONFIG"
+ echo "*** environment variable to the full path to pkg-config."
+ echo "*** You can download pkg-config from the freedesktop.org"
+ echo "*** software repository at"
+ echo "***"
+ echo "*** http://www.freedesktop.org/software/pkgconfig"
+ echo "***"
+ exit 1
+ fi
+ fi
+
+ # check pkg-config version
+ AC_MSG_CHECKING([for pkg-config >= $xdt_cv_PKG_CONFIG_MIN_VERSION])
+ if $PKG_CONFIG --atleast-pkgconfig-version $xdt_cv_PKG_CONFIG_MIN_VERSION; then
+ xdt_cv_PKG_CONFIG_VERSION=`$PKG_CONFIG --version`
+ AC_MSG_RESULT([$xdt_cv_PKG_CONFIG_VERSION])
+ else
+ xdt_cv_PKG_CONFIG_VERSION=`$PKG_CONFIG --version`
+ AC_MSG_RESULT([$xdt_cv_PKG_CONFIG_VERSION])
+ echo "*** Your version of pkg-config is too old. You need atleast"
+ echo "*** pkg-config $xdt_cv_PKG_CONFIG_MIN_VERSION or newer. You can download pkg-config "
+ echo "*** from the freedesktop.org software repository at"
+ echo "***"
+ echo "*** http://www.freedesktop.org/software/pkgconfig"
+ echo "***"
+ exit 1
+ fi
+])
+
+
+
+dnl XDT_CHECK_PACKAGE(varname, package, version, [action-if], [action-if-not])
+dnl
+dnl Checks if "package" >= "version" is installed on the
+dnl target system, using the pkg-config utility. If the
+dnl dependency is met, "varname"_CFLAGS, "varname"_LIBS,
+dnl "varname"_VERSION and "varname"_REQUIRED_VERSION
+dnl will be set and marked for substition.
+dnl
+dnl "varname"_REQUIRED_VERSION will be set to the value of
+dnl "version". This is mostly useful to automatically
+dnl place the correct version information into the RPM
+dnl .spec file.
+dnl
+dnl In addition, if the dependency is met, "action-if" will
+dnl be executed if given.
+dnl
+dnl If the package check fails, "action-if-not" will be
+dnl executed. If this parameter isn't specified, a diagnostic
+dnl message will be printed and the configure script will
+dnl be terminated with exit code 1.
+dnl
+AC_DEFUN([XDT_CHECK_PACKAGE],
+[
+ AC_REQUIRE([XDT_PROG_PKG_CONFIG])
+
+ AC_MSG_CHECKING([for $2 >= $3])
+ if $PKG_CONFIG "--atleast-version=$3" "$2" >/dev/null 2>&1; then
+ $1_VERSION=`$PKG_CONFIG --modversion "$2"`
+ AC_MSG_RESULT([$$1_VERSION])
+
+ AC_MSG_CHECKING([$1_CFLAGS])
+ $1_CFLAGS=`$PKG_CONFIG --cflags "$2"`
+ AC_MSG_RESULT([$$1_CFLAGS])
+
+ AC_MSG_CHECKING([$1_LIBS])
+ $1_LIBS=`$PKG_CONFIG --libs "$2"`
+ AC_MSG_RESULT([$$1_LIBS])
+
+ $1_REQUIRED_VERSION=$3
+
+ AC_SUBST([$1_VERSION])
+ AC_SUBST([$1_CFLAGS])
+ AC_SUBST([$1_LIBS])
+ AC_SUBST([$1_REQUIRED_VERSION])
+
+ ifelse([$4], , , [$4])
+ elif $PKG_CONFIG --exists "$2" >/dev/null 2>&1; then
+ xdg_cv_version=`$PKG_CONFIG --modversion "$2"`
+ AC_MSG_RESULT([found, but $xdt_cv_version])
+
+ ifelse([$5], ,
+ [
+ echo "*** The required package $2 was found on your system,"
+ echo "*** but the installed version ($xdt_cv_version) is too old."
+ echo "*** Please upgrade $2 to atleast version $3, or adjust"
+ echo "*** the PKG_CONFIG_PATH environment variable if you installed"
+ echo "*** the new version of the package in a nonstandard prefix so"
+ echo "*** pkg-config is able to find it."
+ exit 1
+ ], [$5])
+ else
+ AC_MSG_RESULT([not found])
+
+ ifelse([$5], ,
+ [
+ echo "*** The required package $2 was not found on your system."
+ echo "*** Please install $2 (atleast version $3) or adjust"
+ echo "*** the PKG_CONFIG_PATH environment variable if you"
+ echo "*** installed the package in a nonstandard prefix so that"
+ echo "*** pkg-config is able to find it."
+ exit 1
+ ], [$5])
+ fi
+])
+
+
+
+dnl XDT_CHECK_OPTIONAL_PACKAGE(varname, package, version, optionname, helpstring, [default])
+dnl
+dnl Checks for an optional dependency on "package" >= "version". "default"
+dnl can be "yes" or "no" (defaults to "yes" if not specified) and controls
+dnl whether configure should check this dependency by default, or only if
+dnl the user explicitly enables it using a command line switch.
+dnl
+dnl This macro automatically adds a commandline switch based on the "optionname"
+dnl parameter (--enable-optionname/--disable-optionname), which allows the
+dnl user to explicitly control whether this optional dependency should be
+dnl enabled or not. The "helpstring" parameter gives a brief(!) description
+dnl about this dependency.
+dnl
+dnl If the user chose to enable this dependency and the required package
+dnl was found, this macro defines the variable "varname"_FOUND and sets it
+dnl to the string "yes", in addition to the 4 variables set by XDT_CHECK_PACKAGE.
+dnl But "varname"_FOUND will not be marked for substition. Furthermore,
+dnl a CPP define HAVE_"varname" will be placed in config.h (or added to
+dnl the cc command line, depending on your configure.ac) and set to
+dnl 1.
+dnl
+AC_DEFUN([XDT_CHECK_OPTIONAL_PACKAGE],
+[
+ AC_REQUIRE([XDT_PROG_PKG_CONFIG])
+
+ AC_ARG_ENABLE([$4],
+AC_HELP_STRING([--enable-$4], [Enable checking for $5 (default=m4_default([$6], [yes]))])
+AC_HELP_STRING([--disable-$4], [Disable checking for $5]),
+ [xdt_cv_$1_check=$enableval], [xdt_cv_$1_check=m4_default([$6], [yes])])
+
+ if test x"$xdt_cv_$1_check" = x"yes"; then
+ if $PKG_CONFIG --exists "$2 >= $3" >/dev/null 2>&1; then
+ XDT_CHECK_PACKAGE([$1], [$2], [$3],
+ [
+ AC_DEFINE([HAVE_$1], [1], [Define if $2 >= $3 present])
+ $1_FOUND="yes"
+ ])
+ else
+ AC_MSG_CHECKING([for optional package $2 >= $3])
+ AC_MSG_RESULT([not found])
+ fi
+ else
+ AC_MSG_CHECKING([for optional package $2])
+ AC_MSG_RESULT([disabled])
+ fi
+])
+
+
+
+dnl BM_DEPEND(varname, package, version)
+dnl
+dnl Simple wrapper for XDT_CHECK_PACKAGE("varname", "package", "version"). Kept
+dnl for backward compatibility. Will be removed in the future.
+dnl
+AC_DEFUN([BM_DEPEND],
+[
+ XDT_CHECK_PACKAGE([$1], [$2], [$3])
+])
+
+
+
+dnl BM_DEPEND_CHECK(var, pkg, version, name, helpstring, default)
+dnl
+dnl Simple wrapper for XDT_CHECK_OPTIONAL_PACKAGE(). Kept for backward
+dnl compatibility. Will be removed in the future.
+dnl
+AC_DEFUN([BM_DEPEND_CHECK],
+[
+ XDT_CHECK_OPTIONAL_PACKAGE([$1], [$2], [$3], [$4], [$5], [$6])
+])
+
+
+
+dnl XDT_CHECK_LIBX11()
+dnl
+dnl Executes various checks for X11. Sets LIBX11_CFLAGS, LIBX11_LDFLAGS
+dnl and LIBX11_LIBS (and marks them for substitution). In addition
+dnl HAVE_LIBX11 is set to 1 in config.h, if the X window system and
+dnl the development files are detected on the target system.
+dnl
+AC_DEFUN([XDT_CHECK_LIBX11],
+[
+ AC_REQUIRE([AC_PATH_XTRA])
+
+ LIBX11_CFLAGS= LIBX11_LDFLAGS= LIBX11_LIBS=
+ if test x"$no_x" != x"yes"; then
+ AC_CHECK_LIB([X11], [main],
+ [
+ AC_DEFINE([HAVE_LIBX11], [1], [Define if libX11 is available])
+ LIBX11_CFLAGS="$X_CFLAGS"
+ for option in $X_PRE_LIBS $X_EXTRA_LIBS $X_LIBS; do
+ case "$option" in
+ -L*)
+ path=`echo $option | sed 's/^-L//'`
+ if test x"$path" != x""; then
+ LIBX11_LDFLAGS="$LIBX11_LDFLAGS -L$path"
+ fi
+ ;;
+ *)
+ LIBX11_LIBS="$LIBX11_LIBS $option"
+ ;;
+ esac
+ done
+ if ! echo $LIBX11_LIBS | grep -- '-lX11' >/dev/null; then
+ LIBX11_LIBS="$LIBX11_LIBS -lX11"
+ fi
+ ], [], [$X_CFLAGS $X_PRE_LIBS $X_EXTRA_LIBS $X_LIBS])
+ fi
+ AC_SUBST([LIBX11_CFLAGS])
+ AC_SUBST([LIBX11_LDFLAGS])
+ AC_SUBST([LIBX11_LIBS])
+])
+
+
+
+dnl XDT_CHECK_LIBX11_REQUIRE()
+dnl
+dnl Similar to XDT_CHECK_LIBX11(), but terminates with an error if
+dnl the X window system and development files aren't detected on the
+dnl target system.
+dnl
+AC_DEFUN([XDT_CHECK_LIBX11_REQUIRE],
+[
+ AC_REQUIRE([XDT_CHECK_LIBX11])
+
+ if test x"$no_x" = x"yes"; then
+ AC_MSG_ERROR([X Window system libraries and header files are required])
+ fi
+])
+
+
+
+dnl XDT_CHECK_LIBSM()
+dnl
+dnl Checks whether the session management library is present on the
+dnl target system, and sets LIBSM_CFLAGS, LIBSM_LDFLAGS and LIBSM_LIBS
+dnl properly. In addition, HAVE_LIBSM will be set to 1 in config.h
+dnl if libSM is detected.
+dnl
+AC_DEFUN([XDT_CHECK_LIBSM],
+[
+ AC_REQUIRE([XDT_CHECK_LIBX11])
+
+ LIBSM_CFLAGS= LIBSM_LDFLAGS= LIBSM_LIBS=
+ if test x"$no_x" != x"yes"; then
+ AC_CHECK_LIB([SM], [SmcSaveYourselfDone],
+ [
+ AC_DEFINE([HAVE_LIBSM], [1], [Define if libSM is available])
+ LIBSM_CFLAGS="$LIBX11_CFLAGS"
+ LIBSM_LDFLAGS="$LIBX11_LDFLAGS"
+ LIBSM_LIBS="$LIBX11_LIBS"
+ if ! echo $LIBSM_LIBS | grep -- '-lSM' >/dev/null; then
+ LIBSM_LIBS="$LIBSM_LIBS -lSM -lICE"
+ fi
+ ], [], [$LIBX11_CFLAGS $LIBX11_LDFLAGS $LIBX11_LIBS -lICE])
+ fi
+ AC_SUBST([LIBSM_CFLAGS])
+ AC_SUBST([LIBSM_LDFLAGS])
+ AC_SUBST([LIBSM_LIBS])
+])
+
+
+
+dnl XDT_CHECK_LIBXPM()
+dnl
+dnl Checks if the Xpm library is present on the target system, and
+dnl sets LIBXPM_CFLAGS, LIBXPM_LDFLAGS and LIBXPM_LIBS. In addition,
+dnl HAVE_LIBXPM will be set to 1 in config.h if libXpm is detected.
+dnl
+AC_DEFUN([XDT_CHECK_LIBXPM],
+[
+ AC_REQUIRE([XDT_CHECK_LIBX11])
+
+ LIBXPM_CFLAGS= LIBXPM_LDFLAGS= LIBXPM_LIBS=
+ if test "$no_x" != "yes"; then
+ AC_CHECK_LIB([Xpm], [main],
+ [
+ AC_DEFINE([HAVE_LIBXPM], [1], [Define if libXpm is available])
+ LIBXPM_CFLAGS="$LIBX11_CFLAGS"
+ LIBXPM_LDFLAGS="$LIBX11_LDFLAGS"
+ LIBXPM_LIBS="$LIBX11_LIBS"
+ if ! echo $LIBXPM_LIBS | grep -- '-lXpm' >/dev/null; then
+ LIBXPM_LIBS="$LIBXPM_LIBS -lXpm"
+ fi
+ ], [], [$LIBX11_CFLAGS $LIBX11_LDFLAGS $LIBX11_LIBS -lXpm])
+ fi
+ AC_SUBST([LIBXPM_CFLAGS])
+ AC_SUBST([LIBXPM_LDFLAGS])
+ AC_SUBST([LIBXPM_LIBS])
+])
+
+
+
+dnl XDT_CHECK_LIBXPM_REQUIRE()
+dnl
+dnl Similar to XDT_CHECK_LIBXPM(), but fails if the Xpm library isn't
+dnl present on the target system.
+dnl
+AC_DEFUN([XDT_CHECK_LIBXPM_REQUIRE],
+[
+ AC_REQUIRE([XDT_CHECK_LIBX11_REQUIRE])
+ AC_REQUIRE([XDT_CHECK_LIBXPM])
+
+ if test x"$LIBXPM_LIBS" = x""; then
+ AC_MSG_ERROR([The Xpm library was not found on your system])
+ fi
+])
+
+
+
+dnl BM_LIBX11()
+dnl
+dnl Simple wrapper for XDT_CHECK_LIBX11. Kept for backward
+dnl compatibility. Will be removed in the future.
+dnl
+AC_DEFUN([BM_LIBX11],
+[
+ AC_REQUIRE([XDT_CHECK_LIBX11])
+])
+
+
+
+dnl BM_LIBX11_REQUIRE()
+dnl
+dnl Simple wrapper for XDT_CHECK_LIBX11_REQUIRE. Kept for backward
+dnl compatibility. Will be removed in the future.
+dnl
+AC_DEFUN([BM_LIBX11_REQUIRE],
+[
+ AC_REQUIRE([XDT_CHECK_LIBX11_REQUIRE])
+])
+
+
+
+dnl BM_LIBSM()
+dnl
+dnl Simple wrapper for XDT_CHECK_LIBSM. Kept for backward
+dnl compatibility. Will be removed in the future.
+dnl
+AC_DEFUN([BM_LIBSM],
+[
+ AC_REQUIRE([XDT_CHECK_LIBSM])
+])
+
+
+
+dnl BM_LIBXPM
+dnl
+dnl Simple wrapper for XDT_CHECK_LIBXPM. Kept for backward
+dnl compatibility. Will be removed in the future.
+dnl
+AC_DEFUN([BM_LIBXPM],
+[
+ AC_REQUIRE([XDT_CHECK_LIBXPM])
+])
+
+
+
+dnl BM_LIBXPM_REQUIRE
+dnl
+dnl Simple wrapper for XDT_CHECK_LIBXPM_REQUIRE. Kept for
+dnl backward compatibility. Will be removed in the future.
+dnl
+AC_DEFUN([BM_LIBXPM_REQUIRE],
+[
+ AC_REQUIRE([XDT_CHECK_LIBXPM_REQUIRE])
+])
+
diff --git a/m4macros/xdt-features.m4 b/m4macros/xdt-features.m4
new file mode 100644
index 0000000..17403ba
--- /dev/null
+++ b/m4macros/xdt-features.m4
@@ -0,0 +1,120 @@
+dnl $Id$
+dnl
+dnl Copyright (c) 2002-2005
+dnl The Xfce development team. All rights reserved.
+dnl
+dnl Written for Xfce by Benedikt Meurer <benny@xfce.org>.
+dnl
+dnl xdt-depends
+dnl -----------
+dnl Contains M4 macros to check for software dependencies.
+dnl Partly based on prior work of the XDG contributors.
+dnl
+
+
+
+dnl We need recent a autoconf version
+AC_PREREQ([2.53])
+
+
+
+dnl XDT_FEATURE_DEBUG()
+dnl
+AC_DEFUN([XDT_FEATURE_DEBUG],
+[
+ AC_ARG_ENABLE([debug],
+AC_HELP_STRING([--enable-debug[=yes|no|full]], [Build with debugging support])
+AC_HELP_STRING([--disable-debug], [Include no debugging support [default]]),
+ [], [enable_debug=no])
+
+ AC_MSG_CHECKING([whether to build with debugging support])
+ if test x"$enable_debug" != x"no"; then
+ AC_DEFINE([DEBUG], [1], [Define for debugging support])
+
+ xdt_cv_additional_CFLAGS="-Wall"
+ xdt_cv_additional_CFLAGS="$xdt_cv_additional_CFLAGS -DG_DISABLE_DEPRECATED"
+ xdt_cv_additional_CFLAGS="$xdt_cv_additional_CFLAGS -DXFCE_DISABLE_DEPRECATED"
+
+ if test x"$enable_debug" = x"full"; then
+ AC_DEFINE([DEBUG_TRACE], [1], [Define for tracing support])
+ xdt_cv_additional_CFLAGS="-g3 -Werror $xdt_cv_additional_CFLAGS"
+ AC_MSG_RESULT([full])
+ else
+ xdt_cv_additional_CFLAGS="-g $xdt_cv_additional_CFLAGS"
+ AC_MSG_RESULT([yes])
+ fi
+
+ CFLAGS="$CFLAGS $xdt_cv_additional_CFLAGS"
+ CXXFLAGS="$CXXFLAGS $xdt_cv_additional_CFLAGS"
+ else
+ AC_MSG_RESULT([no])
+ fi
+])
+
+
+
+dnl BM_DEBUG_SUPPORT()
+dnl
+AC_DEFUN([BM_DEBUG_SUPPORT],
+[
+dnl # --enable-debug
+ AC_REQUIRE([XDT_FEATURE_DEBUG])
+
+dnl # --enable-profiling
+ AC_ARG_ENABLE([profiling],
+AC_HELP_STRING([--enable-profiling],
+ [Generate extra code to write profile information])
+AC_HELP_STRING([--disable-profiling],
+ [No extra code for profiling (default)]),
+ [], [enable_profiling=no])
+
+ AC_MSG_CHECKING([whether to build with profiling support])
+ if test x"$enable_profiling" != x"no"; then
+ CFLAGS="$CFLAGS -pg"
+ LDFLAGS="$LDFLAGS -pg"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+
+dnl # --enable-gcov
+ AC_ARG_ENABLE([gcov],
+AC_HELP_STRING([--enable-gcov],
+ [compile with coverage profiling instrumentation (gcc only)])
+AC_HELP_STRING([--disable-gcov],
+ [do not generate coverage profiling instrumentation (default)]),
+ [], [enable_gcov=no])
+
+ AC_MSG_CHECKING([whether to compile with coverage profiling instrumentation])
+ if test x"$enable_gcov" != x"no"; then
+ CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+
+dnl # --enable-final
+ AC_REQUIRE([AC_PROG_LD])
+ AC_ARG_ENABLE([final],
+AC_HELP_STRING([--enable-final], [Build final version]),
+ [], [enable_final=yes])
+
+ AC_MSG_CHECKING([whether to build final version])
+ if test x"$enable_final" = x"yes"; then
+ AC_MSG_RESULT([yes])
+ CPPFLAGS="$CPPFLAGS -DG_DISABLE_CHECKS -DG_DISABLE_ASSERT"
+ CPPFLAGS="$CPPFLAGS -DG_DISABLE_CAST_CHECKS"
+ AC_MSG_CHECKING([whether $LD accepts -O1])
+ case `$LD -O1 -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ LDFLAGS="$LDFLAGS -Wl,-O1"
+ AC_MSG_RESULT([yes])
+ ;;
+ *)
+ AC_MSG_RESULT([no])
+ ;;
+ esac
+ else
+ AC_MSG_RESULT([no])
+ fi
+])
diff --git a/m4macros/xdt-i18n.m4 b/m4macros/xdt-i18n.m4
new file mode 100644
index 0000000..4489f2b
--- /dev/null
+++ b/m4macros/xdt-i18n.m4
@@ -0,0 +1,407 @@
+dnl $Id$
+dnl
+dnl Copyright (c) 2002-2005
+dnl The Xfce development team. All rights reserved.
+dnl
+dnl Written for Xfce by Benedikt Meurer <benny@xfce.org>.
+dnl
+dnl xdt-xfce
+dnl --------
+dnl Xfce specific M4 macros.
+dnl
+
+
+dnl This requires a recent version of autoconf
+AC_PREREQ([2.53])
+
+
+
+dnl XDT_LC_MESSAGES()
+dnl
+dnl Checks whether <locale.h> defines LC_MESSAGES on
+dnl the target system. If both <locale.h> is present
+dnl and it defines LC_MESSAGES, this macro sets
+dnl HAVE_LC_MESSAGES to 1 in config.h.
+dnl
+AC_DEFUN([XDT_LC_MESSAGES],
+[
+ AC_CHECK_HEADERS([locale.h])
+ if test x"$ac_cv_header_locale_h" = x"yes"; then
+ AC_CACHE_CHECK([for LC_MESSAGES],
+ [xdt_cv_val_LC_MESSAGES],
+ [AC_TRY_LINK([#include <locale.h>],
+ [return LC_MESSAGES],
+ [xdt_cv_val_LC_MESSAGES=yes],
+ [xdt_cv_val_LC_MESSAGES=no])])
+ if test x"$xdt_cv_val_LC_MESSAGES" = x"yes"; then
+ AC_DEFINE([HAVE_LC_MESSAGES], [1], [Define if your <locale.h> file defines LC_MESSAGES.])
+ fi
+ fi
+])
+
+
+
+dnl XDT_PATH_PROG_WITH_TEST(varname, progname, test, [value-if-not-found], [path])
+dnl
+AC_DEFUN([XDT_PATH_PROG_WITH_TEST],
+[
+ dnl Extract the first word of "$2", so it can be a program name with args.
+ set dummy $2;
+ ac_word=[$]2
+
+ AC_MSG_CHECKING([for $ac_word])
+ AC_CACHE_VAL([ac_cv_path_$1],
+ [
+ case "[$]$1" in
+ /*)
+ ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
+ ;;
+
+ *)
+ IFS="${IFS= }";
+ ac_save_ifs="$IFS";
+ IFS="${IFS}:"
+ for ac_dir in ifelse([$5], , [$PATH], [$5]); do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ if [$3]; then
+ ac_cv_path_$1="$ac_dir/$ac_word"
+ break
+ fi
+ fi
+ done
+ IFS="$ac_save_ifs"
+
+ dnl If no 4th arg is given, leave the cache variable unset,
+ dnl so AC_PATH_PROGS will keep looking.
+ ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"])
+ ;;
+ esac
+ ])
+
+ $1="$ac_cv_path_$1"
+ if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
+ AC_MSG_RESULT([$]$1)
+ else
+ AC_MSG_RESULT([no])
+ fi
+ AC_SUBST([$1])
+])
+
+
+
+dnl XDT_WITH_NLS()
+dnl
+AC_DEFUN([XDT_WITH_NLS],
+[
+ dnl NLS is obligatory
+ USE_NLS=yes
+ AC_SUBST([USE_NLS])
+
+ xdt_cv_have_gettext=no
+
+ CATOBJEXT=NONE
+ XGETTEXT=:
+ INTLLIBS=
+
+ AC_CHECK_HEADER([libintl.h],
+ [
+ xdt_cv_func_dgettext_libintl="no"
+ xdt_cv_libintl_extra_libs=""
+
+ dnl First check in libc
+ AC_CACHE_CHECK([for dgettext in libc], [xdt_cv_func_dgettext_libc],
+ [
+ AC_TRY_LINK([#include <libintl.h>],
+ [return (int) dgettext ("","")],
+ [xdt_cv_func_dgettext_libc=yes],
+ [xdt_cv_func_dgettext_libc=no])
+ ])
+
+ if test x"$xdt_cv_func_dgettext_libc" = x"yes" ; then
+ AC_CHECK_FUNCS([bind_textdomain_codeset])
+ fi
+
+ dnl If we don't have everything we want, check in libintl
+ if test x"$xdt_cv_func_dgettext_libc" != x"yes" \
+ || test x"$ac_cv_func_bind_textdomain_codeset" != x"yes" ; then
+ AC_CHECK_LIB([intl], [bindtextdomain],
+ [
+ AC_CHECK_LIB([intl], [dgettext], [xdt_cv_func_dgettext_libintl=yes])
+ ])
+
+ if test x"$xdt_cv_func_dgettext_libintl" != x"yes" ; then
+ AC_MSG_CHECKING([if -liconv is needed to use gettext])
+ AC_MSG_RESULT([])
+ AC_CHECK_LIB([intl], [dcgettext],
+ [
+ xdt_cv_func_dgettext_libintl=yes
+ xdt_cv_libintl_extra_libs=-liconv
+ ], [:],[-liconv])
+ fi
+
+ dnl If we found libintl, then check in it for bind_textdomain_codeset();
+ dnl we'll prefer libc if neither have bind_textdomain_codeset(),
+ dnl and both have dgettext
+ if test x"$xdt_cv_func_dgettext_libintl" = x"yes" ; then
+ xdt_save_LIBS="$LIBS"
+ LIBS="$LIBS -lintl $xdt_cv_libintl_extra_libs"
+ unset ac_cv_func_bind_textdomain_codeset
+ AC_CHECK_FUNCS([bind_textdomain_codeset])
+ LIBS="$xdt_save_LIBS"
+
+ if test x"$ac_cv_func_bind_textdomain_codeset" = x"yes"; then
+ xdt_cv_func_dgettext_libc=no
+ else
+ if test x"$xdt_cv_func_dgettext_libc" = x"yes"; then
+ xdt_cv_func_dgettext_libintl=no
+ fi
+ fi
+ fi
+ fi
+
+ if test x"$xdt_cv_func_dgettext_libc" = x"yes" \
+ || test x"$xdt_cv_func_dgettext_libintl" = x"yes"; then
+ xdt_cv_have_gettext=yes
+ fi
+
+ if test x"$xdt_cv_func_dgettext_libintl" = x"yes"; then
+ INTLLIBS="-lintl $xdt_cv_libintl_extra_libs"
+ fi
+
+ if test x"$xdt_cv_have_gettext" = x"yes"; then
+ AC_DEFINE([HAVE_GETTEXT], [1], [Define if the GNU gettext() function is already present or preinstalled.])
+ XDT_PATH_PROG_WITH_TEST([MSGFMT], [msgfmt],[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], [no])
+ if test x"$MSGFMT" != x"no"; then
+ xdt_save_LIBS="$LIBS"
+ LIBS="$LIBS $INTLLIBS"
+ AC_CHECK_FUNCS([dcgettext])
+ AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT])
+ XDT_PATH_PROG_WITH_TEST([XGETTEXT], [xgettext], [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], [:])
+ AC_TRY_LINK([], [extern int _nl_msg_cat_cntr; return _nl_msg_cat_cntr],
+ [
+ CATOBJEXT=.gmo
+ DATADIRNAME=share
+ ],
+ [
+ case $host in
+ *-*-solaris*)
+ dnl On Solaris, if bind_textdomain_codeset is in libc,
+ dnl GNU format message catalog is always supported,
+ dnl since both are added to the libc all together.
+ dnl Hence, we'd like to go with DATADIRNAME=share and
+ dnl and CATOBJEXT=.gmo in this case.
+ AC_CHECK_FUNC([bind_textdomain_codeset],
+ [
+ CATOBJEXT=.gmo
+ DATADIRNAME=share
+ ],
+ [
+ CATOBJEXT=.mo
+ DATADIRNAME=lib
+ ])
+ ;;
+
+ *)
+ CATOBJEXT=.mo
+ DATADIRNAME=lib
+ ;;
+ esac
+ ])
+ LIBS="$xdt_save_LIBS"
+ INSTOBJEXT=.mo
+ else
+ xdt_cv_have_gettext=no
+ fi
+ fi
+ ])
+
+ if test x"$xdt_cv_have_gettext" = x"yes"; then
+ AC_DEFINE([ENABLE_NLS], [1], [always defined to indicate that i18n is enabled])
+ fi
+
+ dnl Test whether we really found GNU xgettext.
+ if test x"$XGETTEXT" != x":"; then
+ dnl If it is not GNU xgettext we define it as : so that the
+ dnl Makefiles still can work.
+ if $XGETTEXT --omit-header /dev/null 2>/dev/null; then
+ : ;
+ else
+ AC_MSG_RESULT([found xgettext program is not GNU xgettext; ignore it])
+ XGETTEXT=":"
+ fi
+ fi
+
+ dnl We need to process the po/ directory.
+ POSUB=po
+
+ AC_OUTPUT_COMMANDS(
+ [
+ case "$CONFIG_FILES" in
+ *po/Makefile.in*)
+ sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
+ esac
+ ])
+
+ dnl These rules are solely for the distribution goal. While doing this
+ dnl we only have to keep exactly one list of the available catalogs
+ dnl in configure.in.
+ for lang in $ALL_LINGUAS; do
+ GMOFILES="$GMOFILES $lang.gmo"
+ POFILES="$POFILES $lang.po"
+ done
+
+ dnl Make all variables we use known to autoconf.
+ AC_SUBST([CATALOGS])
+ AC_SUBST([CATOBJEXT])
+ AC_SUBST([DATADIRNAME])
+ AC_SUBST([GMOFILES])
+ AC_SUBST([INSTOBJEXT])
+ AC_SUBST([INTLLIBS])
+ AC_SUBST([PO_IN_DATADIR_TRUE])
+ AC_SUBST([PO_IN_DATADIR_FALSE])
+ AC_SUBST([POFILES])
+ AC_SUBST([POSUB])
+])
+
+
+
+dnl XDT_GNU_GETTEXT([linguas])
+dnl
+AC_DEFUN([XDT_GNU_GETTEXT],
+[
+ AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([AC_HEADER_STDC])
+ AC_REQUIRE([XDT_LC_MESSAGES])
+ AC_REQUIRE([XDT_WITH_NLS])
+
+ if test x"$xdt_cv_have_gettext" = x"yes"; then
+ ifelse([$1], ,
+ [
+ LINGUAS=
+ ],
+ [
+ AC_MSG_CHECKING([for catalogs to be installed])
+ NEW_LINGUAS=
+ for presentlang in $1; do
+ useit=no
+ if test x"%UNSET%" != x"${LINGUAS-%UNSET%}"; then
+ desiredlanguages="$LINGUAS"
+ else
+ desiredlanguages="$1"
+ fi
+
+ for desiredlang in $desiredlanguages; do
+ dnl Use the presentlang catalog if desiredlang is
+ dnl a. equal to presentlang, or
+ dnl b. a variant of presentlang (because in this case,
+ dnl presentlang can be used as a fallback for messages
+ dnl which are not translated in the desiredlang catalog).
+ case "$desiredlang" in
+ "$presentlang"*)
+ useit=yes;;
+ esac
+ done
+
+ if test x"$useit" = x"yes"; then
+ NEW_LINGUAS="$NEW_LINGUAS $presentlang"
+ fi
+ done
+
+ LINGUAS=$NEW_LINGUAS
+ AC_MSG_RESULT([$LINGUAS])
+ fi
+
+ dnl Construct list of names of catalog files to be constructed.
+ if test x"$LINGUAS" != x""; then
+ for lang in $LINGUAS; do
+ CATALOGS="$CATALOGS $lang$CATOBJEXT";
+ done
+ ])
+ fi
+
+ dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
+ dnl find the mkinstalldirs script in another subdir but ($top_srcdir).
+ dnl Try to locate is.
+ MKINSTALLDIRS=
+ if test -n "$ac_aux_dir"; then
+ MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
+ fi
+ if test -z "$MKINSTALLDIRS"; then
+ MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
+ fi
+ AC_SUBST([MKINSTALLDIRS])
+
+ dnl Generate list of files to be processed by xgettext which will
+ dnl be included in po/Makefile.
+ test -d po || mkdir po
+ if test "x$srcdir" != "x."; then
+ if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
+ posrcprefix="$srcdir/"
+ else
+ posrcprefix="../$srcdir/"
+ fi
+ else
+ posrcprefix="../"
+ fi
+ rm -f po/POTFILES
+ sed \
+ -e "/^#/d" -e "/^\$/d" \
+ -e "s,.*, $posrcprefix& \\\\," \
+ -e "\$s/\(.*\) \\\\/\1/" \
+ < $srcdir/po/POTFILES.in > po/POTFILES
+])
+
+
+
+dnl XDT_I18N(LINGUAS [, PACKAGE])
+dnl
+dnl This macro takes care of setting up everything for i18n support.
+dnl
+dnl If PACKAGE isn't specified, it defaults to the package tarname; see
+dnl the description of AC_INIT() for an explanation of what makes up
+dnl the package tarname. Normally, you don't need to specify PACKAGE,
+dnl but you can stick with the default.
+dnl
+AC_DEFUN([XDT_I18N],
+[
+ dnl Substitute GETTEXT_PACKAGE variable
+ GETTEXT_PACKAGE=m4_default([$2], [AC_PACKAGE_TARNAME()])
+ AC_DEFINE([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Name of default gettext domain])
+ AC_SUBST([GETTEXT_PACKAGE])
+
+ dnl gettext and stuff
+ XDT_GNU_GETTEXT([$1])
+
+ dnl This is required on some Linux systems
+ AC_CHECK_FUNC([bind_textdomain_codeset])
+
+ dnl Determine where to install locale files
+ AC_MSG_CHECKING([for locales directory])
+ AC_ARG_WITH([locales-dir],
+ [
+ AC_HELP_STRING([--with-locales-dir=DIR], [Install locales into DIR])
+ ], [localedir=$withval],
+ [
+ if test x"$CATOBJEXT" = x".mo"; then
+ localedir=$libdir/locale
+ else
+ localedir=$datadir/locale
+ ])
+ AC_MSG_RESULT([$localdir])
+ AC_SUBST([localdir])
+])
+
+
+
+dnl BM_I18N(PACKAGE, LINGUAS)
+dnl
+dnl Simple wrapper for XDT_I18N(LINGUAS, PACKAGE). Kept for
+dnl backward compatibility. Will be removed in the
+dnl future.
+dnl
+AC_DEFUN([BM_I18N],
+[
+ XDT_I18N([$2], [$1])
+])
+
diff --git a/m4macros/xdt-xfce.m4 b/m4macros/xdt-xfce.m4
new file mode 100644
index 0000000..93d645c
--- /dev/null
+++ b/m4macros/xdt-xfce.m4
@@ -0,0 +1,111 @@
+dnl $Id$
+dnl
+dnl Copyright (c) 2002-2005
+dnl The Xfce development team. All rights reserved.
+dnl
+dnl Written for Xfce by Benedikt Meurer <benny@xfce.org>.
+dnl
+dnl xdt-xfce
+dnl --------
+dnl Xfce specific M4 macros.
+dnl
+
+
+
+dnl XDT_XFCE_PANEL_PLUGIN(varname, [version = 4.2.0])
+dnl
+dnl This macro is intended to be used by panel plugin writers. It
+dnl detects the xfce4-panel package on the target system and sets
+dnl "varname"_CFLAGS, "varname"_LIBS, "varname"_REQUIRED_VERSION
+dnl and "varname"_VERSION properly. The parameter "version"
+dnl specifies the minimum required version of xfce4-panel (defaults
+dnl to 4.2.0 if not given).
+dnl
+dnl This macro also takes care of handling special panel versions,
+dnl like the threaded panel, that was used during the Xfce 4.2.0
+dnl development, and automatically sets up the correct flags.
+dnl
+dnl In addition, this macro defines "varname"_PLUGINSDIR (and
+dnl marks it for substitution), which points to the directory
+dnl where the panel plugin should be installed to. You should
+dnl use this variable in your Makefile.am.
+dnl
+AC_DEFUN([XDT_XFCE_PANEL_PLUGIN],
+[
+ dnl Check for the xfce4-panel package
+ XDT_CHECK_PACKAGE([$1], [xfce4-panel-1.0], [m4_default([$2], [4.2.0])])
+
+ dnl Check if the panel is threaded (only for old panels)
+ xdt_cv_CFLAGS=$$1_CFLAGS
+ AC_MSG_CHECKING([whether the Xfce panel is threaded])
+ if $PKG_CONFIG --max-version=4.1.90 xfce4-panel-1.0 >/dev/null 2>&1; then
+ AC_MSG_RESULT([yes])
+ xdt_cv_CFLAGS="$xdt_cv_CFLAGS -DXFCE_PANEL_THREADED=1"
+ xdt_cv_CFLAGS="$xdt_cv_CFLAGS -DXFCE_PANEL_LOCK\(\)=gdk_threads_enter\(\)"
+ xdt_cv_CFLAGS="$xdt_cv_CFLAGS -DXFCE_PANEL_UNLOCK\(\)=gdk_threads_leave\(\)"
+ else
+ AC_MSG_RESULT([no])
+ xdt_cv_CFLAGS="$xdt_cv_CFLAGS -DXFCE_PANEL_LOCK\(\)=do{}while\(0\)"
+ xdt_cv_CFLAGS="$xdt_cv_CFLAGS -DXFCE_PANEL_UNLOCK\(\)=do{}while\(0\)"
+ fi
+ $1_CFLAGS="$xdt_cv_CFLAGS"
+
+ dnl Check where to put the plugins to
+ AC_MSG_CHECKING([where to install panel plugins])
+ $1_PLUGINSDIR=$libdir/xfce4/panel-plugins
+ AC_SUBST([$1_PLUGINSDIR])
+ AC_MSG_RESULT([$$1_PLUGINSDIR])
+])
+
+
+
+dnl XDT_XFCE_MCS_PLUGIN(varname, [version = 4.2.0])
+dnl
+dnl This macro is intented to be used by MCS plugin writers. It
+dnl detects the MCS manager package on the target system and sets
+dnl "varname"_CFLAGS, "varname"_LIBS, "varname"_REQUIRED_VERSION,
+dnl and "varname"_VERSION. The parameter "version" allows you
+dnl to specify the minimum required version of xfce-mcs-manager
+dnl (defaults to 4.2.0 if not given).
+dnl
+dnl In addition, this macro defines "varname"_PLUGINSDIR (and
+dnl marks it for substitution), which points to the directory
+dnl where the MCS plugin should be installed to. You should use
+dnl this variable in your Makefile.am.
+dnl
+AC_DEFUN([XDT_XFCE_MCS_PLUGIN],
+[
+ dnl Check for the xfce-mcs-manager package
+ XDT_CHECK_PACKAGE([$1], [xfce-mcs-manager], [m4_default([$2], [4.2.0])])
+
+ dnl Check where to put the plugins to
+ AC_MSG_CHECKING([where to install MCS plugins])
+ $1_PLUGINSDIR=$libdir/xfce4/mcs-plugins
+ AC_SUBST([$1_PLUGINSDIR])
+ AC_MSG_RESULT([$$1_PLUGINSDIR])
+])
+
+
+
+dnl XFCE_PANEL_PLUGIN(varname, version)
+dnl
+dnl Simple wrapper for XDT_XFCE_PANEL_PLUGIN(varname, version). Kept
+dnl for backward compatibility. Will be removed in the future.
+dnl
+AC_DEFUN([XFCE_PANEL_PLUGIN],
+[
+ XDT_XFCE_PANEL_PLUGIN([$1], [$2])
+])
+
+
+
+dnl XFCE_MCS_PLUGIN(varname, version)
+dnl
+dnl Simple wrapper for XDT_XFCE_MCS_PLUGIN(varname, version). Kept
+dnl for backward compatibility. Will be removed in the future.
+dnl
+AC_DEFUN([XFCE_MCS_PLUGIN],
+[
+ XDT_XFCE_MCS_PLUGIN([$1], [$2])
+])
+