bug-autoconf
[Top][All Lists]
Advanced

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

Re: Bug#372179: AC_CANONICAL_SYSTEM overwrites $@


From: Ralf Wildenhues
Subject: Re: Bug#372179: AC_CANONICAL_SYSTEM overwrites $@
Date: Wed, 21 Jun 2006 21:09:02 +0200
User-agent: Mutt/1.5.11+cvs20060403

* Justin Erenkrantz wrote on Mon, Jun 19, 2006 at 06:17:49PM CEST:
> On 6/19/06, Tollef Fog Heen <address@hidden> wrote:
> >| > On 6/18/06, Tollef Fog Heen <address@hidden> wrote:
> >| > >Currently, if configure is passed --sbindir=, it just overrides
> >| > >$sbindir without flagging that at all.  If it, in addition to changing
> >| > >$sbindir, it'd set ac_param_sbindir either to 1 to show that sbindir
> >| > >is derviced from a command line argument or to the value passed on the
> >| > >command line.

> >| > >Would this be an acceptable solution for both the APR and the autoconf
> >| > >people?

> >IMO, command line ordering shouldn't matter, unless you do
> >--bindir=/foo --bindir=/bar.  --with-layout just changes the defaults,
> >it doesn't override the state you're currently in.

> Anything explicitly provided on the command-line is
> literally respected - the layout file just allows the user to change
> autoconf's defaults in a straightforward manner.  -- justin

I'm still a bit unsure whether and how Autoconf should support this.
I would prefer to not have to make up my mind before the 2.60 release,
about whether this approach is consistent or can be made so, long-term
maintainable, and generally useful.

That said, below is a patch to achieve something along the above idea;
it sets
  ac_param_FOO_set

to yes for every assignment of FOO that resulted from a command line
option.  I suggest not documenting this interface for now.

What do the other Autoconf developers think about this?  Safe enough to
apply now, or postpone until after 2.60 (and require the APR people to
keep (ab)using Autoconf internal interfaces, and dragging along a
modified version of the _AC_INIT_PARSE_ARGS macro)?

Cheers,
Ralf

        * lib/autoconf/general.m4 (_AC_INIT_PARSE_ARGS): Extend state
        machine to set `ac_param_${ac_option}_set' to `yes' for each
        option that is set on the command line.
        Suggested by Tollef Fog Heen <address@hidden>.

Index: lib/autoconf/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.925
diff -u -r1.925 general.m4
--- lib/autoconf/general.m4     7 Jun 2006 05:35:46 -0000       1.925
+++ lib/autoconf/general.m4     21 Jun 2006 18:50:24 -0000
@@ -578,7 +578,7 @@
 do
   # If the previous option needs an argument, assign it.
   if test -n "$ac_prev"; then
-    eval $ac_prev=\$ac_option
+    eval "$ac_prev=\$ac_option; ac_param_${ac_prev}_set=yes"
     ac_prev=
     continue
   fi
@@ -588,6 +588,8 @@
   *)   ac_optarg=yes ;;
   esac
 
+  ac_assign=no
+
   # Accept the important Cygnus configure options, so we can diagnose typos.
 
   case $ac_dashdash$ac_option in
@@ -597,34 +599,34 @@
   -bindir | --bindir | --bindi | --bind | --bin | --bi)
     ac_prev=bindir ;;
   -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
-    bindir=$ac_optarg ;;
+    ac_assign=bindir ;;
 
   -build | --build | --buil | --bui | --bu)
     ac_prev=build_alias ;;
   -build=* | --build=* | --buil=* | --bui=* | --bu=*)
-    build_alias=$ac_optarg ;;
+    ac_assign=build_alias ;;
 
   -cache-file | --cache-file | --cache-fil | --cache-fi \
   | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
     ac_prev=cache_file ;;
   -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
   | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
-    cache_file=$ac_optarg ;;
+    ac_assign=cache_file ;;
 
   --config-cache | -C)
-    cache_file=config.cache ;;
+    ac_assign=cache_file; ac_optarg=config.cache ;;
 
   -datadir | --datadir | --datadi | --datad)
     ac_prev=datadir ;;
   -datadir=* | --datadir=* | --datadi=* | --datad=*)
-    datadir=$ac_optarg ;;
+    ac_assign=datadir ;;
 
   -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
   | --dataroo | --dataro | --datar)
     ac_prev=datarootdir ;;
   -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
   | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
-    datarootdir=$ac_optarg ;;
+    ac_assign=datarootdir ;;
 
   -disable-* | --disable-*)
     ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
@@ -632,17 +634,17 @@
     expr "x$ac_feature" : "[.*[^-_$as_cr_alnum]]" >/dev/null &&
       AC_MSG_ERROR([invalid feature name: $ac_feature])
     ac_feature=`echo $ac_feature | sed 's/-/_/g'`
-    eval enable_$ac_feature=no ;;
+    ac_assign=enable_$ac_feature; ac_optarg=no ;;
 
   -docdir | --docdir | --docdi | --doc | --do)
     ac_prev=docdir ;;
   -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
