Page 1 of 1

Honor user flags

Posted: Mon Oct 29, 2012 8:56 pm
by qdii
While debugging something else, I realized that ./configure doesn’t honor my CXXFLAGS, CFLAGS and LDFLAGS.

It is fairly easy to notice it on linux:
run configure

Code: Select all

LDFLAGS="-Wl,--as-needed" CFLAGS="-O2 -g" CXXFLAGS="-O2 -pipe -march=corei7 -g" ./configure --disable-debug
and run make

Code: Select all

g++  -DON_64_BIT  -O3 -DREGEXP_UNICODE  -DNDEBUG  -fPIC -DHAS_LIBCLANG -I/var/tmp/portage/dev-util/codelite-9999/work/codelite-9999/sdk/clang/Linux/x86_64/include  -Wall -I/usr/lib64/wx/include/gtk2-unicode-2.9 -I/usr/include/wx-2.9 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -fno-strict-aliasing -DASTYLE_LIB -DYY_NEVER_INTERACTIVE=1 -DGTK -DSCI_LEXER -DLINK_LEXERS -D__WX__ -DINSTALL_DIR="\"/usr/share/codelite\"" -DPLUGINS_DIR="\"/usr/lib/codelite\""  -DWXMAKINGDLL_WXSF -DWXMAKINGDLL_WXXS    -pthread -DQT_SHARED -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/libdrm -I/usr/include/qt4/QtCore   -I. -I./sdk/codelite_indexer/network -I./sdk/wxsqlite3/include -I./sdk/wxsqlite3/sqlite3/include -I./sdk/wxshapeframework/include -I./sdk/databaselayer/include/wx/dblayer/include -I./Interfaces -I./Debugger -I./Plugin -I./CodeLite -I./PCH    -pthread -DQT_SHARED -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/libdrm -I/usr/include/qt4/QtCore   -I. -I./sdk/codelite_indexer/network -I./sdk/wxsqlite3/include -I./sdk/wxsqlite3/sqlite3/include -I./sdk/wxshapeframework/include -I./sdk/databaselayer/include/wx/dblayer/include -I./Interfaces -I./Debugger -I./Plugin -I./CodeLite -I./PCH    -pthread -DQT_SHARED -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/libdrm -I/usr/include/qt4/QtCore   -I. -I./sdk/codelite_indexer/network -I./sdk/wxsqlite3/include -I./sdk/wxsqlite3/sqlite3/include -I./sdk/wxshapeframework/include -I./sdk/databaselayer/include/wx/dblayer/include -I./Interfaces -I./Debugger -I./Plugin -I./CodeLite -I./PCH    -pthread -DQT_SHARED -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/libdrm -I/usr/include/qt4/QtCore   -I. -I./sdk/codelite_indexer/network -I./sdk/wxsqlite3/include -I./sdk/wxsqlite3/sqlite3/include -I./sdk/wxshapeframework/include -I./sdk/databaselayer/include/wx/dblayer/include -I./Interfaces -I./Debugger -I./Plugin -I./CodeLite -I./PCH  -I./sdk/wxshapeframework/src  -pthread -DQT_SHARED -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/libdrm -I/usr/include/qt4/QtCore   -I. -I./sdk/codelite_indexer/network -I./sdk/wxsqlite3/include -I./sdk/wxsqlite3/sqlite3/include -I./sdk/wxshapeframework/include -I./sdk/databaselayer/include/wx/dblayer/include -I./Interfaces -I./Debugger -I./Plugin -I./CodeLite -I./PCH  -I./sdk/databaselayer/src/sqlite3  -pthread -DQT_SHARED -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng15 -I/usr/include/qt4 -I/usr/include/qt4/QtGui -I/usr/include/libdrm -I/usr/include/qt4/QtCore   -I. -I./sdk/codelite_indexer/network -I./sdk/wxsqlite3/include -I./sdk/wxsqlite3/sqlite3/include -I./sdk/wxshapeframework/include -I./sdk/databaselayer/include/wx/dblayer/include -I./Interfaces -I./Debugger -I./Plugin -I./CodeLite -I./PCH  -MTRelease_gcc_unicode/wxShapeFrameworkObjects_ArrowBase.o -MFRelease_gcc_unicode/wxShapeFrameworkObjects_ArrowBase.o.d  -MM sdk/wxshapeframework/src/ArrowBase.cpp
Notice that my CXXFLAGS have been ignored and the same goes for CFLAGS and LDFLAGS.
I have attached a patch that changes this behavior, by removing the "-Ox" flags and adding CXXFLAGS, CFLAGS and LDFLAGS appropriately in the configure script.
To apply it:

Code: Select all

cd /path/to/svn/trunk
patch -p0 < codelite-honor-compile-flags.patch
Hopefully, that should help people :)