Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2014-06-24 17:15:36 -0400
committerJeff Johnston2014-06-24 18:15:45 -0400
commit753276a27d94ba9a066fa4a92beba199bcf62385 (patch)
tree0b15800e527abee88d20882010df6266f1769b65 /build/org.eclipse.cdt.autotools.core/src
parent1f29931ff1266efe491032c098741fc08ef7b5f5 (diff)
downloadorg.eclipse.cdt-753276a27d94ba9a066fa4a92beba199bcf62385.tar.gz
org.eclipse.cdt-753276a27d94ba9a066fa4a92beba199bcf62385.tar.xz
org.eclipse.cdt-753276a27d94ba9a066fa4a92beba199bcf62385.zip
Bug 438092 - Advanced Autotools flags not set for C++ projects
- enhance the FlagConfigureOption to handle multiple flags at once by accepting the | delimiter in the name and generate separate multiple flag outputs using the children flag value options - add a new CFLAGS|CXXFLAGS flag so that both CFLAGS and CXXFLAGS will be set at the same time (to handle both C and C++ source) - modify the Autotools tests to verify the fix works Change-Id: I4e97c1a16381a3a10404e2fd20f8e49d99590db5 Reviewed-on: https://git.eclipse.org/r/28941 Tested-by: Hudson CI Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> Tested-by: Jeff Johnston <jjohnstn@redhat.com>
Diffstat (limited to 'build/org.eclipse.cdt.autotools.core/src')
-rw-r--r--build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/AutotoolsOptionConstants.java4
-rw-r--r--build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java2
-rw-r--r--build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/FlagConfigureOption.java45
3 files changed, 32 insertions, 19 deletions
diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/AutotoolsOptionConstants.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/AutotoolsOptionConstants.java
index 43658956a4..46c102d853 100644
--- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/AutotoolsOptionConstants.java
+++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/autotools/core/AutotoolsOptionConstants.java
@@ -40,6 +40,10 @@ public class AutotoolsOptionConstants {
public final static String CATEGORY_FEATURES = "features"; // $NON-NLS-1$
public final static String OPT_ENABLE_MAINTAINER_MODE = "enable-maintainer-mode"; // $NON-NLS-1$
public final static String FLAG_CFLAGS = "CFLAGS"; // $NON-NLS-1$
+ /**
+ * @since 1.4
+ */
+ public final static String FLAG_CFLAGS_CXXFLAGS = "CFLAGS|CXXFLAGS"; // $NON-NLS-1$
public final static String OPT_CFLAGS_DEBUG = "cflags-debug"; // $NON-NLS-1$
public final static String OPT_CFLAGS_GPROF = "cflags-gprof"; // $NON-NLS-1$
public final static String OPT_CFLAGS_GCOV = "cflags-gcov"; // $NON-NLS-1$
diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java
index 40dfb2f30f..93727fdd61 100644
--- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java
+++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/AutotoolsConfiguration.java
@@ -103,7 +103,7 @@ public class AutotoolsConfiguration implements IAConfiguration {
new Option(AutotoolsOptionConstants.OPT_PROGRAM_TRANSFORM_NAME, "program_transform_name", IConfigureOption.STRING), // $NON-NLS-1$
new Option(AutotoolsOptionConstants.CATEGORY_FEATURES, IConfigureOption.CATEGORY),
new Option(AutotoolsOptionConstants.OPT_ENABLE_MAINTAINER_MODE, "enable_maintainer_mode", IConfigureOption.BIN), // $NON-NLS-1$
- new Option(AutotoolsOptionConstants.FLAG_CFLAGS, IConfigureOption.FLAG),
+ new Option(AutotoolsOptionConstants.FLAG_CFLAGS_CXXFLAGS, IConfigureOption.FLAG),
new Option(AutotoolsOptionConstants.OPT_CFLAGS_DEBUG, "cflags_debug", IConfigureOption.FLAGVALUE), // $NON-NLS-1$ // $NON-NLS-2$
new Option(AutotoolsOptionConstants.OPT_CFLAGS_GPROF, "cflags_gprof", IConfigureOption.FLAGVALUE), // $NON-NLS-1$ // $NON-NLS-2$
new Option(AutotoolsOptionConstants.OPT_CFLAGS_GCOV, "cflags_gcov", IConfigureOption.FLAGVALUE), // $NON-NLS-1$ // $NON-NLS-2$
diff --git a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/FlagConfigureOption.java b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/FlagConfigureOption.java
index 8f5080b265..b886ad336e 100644
--- a/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/FlagConfigureOption.java
+++ b/build/org.eclipse.cdt.autotools.core/src/org/eclipse/cdt/internal/autotools/core/configure/FlagConfigureOption.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Red Hat Inc.
+ * Copyright (c) 2011, 2014 Red Hat Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* Red Hat Inc. - initial API and implementation
+ * Red Hat Inc. - add support for specifying multiple flag names at once
*******************************************************************************/
package org.eclipse.cdt.internal.autotools.core.configure;
@@ -37,27 +38,35 @@ public class FlagConfigureOption extends AbstractConfigurationOption {
}
public String getParameter() {
- StringBuffer parm = new StringBuffer(getName()+"=\""); //$NON-NLS-1$
- boolean haveParm = false;
- if (isParmSet()) {
- String separator = "";
- for (int i = 0; i < children.size(); ++i) {
- String fvname = children.get(i);
- IConfigureOption o = cfg.getOption(fvname);
- if (o.isParmSet()) {
- if (o instanceof IFlagConfigureValueOption) {
- parm.append(separator + ((IFlagConfigureValueOption)o).getFlags()); //$NON-NLS-1$
- separator = " ";
- haveParm = true;
+ StringBuffer parms = new StringBuffer();
+ // Multiple flags are designated by putting multiple flags together using "|" as delimiter
+ String[] flagNames = getName().split("\\|"); //$NON-NLS-1$
+ String flagSeparator = "";
+ for (String flagName : flagNames) {
+ parms.append(flagSeparator);
+ flagSeparator = " "; //$NON-NLS-1$
+ StringBuffer parm = new StringBuffer(flagName+"=\""); //$NON-NLS-1$
+ boolean haveParm = false;
+ if (isParmSet()) {
+ String separator = "";
+ for (int i = 0; i < children.size(); ++i) {
+ String fvname = children.get(i);
+ IConfigureOption o = cfg.getOption(fvname);
+ if (o.isParmSet()) {
+ if (o instanceof IFlagConfigureValueOption) {
+ parm.append(separator + ((IFlagConfigureValueOption)o).getFlags()); //$NON-NLS-1$
+ separator = " ";
+ haveParm = true;
+ }
}
}
- }
- if (haveParm) {
- parm.append("\""); //$NON-NLS-1$
- return parm.toString();
+ if (haveParm) {
+ parm.append("\""); //$NON-NLS-1$
+ parms.append(parm);
+ }
}
}
- return ""; //$NON-NLS-1$
+ return parms.toString();
}
public String getParameterName() {

Back to the top