Do not alter environment CFLAGS, CPPFLAGS etc.

These variables should never be overriden by our makefiles, only the
AM_CFLAGS or libcf_agent_la_CFLAGS variants are to be set.

Also fixed wrong libutils dependencies that were discovered after this
change: libutils currently must link to OpenSSL and PCRE.

This clean-up occurred after an attempt to only link cf-upgrade to
libutils, but noticing that it pulls out everything as dependency.

(cherry picked from commit 1e7fe4b650194428bb133d3a13c21a516f7fee51)
CFLAGS, CPPFLAGS etc should override auto-detected variables.

CFLAGS, CPPFLAGS, LDFLAGS are the ones that user sets on the command
line by doing:

./configure CFLAGS=-O3

Thus they should stay the last ones, overriding all auto-detected values
and configure-specified values. This patch attempts to make this happen.

Nevertheless we still retain and manually append ENV_CFLAGS at the end
of CFLAGS.  Even though CFLAGS should contain the ./configure command
line CFLAGS as last, some macro seem to mess the order up and insert
its own optimisation flags as well. So we append ENV_CFLAGS at the end
manually, causing a bit of flag duplication.  Thanks @kacfengine for
bringing this up.

(cherry picked from commit 618771b787910cbcafaeafb61900e5a5bfb3430f)
Separately include proper CPPFLAGS for every binary

Now that CORE_*FLAGS are not used anymore, I tried to explicitly include
only the needed CPPFLAGS for each binary. Unfortunately, because
cf3.defs.h is inluded almost everywhere, and it includes headers from
libutils, which needs OpenSSL includes, I had to carry the
OPENSSL_CPPFLAGS almost everywhere, and in fewer cases PCRE_CPPFLAGS as
well.

I didn't manage to completely remove those dependencies (OpenSSL, PCRE),
but at least now they are not included from within platform.h, but only
from the respective headers that need them.

To sum up, the dependency mess is less but still exists, but at least it
is visible in each makefile and we can untangle it little by little. And
every new dependency added by mistake will trigger a failure, where
previously it succeeded because CORE_CPPFLAGS included everything plus
the kitchen sink.

(cherry picked from commit f08073835f7e08084288e381d93a111e4d9904ff)
Remove hackishly stated dependencies, they are properly detected now.

(cherry picked from commit 2c15821466b38112954232f7dce31ec901207720)
Remove lots of cruft from the default CPPFLAGS

This piece of code has been there since first git commit in 2008. It
refers to a similar bunch of code that modifies LDFLAGS, which has been
removed some time now. So lets remove this piece as well...

(cherry picked from commit 0bc2c07e694419c2f9e9e9ca9ce74e5ddf7484a5)
Indentation.

(cherry picked from commit 4157a0bca695fd11ee3454bcd23215e92fa7ed63)
CF3_WITH_LIBRARY now takes into account previous *FLAGS

It is used for libxml2, which by defaults exists in a libxml2/
subdirectory inside include/. Thus, before calling the CF3_WITH_LIBRARY
macro, we set LIBXML2_CPPFLAGS according to the --with-libxml2 argument
together with the subdirectory prefix, and the macro is happily
detecting libxml2 like that.

(cherry picked from commit 52adea90dfa456f8d599ec092a3133cc2b1f7363)
CPPFLAGS now only include libutils directory. Yay!

So the last offenders modifying the environment CPPFLAGS were MYSQL,
POSTGRESQL, LIBXML2. They have been converted to have their own set of
blah_CPPFLAGS.

In addition, libxml2 includes were removed from within cf3.defs.h and
added to the source files that really need them.

As a result, cf-upgrade compilation line is at last free of dependencies:

gcc -DHAVE_CONFIG_H -I. -I../libutils   -std=gnu99  -pthread -g -O2 -g -Wall -Wno-pointer-sign -Werror=implicit-function-declaration -Wunused-parameter -g3 -O0  -MT cf-upgrade.o -MD -MP -MF .deps/cf-upgrade.Tpo -c -o cf-upgrade.o cf-upgrade.c

(cherry picked from commit e15618b62f658a4ceaacd0b6615bf7cd6ab38c4a)
Old autoconf does not deal well with unquoted EOLs in arguments.

(cherry picked from commit e4f180c47033256f83cf8e75c154aebc2bc2f778)
Removed PCRE dependency when linking to libutils

cf-upgrade refused to link to libutils without -lcrypto and -lpcre. The
PCRE dependency has been removed in this patch, OpenSSL dependency is
still TODO though.

(cherry picked from commit 99a5f54c84d0e21ba598f7d2f5899c858f17f005)
Remove mandatory OpenSSL dependency from libutils.

(cherry picked from commit 6e1c05efd5a1c43b40e17de060f012af97256e76)
LOUDLY mention that platform.h needs to come first.

(cherry picked from commit 3843f2338284f1d391dbe8acf52fff3e0ee8a5ce)
Some GCC versions disallow #pragma inside function body.

(cherry picked from commit b823672dd3a8dddbe0dcf9cf351b9d45a5158eb7)
Disable printf format warnings on Windows.

Our wrapper supports more flags than vanilla Windows version, so they
are false positives.

(cherry picked from commit 26b224c7598bd19237fbc1be6844416f50266658)
Add missing quotes in shell expression to fix AIX build.

(cherry picked from commit 1876a215a2740480f15ddfbf10f381e75aaea126)