summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfigure36
-rw-r--r--tools/configure/configureapp.cpp23
-rw-r--r--tools/configure/configureapp.h1
3 files changed, 32 insertions, 28 deletions
diff --git a/configure b/configure
index 9ab3834cf8..8be7b5fa44 100755
--- a/configure
+++ b/configure
@@ -75,8 +75,12 @@ fi
# do this early so we don't store it in config.status
CFG_TOPLEVEL=
+relpathMangled=$relpath
+outpathPrefix=
if [ x"$1" = x"-top-level" ]; then
CFG_TOPLEVEL=yes
+ relpathMangled=`dirname "$relpath"`
+ outpathPrefix=../
shift
fi
@@ -90,11 +94,15 @@ IFS='
for i in "$@"; do
case $i in
-redo|--redo)
- if ! test -f config.opt; then
+ optfile=${outpathPrefix}config.opt
+ if test -n "$CFG_TOPLEVEL" && ! test -f $optfile; then
+ optfile=config.opt
+ fi
+ if ! test -f $optfile; then
echo >&2 "No config.opt present - cannot redo configuration."
exit 1
fi
- for a in `cat config.opt`; do
+ for a in `cat $optfile`; do
OPT_CMDLINE="$OPT_CMDLINE
$a"
QMAKE_CMDLINE="$QMAKE_CMDLINE
@@ -1917,17 +1925,11 @@ fi
# build makefiles based on the configuration
#-------------------------------------------------------------------------------
-( # fork to make the cd stay local
-
- relpathMangled=$relpath
- if [ -n "$CFG_TOPLEVEL" ]; then
- relpathMangled=`dirname "$relpath"`
- cd ..
- fi
-
- "$CFG_QMAKE_PATH" -qtconf "$QTCONFFILE" "$relpathMangled"
+if [ -n "$CFG_TOPLEVEL" ]; then
+ cd ..
+fi
-) || exit
+"$CFG_QMAKE_PATH" -qtconf "$QTCONFFILE" "$relpathMangled" || exit
#-------------------------------------------------------------------------------
# finally save the executed command to another script
@@ -1937,12 +1939,12 @@ if [ $CFG_REDO = no ]; then
-confirm-license"
# skip first line, as it's always empty due to unconditional field separation
- echo "$OPT_CMDLINE" | tail -n +2 > "$outpath/config.opt"
+ echo "$OPT_CMDLINE" | tail -n +2 > config.opt
- [ -f "$outpath/config.status" ] && rm -f "$outpath/config.status"
- echo "#!/bin/sh" > "$outpath/config.status"
- echo "$relpath/$relconf -redo \"\$@\"" >> "$outpath/config.status"
- chmod +x "$outpath/config.status"
+ [ -f "config.status" ] && rm -f config.status
+ echo "#!/bin/sh" > config.status
+ echo "$relpathMangled/$relconf -redo \"\$@\"" >> config.status
+ chmod +x config.status
fi
if [ -n "$PREFIX_COMPLAINTS" ]; then
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 650ede7474..467af0e021 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -184,9 +184,13 @@ QString Configure::formatPath(const QString &path)
void Configure::parseCmdLine()
{
+ sourcePathMangled = sourcePath;
+ buildPathMangled = buildPath;
if (configCmdLine.size() && configCmdLine.at(0) == "-top-level") {
dictionary[ "TOPLEVEL" ] = "yes";
configCmdLine.removeAt(0);
+ sourcePathMangled = QFileInfo(sourcePath).path();
+ buildPathMangled = QFileInfo(buildPath).path();
}
int argCount = configCmdLine.size();
@@ -1025,12 +1029,6 @@ void Configure::generateMakefiles()
{
QString pwd = QDir::currentPath();
{
- QString sourcePathMangled = sourcePath;
- QString buildPathMangled = buildPath;
- if (dictionary.contains("TOPLEVEL")) {
- sourcePathMangled = QFileInfo(sourcePath).path();
- buildPathMangled = QFileInfo(buildPath).path();
- }
QStringList args;
args << buildPath + "/bin/qmake" << sourcePathMangled;
@@ -1180,11 +1178,14 @@ void Configure::readLicense()
void Configure::reloadCmdLine(int idx)
{
if (dictionary[ "REDO" ] == "yes") {
- QFile inFile(buildPath + "/config.opt");
+ QFile inFile(buildPathMangled + "/config.opt");
if (!inFile.open(QFile::ReadOnly)) {
- inFile.setFileName(buildPath + "/configure.cache");
- if (!inFile.open(QFile::ReadOnly))
- return;
+ inFile.setFileName(buildPath + "/config.opt");
+ if (!inFile.open(QFile::ReadOnly)) {
+ inFile.setFileName(buildPath + "/configure.cache");
+ if (!inFile.open(QFile::ReadOnly))
+ return;
+ }
}
QTextStream inStream(&inFile);
while (!inStream.atEnd())
@@ -1195,7 +1196,7 @@ void Configure::reloadCmdLine(int idx)
void Configure::saveCmdLine()
{
if (dictionary[ "REDO" ] != "yes") {
- QFile outFile(buildPath + "/config.opt");
+ QFile outFile(buildPathMangled + "/config.opt");
if (outFile.open(QFile::WriteOnly | QFile::Text)) {
QTextStream outStream(&outFile);
for (QStringList::Iterator it = configCmdLine.begin(); it != configCmdLine.end(); ++it) {
diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h
index 249080b288..da7d8885ce 100644
--- a/tools/configure/configureapp.h
+++ b/tools/configure/configureapp.h
@@ -75,6 +75,7 @@ private:
QTextStream outStream;
QString sourcePath, buildPath;
+ QString sourcePathMangled, buildPathMangled;
QDir sourceDir, buildDir;
QString confStrOffsets[2];