Dear Code::Blocks maintainers,
I have put together a comprehensive patch for modernizing Code::Blocks. The changes I have done to SVN trunk:
m4/ directory.CFLAGS/CXXFLAGS/CPPFLAGS/LDFLAGS are to be set. If the user provides none of these, then the build system sets its preferred defaults. On the other hand, if one of these variables is defined and set, the buildsystem will not set its defaults. This is especially important for distributions, which use their own set of flags.AC_SEARCH_LIBS, which is more cumbersome and less reliable than PKG_CHECK_MODULES.AX_BOOST_BASE macro from the autoconf archive is now used.CXXFLAGS (which is a user flag anyway) but rather in the AM_CPPFLAGS.std::auto_ptr with std::unique_ptr. std::unique_ptr is much safer and future-proof, whereas std::auto_ptr is deprecated and could be removed in future C++ standards.Please apply the patch as a whole, as the {C,CXX,CPP,LD}FLAGS detection code in acinclude.m4 required some edits, hence this file is not just a pure move.
Some notes:
I'm testing the patch and probably will apply it.
if you want I can strip the two apart. When I did an SVN checkout, I edited everything that was there, which included the plugins. The empty virtual function wasn't added, it was just moved from private to public because the virtual dtor is needed for std::unique_ptr's deleter.
No need, I've already done this.
I'll apply all other changes, but this one is questionable.
In your version you omit the -DCB_AUTOTOOLS flag. If you do this some bad things will happen.
My patch (see attachment) tries to fix the problem but it fails, because I don't speak auto-fu. If you do please fix it and upload the correct version, thanks.
Teodor, it actually looks correct. I've amended it a bit (because "-Dfoo" flags should go into CPPFLAGS and not C{,XX}FLAGS). What hasn't worked? The patch might need some offsets to apply, as I don't have access to your tree. With this patch, -DCB_AUTOTOOLS is added either how.
Last edit: David Seifert 2016-05-12
For some not apparent reason I get these flags appended:
It seems that -g -O2 is coming from somewhere and I don't know from where.
Does this happen for you, too?
https://github.com/obfuscated/codeblocks_sf/tree/modernize_autotools this is a branch with all the patches I've split up. Can you test it if you observe the same behaviour?
The main problem comes from all the
AC_PROG_CXXetc macros. These do exactly the same thing as the lines I have inserted: they try to detect whether CFLAGS and friends are unset, and if so, they set "-g -O2". The problem is, in the case were we want to set default flags, the setting of the flags happens after theAC_PROG_CXXmacro, namely in theCODEBLOCKS_CHECK_DEBUGmacro. Moving this macro before the block ofAC_PROG_CXXmacros fixes the problem.There are lots of "XXX does not appear in AM_CONDITIONAL" warnings that have started to appear with this commit:
Can you post a patch that fixes this problem?
Last edit: Teodor Petrov 2016-05-15
Dear Teodor,
attached the patch. The m4_include() is necessary to call the
AM_CONDITIONALs. I've shuffled some flags around, as -DPIC belongs into
CPPFLAGS.
David
Any explanation why the CODEBLOCKS_CHECK_DEBUG is move once again? Is this related to the m4_include or the changes to the other flags, or even a separate issue?
CODEBLOCKS_CHECK_DEBUG has to occur before AC_PROG_CC and AC_PROG_CXX,
as both latter macros will set CFLAGS resp. CXXFLAGS (to "-g -O2"). By
moving it before both of them, we set the CFLAGS to our defaults and
then AC_PROG_CC and AC_PROG_CXX stop setting and values.
On Mi, 2016-05-18 at 08:02 +0000, Teodor Petrov wrote:
Related
Tickets:
#349I see a discrepancy here: -std=c90 is set in CFLAGS and -std=c++11 is set in the CXX. Could we fix this? I'm not sure which option I like more though.
The branch https://github.com/obfuscated/codeblocks_sf/tree/modernize_autotools is updated with all the patches you've sent. You can test if you like.
Applied in rev 10945, thanks for the contribution.