From 7c4c3dd291c741e2a42c78efd77ffbd3a1c9c1c1 Mon Sep 17 00:00:00 2001 From: Raphael Manfredi Date: Tue, 5 Jun 2018 14:28:56 +0200 Subject: Added Specific.U as a hook for project-specific code. After generating config.sh, this is a place where optional generation can happen, before going on with the .SH file extractions and dependency computations. Typically, this can be used to generate a revision.h file. --- mcon/U/Finish.U | 2 +- mcon/U/Specific.U | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 mcon/U/Specific.U (limited to 'mcon/U') diff --git a/mcon/U/Finish.U b/mcon/U/Finish.U index cf5a364..51039c4 100644 --- a/mcon/U/Finish.U +++ b/mcon/U/Finish.U @@ -35,7 +35,7 @@ ?X: SH files, which among other things produce config.h and (usually) Makefile. ?X: It offers to do a make depend if the Makefile contains that target. ?X: -?MAKE:Finish: Chk_MANI Extract Myread Oldsym Magic_h cat rm contains \ +?MAKE:Finish: Chk_MANI Extract Specific Myread Oldsym Magic_h cat rm contains \ test package make ?MAKE: -pick add $@ %< ?F:!config.sh diff --git a/mcon/U/Specific.U b/mcon/U/Specific.U new file mode 100644 index 0000000..feb189b --- /dev/null +++ b/mcon/U/Specific.U @@ -0,0 +1,26 @@ +?RCS: +?RCS: Copyright (c) 2018, Raphael Manfredi +?RCS: +?RCS: You may redistribute only under the terms of the Artistic License, +?RCS: as specified in the README file that comes with the distribution. +?RCS: You may reuse parts of this distribution only within the terms of +?RCS: that same Artistic License; a copy of which may be found at the root +?RCS: of the source tree for dist 4.0. +?RCS: +?X: +?X: This unit is intended to be a project-specific hook. +?X: By default, it is therefore empty, meant to be copied to your private +?X: unit directory (U) and seasoned to taste. +?X: +?X: If you need specific code generation to happen once the configuration +?X: is finished and config.sh was generated, but before the extraction of +?X: the .SH files begins, then this is the place to put these special +?X: code that the .SH files will require to run properly. +?X: +?X: When this unit triggers, Configure is back to the top directory. +?X: +?MAKE:Specific: Config_sh +?MAKE: -pick add $@ %< +?X: +?X: Keep the above ?MAKE: lines and then append your specific code here. +?X: -- cgit v1.2.3 From 8e1f96af6f9d7f755ef551f6b422d856be37e41a Mon Sep 17 00:00:00 2001 From: Raphael Manfredi Date: Tue, 5 Jun 2018 15:23:33 +0200 Subject: Use new project public location, along with change from SVN to git. --- mcon/U/Head.U | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mcon/U') diff --git a/mcon/U/Head.U b/mcon/U/Head.U index 933e489..0b8a98e 100644 --- a/mcon/U/Head.U +++ b/mcon/U/Head.U @@ -77,8 +77,8 @@ ?X: # Note: this Configure script was generated automatically. Rather than # working with this copy of Configure, you may wish to get metaconfig. -# The dist package (which contains metaconfig) is available via SVN: -# svn co https://svn.code.sf.net/p/dist/code/trunk/dist +# The dist package (which contains metaconfig) is available via git: +# git clone git@github.com:rmanfredi/dist.git ?X: ?X: NOTA BENE: ?X: If you develop you own version of metaconfig based on this work, -- cgit v1.2.3 From 86ac5a95aedd0e21087e358cbbc47eb5fc65d5a2 Mon Sep 17 00:00:00 2001 From: Raphael Manfredi Date: Sun, 18 Nov 2018 15:19:25 +0100 Subject: Added test for memrchr(). --- mcon/U/d_memrchr.U | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 mcon/U/d_memrchr.U (limited to 'mcon/U') diff --git a/mcon/U/d_memrchr.U b/mcon/U/d_memrchr.U new file mode 100644 index 0000000..c7b1c01 --- /dev/null +++ b/mcon/U/d_memrchr.U @@ -0,0 +1,40 @@ +?RCS: +?RCS: Copyright (c) 2018 Raphael Manfredi +?RCS: +?RCS: You may redistribute only under the terms of the Artistic License, +?RCS: as specified in the README file that comes with the distribution. +?RCS: You may reuse parts of this distribution only within the terms of +?RCS: that same Artistic License; a copy of which may be found at the root +?RCS: of the source tree for dist 4.0. +?RCS: +?MAKE:d_memrchr: Trylink cat +?MAKE: -pick add $@ %< +?S:d_memrchr: +?S: This variable conditionally defines the HAS_MEMRCHR symbol, which +?S: indicates to the C program that the memrchr() routine is available +?S: to scan a block of memory backwards for a character. +?S:. +?C:HAS_MEMRCHR: +?C: This symbol, if defined, indicates that the memrchr routine is available +?C: to scan a block of memory backwards for a character. +?C: If undefined, roll your own. +?C:. +?H:#$d_memrchr HAS_MEMRCHR /**/ +?H:. +?LINT:set d_memrchr +: see if memrchr exists +$cat >try.c < +int main(void) +{ + static char s[] = "xxx"; + static size_t n = sizeof(s); + void *p; + p = memrchr(s, 'x', n); + return p ? 0 : 1; +} +EOC +cyn=memrchr +set d_memrchr +eval $trylink + -- cgit v1.2.3 From 3e3a5f35940c277f3d82904be28de432b775be54 Mon Sep 17 00:00:00 2001 From: Raphael Manfredi Date: Tue, 20 Nov 2018 15:10:06 +0100 Subject: Removed d_fast_assert.U. This is a private unit from gtk-gnutella that should not have been made available to metaconfig as it is not of general purpose. --- mcon/U/d_fast_assert.U | 85 -------------------------------------------------- 1 file changed, 85 deletions(-) delete mode 100644 mcon/U/d_fast_assert.U (limited to 'mcon/U') diff --git a/mcon/U/d_fast_assert.U b/mcon/U/d_fast_assert.U deleted file mode 100644 index dba5132..0000000 --- a/mcon/U/d_fast_assert.U +++ /dev/null @@ -1,85 +0,0 @@ -?RCS: $Id$ -?RCS: -?RCS: Copyright (c) 2006, Christian Biere -?RCS: -?RCS: You may redistribute only under the terms of the Artistic License, -?RCS: as specified in the README file that comes with the distribution. -?RCS: You may reuse parts of this distribution only within the terms of -?RCS: that same Artistic License; a copy of which may be found at the root -?RCS: of the source tree for dist 4.0. -?RCS: -?MAKE:d_fast_assert: Myread Setvar cat gccversion spackage \ - sed +ccflags +cc +ldflags +optimize -?MAKE: -pick add $@ %< -?S:d_fast_assert: -?S: This variable conditionally defines FAST_ASSERTIONS. -?S:. -?C:FAST_ASSERTIONS: -?C: This symbol, when defined, indicates that the program should make -?C: use of its own asserting and failure reporting code, instead of -?C: the one from GLib. -?C:. -?H:#$d_fast_assert FAST_ASSERTIONS /**/ -?H:. -?F:!try.c !try -?LINT:set d_fast_assert -?LINT:change ccflags -: determine whether to enable fast assertions -echo " " -case "$d_fast_assert" in -"$undef") - dflt=n;; -*) - dflt=y;; -esac -$cat <try.c <<'EOC' -int main() -{ - return 0; -} -EOC - if $cc $ccflags -momit-leaf-frame-pointer $ldflags -o try try.c >/dev/null 2>&1 - then - case "$ccflags $optimize" in - *-momit-leaf-frame-pointer*) ;; - *-O0*) ;; - *-O*) - ccflags="-momit-leaf-frame-pointer $ccflags" - echo "Added -momit-leaf-frame-pointer to the cc flags." >&4 - ;; - esac - else - case "$ccflags" in - *-momit-leaf-frame-pointer*) - echo "Stripping -momit-leaf-frame-pointer from cc flags." >&4 - ccflags=`echo $ccflags | $sed 's/ *-momit-leaf-frame-pointer//'` - ;; - esac - fi - ;; - esac -;; -esac - -- cgit v1.2.3 From 95f048e9762e73782a47c73f27f4de4500bf5051 Mon Sep 17 00:00:00 2001 From: Raphael Manfredi Date: Mon, 16 Mar 2020 17:08:27 +0100 Subject: Was missing a few $cat uses. --- mcon/U/Checkcc.U | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mcon/U') diff --git a/mcon/U/Checkcc.U b/mcon/U/Checkcc.U index 3cae05c..ce0dc62 100644 --- a/mcon/U/Checkcc.U +++ b/mcon/U/Checkcc.U @@ -37,10 +37,10 @@ ?INIT:ccname='' ?INIT:ccversion='' : generate the trygcc script for later perusal -cat <trygcc +$cat <trygcc $startsh EOS -cat <<'EOSC' >>trygcc +$cat <<'EOSC' >>trygcc case "$cc" in '') ;; *) $rm -f try try.* @@ -100,10 +100,10 @@ esac EOSC : generate the checkcc script for later perusal -cat <checkcc +$cat <checkcc $startsh EOS -cat <<'EOSC' >>checkcc +$cat <<'EOSC' >>checkcc case "$cc" in '') ;; *) $rm -f try try.* -- cgit v1.2.3 From 2f64ea88c70b412b1543e36e5f7421c48bfd464e Mon Sep 17 00:00:00 2001 From: Raphael Manfredi Date: Mon, 16 Mar 2020 17:11:08 +0100 Subject: Added space to be consistent. --- mcon/U/Trylink.U | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mcon/U') diff --git a/mcon/U/Trylink.U b/mcon/U/Trylink.U index d45ffe2..4ed9128 100644 --- a/mcon/U/Trylink.U +++ b/mcon/U/Trylink.U @@ -74,7 +74,7 @@ case "$cyn" in "") echo "--- $var ---" >> "$file";; *) echo " "; $echo $n "Checking $msg...$c" >&4; - echo "--- $var --- ($msg)" >>"$file" + echo "--- $var --- ($msg)" >> "$file" ;; esac; $cat try.c >> "$file"; -- cgit v1.2.3 From 3a771ebdb5e31d41b611d176f65fc1205c391f43 Mon Sep 17 00:00:00 2001 From: Raphael Manfredi Date: Mon, 16 Mar 2020 17:24:17 +0100 Subject: Mark that this unit exports the config.sh file. --- mcon/U/Config_sh.U | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mcon/U') diff --git a/mcon/U/Config_sh.U b/mcon/U/Config_sh.U index bb47b7b..1b3b0c6 100644 --- a/mcon/U/Config_sh.U +++ b/mcon/U/Config_sh.U @@ -32,7 +32,7 @@ ?MAKE: -pick add.Config_sh $@ %< ?MAKE: -pick add $@ ./Obsol_sh ?MAKE: -pick close.Config_sh $@ %< -?F:!config.over !config.arch +?F:!config.over !config.arch config.sh ?T:file sfile xsed ?LINT:unclosed EOT : back to where it started -- cgit v1.2.3 From 41979518039d93f7ce33c9ed1b3d16620a7bd61a Mon Sep 17 00:00:00 2001 From: Raphael Manfredi Date: Mon, 16 Mar 2020 18:48:47 +0100 Subject: Avoid compiler warning during void-support test. --- mcon/U/voidflags.U | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mcon/U') diff --git a/mcon/U/voidflags.U b/mcon/U/voidflags.U index 0e0f49c..5db1db9 100644 --- a/mcon/U/voidflags.U +++ b/mcon/U/voidflags.U @@ -111,6 +111,8 @@ sub() { hue = buf; if (doit()) iptr = hue; +?X: Avoid "variable set but not used" compilation warning + (void) iptr; #endif doit(); } -- cgit v1.2.3 From c15168c17871134abedd45d1690708834ad6a3b6 Mon Sep 17 00:00:00 2001 From: Raphael Manfredi Date: Mon, 16 Mar 2020 19:32:07 +0100 Subject: Check whether bfd_get_section_vma() takes 1 or 2 arguments. --- mcon/U/d_bfd_section_vma.U | 80 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 mcon/U/d_bfd_section_vma.U (limited to 'mcon/U') diff --git a/mcon/U/d_bfd_section_vma.U b/mcon/U/d_bfd_section_vma.U new file mode 100644 index 0000000..0b41f44 --- /dev/null +++ b/mcon/U/d_bfd_section_vma.U @@ -0,0 +1,80 @@ +?RCS: $Id$ +?RCS: +?RCS: Copyright (c) 2020, Raphael Manfredi +?RCS: +?RCS: You may redistribute only under the terms of the Artistic License, +?RCS: as specified in the README file that comes with the distribution. +?RCS: You may reuse parts of this distribution only within the terms of +?RCS: that same Artistic License; a copy of which may be found at the root +?RCS: of the source tree for dist 4.0. +?RCS: +?MAKE:d_bfd_section_vma d_bfd_section_vma2: Trylink cat cp rm d_bfd_lib +?MAKE: -pick add $@ %< +?S:d_bfd_section_vma: +?S: This variable conditionally defines the HAS_BFD_SECTION_VMA_1ARG symbol, +?S: which indicates to the C program that the bfd_get_section_vma() routine from +?S: the BFD library takes only one argument. +?S:. +?S:d_bfd_section_vma2: +?S: This variable conditionally defines the HAS_BFD_SECTION_VMA_2ARGS symbol, +?S: which indicates to the C program that the bfd_get_section_vma() routine from +?S: the BFD library takes two arguments, the first being probably ignored. +?S: This was the old behaviour (before 2020-03 at least), the new behaviour +?S: being to use a new 1-argument signature. +?S:. +?C:HAS_BFD_SECTION_VMA_1ARG: +?C: This symbol, if defined, indicates that the bfd_get_section_vma() routine +?C: from the BFD library takes only one argument, which is the new behaviour +?C: starting from 2020-03 at least. +?C:. +?C:HAS_BFD_SECTION_VMA_2ARGS: +?C: This symbol, if defined, indicates that the bfd_get_section_vma() routine +?C: from the BFD library takes two arguments, which is the old behaviour, +?C: with the first argument probably ignored underneath. +?C:. +?H:#$d_bfd_section_vma HAS_BFD_SECTION_VMA_1ARG /**/ +?H:#$d_bfd_section_vma2 HAS_BFD_SECTION_VMA_2ARGS /**/ +?H:. +?F:!head.c +: see whether d_bfd_get_section_vma exists and takes 1 or 2 arguments +$cat >head.c < +int main(void) +{ + bfd *b = 0; + asection *sec = 0; +EOC +case "$d_bfd_lib" in +$undef) + d_bfd_section_vma=$undef + d_bfd_section_vma2=$undef + ;; +*) + $cp head.c try.c + $cat >>try.c <>try.c < Date: Tue, 17 Mar 2020 10:10:38 +0100 Subject: Reworked BFD section tests. It's not only bfd_get_section_vma() which is impacted! The change in the BFD library, starting with 2.34, is rather that: - bfd_section_xxx() accessors now take only the BFD section as argument. - bfd_get_section_xxx() accessors, which used 2 arguments, are removed. The first argument in bfd_get_section_xxx() calls was the BFD descriptor and it was purely ignored in recent versions of the library. --- mcon/U/d_bfd_section.U | 49 ++++++++++++++++++++++++++++ mcon/U/d_bfd_section_vma.U | 80 ---------------------------------------------- 2 files changed, 49 insertions(+), 80 deletions(-) create mode 100644 mcon/U/d_bfd_section.U delete mode 100644 mcon/U/d_bfd_section_vma.U (limited to 'mcon/U') diff --git a/mcon/U/d_bfd_section.U b/mcon/U/d_bfd_section.U new file mode 100644 index 0000000..d876541 --- /dev/null +++ b/mcon/U/d_bfd_section.U @@ -0,0 +1,49 @@ +?RCS: $Id$ +?RCS: +?RCS: Copyright (c) 2020, Raphael Manfredi +?RCS: +?RCS: You may redistribute only under the terms of the Artistic License, +?RCS: as specified in the README file that comes with the distribution. +?RCS: You may reuse parts of this distribution only within the terms of +?RCS: that same Artistic License; a copy of which may be found at the root +?RCS: of the source tree for dist 4.0. +?RCS: +?MAKE:d_bfd_section: Trylink cat d_bfd_lib +?MAKE: -pick add $@ %< +?S:d_bfd_section: +?S: This variable conditionally defines the HAS_BFD_SECTION_1ARG symbol, +?S: which indicates to the C program that the bfd_section_xxx() accessors +?S: from the BFD library exists and taks only one argument. +?S:. +?C:HAS_BFD_SECTION_1ARG: +?C: This symbol, if defined, indicates that the bfd_section_xxx() accessors +?C: from the BFD library takes only one argument, which is the new behaviour +?C: starting from BFD 2.34. +?C:. +?H:#$d_bfd_section HAS_BFD_SECTION_1ARG /**/ +?H:. +: see whether bfd_section_vma exists and takes 1 argument +case "$d_bfd_lib" in +$undef) + d_bfd_section=$undef + ;; +*) + $cat >try.c < +int main(void) +{ + bfd *b = 0; + asection *sec = 0; + + return 0 == bfd_section_vma(sec); +} +EOC + cyn="whether bfd_section_vma() takes 1 argument" + set d_bfd_section + eval $trylink + ;; +esac + diff --git a/mcon/U/d_bfd_section_vma.U b/mcon/U/d_bfd_section_vma.U deleted file mode 100644 index 0b41f44..0000000 --- a/mcon/U/d_bfd_section_vma.U +++ /dev/null @@ -1,80 +0,0 @@ -?RCS: $Id$ -?RCS: -?RCS: Copyright (c) 2020, Raphael Manfredi -?RCS: -?RCS: You may redistribute only under the terms of the Artistic License, -?RCS: as specified in the README file that comes with the distribution. -?RCS: You may reuse parts of this distribution only within the terms of -?RCS: that same Artistic License; a copy of which may be found at the root -?RCS: of the source tree for dist 4.0. -?RCS: -?MAKE:d_bfd_section_vma d_bfd_section_vma2: Trylink cat cp rm d_bfd_lib -?MAKE: -pick add $@ %< -?S:d_bfd_section_vma: -?S: This variable conditionally defines the HAS_BFD_SECTION_VMA_1ARG symbol, -?S: which indicates to the C program that the bfd_get_section_vma() routine from -?S: the BFD library takes only one argument. -?S:. -?S:d_bfd_section_vma2: -?S: This variable conditionally defines the HAS_BFD_SECTION_VMA_2ARGS symbol, -?S: which indicates to the C program that the bfd_get_section_vma() routine from -?S: the BFD library takes two arguments, the first being probably ignored. -?S: This was the old behaviour (before 2020-03 at least), the new behaviour -?S: being to use a new 1-argument signature. -?S:. -?C:HAS_BFD_SECTION_VMA_1ARG: -?C: This symbol, if defined, indicates that the bfd_get_section_vma() routine -?C: from the BFD library takes only one argument, which is the new behaviour -?C: starting from 2020-03 at least. -?C:. -?C:HAS_BFD_SECTION_VMA_2ARGS: -?C: This symbol, if defined, indicates that the bfd_get_section_vma() routine -?C: from the BFD library takes two arguments, which is the old behaviour, -?C: with the first argument probably ignored underneath. -?C:. -?H:#$d_bfd_section_vma HAS_BFD_SECTION_VMA_1ARG /**/ -?H:#$d_bfd_section_vma2 HAS_BFD_SECTION_VMA_2ARGS /**/ -?H:. -?F:!head.c -: see whether d_bfd_get_section_vma exists and takes 1 or 2 arguments -$cat >head.c < -int main(void) -{ - bfd *b = 0; - asection *sec = 0; -EOC -case "$d_bfd_lib" in -$undef) - d_bfd_section_vma=$undef - d_bfd_section_vma2=$undef - ;; -*) - $cp head.c try.c - $cat >>try.c <>try.c < Date: Thu, 9 Apr 2020 13:55:22 +0200 Subject: Use a more compact version of STATIC_ASSERT(). --- mcon/U/Assert.U | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'mcon/U') diff --git a/mcon/U/Assert.U b/mcon/U/Assert.U index 76de54d..1a38e49 100644 --- a/mcon/U/Assert.U +++ b/mcon/U/Assert.U @@ -20,7 +20,6 @@ ?X: There is no need to link the file to spot the assertion failure. ?X: $cat >static_assert.h <<'EOC' -#define STATIC_ASSERT(expr) \ - do { switch (0) { case ((expr) ? 1 : 0): case 0: break; } } while(0) +#define STATIC_ASSERT(expr) ((void) sizeof(char[1 - 2*!(expr)])) EOC -- cgit v1.2.3 From 9f837754617b4cb3a6b2dbd176e621ad83bd4c15 Mon Sep 17 00:00:00 2001 From: "H.Merijn Brand - Tux" Date: Sat, 25 Apr 2020 16:49:47 +0200 Subject: Fix repeated-word typos --- mcon/U/Getfile.U | 2 +- mcon/U/Obsol_h.U | 2 +- mcon/U/Obsol_sh.U | 2 +- mcon/U/d_tminsys.U | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'mcon/U') diff --git a/mcon/U/Getfile.U b/mcon/U/Getfile.U index f5cf49b..641ea30 100644 --- a/mcon/U/Getfile.U +++ b/mcon/U/Getfile.U @@ -48,7 +48,7 @@ ?X: those are prefixes for the filename. Unless $gfpthkeep is set to 'y', ?X: gfpth is cleared on return from Getfile. ?X: -?X: If is is followed by a ~, then ~name substitution will occur. Upon return, +?X: If it is followed by a ~, then ~name substitution will occur. Upon return, ?X: $ans is set with the filename value. If a / is specified, then only a full ?X: path name is accepted (but ~ substitution occurs before, if needed). The ?X: expanded path name is returned in that case. diff --git a/mcon/U/Obsol_h.U b/mcon/U/Obsol_h.U index fc59938..c19c5a4 100644 --- a/mcon/U/Obsol_h.U +++ b/mcon/U/Obsol_h.U @@ -20,7 +20,7 @@ ?MAKE: -pick prepend $@ ./Obsol_h ?LINT:nocomment /* - * The following symbols are obsolete. They are mapped to the the new + * The following symbols are obsolete. They are mapped to the new * symbols only to ease the transition process. The sources should be * updated so as to use the new symbols only, as the support for these * obsolete symbols may end without notice. diff --git a/mcon/U/Obsol_sh.U b/mcon/U/Obsol_sh.U index de1a1e1..3b3f0d6 100644 --- a/mcon/U/Obsol_sh.U +++ b/mcon/U/Obsol_sh.U @@ -20,7 +20,7 @@ ?MAKE: -pick prepend $@ ./Obsol_sh ?LINT:nocomment # -# The following symbols are obsolete. They are mapped to the the new +# The following symbols are obsolete. They are mapped to the new # symbols only to ease the transition process. The sources should be # updated so as to use the new symbols only, since supporting of those # obsolete symbols may end without notice. diff --git a/mcon/U/d_tminsys.U b/mcon/U/d_tminsys.U index 60fc95a..548a014 100644 --- a/mcon/U/d_tminsys.U +++ b/mcon/U/d_tminsys.U @@ -20,7 +20,7 @@ ?S:. ?C:TM_IN_SYS (TMINSYS): ?C: This symbol is defined if this system declares "struct tm" in -?C: in rather than . We can't just say +?C: rather than . We can't just say ?C: -I/usr/include/sys because some systems have both time files, and ?C: the -I trick gets the wrong one. ?C:. -- cgit v1.2.3 From 2cec35331a912b165e2dd135d22de81f34bbc83f Mon Sep 17 00:00:00 2001 From: Raphael Manfredi Date: Sat, 16 May 2020 09:50:30 +0200 Subject: Note that gccversion only contains major version. We used to say things like: case "$gccversion" in 1*) ... but that was wrong because it now starts to catch version 10 as well, for cases that only pertained to gcc version 1! We now need to say: case "$gccversion" in 1) ... 2) ... etc. to handle versions 1 and 2 differently. Thanks to Dmitry Butskoy for spotting this bug. --- mcon/U/ccflags.U | 8 ++++---- mcon/U/gccvers.U | 7 +++++-- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'mcon/U') diff --git a/mcon/U/ccflags.U b/mcon/U/ccflags.U index 942e462..b134f57 100644 --- a/mcon/U/ccflags.U +++ b/mcon/U/ccflags.U @@ -174,11 +174,11 @@ dflt='' case "$hint" in default|recommended) case "$gccversion" in - 1*) dflt='-fpcc-struct-return' ;; + 1) dflt='-fpcc-struct-return' ;; esac ?X: check for POSIXized ISC case "$gccversion" in - 2*) if test -d /etc/conf/kconfig.d && + 2) if test -d /etc/conf/kconfig.d && $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1 then dflt="$dflt -posix" @@ -187,7 +187,7 @@ default|recommended) esac ?X: turn warnings on if they're using gcc case "$gccversion" in - 1*|2*) dflt="$dflt -Wall";; + 1|2) dflt="$dflt -Wall";; ?X: starting with version 3, add "-W -Wall -Wformat=2 -Wshadow" by default *) dflt="$dflt -W -Wall -Wformat=2 -Wshadow";; esac @@ -265,7 +265,7 @@ esac : the following weeds options from ccflags that are of no interest to cpp cppflags="$ccflags" case "$gccversion" in -1*) cppflags="$cppflags -D__GNUC__" +1) cppflags="$cppflags -D__GNUC__" esac case "$mips_type" in '');; diff --git a/mcon/U/gccvers.U b/mcon/U/gccvers.U index 702a5e9..b5abb47 100644 --- a/mcon/U/gccvers.U +++ b/mcon/U/gccvers.U @@ -17,6 +17,9 @@ ?S: If GNU cc (gcc) is used, this variable holds '1' or '3' (for instance) ?S: to indicate whether the compiler is version 1 or 3. This is used in ?S: setting some of the default cflags. It is set to '' if not gcc. +?S: Note that it only contains the major version number, and, when using +?S: case statements to do different things depending on the major, do not +?S: use statements like "1*)" because it will match version 1, 10, 11, etc. ?S:. ?S:gccosandvers: ?S: If GNU cc (gcc) is used, this variable the operating system and @@ -58,7 +61,7 @@ else fi $rm -f try try.* case "$gccversion" in -1*) cpp=`./loc gcc-cpp $cpp $pth` ;; +1) cpp=`./loc gcc-cpp $cpp $pth` ;; esac case "$gccversion" in '') gccosandvers='' ;; @@ -99,7 +102,7 @@ esac : gcc 3.1 complains about adding -Idirectories that it already knows about, : so we will take those off from locincpth. case "$gccversion" in -3*) +3) echo "main(){}">try.c for incdir in `$cc -v -c try.c 2>&1 | \ sed '1,/^#include <\.\.\.>/d;/^End of search list/,$d;s/^ //'` ; do -- cgit v1.2.3