[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CC=cc ./configure or ./configure CC=cc

From: Ralf Wildenhues
Subject: Re: CC=cc ./configure or ./configure CC=cc
Date: Tue, 8 Aug 2006 18:24:22 +0200
User-agent: Mutt/1.5.11

Hello Bruno,

* Bruno Haible wrote on Tue, Aug 08, 2006 at 04:32:55PM CEST:
> 3) A recommendation to use VAR=value in the configure command line will
>    not work with some 'configure' scripts that comply to GNU standards
>    but are not generated by autoconf. For example, GNU clisp's toplevel
>    configure script is written by hand and does not support VAR=value.
>    In other words, if you want to make universal recommendations, they
>    should IMO be based on the GNU standards.

While at it, here's a quick and little-tested patch for clisp's toplevel
configure, still missing a documentation adjustment, which I've not had
the time to do, sorry (it's not obvious to me what documentation needs
to be changed).  Feel free to forward this to the appropriate place, or
tell me what to do so that this can go in (adding an item to ?).

FWIW, the `|| :' is to cater for the `set -e'; writing
  if var=`$cmd`; then ...

is nicer, but not as portable; see the Autoconf manual.

FWIW2, I would recommend to move to quoting $subdir_configure_args in a
manner that Autoconf does as well.  Or just move to an
Autoconf-generated script in the first place.  Oh well...


        * configure: rewrite to accept variable settings on the command
        line, just like Autoconf-generated configure scripts do, while
        remaining backward compatible for arguments that do not look
        like variable assignments.

Index: configure
RCS file: /cvsroot/clisp/clisp/configure,v
retrieving revision 1.101
diff -u -r1.101 configure
--- configure   4 Aug 2006 00:21:13 -0000       1.101
+++ configure   8 Aug 2006 16:22:39 -0000
@@ -2,8 +2,8 @@
 # Usage: configure [options] [dirname [cc]]
 # Examples:
 #   configure obj
-#   CC=gcc configure make.gcc
-#   CC=cc configure
+#   configure CC=gcc make.gcc
+#   configure CC=cc
 #   configure make.gcc gcc     (deprecated)
 #   configure cc       (deprecated)
@@ -27,7 +27,7 @@
 dirname: Name of directory in which to build CLISP. This allows you to build
          CLISP with different compilers on the same machine or for different
          architectures in the same filesystem, sharing the same source.
-         Default is "src".
+         Default is "src".  The name should not contain `='.
 options: The following options are recognized:
   --help                print this message and exit
   --version             print the CLISP version and exit
@@ -93,6 +93,8 @@
                         (needed on HP-UX and OpenBSD)
   --edit-config         edit config.lisp with ${EDITOR:-vi} before make
                         (useful with --build and --install)
   configure --build built-with-gcc
   su bin
@@ -100,14 +102,12 @@
 Specifying the C compiler:
   If you wish to specify the C compiler that will get used to build
-  CLISP, set the environment variables CC, CFLAGS, LIBS.
+  CLISP, set the variables CC, CFLAGS, LIBS on the command line.
   Put compiler flags that have to be passed to the preprocessor
   into the CC variable, not the CFLAGS variable.
   For example, if you want to use gcc in ANSI C mode,
-  execute the following before calling `configure':
-        setenv CC "gcc -ansi"                 if using csh
-        export CC="gcc -ansi"                 if using bash or ksh
-        CC="gcc -ansi"; export CC             if using sh
+  use the following:
+        configure CC="gcc -ansi"
 If you have headers in a nonstandard directory <include dir>
   set CPPFLAGS to "-I<include dir>"
 If you have libraries in a nonstandard directory <lib dir>
@@ -417,10 +417,17 @@
         echo "$0: Try \`$0 --help'" 1>&2
         exit 1 ;;
-      *) # Everything else counts as a positional argument
-        argcount=`expr $argcount + 1`
-        eval "POSARG$argcount=\$arg" ;;
+      *) # Everything else counts as a positional argument,
+         # or as variable assignment if it looks like it.
+        envvar=`expr "x$arg" : 'x\([_a-zA-Z][_a-zA-Z0-9]*\)=' || :`
+        if test -n "$envvar"; then
+          optarg=`expr "X$arg" : '[^=]*=\(.*\)' || :` # empty arguments are ok.
+          eval "$envvar=\$optarg"
+          export $envvar
+        else
+          argcount=`expr $argcount + 1`
+          eval "POSARG$argcount=\$arg"
+        fi ;;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]