> -----Original Message----- > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of David Marchand > Sent: Tuesday, February 24, 2015 10:21 AM > To: Panu Matilainen > Cc: dev at dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2] mk: Rework gcc version detection to > permit versions newer than 4.x > > On Tue, Feb 24, 2015 at 11:09 AM, David Marchand > <david.marchand at 6wind.com> > wrote: > > > On Tue, Feb 24, 2015 at 10:50 AM, Panu Matilainen > > <pmatilai at redhat.com> > > wrote: > > > >> $ gcc -dumpversion > >>> 4.7 > >>> > Hum, how about something like always appending .0.0 to the gcc - > dumpversion then cut at 3 characters ?
Hi, Or something like this in Sed or Perl within the $(shell) expansion: $ gcc -dumpversion | perl -pe 's/^(\d+\.\d+)$/$1.0/' 4.7.0 # Tests: $ echo 4.7 | perl -pe 's/^(\d+\.\d+)$/$1.0/' 4.7.0 $ echo 4.7.0 | perl -pe 's/^(\d+\.\d+)$/$1.0/' 4.7.0 $ echo 4.7.1 | perl -pe 's/^(\d+\.\d+)$/$1.0/' 4.7.1 $ echo 144.7 | perl -pe 's/^(\d+\.\d+)$/$1.0/' 144.7.0 John --