Messing around with the autojungle. Fixing/cleaning up the acinclude
authorFabian Groffen <grobian@gentoo.org>
Fri, 9 Feb 2007 22:23:48 +0000 (22:23 -0000)
committerFabian Groffen <grobian@gentoo.org>
Fri, 9 Feb 2007 22:23:48 +0000 (22:23 -0000)
file.  Add functions for things we need.  Dropped many tests for tools
that are never used by portage.  We require GNU versions of some core
tools now.  This should help me stop wasting time on crappy
implementations of vital tools.

svn path=/main/branches/prefix/; revision=5932

acinclude.m4
configure.in

index a659ee7240b7832d1a83c613c082b4db83a1f21a..499d068dd268709244c7ee2244a65d337153d020 100644 (file)
@@ -12,188 +12,74 @@ dnl PARTICULAR PURPOSE.
 
 dnl ______  ______
 
-dnl ______ /usr/share/aclocal/djmitche/ax_with_python.m4 ______
-dnl @synopsis AX_WITH_PYTHON([minimum-version], [value-if-not-found], [path])
-dnl 
-dnl Locates an installed Python binary, placing the result in the precious
-dnl variable $PYTHON.  Accepts a present $PYTHON, then --with-python, and failing
-dnl that searches for python in the given path (which defaults to the system
-dnl path).  If python is found, $PYTHON is set to the full path of the binary; if
-dnl it is not found, $PYTHON is set to VALUE-IF-NOT-FOUND, which defaults to
-dnl 'python'.
-dnl 
-dnl Example:
-dnl
-dnl   AX_WITH_PYTHON(2.2, missing)
-dnl
-dnl @author Dustin Mitchell <dustin@cs.uchicago.edu>
-dnl @version %Id: %
-
-AC_DEFUN([AX_WITH_PYTHON],
+dnl GENTOO_PATH_PYTHON([minimum-version], [path])
+dnl author: Fabian Groffen <grobian a gentoo.org>
+AC_DEFUN([GENTOO_PATH_PYTHON],
 [
-  AC_ARG_VAR([PYTHON])
- 
-  dnl unless PYTHON was supplied to us (as a precious variable)
-  if test -z "$PYTHON"
-  then
-    AC_MSG_CHECKING(for --with-python)
-    AC_ARG_WITH(python,
-                AC_HELP_STRING([--with-python=PYTHON],
-                               [absolute path name of Python executable]),
-                [ if test "$withval" != "yes"
-                  then
-                    PYTHON="$withval"
-                    AC_MSG_RESULT($withval)
-                  else
-                    AC_MSG_RESULT(no)
-                  fi
-                ],
-                [ AC_MSG_RESULT(no)
-                ])
-  fi
+  AC_PATH_PROG([PYTHON], [python], no, $2)
 
-  dnl if it's still not found, check the paths, or use the fallback
-  if test -z "$PYTHON" 
-  then
-    AC_PATH_PROG([PYTHON], python, m4_ifval([$2],[$2],[python]), $3)
+  dnl is is there at all?
+  if test "$PYTHON" = "no" ; then
+    AC_MSG_ERROR([no python found in your path])
   fi
 
-  dnl check version if required
-  m4_ifvaln([$1], [
-    dnl do this only if we didn't fall back
-    if test "$PYTHON" != "m4_ifval([$2],[$2],[python])"
-    then
-      AC_MSG_CHECKING($PYTHON version >= $1)
-      if test `$PYTHON -c ["import sys; print sys.version[:3] >= \"$1\" and \"OK\" or \"OLD\""]` = "OK"
-      then
-        AC_MSG_RESULT(ok)
-      else
-        AC_MSG_RESULT(no)
-        PYTHON="$2"
-      fi
-    fi])
+  dnl is it the version we want?
+  ver=`$PYTHON -c 'import sys; print sys.version.split(" ")[[0]]'`
+  AC_MSG_CHECKING([whether $PYTHON $ver >= $1])
+  cmp=`$PYTHON -c 'import sys; print sys.version.split(" ")[[0]] >= "$1"'`
+  if test "$cmp" = "True" ; then
+    AC_MSG_RESULT([yes])
+  else
+    AC_MSG_ERROR([need at least version $1 of python])
+  fi
 ])
 
-dnl ______ /usr/share/aclocal/Installed_Packages/ac_prog_perl_version.m4 ______
-dnl @synopsis AC_PROG_PERL_VERSION(VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
-dnl
-dnl Makes sure that perl supports the version indicated. If true the shell
-dnl commands in ACTION-IF-TRUE are executed.  If not the shell commands in
-dnl ACTION-IF-FALSE are run.   Note if $PERL is not set (for example by
-dnl running AC_CHECK_PROG or AC_PATH_PROG), AC_CHECK_PROG(PERL, perl, perl) will
-dnl be run.
-dnl
-dnl Example:
-dnl
-dnl   AC_PROG_PERL_VERSION(5.6.0)
-dnl
-dnl This will check to make sure that the perl you have supports at least
-dnl version 5.6.0.
-dnl
-dnl @version %Id: ac_prog_perl_version.m4,v 1.1 2002/12/12 23:14:52 guidod Exp %
-dnl @author Dean Povey <povey@wedgetail.com>
-dnl
-AC_DEFUN([AC_PROG_PERL_VERSION],[dnl
-# Make sure we have perl
-if test -z "$PERL"; then
-AC_CHECK_PROG(PERL,perl,perl)
-fi
+dnl GENTOO_PATH_XCU_ID([path])
+dnl author: Fabian Groffen <grobian a gentoo.org>
+dnl         based on the original work by
+dnl         Michael Haubenwallner <mhaubi at users dot sourceforge dot net>
+AC_DEFUN([GENTOO_PATH_XCU_ID],
+[
+  AC_PATH_PROG([XCU_ID], [id], no, $1)
 
-# Check if version of Perl is sufficient
-ac_perl_version="$1"
+  dnl is is there at all?
+  if test "$PYTHON" = "no" ; then
+    AC_MSG_ERROR([no python found in your path])
+  fi
 
-if test "x$PERL" != "x"; then
-  AC_MSG_CHECKING(for perl version greater than or equal to $ac_perl_version)
-  # NB: It would be nice to log the error if there is one, but we cannot rely
-  # on autoconf internals
-  $PERL -e "use $ac_perl_version;" > /dev/null 2>&1
-  if test $? -ne 0; then
-    AC_MSG_RESULT(no);
-    $3
+  dnl does it support all the bells and whistles we need?
+  AC_MSG_CHECKING([whether $XCU_ID is good enough])
+  for a in '' '-G' '-Gn' '-g' '-gn' '-gr' '-gnr' '-u' '-un' '-ur' '-unr' ; do
+    "$XCU_ID" $a >/dev/null 2>&1 || { XCU_ID=no ; break ; }
+  done
+  if test "$XCU_ID" != "no" ; then
+    AC_MSG_RESULT([yes])
   else
-    AC_MSG_RESULT(ok);
-    $2
+    AC_MSG_ERROR([$XCU_ID doesn't understand $a])
   fi
-else
-  AC_MSG_WARN(could not find perl)
-fi
 ])dnl
 
+dnl GENTOO_PATH_GNUPROG([variable], [prog-to-check-for], [path])
+dnl author: Fabian Groffen <grobian a gentoo.org>
+AC_DEFUN([GENTOO_PATH_GNUPROG],
+[
+  AC_PATH_PROG([$1], [$2], no, $3)
 
-dnl ______ acpackage.m4 ______
-dnl @synopsis AX_PATH_XCU_ID
-dnl
-dnl Find the correct 'id' programm which accepts the arguments specified
-dnl in http://www.opengroup.org/onlinepubs/007908799/xcu/id.html
-dnl SunOS for example has this one in /usr/xpg4/bin, not /usr/bin
-dnl
-dnl This does AC_SUBST(XCU_ID) and accepts an absolute path
-dnl to be preset in XCU_ID variable.
-dnl If no id program is found, XCU_ID is left empty, not the word 'no'.
-dnl
-dnl Q: Why is it called 'XCU_ID' ?
-dnl A: The name 'ID' might be misunderstood, so i decided 'XCU_ID'.
-dnl    XCU is the section where the specification of 'id' resides in at
-dnl    opengroup.org, whereof 'CU' is synonym for "commandline utilities".
-dnl
-dnl @version $Id$
-dnl
-dnl @author Michael Haubenwallner <mhaubi at users dot sourceforge dot net>
-dnl
-AC_DEFUN([AX_PATH_XCU_ID],[dnl
-  AC_CACHE_CHECK([for a SUSv2-compatible xcu id], [ax_cv_path_XCU_ID],
-  [case $XCU_ID in
-  [[\\/]]* | ?:[[\\/]]*)
-    # Let the user override the test with a path.
-    ax_cv_path_XCU_ID="$XCU_ID"
+  dnl is is there at all?
+  tool="`eval echo \$$1`"
+  if test "$tool" = "no" ; then
+    AC_MSG_ERROR([$1 was not found in your path])
+  fi
+
+  dnl is it a GNU version?
+  AC_MSG_CHECKING([whether $tool is GNU $2])
+  ver=`$tool --version 2>/dev/null | head -n 1`
+  case $ver in
+    *GNU*)
+      AC_MSG_RESULT([yes])
     ;;
-  *)
-    save_IFS=${IFS}
-    ax_cv_path_XCU_ID=no
-    IFS=':'
-    for p in ${PATH}:/usr/bin:/usr/xpg4/bin
-    do
-      IFS=${save_IFS}
-      test -x "${p}/id" || continue
-      ax_cv_path_XCU_ID="${p}/id"
-      for a in '' '-G' '-Gn' '-g' '-gn' '-gr' '-gnr' '-u' '-un' '-ur' '-unr'
-      do
-        "${ax_cv_path_XCU_ID}" ${a} >/dev/null 2>&1 \
-        || { ax_cv_path_XCU_ID=no ; break ; }
-      done
-      test "x${ax_cv_path_XCU_ID}" = "xno" || break
-    done
-    IFS=${save_IFS}
+    *)
+      AC_MSG_ERROR([no])
     ;;
-  esac])
-  XCU_ID="${ax_cv_path_XCU_ID}"
-  test "x${XCU_ID}" != "xno" || XCU_ID=
-  test "$1:${XCU_ID}" != "required:"dnl
-  || AC_MSG_ERROR([SUSv2-compatible id not found (use XCU_ID=/path/to/id).])
-  AC_SUBST(XCU_ID)dnl
-])dnl
-
-dnl @synopsis AX_PATH_EGREP
-dnl
-dnl Much like AC_PROG_EGREP, but set output variable EGREP to an absolute path.
-dnl
-dnl Example:
-dnl
-dnl   AX_PATH_EGREP
-dnl
-dnl This let EGREP be the absolute path for egrep
-dnl
-dnl @version %Id:%
-dnl @author Michael Haubenwallner <mhaubi at users dot sf dot net>
-dnl
-AC_DEFUN([AX_PATH_EGREP],[dnl
-  AC_REQUIRE([AC_PROG_EGREP])dnl
-  set dummy ${EGREP}
-  egrep=[$]2 ; shift ; shift
-  egrep_args=[$]*
-  EGREP=
-  AC_PATH_PROG(EGREP, [${egrep}])
-  EGREP="${EGREP} ${egrep_args}"
-])dnl
-
-
+  esac
+])
index f9b0c8e6b629b7953396e1973dce7c1651ed340e..311a859c98f8bb462c1876342b6daf6f399076ee 100644 (file)
@@ -1,14 +1,7 @@
 dnl Process this file with autoconf to produce a configure script.
 AC_INIT(portage, 2.1.20, grobian@gentoo.org, portage-prefix)
 
-AC_PREREQ([2.60])
-
-dnl Define our precious vars
-dnl AC_ARG_VAR(prefix, the location portage will be installed to)
-dnl AC_ARG_VAR(offset-prefix, the location all packages will be installed to)
-dnl AC_ARG_VAR(rootuser, the user that pwns portage)
-dnl AC_ARG_VAR(portageuser, the user that portage will operate as [defaults to 'portage'])
-dnl AC_ARG_VAR(portagegroup, the group that portage will operate under [defaults to 'portage'])
+AC_PREREQ([2.61])
 
 case "${prefix}" in
        '')     AC_MSG_ERROR([bad value ${prefix} for --prefix, must not be empty]) ;;
@@ -22,83 +15,37 @@ AC_CANONICAL_HOST
 AC_CANONICAL_TARGET
 
 AM_INIT_AUTOMAKE
-dnl AM_CONFIG_HEADER(config.h)
 
 dnl Checks for programs.
-dnl store clfags prior, otherwise it's not propogaed.
+dnl store clfags prior, otherwise it's not propagated.
 if test "x$CFLAGS" != "x"
 then
 CFLAGS=$CFLAGS
 fi
 
 AC_PREFIX_DEFAULT([/usr])
+
 AC_PROG_CC
 AC_PROG_INSTALL
 AC_PROG_LN_S
-AX_PATH_EGREP
-case `${EGREP} --version 2>/dev/null` in
-*"GNU grep"*) ;;
-*)
-       AC_MSG_ERROR([Need GNU grep for ${EGREP}])
-       ;;
-esac
-
-AX_PATH_XCU_ID([required])
-AC_PATH_PROGS(RM, [grm gnurm rm], /bin/rm)
-AC_PATH_PROGS(MV, [gmv gnumv mv], /bin/mv)
-AC_PATH_PROGS(SED, [gsed gnused sed], /usr/bin/sed)
-
-dnl when /bin/sh is bash, then BASH is set to /bin/sh
-test "${BASH}" != "/bin/sh" || $as_unset BASH
-AC_PATH_PROGS(BASH, [bash2 bash], /bin/bash)
-
-dnl >=python-2.4, but prefer path .../python
-AC_PATH_PROG(PYTHON, [python], /usr/bin/python)
-AX_WITH_PYTHON([2.4], [missing])
-if test "x${PYTHON}" = "xmissing"; then
-       PYTHON=
-       AC_PATH_PROGS(PYTHON,
-                         [python2.4 python2.3 python2 python],
-                         [/usr/bin/python])
-       AX_WITH_PYTHON([2.4], [missing])
-fi
-if test "x${PYTHON}" = "xmissing"; then
-       AC_MSG_ERROR([cannot find python version >= 2.4])
-fi
-
-AC_PATH_PROG(PERL, perl, [/usr/bin/perl])
-AC_PROG_PERL_VERSION([5.6.0], , [PERL=])
-if test "x${PERL}" = "x"; then
-       AC_PATH_PROGS(PERL, [perl5.8.6 perl5.8.5 perl5.8.4 perl5.8.3 perl5.8.2 \
-               perl5.8.1 perl5.8.0 perl5.8 perl5.6.1 perl5.6.0 perl5.6 perl5 perl],
-               [/usr/bin/perl])
-       AC_PROG_PERL_VERSION([5.6.0], ,
-               [AC_MSG_ERROR([cannot find a perl version >= 5.6.0])]
-       )
-fi
+AC_PROG_EGREP
+
+GENTOO_PATH_XCU_ID()
+GENTOO_PATH_PYTHON([2.4])
+
+AC_PATH_PROG(RM, [rm], no)
+AC_PATH_PROG(MV, [mv], no)
+AC_PATH_PROG(BASENAME, [basename], no)
+AC_PATH_PROG(DIRNAME, [dirname], no)
+dnl avoid bash internal variable messing up things here
+unset BASH
+GENTOO_PATH_GNUPROG(BASH, [bash])
+GENTOO_PATH_GNUPROG(SED, [sed])
+GENTOO_PATH_GNUPROG(WGET, [wget])
+GENTOO_PATH_GNUPROG(FIND, [find])
+GENTOO_PATH_GNUPROG(XARGS, [xargs])
+GENTOO_PATH_GNUPROG(GREP, [grep])
 