-    docdir=$ac_optarg ;;
+    ac_assign=docdir ;;
 
   -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
     ac_prev=dvidir ;;
   -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
-    dvidir=$ac_optarg ;;
+    ac_assign=dvidir ;;
 
   -enable-* | --enable-*)
     ac_feature=`expr "x$ac_option" : 'x-*enable-\([[^=]]*\)'`
@@ -650,7 +652,7 @@
     expr "x$ac_feature" : "[.*[^-_$as_cr_alnum]]" >/dev/null &&
       AC_MSG_ERROR([invalid feature name: $ac_feature])
     ac_feature=`echo $ac_feature | sed 's/-/_/g'`
-    eval enable_$ac_feature=\$ac_optarg ;;
+    ac_assign=enable_$ac_feature ;;
 
   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -659,82 +661,82 @@
   -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
   | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
   | --exec=* | --exe=* | --ex=*)
-    exec_prefix=$ac_optarg ;;
+    ac_assign=exec_prefix ;;
 
   -gas | --gas | --ga | --g)
     # Obsolete; use --with-gas.
-    with_gas=yes ;;
+    ac_assign=with_gas ;;
 
   -help | --help | --hel | --he | -h)
-    ac_init_help=long ;;
+    ac_assign=ac_init_help; ac_optarg=long ;;
   -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
-    ac_init_help=recursive ;;
+    ac_assign=ac_init_help; ac_optarg=recursive ;;
   -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
-    ac_init_help=short ;;
+    ac_assign=ac_init_help; ac_optarg=short ;;
 
   -host | --host | --hos | --ho)
     ac_prev=host_alias ;;
   -host=* | --host=* | --hos=* | --ho=*)
-    host_alias=$ac_optarg ;;
+    ac_assign=host_alias ;;
 
   -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
     ac_prev=htmldir ;;
   -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
   | --ht=*)
-    htmldir=$ac_optarg ;;
+    ac_assign=htmldir ;;
 
   -includedir | --includedir | --includedi | --included | --include \
   | --includ | --inclu | --incl | --inc)
     ac_prev=includedir ;;
   -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
   | --includ=* | --inclu=* | --incl=* | --inc=*)
-    includedir=$ac_optarg ;;
+    ac_assign=includedir ;;
 
   -infodir | --infodir | --infodi | --infod | --info | --inf)
     ac_prev=infodir ;;
   -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
-    infodir=$ac_optarg ;;
+    ac_assign=infodir ;;
 
   -libdir | --libdir | --libdi | --libd)
     ac_prev=libdir ;;
   -libdir=* | --libdir=* | --libdi=* | --libd=*)
-    libdir=$ac_optarg ;;
+    ac_assign=libdir ;;
 
   -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
   | --libexe | --libex | --libe)
     ac_prev=libexecdir ;;
   -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
   | --libexe=* | --libex=* | --libe=*)
-    libexecdir=$ac_optarg ;;
+    ac_assign=libexecdir ;;
 
   -localedir | --localedir | --localedi | --localed | --locale)
     ac_prev=localedir ;;
   -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
-    localedir=$ac_optarg ;;
+    ac_assign=localedir ;;
 
   -localstatedir | --localstatedir | --localstatedi | --localstated \
   | --localstate | --localstat | --localsta | --localst | --locals)
     ac_prev=localstatedir ;;
   -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
   | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
-    localstatedir=$ac_optarg ;;
+    ac_assign=localstatedir ;;
 
   -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
     ac_prev=mandir ;;
   -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
-    mandir=$ac_optarg ;;
+    ac_assign=mandir ;;
 
   -nfp | --nfp | --nf)
     # Obsolete; use --without-fp.
-    with_fp=no ;;
+    ac_assign=with_fp; ac_optarg=no ;;
 
   -no-create | --no-create | --no-creat | --no-crea | --no-cre \
   | --no-cr | --no-c | -n)
-    no_create=yes ;;
+    ac_assign=no_create ;;
 
   -no-recursion | --no-recursion | --no-recursio | --no-recursi \
   | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
-    no_recursion=yes ;;
+    ac_assign=no_recursion ;;
 
   -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
   | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
@@ -743,26 +745,26 @@
   -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
   | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
   | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
-    oldincludedir=$ac_optarg ;;
+    ac_assign=oldincludedir ;;
 
   -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
     ac_prev=prefix ;;
   -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
-    prefix=$ac_optarg ;;
+    ac_assign=prefix ;;
 
   -program-prefix | --program-prefix | --program-prefi | --program-pref \
   | --program-pre | --program-pr | --program-p)
     ac_prev=program_prefix ;;
   -program-prefix=* | --program-prefix=* | --program-prefi=* \
   | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
-    program_prefix=$ac_optarg ;;
+    ac_assign=program_prefix ;;
 
   -program-suffix | --program-suffix | --program-suffi | --program-suff \
   | --program-suf | --program-su | --program-s)
     ac_prev=program_suffix ;;
   -program-suffix=* | --program-suffix=* | --program-suffi=* \
   | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
