Mike Frysinger wrote:
so as more and more e17 packages are added to cvs, more and more m4 files are
being duplicated ... sometimes they are using older, crappier versions, and
it's getting to be a real pain to track what's out of date
so what i'm thinking is we add a new toplevel m4 dir, move all the m4 files to
it, and then update the autogen.sh scripts to automatically copy over the m4
tree everytime it's run
I think it is not a good solution. If someone checks-out a single module
and not the full repository, he will not have this m4 directory, and
will not be happy to have to get it singly. Then, keeping it up to date
will be a pain.
In a project, we used to keep this kind of stuff in a single directory
on the repository, then using svn:external to 'link' this directory into
each sub-projects. But you're not using subversion...
There is also one another solution. Install m4 files on 'make install'
in $prefix/share/autoconf of whatever from the most low-level project,
then all others projects could use it. However, it will not work for
enlightenment, because there is no such package that all other depend
on, and making one only for this purpose is silly (worse than having a
top-level m4 directory).
I suggest that common configure.{ac,in} stuff across projects be puts in
m4 files. Then, when the autotools maintainer modifies one of these
files, he copy it into _every_ m4 directory (one-line shell command).
Thus, the dirty work is only for one person, and transparent for all other.
Anyway, I agree that all autoconf stuff should be cleaned and improved,
especially on these files:
---
# get rid of that stupid cache mechanism
rm -f config.cache
---
I made a generic m4 macro that handle enlightenment packages detection
(file attached), and a cleaner configure.ac that could be used
everywhere. There is also a m4 macro (ac_path_generic.m4) that looks
fine, but seems unused in some configure.in...
Cheers,
# -*- shell-script -*-
#
# E_CHECK_PACKAGE(VARIABLE, CONFIG_PROGRAM, [HEADER_WITNESS], [LIB_WITNESS])
#
# Checks the existence of package which configuration given by CONFIG_PROGRAM.
# First, CONFIG_PROGRAM is searched on the $PATH, an error occur if it isn't
found.
# Then, it sets the following variables:
# - ${VARIABLE}_CONFIG: full path to CONFIG_PROGRAM
# - ${VARIABLE}_CFLAGS: additional gcc cflags options to compile with the
package.
# - ${VARIABLE}_LIBS: additional gcc ldflags options to compile with the
package.
#
# The optional HEADER_WITNESS checks if the package is indeed
# installed at the location where the CONFIG_PROGRAM file says it
# is installed.
#
# The optional LIB_WITNESS, giving a function name present in the library,
# checks if the package basically works with the options given by
CONFIG_PROGRAM.
# // FIXME: LIB_WITNESS doesn't work very well.
#
# Some use sample, in configure.ac:
# dnl Check for e*-config programs
# E_CHECK_PACKAGE([ECORE], [ecore-config], [Ecore.h])
# E_CHECK_PACKAGE([EVAS], [evas-config], [Evas.h])
# E_CHECK_PACKAGE([EDJE], [edje-config], [Edje.h])
# E_CHECK_PACKAGE([E], [enlightenment-config], [E_Lib.h])
#
#
AC_DEFUN([E_CHECK_PACKAGE],
[
AC_ARG_WITH([$2],
AS_HELP_STRING([--with-$2=$1_CONFIG], [use the specified $2]),
[prg=$withval],
[test "x${hint_$1_CONFIG+set}" = "xset" && prg=${hint_$1_CONFIG} || prg=$2]
)
AC_PATH_PROG([$1_CONFIG], [`basename $prg`], [no],
[`dirname $prg`:$exec_prefix/bin:$PATH])
if test ! -x "${$1_CONFIG}"; then
AC_MSG_ERROR([cannot find $prg.])
fi
AC_ARG_VAR([$1_CONFIG], [same as --with-$2 flag])
# Check for header presence.
m4_ifval([$3],
[
sav_CFLAGS=$CFLAGS
sav_CPPFLAGS=$CPPFLAGS
CPPFLAGS="`${$1_CONFIG} --cflags` $CPPFLAGS"
CFLAGS="`${$1_CONFIG} --cflags` $CFLAGS"
AC_CHECK_HEADER([$3], [have_header=yes])
if test x$have_header = x; then
AC_MSG_ERROR([Header '$3' not found. We were abused by $2. Aborting.])
fi
CPPFLAGS=$sav_CPPFLAGS
CFLAGS=$sav_CFLAGS
])
# Check for library presence.
m4_ifval([$4],
[
sav_CFLAGS=$CFLAGS
sav_LDFLAGS=$LDFLAGS
CFLAGS="`${$1_CONFIG} --cflags` $CFLAGS"
LDFLAGS="`${$1_CONFIG} --libs` $LDFLAGS"
AC_CHECK_LIB([$LDFLAGS], [$4] [have_lib=yes])
if test x$have_lib = x; then
AC_MSG_ERROR(["Can't link with library '$4'. We were abused by $2.
Aborting."])
fi
CFLAGS=$sav_CFLAGS
LDFLAGS=$sav_LDFLAGS
])
AC_SUBST([$1_CFLAGS], [`${$1_CONFIG} --cflags`])
AC_SUBST([$1_LIBS], [`${$1_CONFIG} --libs`])
])dnl !E_CHECK_PACKAGE