Skip to content
Snippets Groups Projects
aclocal.m4 77 KiB
Newer Older
       done
       LINGUAS=$NEW_LINGUAS
       AC_MSG_RESULT($LINGUAS)
     fi

     dnl Construct list of names of catalog files to be constructed.
     if test -n "$LINGUAS"; then
       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
     fi
   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
  ])

# AM_GLIB_DEFINE_LOCALEDIR(VARIABLE)
# -------------------------------
# Define VARIABLE to the location where catalog files will
# be installed by po/Makefile.
glib_DEFUN(GLIB_DEFINE_LOCALEDIR,
[glib_REQUIRE([GLIB_GNU_GETTEXT])dnl
glib_save_prefix="$prefix"
test "x$prefix" = xNONE && prefix=$ac_default_prefix
if test "x$CATOBJEXT" = "x.mo" ; then
  localedir=`eval echo "${libdir}/locale"`
else
  localedir=`eval echo "${datadir}/locale"`
fi
prefix="$glib_save_prefix"
AC_DEFINE_UNQUOTED($1, "$localedir",
  [Define the location where the catalogs will be installed])
])

dnl
dnl Now the definitions that aclocal will find
dnl
ifdef(glib_configure_in,[],[
AC_DEFUN(AM_GLIB_GNU_GETTEXT,[GLIB_GNU_GETTEXT($@)])
AC_DEFUN(AM_GLIB_DEFINE_LOCALEDIR,[GLIB_DEFINE_LOCALEDIR($@)])
])dnl
Benedikt Meurer's avatar
Benedikt Meurer committed
dnl From Benedikt Meurer (benedikt.meurer@unix-ag.uni-siegen.de)
dnl Check for X11

AC_DEFUN([BM_LIBX11],
[
  AC_REQUIRE([AC_PATH_XTRA])
  AC_REQUIRE([BM_RPATH_SUPPORT])
  LIBX11_CFLAGS= LIBX11_LDFLAGS= LIBX11_LIBS=
  if test "$no_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"
            if test -n "$LD_RPATH"; then
              LIBX11_LDFLAGS="$LIBX11_LDFLAGS $LD_RPATH$path"
            fi
          fi
          ;;
        *)
          LIBX11_LIBS="$LIBX11_LIBS $option"
          ;;
        esac
      done
      if ! echo $LIBX11_LIBS | grep -q -- '-lX11'; 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)
])

AC_DEFUN([BM_LIBX11_REQUIRE],
[
  AC_REQUIRE([BM_LIBX11])
  if test "$no_x" == "yes"; then
    AC_MSG_ERROR([X Window system libraries and header files are required])
  fi
])

AC_DEFUN([BM_LIBSM],
[
  AC_REQUIRE([BM_LIBX11])
  LIBSM_CFLAGS= LIBSM_LDFLAGS= LIBSM_LIBS=
  if test "$no_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 -q -- '-lSM'; 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)
])

AC_DEFUN([BM_LIBXPM],
[
  AC_REQUIRE([BM_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 -q -- '-lXpm'; 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])
])

AC_DEFUN([BM_LIBXPM_REQUIRE],
[
  AC_REQUIRE([BM_LIBX11_REQUIRE])
  AC_REQUIRE([BM_LIBXPM])
  if test -z "$LIBXPM_LIBS"; then
    AC_MSG_ERROR([The Xpm library was not found on you system])
  fi
])

AC_DEFUN([BM_LIBXINERAMA],
[
  AC_ARG_ENABLE(xinerama,
AC_HELP_STRING([--enable-xinerama], [enable xinerama extension])
AC_HELP_STRING([--disable-xinerama], [disable xinerama extension [default]]),
      [], [enable_xinerama=no])
  LIBXINERAMA_CFLAGS= LIBXINERAMA_LDFLAGS= LIBXINERAMA_LIBS=
  if test "x$enable_xinerama" = "xyes"; then
    AC_REQUIRE([BM_LIBX11_REQUIRE])
    AC_CHECK_LIB(Xinerama, XineramaQueryScreens,
    [
      AC_DEFINE(HAVE_LIBXINERAMA, 1, Define if XFree86 Xinerama is available)
      LIBXINERAMA_CFLAGS="$LIBX11_CFLAGS"
      LIBXINERAMA_LDFLAGS="$LIBX11_LDFLAGS"
      LIBXINERAMA_LIBS="$LIBX11_LIBS"
      if ! echo $LIBXINERAMA_LIBS | grep -q -- '-lXinerama'; then
        LIBXINERAMA_LIBS="$LIBXINERAMA_LIBS -lXinerama"
      fi
      if ! echo $LIBXINERAMA_LIBS | grep -q -- '-lXext'; then
        LIBXINERAMA_LIBS="$LIBXINERAMA_LIBS -lXext"
      fi
    ],[], [$LIBX11_CFLAGS $LIBX11_LDFLAGS $LIBX11_LIBS -lXext])
  fi
  AC_SUBST(LIBXINERAMA_CFLAGS)
  AC_SUBST(LIBXINERAMA_LDFLAGS)
  AC_SUBST(LIBXINERAMA_LIBS)
])