-    program_suffix=$ac_optarg ;;
+    ac_assign=program_suffix ;;
 
   -program-transform-name | --program-transform-name \
   | --program-transform-nam | --program-transform-na \
@@ -779,27 +781,27 @@
   | --program-transfo=* | --program-transf=* \
   | --program-trans=* | --program-tran=* \
   | --progr-tra=* | --program-tr=* | --program-t=*)
-    program_transform_name=$ac_optarg ;;
+    ac_assign=program_transform_name ;;
 
   -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
     ac_prev=pdfdir ;;
   -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
-    pdfdir=$ac_optarg ;;
+    ac_assign=pdfdir ;;
 
   -psdir | --psdir | --psdi | --psd | --ps)
     ac_prev=psdir ;;
   -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
-    psdir=$ac_optarg ;;
+    ac_assign=psdir ;;
 
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
   | -silent | --silent | --silen | --sile | --sil)
-    silent=yes ;;
+    ac_assign=silent ;;
 
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
   | --sbi=* | --sb=*)
-    sbindir=$ac_optarg ;;
+    ac_assign=sbindir ;;
 
   -sharedstatedir | --sharedstatedir | --sharedstatedi \
   | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
@@ -810,35 +812,35 @@
   | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
   | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
   | --sha=* | --sh=*)
-    sharedstatedir=$ac_optarg ;;
+    ac_assign=sharedstatedir ;;
 
   -site | --site | --sit)
     ac_prev=site ;;
   -site=* | --site=* | --sit=*)
-    site=$ac_optarg ;;
+    ac_assign=site ;;
 
   -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
     ac_prev=srcdir ;;
   -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
-    srcdir=$ac_optarg ;;
+    ac_assign=srcdir ;;
 
   -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
   | --syscon | --sysco | --sysc | --sys | --sy)
     ac_prev=sysconfdir ;;
   -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
   | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
-    sysconfdir=$ac_optarg ;;
+    ac_assign=sysconfdir ;;
 
   -target | --target | --targe | --targ | --tar | --ta | --t)
     ac_prev=target_alias ;;
   -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
-    target_alias=$ac_optarg ;;
+    ac_assign=target_alias ;;
 
   -v | -verbose | --verbose | --verbos | --verbo | --verb)
-    verbose=yes ;;
+    ac_assign=verbose ;;
 
   -version | --version | --versio | --versi | --vers | -V)
-    ac_init_version=: ;;
+    ac_assign=ac_init_version; ac_optarg=: ;;
 
   -with-* | --with-*)
     ac_package=`expr "x$ac_option" : 'x-*with-\([[^=]]*\)'`
@@ -846,7 +848,7 @@
     expr "x$ac_package" : "[.*[^-_$as_cr_alnum]]" >/dev/null &&
       AC_MSG_ERROR([invalid package name: $ac_package])
     ac_package=`echo $ac_package| sed 's/-/_/g'`
-    eval with_$ac_package=\$ac_optarg ;;
+    ac_assign=with_$ac_package ;;
 
   -without-* | --without-*)
     ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
@@ -854,25 +856,25 @@
     expr "x$ac_package" : "[.*[^-_$as_cr_alnum]]" >/dev/null &&
       AC_MSG_ERROR([invalid package name: $ac_package])
     ac_package=`echo $ac_package | sed 's/-/_/g'`
-    eval with_$ac_package=no ;;
+    ac_assign=with_$ac_package; ac_optarg=no ;;
 
   --x)
     # Obsolete; use --with-x.
-    with_x=yes ;;
+    ac_assign=with_x ;;
 
   -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
   | --x-incl | --x-inc | --x-in | --x-i)
     ac_prev=x_includes ;;
   -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
   | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
-    x_includes=$ac_optarg ;;
+    ac_assign=x_includes ;;
 
   -x-libraries | --x-libraries | --x-librarie | --x-librari \
   | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
     ac_prev=x_libraries ;;
   -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
-    x_libraries=$ac_optarg ;;
+    ac_assign=x_libraries ;;
 
   -*) AC_MSG_ERROR([unrecognized option: $ac_option
 Try `$[0] --help' for more information.])
@@ -883,7 +885,7 @@
     # Reject names that are not valid shell variable names.
     expr "x$ac_envvar" : "[.*[^_$as_cr_alnum]]" >/dev/null &&
       AC_MSG_ERROR([invalid variable name: $ac_envvar])
-    eval $ac_envvar=\$ac_optarg
+    eval "$ac_envvar=\$ac_optarg; ac_param_${ac_envvar}_set=yes"
     export $ac_envvar ;;
 
   *)
@@ -895,6 +897,11 @@
     ;;
 
   esac
+
+  case $ac_assign in
+  no) ;;
+  *) eval "$ac_assign=\$ac_optarg; ac_param_${ac_assign}_set=yes" ;;
+  esac
 done
 
 if test -n "$ac_prev"; then




reply via email to

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