-AC_PATH_PROGS(BASENAME, [gbasename gnubasename basename], /bin/basename)
-AC_PATH_PROGS(DIRNAME, [gdirname gnudirname dirname], /usr/bin/dirname)
-AC_PATH_PROG(DIALOG, dialog, no)
-AC_PATH_PROG(WGET, wget, /usr/bin/wget)
-AC_PATH_PROG(CURL, curl, no)
-AC_PATH_PROG(INSTALL_INFO, install-info, /usr/bin/install-info)
-AC_PATH_PROG(SANDBOX, sandbox, no)
-AC_PATH_PROG(PRELINK, prelink, no)
-AC_PATH_PROG(RSYNC, rsync, /usr/bin/rsync)
-AC_PATH_PROG(CVS, cvs, /usr/bin/cvs)
-AC_PATH_PROG(SVN, svn, no)
-AC_PATH_PROGS(GPG, [gpg pgp], no)
-AC_PATH_PROG(MD5SUM, md5sum, no)
-AC_PATH_PROG(LOGGER, logger, no)
-AC_PATH_PROGS(FIND, [gfind gnufind find], /usr/bin/find)
-AC_PATH_PROGS(FILE, [gfile gnufile file], /usr/bin/file)
-AC_PATH_PROG(SCANELF, scanelf, no)
-AC_PATH_PROG(SETFILES, setfiles, no)
-AC_PATH_PROG(FAKEROOT, fakeroot, no)
-AC_PATH_PROGS(DIFF, [gdiff gnudiff diff], /usr/bin/diff)
-AC_PATH_PROGS(PATCH, [gpatch gnupatch patch], /usr/bin/patch)
-AC_PATH_PROGS(XARGS, [gxargs gnuxargs xargs], /usr/bin/xargs)
 dnl Checks for libraries.
 dnl Replace `main' with a function in -lc:
 AC_CHECK_LIB(c, main)