diff --git a/conf.pri.in b/conf.pri.in index ca6c0241e..e0b03c76f 100644 --- a/conf.pri.in +++ b/conf.pri.in @@ -5,7 +5,8 @@ BINDIR = @EXPAND_BINDIR@ DATADIR = @EXPAND_DATADIR@ MANPREFIX = @EXPAND_MANDIR@ -QMAKE_CXXFLAGS += @CPPFLAGS@ +QMAKE_CXXFLAGS += @QBT_CONF_EXTRA_CFLAGS@ +INCLUDEPATH += @QBT_CONF_INCLUDES@ LIBS += @LDFLAGS@ @LIBS@ CONFIG += @QBT_ADD_CONFIG@ diff --git a/configure b/configure index 93425fbbf..7eabaaf86 100755 --- a/configure +++ b/configure @@ -592,6 +592,8 @@ QBT_REMOVE_DEFINES QBT_ADD_DEFINES QBT_REMOVE_CONFIG QBT_ADD_CONFIG +QBT_CONF_EXTRA_CFLAGS +QBT_CONF_INCLUDES EXPAND_MANDIR EXPAND_DATADIR EXPAND_BINDIR @@ -2787,8 +2789,8 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -4080,6 +4082,7 @@ fi + # Define --wth-* and --enable-* arguments @@ -5375,12 +5378,42 @@ _ACEOF test "$exec_prefix_NONE" && exec_prefix=NONE +# Original extract() function contributed by pmzqla +# $*: Strings to parse +# Set $DEFINES, $INCLUDES, $OTHER +extract() { + if [ -z "$*" ]; then + echo "Input string required" + return 1 + fi + + # Convert " -" to "\n" if not between quotes + string=$(echo " $*" | sed -e 's: -:\n:g' -e 's:"\(.*\)\n\(.*\)":\"\1 -\2":g' -e "s:'\(.*\)\n\(.*\)':\'\1 -\2':g") + SAVEIFS=$IFS + IFS=$(printf "\n\b") + for i in $string; do + case "$(echo "$i" | cut -c1)" in + '') ;; + D) QBT_CONF_DEFINES="$(echo $i | cut -c2-) $QBT_CONF_DEFINES";; + I) QBT_CONF_INCLUDES="$(echo $i | cut -c2-) $QBT_CONF_INCLUDES";; + *) QBT_CONF_EXTRA_CFLAGS="-$i $QBT_CONF_EXTRA_CFLAGS";; + esac + done + IFS=$SAVEIFS +} + +extract $CPPFLAGS +QBT_ADD_DEFINES="$QBT_ADD_DEFINES $QBT_CONF_DEFINES" +QBT_CONF_EXTRA_CFLAGS="$QBT_CONF_EXTRA_CFLAGS $CXXFLAGS" + # Substitute the values of these vars in conf.pri.in + + ac_config_files="$ac_config_files conf.pri" cat >confcache <<\_ACEOF diff --git a/configure.ac b/configure.ac index 2a93a28a8..43a830385 100644 --- a/configure.ac +++ b/configure.ac @@ -172,7 +172,37 @@ AX_DEFINE_DIR([EXPAND_BINDIR], [bindir]) AX_DEFINE_DIR([EXPAND_DATADIR], [datadir]) AX_DEFINE_DIR([EXPAND_MANDIR], [mandir]) +# Original extract() function contributed by pmzqla +# $*: Strings to parse +# Set $DEFINES, $INCLUDES, $OTHER +extract() { + if [[ -z "$*" ]]; then + echo "Input string required" + return 1 + fi + + # Convert " -" to "\n" if not between quotes + string=$(echo " $*" | sed -e 's: -:\n:g' -e 's:"\(.*\)\n\(.*\)":\"\1 -\2":g' -e "s:'\(.*\)\n\(.*\)':\'\1 -\2':g") + SAVEIFS=$IFS + IFS=$(printf "\n\b") + for i in $string; do + case "$(echo "$i" | cut -c1)" in + '') ;; + D) QBT_CONF_DEFINES="$(echo $i | cut -c2-) $QBT_CONF_DEFINES";; + I) QBT_CONF_INCLUDES="$(echo $i | cut -c2-) $QBT_CONF_INCLUDES";; + *) QBT_CONF_EXTRA_CFLAGS="-$i $QBT_CONF_EXTRA_CFLAGS";; + esac + done + IFS=$SAVEIFS +} + +extract $CPPFLAGS +QBT_ADD_DEFINES="$QBT_ADD_DEFINES $QBT_CONF_DEFINES" +QBT_CONF_EXTRA_CFLAGS="$QBT_CONF_EXTRA_CFLAGS $CXXFLAGS" + # Substitute the values of these vars in conf.pri.in +AC_SUBST(QBT_CONF_INCLUDES) +AC_SUBST(QBT_CONF_EXTRA_CFLAGS) AC_SUBST(QBT_ADD_CONFIG) AC_SUBST(QBT_REMOVE_CONFIG) AC_SUBST(QBT_ADD_DEFINES)