From: oliva Date: Wed, 15 Sep 1999 02:29:01 +0000 (+0000) Subject: * acgeneral.m4 (Configuration): Accept --env-VAR=VALUE and X-Git-Tag: exp-1999-09-21~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=be0b76c255a5d2960a2cf0ad0a28c08df8f05b31;p=thirdparty%2Fautoconf.git * acgeneral.m4 (Configuration): Accept --env-VAR=VALUE and VAR=value. * autoconf.texi, install.texi: Document it. * configure: Rebuilt. --- diff --git a/ChangeLog b/ChangeLog index 287d7a4f..a5400722 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +1999-09-14 Alexandre Oliva + + * acgeneral.m4 (Configuration): Accept --env-VAR=VALUE and + VAR=value. + * autoconf.texi, install.texi: Document it. + * configure: Rebuilt. + 1999-09-14 Akim Demaille * acgeneral.m4 (AC_HELP_STRING): Rewrite in m4. Have m4 work, and diff --git a/acgeneral.m4 b/acgeneral.m4 index 44217731..bd01f41c 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -712,6 +712,21 @@ changequote([, ])dnl esac eval "enable_${ac_feature}='$ac_optarg'" ;; + -env-* | --env-*) + ac_envvar=`echo $ac_option|sed -e 's/^-*env-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. +changequote(, )dnl + if test -n "`echo $ac_envvar| sed 's/[_a-zA-Z0-9]//g'`"; then +changequote([, ])dnl + AC_MSG_ERROR($ac_envvar: invalid variable name) + fi + case "$ac_option" in + *=*) ;; + *) AC_MSG_ERROR($ac_envvar: missing value) ;; + esac + eval "${ac_envvar}='$ac_optarg'" + export $ac_envvar ;; + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) @@ -734,6 +749,7 @@ Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: --cache-file=FILE cache test results in FILE + [--env-]VAR=VALUE set environment variable VAR to VALUE --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages @@ -979,6 +995,17 @@ changequote([, ])dnl -*) AC_MSG_ERROR([$ac_option: invalid option; use --help to show usage]) ;; + *=*) + ac_envvar=`echo $ac_option|sed -e 's/=.*//'` + # Reject names that are not valid shell variable names. +changequote(, )dnl + if test -n "`echo $ac_envvar| sed 's/[_a-zA-Z0-9]//g'`"; then +changequote([, ])dnl + AC_MSG_ERROR($ac_envvar: invalid variable name) + fi + eval "${ac_envvar}='$ac_optarg'" + export $ac_envvar ;; + *) changequote(, )dnl if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then diff --git a/autoconf.texi b/autoconf.texi index 6609c4f0..9ca57302 100644 --- a/autoconf.texi +++ b/autoconf.texi @@ -281,6 +281,7 @@ Running @code{configure} Scripts * Optional Features:: Selecting optional features * System Type:: Specifying the system type * Sharing Defaults:: Setting site-wide defaults for @code{configure} +* Environment Variables:: Defining environment variables. * Operation Controls:: Changing how @code{configure} runs Questions About Autoconf @@ -5003,6 +5004,7 @@ may use comes with Autoconf. * Optional Features:: Selecting optional features * System Type:: Specifying the system type * Sharing Defaults:: Setting site-wide defaults for @code{configure} +* Environment Variables:: Defining environment variables. * Operation Controls:: Changing how @code{configure} runs @end menu diff --git a/configure b/configure index 291d7704..5e9b3673 100755 --- a/configure +++ b/configure @@ -120,6 +120,19 @@ do esac eval "enable_${ac_feature}='$ac_optarg'" ;; + -env-* | --env-*) + ac_envvar=`echo $ac_option|sed -e 's/^-*env-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_envvar| sed 's/[_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_envvar: invalid variable name" 1>&2; exit 1; } + fi + case "$ac_option" in + *=*) ;; + *) { echo "configure: error: $ac_envvar: missing value" 1>&2; exit 1; } ;; + esac + eval "${ac_envvar}='$ac_optarg'" + export $ac_envvar ;; + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) @@ -141,6 +154,7 @@ Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: --cache-file=FILE cache test results in FILE + [--env-]VAR=VALUE set environment variable VAR to VALUE --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages @@ -381,6 +395,15 @@ EOF -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } ;; + *=*) + ac_envvar=`echo $ac_option|sed -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_envvar| sed 's/[_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_envvar: invalid variable name" 1>&2; exit 1; } + fi + eval "${ac_envvar}='$ac_optarg'" + export $ac_envvar ;; + *) if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then echo "configure: warning: $ac_option: invalid host type" 1>&2 @@ -897,8 +920,7 @@ ac_given_INSTALL="$INSTALL" # Allow concurrent executions conftest=cft\$\$ -: \${CONFIG_FILES="Makefile -testsuite/Makefile"} +: \${CONFIG_FILES="Makefile testsuite/Makefile"} rm -fr \`echo "\$CONFIG_FILES " | sed "s/:@BKL@^ @BKR@*//g"\` trap 'rm -fr \$conftest*; exit 1' 1 2 15 diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 6609c4f0..9ca57302 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -281,6 +281,7 @@ Running @code{configure} Scripts * Optional Features:: Selecting optional features * System Type:: Specifying the system type * Sharing Defaults:: Setting site-wide defaults for @code{configure} +* Environment Variables:: Defining environment variables. * Operation Controls:: Changing how @code{configure} runs Questions About Autoconf @@ -5003,6 +5004,7 @@ may use comes with Autoconf. * Optional Features:: Selecting optional features * System Type:: Specifying the system type * Sharing Defaults:: Setting site-wide defaults for @code{configure} +* Environment Variables:: Defining environment variables. * Operation Controls:: Changing how @code{configure} runs @end menu diff --git a/doc/install.texi b/doc/install.texi index f26dfcd4..a9432a9e 100644 --- a/doc/install.texi +++ b/doc/install.texi @@ -73,13 +73,7 @@ the @code{configure} script does not know about. You can give environment. Using a Bourne-compatible shell, you can do that on the command line like this: @example -CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure -@end example - -@noindent -Or on systems that have the @code{env} program, you can do it like this: -@example -env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure +./configure CC=c89 CFLAGS=-O2 LIBS=-lposix @end example @node Multiple Architectures @@ -174,6 +168,19 @@ default values for variables like @code{CC}, @code{cache_file}, and the @code{CONFIG_SITE} environment variable to the location of the site script. A warning: not all @code{configure} scripts look for a site script. +@node Environment Variables +@section Environment Variables + +Variables not defined in a site shell script can be set in the +environment passed to configure. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you can set them +in the @code{configure} command line, using @samp{--env-VAR=value} or +@samp{VAR=value}. For example, the switch +@samp{--env-CC=/usr/local2/bin/gcc} will cause the specified gcc to be +used as the C compiler (unless it is overridden in the site shell +script). + @node Operation Controls @section Operation Controls diff --git a/install.texi b/install.texi index f26dfcd4..a9432a9e 100644 --- a/install.texi +++ b/install.texi @@ -73,13 +73,7 @@ the @code{configure} script does not know about. You can give environment. Using a Bourne-compatible shell, you can do that on the command line like this: @example -CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure -@end example - -@noindent -Or on systems that have the @code{env} program, you can do it like this: -@example -env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure +./configure CC=c89 CFLAGS=-O2 LIBS=-lposix @end example @node Multiple Architectures @@ -174,6 +168,19 @@ default values for variables like @code{CC}, @code{cache_file}, and the @code{CONFIG_SITE} environment variable to the location of the site script. A warning: not all @code{configure} scripts look for a site script. +@node Environment Variables +@section Environment Variables + +Variables not defined in a site shell script can be set in the +environment passed to configure. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you can set them +in the @code{configure} command line, using @samp{--env-VAR=value} or +@samp{VAR=value}. For example, the switch +@samp{--env-CC=/usr/local2/bin/gcc} will cause the specified gcc to be +used as the C compiler (unless it is overridden in the site shell +script). + @node Operation Controls @section Operation Controls diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index 44217731..bd01f41c 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -712,6 +712,21 @@ changequote([, ])dnl esac eval "enable_${ac_feature}='$ac_optarg'" ;; + -env-* | --env-*) + ac_envvar=`echo $ac_option|sed -e 's/^-*env-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. +changequote(, )dnl + if test -n "`echo $ac_envvar| sed 's/[_a-zA-Z0-9]//g'`"; then +changequote([, ])dnl + AC_MSG_ERROR($ac_envvar: invalid variable name) + fi + case "$ac_option" in + *=*) ;; + *) AC_MSG_ERROR($ac_envvar: missing value) ;; + esac + eval "${ac_envvar}='$ac_optarg'" + export $ac_envvar ;; + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) @@ -734,6 +749,7 @@ Usage: configure [options] [host] Options: [defaults in brackets after descriptions] Configuration: --cache-file=FILE cache test results in FILE + [--env-]VAR=VALUE set environment variable VAR to VALUE --help print this message --no-create do not create output files --quiet, --silent do not print \`checking...' messages @@ -979,6 +995,17 @@ changequote([, ])dnl -*) AC_MSG_ERROR([$ac_option: invalid option; use --help to show usage]) ;; + *=*) + ac_envvar=`echo $ac_option|sed -e 's/=.*//'` + # Reject names that are not valid shell variable names. +changequote(, )dnl + if test -n "`echo $ac_envvar| sed 's/[_a-zA-Z0-9]//g'`"; then +changequote([, ])dnl + AC_MSG_ERROR($ac_envvar: invalid variable name) + fi + eval "${ac_envvar}='$ac_optarg'" + export $ac_envvar ;; + *) changequote(, )dnl if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then