The main big issue with 'platform-neutral' static source files, that they tend to
grow with tons of #ifdef-s over time, reducing readability and creating a mess.
My point is that one or another way you have to deal with platform differences,
but not .m4 files, or .cmake files, or writing a medium novel long configuration files
using strange (better to say weird) scripting DSL.
I can express all build process logic in smalltalk, which does not lessens the amount
of work to deal with all platform nuances and dependencies etc, but at least it allows me to organize and shape it
into some manageable form, which is easy to change & learn.
And another difference is, that i prefer working with browser & classes than
with dozens of directories and files lying here and there.
But sure thing, it is a question of taste. If you prefer to maintain this:
-------------------------
MACRO (INTERNAL_PLUGIN plugin)
SET (plugin_sources "")
IF (DEFINED ${plugin}_sources)
SET (plugin_sources ${${plugin}_sources})
ELSE (DEFINED ${plugin}_sources)
FOREACH (dir ${src}/vm/intplugins ${cross}/plugins ${unix}/plugins)
SET (tmp "")
AUX_SOURCE_DIRECTORY (${dir}/${plugin} tmp)
STRING_APPEND (plugin_sources "${tmp}")
ENDFOREACH (dir)
ENDIF (DEFINED ${plugin}_sources)
IF (DEFINED ${plugin}_extra_sources)
STRING_APPEND (plugin_sources "${${plugin}_extra_sources}")
ENDIF (DEFINED ${plugin}_extra_sources)
FILE (WRITE ${bld}/${plugin}/CMakeLists.in "")
FOREACH (dir ${unix}/plugins ${unix})
FILE_APPEND (${bld}/${plugin}/CMakeLists.in ${dir}/${plugin}/build.cmake)
ENDFOREACH (dir)
FILE_APPEND (${bld}/${plugin}/CMakeLists.in ${config}/PluginInternal.cmake)
CONFIGURE_FILE (${bld}/${plugin}/CMakeLists.in ${bld}/${plugin}/CMakeLists.txt @ONLY)
ADD_SUBDIRECTORY (${bld}/${plugin} ${bld}/${plugin})
ENDMACRO (INTERNAL_PLUGIN)
--------------------------
And/or this:
--------------------------
AC_INIT([
config.h.in])
SVNREV=`grep '\$Rev: ' ${srcdir}/../../../platforms/Cross/vm/sqSCCSVersion.h \
| sed 's/.*$Rev: \([[0-9]][[0-9]]*\).*/\1/'`
AC_VM_VERSION(4,0,${SVNREV},4,2,0)
topdir=`cd ${srcdir}/../../..; pwd`
cfgdir=`cd ${srcdir}; pwd`
AC_ARG_WITH(src,
[ --with-src=dir generated src directory [default=src]],
[ vmmsrc="${with_src}"],
[ vmmsrc="src"])
vmmdir="${topdir}/${vmmsrc}"
if test ! -d "${topdir}/${vmmsrc}"; then
if test -d "${topdir}/platforms/unix/${vmmsrc}"; then
vmmdir="${topdir}/platforms/unix/${vmmsrc}"
AC_MSG_RESULT([using built-in src directory])
fi
fi
AC_MSG_RESULT(${vmmdir})
blddir=`pwd`
AC_ARG_WITH(vmmcfg,
[ --with-vmmcfg=dir vm configuration directory containing
plugins.int and plugins.ext [default=.]],
[ vmmcfg="${with-vmmcfg}"],
[ vmmcfg="${blddir}"])
# Compiling a Cogit VM or not? If so, need a cogit$o, cointerp, etc.
AC_ARG_ENABLE(cogit,
[ --enable-cogit compile a cogit VM [default=yes]],
cogit="no", cogit="yes")
AC_SUBST(cogit)
#AC_ARG_ENABLE(jit,
#[ --enable-jit enable J4 support [default=no]],
#JIT="yes", JIT="no")
#
#test $JIT = "yes" && J_CFLAGS="-DJ_ENABLED"
#AC_SUBST(J_CFLAGS)
# Check the generated src dir looks sane
AC_CHECK_VMM_DIR
AC_SUBST(topdir)
AC_SUBST(cfgdir)
AC_SUBST(vmmdir)
AC_SUBST(vmmcfg)
AC_SUBST(blddir)
SQ_VERSION=${SQ_MAJOR}.${SQ_MINOR}-${SQ_UPDATE}
AC_DEFINE_UNQUOTED(SQ_VERSION, "${SQ_VERSION}")
AC_SUBST(SQ_MAJOR)
AC_SUBST(SQ_MINOR)
AC_SUBST(SQ_UPDATE)
AC_SUBST(SQ_VERSION)
VM_VERSION=${VM_MAJOR}.${VM_MINOR}-${VM_RELEASE}
AC_DEFINE_UNQUOTED(VM_VERSION, "${VM_VERSION}")
AC_SUBST(VM_MAJOR)
AC_SUBST(VM_MINOR)
AC_SUBST(VM_RELEASE)
AC_SUBST(VM_VERSION)
# libdir contains ${exec_prefix}, so we have to default and expand early
test "x$prefix" = xNONE && prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
imgdir=`eval echo ${libdir}/squeak`
expanded_relative_imgdir=`eval echo lib/squeak/${VM_VERSION}`
plgdir='${imgdir}/'`eval echo ${VM_VERSION}`
AC_SUBST(imgdir)
AC_SUBST(expanded_relative_imgdir)
AC_SUBST(plgdir)
AC_DEFINE(OS_TYPE, "unix")
AC_CANONICAL_HOST
host_cpu=`echo $host | sed 's,-.*,,'`
host=`echo $host | sed 's,-unknown,,'`
AC_SUBST(host)
AC_SUBST(host_cpu)
AC_SUBST(host_vendor)
AC_SUBST(host_os)
----------------------------
instead of plain smalltalk code, it is up to you.
But that's about 'too much' for my taste.