m4 junk
authorCarsten Haitzler <raster@rasterman.com>
Thu, 24 Jun 2004 05:59:57 +0000 (05:59 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Thu, 24 Jun 2004 05:59:57 +0000 (05:59 +0000)
SVN revision: 10573

legacy/embryo/autogen.sh
legacy/embryo/m4/ac_expand_dir.m4 [new file with mode: 0644]
legacy/embryo/m4/ac_path_generic.m4 [new file with mode: 0644]

index 778fc5b..88ee7f3 100755 (executable)
 #!/bin/sh
-# Run this to generate all the initial makefiles, etc.
 
-srcdir=`dirname $0`
-PKG_NAME="the package."
+rm -rf autom4te.cache
+rm -f aclocal.m4
 
-DIE=0
+echo "Running aclocal..."; aclocal $ACLOCAL_FLAGS -I m4 \
+&& echo "Running autoheader..."; autoheader \
+&& echo "Running autoconf..."; autoconf \
+&& echo "Running libtoolize..."; libtoolize --automake \
+&& echo "Running automake..."; automake --add-missing --copy --gnu
 
-(autoconf --version) < /dev/null > /dev/null 2>&1 || {
-  echo
-  echo "**Error**: You must have \`autoconf' installed to."
-  echo "Download the appropriate package for your distribution,"
-  echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
-  DIE=1
-}
-
-(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
-  (libtoolize --version) < /dev/null > /dev/null 2>&1 || {
-    echo
-    echo "**Error**: You must have \`libtool' installed."
-    echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
-    echo "(or a newer version if it is available)"
-    DIE=1
-  }
-}
-
-grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && {
-  grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
-  (gettext --version) < /dev/null > /dev/null 2>&1 || {
-    echo
-    echo "**Error**: You must have \`gettext' installed."
-    echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
-    echo "(or a newer version if it is available)"
-    DIE=1
-  }
-}
-
-(automake --version) < /dev/null > /dev/null 2>&1 || {
-  echo
-  echo "**Error**: You must have \`automake' installed."
-  echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
-  echo "(or a newer version if it is available)"
-  DIE=1
-  NO_AUTOMAKE=yes
-}
-
-
-# if no automake, don't bother testing for aclocal
-test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
-  echo
-  echo "**Error**: Missing \`aclocal'.  The version of \`automake'"
-  echo "installed doesn't appear recent enough."
-  echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
-  echo "(or a newer version if it is available)"
-  DIE=1
-}
-
-if test "$DIE" -eq 1; then
-  exit 1
-fi
-
-if test -z "$*"; then
-  echo "**Warning**: I am going to run \`configure' with no arguments."
-  echo "If you wish to pass any to it, please specify them on the"
-  echo \`$0\'" command line."
-  echo
-fi
-
-case $CC in
-xlc )
-  am_opt=--include-deps;;
-esac
-
-for coin in `find $srcdir -name configure.in -print`
-do 
-  dr=`dirname $coin`
-  if test -f $dr/NO-AUTO-GEN; then
-    echo skipping $dr -- flagged as no auto-gen
-  else
-    echo processing $dr
-    macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < $coin`
-    ( cd $dr
-      aclocalinclude="$ACLOCAL_FLAGS"
-      for k in $macrodirs; do
-       if test -d $k; then
-          aclocalinclude="$aclocalinclude -I $k"
-       ##else 
-       ##  echo "**Warning**: No such directory \`$k'.  Ignored."
-        fi
-      done
-      if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then
-       if grep "sed.*POTFILES" configure.in >/dev/null; then
-         : do nothing -- we still have an old unmodified configure.in
-       else
-         echo "Creating $dr/aclocal.m4 ..."
-         test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
-         echo "Running gettextize...  Ignore non-fatal messages."
-         echo "no" | gettextize --force --copy
-         echo "Making $dr/aclocal.m4 writable ..."
-         test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
-        fi
-      fi
-      if grep "^AM_GNOME_GETTEXT" configure.in >/dev/null; then
-       echo "Creating $dr/aclocal.m4 ..."
-       test -r $dr/aclocal.m4 || touch $dr/aclocal.m4
-       echo "Running gettextize...  Ignore non-fatal messages."
-       echo "no" | gettextize --force --copy
-       echo "Making $dr/aclocal.m4 writable ..."
-       test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4
-      fi
-      if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
-       echo "Running libtoolize..."
-       libtoolize --force --copy
-      fi
-      echo "Running aclocal $aclocalinclude ..."
-      aclocal $aclocalinclude
-      if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
-       echo "Running autoheader..."
-       autoheader
-      fi
-      echo "Running automake --gnu $am_opt ..."
-      automake --add-missing --gnu $am_opt
-      echo "Running autoconf ..."
-      autoconf
-    )
-  fi
-done
-
-#conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
-
-if test x$NOCONFIGURE = x; then
-  echo Running $srcdir/configure $conf_flags "$@" ...
-  $srcdir/configure $conf_flags "$@" \
-  && echo Now type \`make\' to compile $PKG_NAME
-else
-  echo Skipping configure process.
-fi
+###  If you want this, uncomment it.
+./configure "$@"
diff --git a/legacy/embryo/m4/ac_expand_dir.m4 b/legacy/embryo/m4/ac_expand_dir.m4
new file mode 100644 (file)
index 0000000..b5599a0
--- /dev/null
@@ -0,0 +1,14 @@
+dnl AC_EXPAND_DIR(VARNAME, DIR)
+dnl expands occurrences of ${prefix} and ${exec_prefix} in the given DIR,
+dnl and assigns the resulting string to VARNAME
+dnl example: AC_DEFINE_DIR(DATADIR, "$datadir")
+dnl by Alexandre Oliva <oliva@dcc.unicamp.br>
+AC_DEFUN([AC_EXPAND_DIR], [
+       $1=$2
+       $1=`(
+           test "x$prefix" = xNONE && prefix="$ac_default_prefix"
+           test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
+           eval echo \""[$]$1"\"
+           )`
+])
+
diff --git a/legacy/embryo/m4/ac_path_generic.m4 b/legacy/embryo/m4/ac_path_generic.m4
new file mode 100644 (file)
index 0000000..27b55b3
--- /dev/null
@@ -0,0 +1,136 @@
+dnl @synopsis AC_PATH_GENERIC(LIBRARY [, MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl
+dnl Runs a LIBRARY-config script and defines LIBRARY_CFLAGS and LIBRARY_LIBS
+dnl
+dnl The script must support `--cflags' and `--libs' args.
+dnl If MINIMUM-VERSION is specified, the script must also support the
+dnl `--version' arg.
+dnl If the `--with-library-[exec-]prefix' arguments to ./configure are given,
+dnl it must also support `--prefix' and `--exec-prefix'.
+dnl (In other words, it must be like gtk-config.)
+dnl
+dnl For example:
+dnl
+dnl    AC_PATH_GENERIC(Foo, 1.0.0)
+dnl
+dnl would run `foo-config --version' and check that it is at least 1.0.0
+dnl
+dnl If so, the following would then be defined:
+dnl
+dnl    FOO_CFLAGS to `foo-config --cflags`
+dnl    FOO_LIBS   to `foo-config --libs`
+dnl
+dnl At present there is no support for additional "MODULES" (see AM_PATH_GTK)
+dnl (shamelessly stolen from gtk.m4 and then hacked around a fair amount)
+dnl
+dnl @author Angus Lees <gusl@cse.unsw.edu.au>
+
+AC_DEFUN([AC_PATH_GENERIC],
+[dnl
+dnl we're going to need uppercase, lowercase and user-friendly versions of the
+dnl string `LIBRARY'
+pushdef([UP], translit([$1], [a-z], [A-Z]))dnl
+pushdef([DOWN], translit([$1], [A-Z], [a-z]))dnl
+
+dnl
+dnl Get the cflags and libraries from the LIBRARY-config script
+dnl
+AC_ARG_WITH(DOWN-prefix,[  --with-]DOWN[-prefix=PFX       Prefix where $1 is installed (optional)],
+        DOWN[]_config_prefix="$withval", DOWN[]_config_prefix="")
+AC_ARG_WITH(DOWN-exec-prefix,[  --with-]DOWN[-exec-prefix=PFX Exec prefix where $1 is installed (optional)],
+        DOWN[]_config_exec_prefix="$withval", DOWN[]_config_exec_prefix="")
+
+  if test x$DOWN[]_config_exec_prefix != x ; then
+     DOWN[]_config_args="$DOWN[]_config_args --exec-prefix=$DOWN[]_config_exec_prefix"
+     if test x${UP[]_CONFIG+set} != xset ; then
+       UP[]_CONFIG=$DOWN[]_config_exec_prefix/bin/DOWN-config
+     fi
+  fi
+  if test x$DOWN[]_config_prefix != x ; then
+     DOWN[]_config_args="$DOWN[]_config_args --prefix=$DOWN[]_config_prefix"
+     if test x${UP[]_CONFIG+set} != xset ; then
+       UP[]_CONFIG=$DOWN[]_config_prefix/bin/DOWN-config
+     fi
+  fi
+
+  AC_PATH_PROG(UP[]_CONFIG, DOWN-config, no)
+  ifelse([$2], ,
+     AC_MSG_CHECKING(for $1),
+     AC_MSG_CHECKING(for $1 - version >= $2)
+  )
+  no_[]DOWN=""
+  if test "$UP[]_CONFIG" = "no" ; then
+     no_[]DOWN=yes
+  else
+     UP[]_CFLAGS="`$UP[]_CONFIG $DOWN[]_config_args --cflags`"
+     UP[]_LIBS="`$UP[]_CONFIG $DOWN[]_config_args --libs`"
+     ifelse([$2], , ,[
+        DOWN[]_config_major_version=`$UP[]_CONFIG $DOWN[]_config_args \
+         --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+        DOWN[]_config_minor_version=`$UP[]_CONFIG $DOWN[]_config_args \
+         --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+        DOWN[]_config_micro_version=`$UP[]_CONFIG $DOWN[]_config_args \
+         --version | sed 's/[[^0-9]]*\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+        DOWN[]_wanted_major_version="regexp($2, [\<\([0-9]*\)], [\1])"
+        DOWN[]_wanted_minor_version="regexp($2, [\<\([0-9]*\)\.\([0-9]*\)], [\2])"
+        DOWN[]_wanted_micro_version="regexp($2, [\<\([0-9]*\).\([0-9]*\).\([0-9]*\)], [\3])"
+
+        # Compare wanted version to what config script returned.
+        # If I knew what library was being run, i'd probably also compile
+        # a test program at this point (which also extracted and tested
+        # the version in some library-specific way)
+        if test "$DOWN[]_config_major_version" -lt \
+                        "$DOWN[]_wanted_major_version" \
+          -o \( "$DOWN[]_config_major_version" -eq \
+                        "$DOWN[]_wanted_major_version" \
+            -a "$DOWN[]_config_minor_version" -lt \
+                        "$DOWN[]_wanted_minor_version" \) \
+          -o \( "$DOWN[]_config_major_version" -eq \
+                        "$DOWN[]_wanted_major_version" \
+            -a "$DOWN[]_config_minor_version" -eq \
+                        "$DOWN[]_wanted_minor_version" \
+            -a "$DOWN[]_config_micro_version" -lt \
+                        "$DOWN[]_wanted_micro_version" \) ; then
+          # older version found
+          no_[]DOWN=yes
+          echo -n "*** An old version of $1 "
+          echo -n "($DOWN[]_config_major_version"
+          echo -n ".$DOWN[]_config_minor_version"
+          echo    ".$DOWN[]_config_micro_version) was found."
+          echo -n "*** You need a version of $1 newer than "
+          echo -n "$DOWN[]_wanted_major_version"
+          echo -n ".$DOWN[]_wanted_minor_version"
+          echo    ".$DOWN[]_wanted_micro_version."
+          echo "***"
+          echo "*** If you have already installed a sufficiently new version, this error"
+          echo "*** probably means that the wrong copy of the DOWN-config shell script is"
+          echo "*** being found. The easiest way to fix this is to remove the old version"
+          echo "*** of $1, but you can also set the UP[]_CONFIG environment to point to the"
+          echo "*** correct copy of DOWN-config. (In this case, you will have to"
+          echo "*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf"
+          echo "*** so that the correct libraries are found at run-time)"
+        fi
+     ])
+  fi
+  if test "x$no_[]DOWN" = x ; then
+     AC_MSG_RESULT(yes)
+     ifelse([$3], , :, [$3])
+  else
+     AC_MSG_RESULT(no)
+     if test "$UP[]_CONFIG" = "no" ; then
+       echo "*** The DOWN-config script installed by $1 could not be found"
+       echo "*** If $1 was installed in PREFIX, make sure PREFIX/bin is in"
+       echo "*** your path, or set the UP[]_CONFIG environment variable to the"
+       echo "*** full path to DOWN-config."
+     fi
+     UP[]_CFLAGS=""
+     UP[]_LIBS=""
+     ifelse([$4], , :, [$4])
+  fi
+  AC_SUBST(UP[]_CFLAGS)
+  AC_SUBST(UP[]_LIBS)
+
+  popdef([UP])
+  popdef([DOWN])
+])
+