There is a requirement for some build environment to set CC
to something other than the Autoconf default.

There is already a variable CONFCFLAGS in place that can handle C flags,
however it was more a side-effect of adding -g option rather than
a comprehensive support for C flags.

The user interface for build.sh should closely follow the Autoconf one.
Rather than inventing new variable names, let's use the ones
Autoconf uses. The user will not have to learn two interfaces
and do the mental mapping.

Reviewed-by: Trevor Woerner <[email protected]>
Signed-off-by: Gaetan Nadon <[email protected]>
---

        Third edition: change quoting for CC/CFLAGS/CPP/CPPFLAGS/LDFLAGS

 build.sh |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/build.sh b/build.sh
index 075e9f4..33120e0 100755
--- a/build.sh
+++ b/build.sh
@@ -15,6 +15,13 @@ global environment variables you may set to replace default 
functionality:
             (default: git://anongit.freedesktop.org/git)
 
 global environment variables you may set to augment functionality:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
   CONFFLAGS:  additional flags to pass to all configure scripts
   CONFCFLAGS: additional compile flags to pass to all configure scripts
   MAKEFLAGS:  additional flags to pass to all make invocations
@@ -348,7 +355,14 @@ process() {
     if [ $needs_config -eq 1 ] || [ X"$NOAUTOGEN" = X ]; then
        sh ${DIR_CONFIG}/${CONFCMD} --prefix=${PREFIX} ${LIB_FLAGS} \
            ${QUIET:+--quiet} \
-           ${CACHE:+--cache-file=}${CACHE} ${CONFFLAGS} "$CONFCFLAGS"
+           ${CACHE:+--cache-file=}${CACHE} \
+           ${CONFFLAGS} \
+           ${CC:+CC="$CC"} \
+           ${CPP:+CPP="$CPP"} \
+           ${CPPFLAGS:+CPPFLAGS="$CPPFLAGS"} \
+           ${CFLAGS:+CFLAGS="$CFLAGS"} \
+           ${LDFLAGS:+LDFLAGS="$LDFLAGS"} \
+           "$CONFCFLAGS"
        if [ $? -ne 0 ]; then
            failed ${CONFCMD} $1 $2
            cd $old_pwd
-- 
1.6.0.4

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to