dnl From Benedikt Meurer (benedikt.meurer@unix-ag.uni-siegen.de)
dnl
dnl Workaround for some broken ELF systems
dnl

AC_DEFUN([BM_RPATH_SUPPORT],
[
  AC_ARG_ENABLE(rpath,
AC_HELP_STRING([--enable-rpath], [Specify run path to the ELF linker (default)])
AC_HELP_STRING([--disable-rpath], [Do not use -rpath (use with care!!)]),
    [ac_cv_rpath=$enableval], [ac_cv_rpath=yes])
  AC_MSG_CHECKING([whether to use -rpath])
  LD_RPATH=
  if test "x$ac_cv_rpath" != "xno"; then
    LD_RPATH="-Wl,-R"
    AC_MSG_RESULT([yes])
  else
    LD_RPATH=""
    AC_MSG_RESULT([no])
  fi
])

dnl From Benedikt Meurer (benedikt.meurer@unix-ag.uni-siegen.de)
dnl
dnl

AC_DEFUN([BM_DEPEND],
[
  PKG_CHECK_MODULES([$1], [$2 >= $3])
  $1_REQUIRED_VERSION=$3
  AC_SUBST($1_REQUIRED_VERSION)
])

dnl
dnl BM_DEPEND_CHECK(var, pkg, version)
dnl
AC_DEFUN([BM_DEPEND_CHECK],
[
  AC_MSG_CHECKING([for $2 >= $3])
  if $PKG_CONFIG --atleast-version $2 $3 2> /dev/null; then
    AC_MSG_RESULT([yes])
    BM_DEPEND([$1], [$2], [$3])
    AC_DEFINE([HAVE_$1], [1], [Define if you have $2 >= $3])
  else
    AC_MSG_RESULT([no])
  fi
])


Olivier Fourdan's avatar
Olivier Fourdan committed

dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
dnl also defines GSTUFF_PKG_ERRORS on error
AC_DEFUN(PKG_CHECK_MODULES, [
  succeeded=no

  if test -z "$PKG_CONFIG"; then
    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  fi

  if test "$PKG_CONFIG" = "no" ; then
     echo "*** The pkg-config script could not be found. Make sure it is"
     echo "*** in your path, or set the PKG_CONFIG environment variable"
     echo "*** to the full path to pkg-config."
     echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
  else
     PKG_CONFIG_MIN_VERSION=0.9.0
     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
        AC_MSG_CHECKING(for $2)

        if $PKG_CONFIG --exists "$2" ; then
            AC_MSG_RESULT(yes)
            succeeded=yes

            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)
        else
            $1_CFLAGS=""
            $1_LIBS=""
            ## If we have a custom action on failure, don't print errors, but 
            ## do set a variable so people can do so.
            $1_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
            ifelse([$4], ,echo $$1_PKG_ERRORS,)
        fi

        AC_SUBST($1_CFLAGS)
        AC_SUBST($1_LIBS)
     else
        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
        echo "*** See http://www.freedesktop.org/software/pkgconfig"
     fi
  fi

  if test $succeeded = yes; then
     ifelse([$3], , :, [$3])
  else
     ifelse([$4], , AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.]), [$4])
  fi
])



Benedikt Meurer's avatar
Benedikt Meurer committed
dnl From Benedikt Meurer (benedikt.meurer@unix-ag.uni-siegen.de)
dnl
dnl if debug support is requested:
dnl
dnl   1) defines DEBUG to 1
dnl   2) adds requested debug level flags to CFLAGS
dnl

AC_DEFUN([BM_DEBUG_SUPPORT],
[
  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]]),
    [ac_cv_debug=$enableval], [ac_cv_debug=no])
  AC_MSG_CHECKING([whether to build with debugging support])
  if test "x$ac_cv_debug" != "xno"; then
    AC_DEFINE(DEBUG, 1, Define for debugging support)
    if test "x$ac_cv_debug" == "xfull"; then
      CFLAGS="$CFLAGS -g3 -Wall -Werror"
      AC_MSG_RESULT([full])
    else
      CFLAGS="$CFLAGS -g -Wall -Werror"
      AC_MSG_RESULT([yes])
    fi
  else
    AC_MSG_RESULT([no])
  fi
])