[Xfce4-commits] <tumbler:master> Put in place dev-tools neutral build environment

Jannis Pohlmann noreply at xfce.org
Tue Oct 6 14:44:02 CEST 2009


Updating branch refs/heads/master
         to 292fd407ae55590a1d4ec46b0b936c80c5a03384 (commit)
       from f13b573199bf3af409d1836e1e2078f97c45cc98 (commit)

commit 292fd407ae55590a1d4ec46b0b936c80c5a03384
Author: Philip Van Hoof <philip at codeminded.be>
Date:   Tue Oct 6 11:46:28 2009 +0200

    Put in place dev-tools neutral build environment
    
    Signed-off-by: Jannis Pohlmann <jannis at xfce.org>

 autogen.sh => autogen-gnome.sh      |    2 +
 docs/Makefile.am => autogen-xfce.sh |   20 ++-
 autogen.sh                          |   33 ++---
 configure.ac                        |    9 +-
 m4/xdt-features.m4                  |  285 +++++++++++++++++++++++++++++++++++
 m4/xdt-i18n.m4                      |   90 +++++++++++
 6 files changed, 415 insertions(+), 24 deletions(-)

diff --git a/autogen.sh b/autogen-gnome.sh
similarity index 91%
copy from autogen.sh
copy to autogen-gnome.sh
index 27dd499..604002b 100755
--- a/autogen.sh
+++ b/autogen-gnome.sh
@@ -1,6 +1,8 @@
 #!/bin/sh
 # Run this to generate all the initial makefiles, etc.
 
+export ACLOCAL_FLAGS="-I `pwd`/m4 $ACLOCAL_FLAGS"
+
 srcdir=`dirname $0`
 test -z "$srcdir" && srcdir=.
 
diff --git a/docs/Makefile.am b/autogen-xfce.sh
old mode 100644
new mode 100755
similarity index 61%
copy from docs/Makefile.am
copy to autogen-xfce.sh
index de40f05..21f1742
--- a/docs/Makefile.am
+++ b/autogen-xfce.sh
@@ -1,4 +1,6 @@
-# vi:set ts=8 sw=8 noet ai nocindent:
+#!/bin/sh
+#
+# vi:set et ai sw=2 sts=2 ts=2: */
 # -
 # Copyright (c) 2009 Jannis Pohlmann <jannis at xfce.org>
 # 
@@ -17,5 +19,17 @@
 # Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 # Boston, MA 02110-1301, USA.
 
-SUBDIRS =								\
-	reference
+(type xdt-autogen) >/dev/null 2>&1 || {
+  cat >&2 <<EOF
+autogen.sh: You don't seem to have the Xfce development tools installed on
+            your system, which are required to build this software.
+            Please install the xfce4-dev-tools package first, it is available
+            from http://www.xfce.org/.
+EOF
+  exit 1
+}
+
+# # initialize GTK-Doc
+# gtkdocize || exit 1
+
+XDT_AUTOGEN_REQUIRED_VERSION="4.7.2" exec xdt-autogen $@
diff --git a/autogen.sh b/autogen.sh
index 27dd499..51551ce 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,24 +1,19 @@
-#!/bin/sh
-# Run this to generate all the initial makefiles, etc.
+which xdt-autogen
 
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
+if test x$? = x"0"; then
+  echo "Picked XFCE development environment"
+  .  ./autogen-xfce.sh
+  exit 0
+fi
 
-PKG_NAME="tumbler"
-REQUIRED_AUTOMAKE_VERSION=1.9
+which gnome-autogen.sh
 
-(test -f $srcdir/configure.ac \
-  && test -f $srcdir/README) || {
-    echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
-    echo " top-level $PKG_NAME directory"
-    exit 1
-}
+if test x$? = x"0"; then
+  echo "Picked GNOME development environment"
+  .  ./autogen-gnome.sh
+  exit 0
+fi
 
-# Automake requires that ChangeLog exist.
-touch ChangeLog
+echo "You need to install either gnome-common or xfce4-dev-tools"
+exit 1
 
