in reply to Config sets optimisation compilation flags (-O/-g)!

Note that %Config can easily be overwritten:
use strict; use warnings; use Config; print "1: $Config{optimize}\n"; my $preferred = tied %Config; $preferred->{optimize} = 'this is what I want'; print "2: $Config{optimize}\n"; __END__ On my Windows 7 box, that outputs: 1: -s -O2 2: this is what I want
Not sure if that is helpful to you but it's a capability that, in the past, has been useful to me.

Cheers,
Rob

Replies are listed 'Best First'.
Re^2: Config sets optimisation compilation flags (-O/-g)!
by bliako (Abbot) on Jan 29, 2019 at 10:21 UTC

    I guess your solution (and Fakeconfig from Anonymous) will eliminate the pain to clean the config string in an m4 macro (as I am using Gnu Autotools to generate the Makefile for the project). Of course I do not know what I want, I know what I do not want! I do not want "-O*", so I will filter that out inside the Perl one liner calling Config to tell me the CFLAGS. Thanks for the idea.

    I have updated my question so as mention an m4 macro which can be used by Autotools to get CFLAGS when compiling C programs having an embeded Perl.