-which gnome-autogen.sh || {
-    echo "You need to install gnome-common from the GNOME CVS"
-    exit 1
-}
-. gnome-autogen.sh
diff --git a/configure.ac b/configure.ac
index 3220a1d..5ed0b1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,6 +47,8 @@ dnl ***************************
 dnl *** Initialize automake ***
 dnl ***************************
 AM_INIT_AUTOMAKE([AC_PACKAGE_TARNAME()], [AC_PACKAGE_VERSION()])
+AC_CONFIG_MACRO_DIR([m4])
+AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS -I m4")
 AM_CONFIG_HEADER([config.h])
 AM_MAINTAINER_MODE()
 
@@ -117,7 +119,10 @@ AC_FUNC_MMAP()
 dnl ******************************
 dnl *** Check for i18n support ***
 dnl ******************************
-dnl XDT_I18N([@LINGUAS@])
+
+linguas=`ls po/*.po | sed s/.po//g | sed sApo/AA | xargs`
+
+XDT_I18N([$linguas])
 
 dnl *************************
 dnl *** Check for GTK-Doc ***
@@ -227,7 +232,7 @@ fi
 dnl ***********************************
 dnl *** Check for debugging support ***
 dnl ***********************************
-dnl XDT_FEATURE_DEBUG()
+XDT_FEATURE_DEBUG()
 
 dnl **************************************
 dnl *** Check for linker optimizations ***
diff --git a/m4/xdt-features.m4 b/m4/xdt-features.m4
new file mode 100644
index 0000000..ea0c685
--- /dev/null
+++ b/m4/xdt-features.m4
@@ -0,0 +1,285 @@
+dnl $Id$
+dnl
+dnl Copyright (c) 2002-2006
+dnl         The Xfce development team. All rights reserved.
+dnl
+dnl Written for Xfce by Benedikt Meurer <benny at xfce.org>.
+dnl
+dnl This program is free software; you can redistribute it and/or modify it
+dnl under the terms of the GNU General Public License as published by the Free
+dnl Software Foundation; either version 2 of the License, or (at your option)
+dnl any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful, but WITHOUT
+dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+dnl FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+dnl more details.
+dnl
+dnl You should have received a copy of the GNU General Public License along with
+dnl this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+dnl Place, Suite 330, Boston, MA  02111-1307  USA
+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_SUPPORTED_FLAGS(VAR, FLAGS)
+dnl
+dnl For each token in FLAGS, checks to be sure the compiler supports
+dnl the flag, and if so, adds each one to VAR.
+dnl
+AC_DEFUN([XDT_SUPPORTED_FLAGS],
+[
+  for flag in $2; do
+    AC_MSG_CHECKING([if $CC supports $flag])
+    saved_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS $flag"
+    AC_COMPILE_IFELSE([ ], [flag_supported=yes], [flag_supported=no])
+    CFLAGS="$saved_CFLAGS"
+    AC_MSG_RESULT([$flag_supported])
+
+    if test "x$flag_supported" = "xyes"; then
+      $1="$$1 $flag"
+    fi
+  done
+])
+
+
+
+dnl XDT_FEATURE_DEBUG(default_level=minimum)
+dnl
+AC_DEFUN([XDT_FEATURE_DEBUG],
+[
+  dnl weird indentation to keep output indentation correct
+  AC_ARG_ENABLE([debug],
+                AC_HELP_STRING([--enable-debug@<:@=no|minimum|yes|full@:>@],
+                               [Build with debugging support @<:@default=m4_default([$1], [minimum])@:>@])
+AC_HELP_STRING([--disable-debug], [Include no debugging support]),
+                [enable_debug=$enableval], [enable_debug=m4_default([$1], [minimum])])
+
+  AC_MSG_CHECKING([whether to build with debugging support])
+  if test x"$enable_debug" = x"full" -o x"$enable_debug" = x"yes"; then
+    AC_DEFINE([DEBUG], [1], [Define for debugging support])
+
+    xdt_cv_additional_CFLAGS="-DXFCE_DISABLE_DEPRECATED \
+                              -Wall -Wextra \
+                              -Wno-missing-field-initializers \
+                              -Wno-unused-parameter -Wold-style-definition \
+                              -Wdeclaration-after-statement \
+                              -Wmissing-declarations -Wredundant-decls \
+                              -Wmissing-noreturn -Wshadow -Wpointer-arith \
+                              -Wcast-align -Wformat-security \
+                              -Winit-self -Wmissing-include-dirs -Wundef \
+                              -Wmissing-format-attribute -Wnested-externs \
+                              -fstack-protector"
+    CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
+    
+    if test x"$enable_debug" = x"full"; then
+      AC_DEFINE([DEBUG_TRACE], [1], [Define for tracing support])
+      xdt_cv_additional_CFLAGS="$xdt_cv_additional_CFLAGS -O0 -g3 -Werror"
+      CPPFLAGS="$CPPFLAGS -DG_ENABLE_DEBUG"
+      AC_MSG_RESULT([full])
+    else
+      xdt_cv_additional_CFLAGS="$xdt_cv_additional_CFLAGS -g"
+      AC_MSG_RESULT([yes])
+    fi
+
+    XDT_SUPPORTED_FLAGS([supported_CFLAGS], [$xdt_cv_additional_CFLAGS])
+
+    ifelse([$CXX], , , [
+      dnl FIXME: should test on c++ compiler, but the following line causes
+      dnl        autoconf errors for projects that don't check for a
+      dnl        c++ compiler at all.
+      dnl AC_LANG_PUSH([C++])
+      dnl XDT_SUPPORTED_FLAGS([supported_CXXFLAGS], [$xdt_cv_additional_CFLAGS])
+      dnl AC_LANG_POP()
+      dnl        instead, just use supported_CFLAGS...
+      supported_CXXFLAGS="$supported_CFLAGS"
+    ])
+
+    CFLAGS="$CFLAGS $supported_CFLAGS"
+    CXXFLAGS="$CXXFLAGS $supported_CXXFLAGS"
+  else
+    CPPFLAGS="$CPPFLAGS -DNDEBUG"
+
+    if test x"$enable_debug" = x"no"; then
+      CPPFLAGS="$CPPFLAGS -DG_DISABLE_CAST_CHECKS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
+      AC_MSG_RESULT([no])
+    else
+      AC_MSG_RESULT([minimum])
+    fi
+  fi
+])
+
+
+dnl XDT_FEATURE_VISIBILITY()
+dnl
+dnl Checks to see if the compiler supports the 'visibility' attribute
+dnl If so, adds -DHAVE_GNUC_VISIBILTY to CPPFLAGS.  Also sets the
+dnl automake conditional HAVE_GNUC_VISIBILITY.
+dnl
+AC_DEFUN([XDT_FEATURE_VISIBILITY],
+[
+  AC_ARG_ENABLE([visibility],
+                AC_HELP_STRING([--disable-visibility],
+                               [Don't use ELF visibility attributes]),
+                [enable_visibility=$enableval], [enable_visibility=yes])
+  have_gnuc_visibility=no
+  if test "x$enable_visibility" != "xno"; then
+    XDT_SUPPORTED_FLAGS([xdt_vis_test_cflags], [-Wall -Werror -Wno-unused-parameter])
+    saved_CFLAGS="$CFLAGS"
+    CFLAGS="$CFLAGS $xdt_vis_test_cflags"
+    AC_MSG_CHECKING([whether $CC supports the GNUC visibility attribute])
+    AC_COMPILE_IFELSE(AC_LANG_SOURCE(
+    [
+      void test_default (void);
+      void test_hidden (void);
+
+      void __attribute__ ((visibility("default"))) test_default (void) {}
+      void __attribute__ ((visibility("hidden"))) test_hidden (void) {}
+
+      int main (int argc, char **argv) {
+        test_default ();
+        test_hidden ();
+        return 0;
+      }
+    ]),
+    [
+      have_gnuc_visibility=yes
+      AC_MSG_RESULT([yes])
+    ],
+    [
+      AC_MSG_RESULT([no])
+    ])
+    CFLAGS="$saved_CFLAGS"
+  fi
+
+  if test "x$have_gnuc_visibility" = "xyes"; then
+    CPPFLAGS="$CPPFLAGS -DHAVE_GNUC_VISIBILITY"
+    XDT_SUPPORTED_FLAGS([xdt_vis_hidden_cflags], [-fvisibility=hidden])
+    CFLAGS="$CFLAGS $xdt_vis_hidden_cflags"
+  fi
+
+  AM_CONDITIONAL([HAVE_GNUC_VISIBILITY], [test "x$have_gnuc_visibility" = "xyes"])
+])
+
+dnl XDT_FEATURE_LINKER_OPTS
+dnl
+dnl Checks for and enables any special linker optimizations.
+dnl
+AC_DEFUN([XDT_FEATURE_LINKER_OPTS],
+[
+  AC_ARG_ENABLE([linker-opts],
+                AC_HELP_STRING([--disable-linker-opts],
+                               [Disable linker optimizations]),
+                [enable_linker_opts=$enableval], [enable_linker_opts=yes])
+
+  if test "x$enable_linker_opts" != "xno"; then
+    AC_MSG_CHECKING([whether $LD accepts --as-needed])
+    case `$LD --as-needed -v 2>&1 </dev/null` in
+    *GNU* | *'with BFD'*)
+      LDFLAGS="$LDFLAGS -Wl,--as-needed"
+      AC_MSG_RESULT([yes])
+      ;;
+    *)
+      AC_MSG_RESULT([no])
+      ;;
+    esac
+    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
+  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 # --disable-asserts
+  AC_ARG_ENABLE([asserts],
+AC_HELP_STRING([--disable-asserts], [Disable assertions [DANGEROUS]]),
+    [], [enable_asserts=yes])
+
+  AC_MSG_CHECKING([whether to disable assertions])
+  if test x"$enable_asserts" = x"no"; then
+    AC_MSG_RESULT([yes])
+    CPPFLAGS="$CPPFLAGS -DG_DISABLE_CHECKS -DG_DISABLE_ASSERT"
+    CPPFLAGS="$CPPFLAGS -DG_DISABLE_CAST_CHECKS"
+  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])
+    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/m4/xdt-i18n.m4 b/m4/xdt-i18n.m4
new file mode 100644
index 0000000..34f2126
--- /dev/null
+++ b/m4/xdt-i18n.m4
@@ -0,0 +1,90 @@
+dnl $Id$
+dnl
+dnl Copyright (c) 2002-2006
+dnl         The Xfce development team. All rights reserved.
+dnl
+dnl Written for Xfce by Benedikt Meurer <benny at xfce.org>.
+dnl
+dnl This program is free software; you can redistribute it and/or modify it
+dnl under the terms of the GNU General Public License as published by the Free
+dnl Software Foundation; either version 2 of the License, or (at your option)
+dnl any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful, but WITHOUT
+dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+dnl FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+dnl more details.
+dnl
+dnl You should have received a copy of the GNU General Public License along with
+dnl this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+dnl Place, Suite 330, Boston, MA  02111-1307  USA
+dnl
+dnl xdt-i18n
+dnl --------
+dnl  Internalization M4 macros.
+dnl
+
+
+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_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Name of default gettext domain])
+  AC_SUBST([GETTEXT_PACKAGE])
+
+  dnl gettext and stuff
+  ALL_LINGUAS="$1"
+  AM_GLIB_GNU_GETTEXT()
+
+  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
+    fi
+  ])
+  AC_MSG_RESULT([$localedir])
+  AC_SUBST([localedir])
+
+  dnl Determine additional xgettext flags
+  AC_MSG_CHECKING([for additional xgettext flags])
+  if test x"$XGETTEXT_ARGS" = x""; then
+    XGETTEXT_ARGS="--keyword=Q_ --from-code=UTF-8";
+  else
+    XGETTEXT_ARGS="$XGETTEXT_ARGS --keyword=Q_ --from-code=UTF-8";
+  fi
+  AC_SUBST([XGETTEXT_ARGS])
+  AC_MSG_RESULT([$XGETTEXT_ARGS])
+])
+
+
+
+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])
+])
+



More information about the Xfce4-commits mailing list