diff mbox

[v4,01/10] configure: Support configuring c++ compiler

Message ID 20130606150625.10486.29912.stgit@hds.com
State New
Headers show

Commit Message

Tomoki Sekiyama June 6, 2013, 3:06 p.m. UTC
Add configuration for c++ compiler (${cross_prefix}g++ as default) in
configure and Makefiles.

Currently, usage of c++ language is only for access to Windows VSS
using COM+ services in qemu-guest-agent for Windows.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
---
 configure |   13 +++++++++++++
 rules.mak |    9 ++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

Comments

Paolo Bonzini June 18, 2013, 10:17 a.m. UTC | #1
Il 06/06/2013 17:06, Tomoki Sekiyama ha scritto:
> Add configuration for c++ compiler (${cross_prefix}g++ as default) in
> configure and Makefiles.
> 
> Currently, usage of c++ language is only for access to Windows VSS
> using COM+ services in qemu-guest-agent for Windows.
> 
> Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
> ---
>  configure |   13 +++++++++++++
>  rules.mak |    9 ++++++++-
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 1654413..a2fc3f3 100755
> --- a/configure
> +++ b/configure
> @@ -251,6 +251,8 @@ for opt do
>    ;;
>    --cc=*) CC="$optarg"
>    ;;
> +  --cxx=*) CXX="$optarg"
> +  ;;
>    --source-path=*) source_path="$optarg"
>    ;;
>    --cpu=*) cpu="$optarg"
> @@ -281,6 +283,12 @@ else
>    cc="${CC-${cross_prefix}gcc}"
>  fi
>  
> +if test -z "${CXX}${cross_prefix}"; then
> +  cxx="c++"
> +else
> +  cxx="${CXX-${cross_prefix}g++}"
> +fi
> +
>  ar="${AR-${cross_prefix}ar}"
>  as="${AS-${cross_prefix}as}"
>  cpp="${CPP-$cc -E}"
> @@ -614,6 +622,8 @@ for opt do
>    ;;
>    --host-cc=*) host_cc="$optarg"
>    ;;
> +  --cxx=*) cxx="$optarg"
> +  ;;
>    --objcc=*) objcc="$optarg"
>    ;;
>    --make=*) make="$optarg"
> @@ -1015,6 +1025,7 @@ echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
>  echo "  --cc=CC                  use C compiler CC [$cc]"
>  echo "  --host-cc=CC             use C compiler CC [$host_cc] for code run at"
>  echo "                           build time"
> +echo "  --cxx=CXX                use C++ compiler CXX [$cxx]"
>  echo "  --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]"
>  echo "  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS"
>  echo "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
> @@ -3459,6 +3470,7 @@ fi
>  echo "Source path       $source_path"
>  echo "C compiler        $cc"
>  echo "Host C compiler   $host_cc"
> +echo "C++ compiler      $cxx"
>  echo "Objective-C compiler $objcc"
>  echo "CFLAGS            $CFLAGS"
>  echo "QEMU_CFLAGS       $QEMU_CFLAGS"
> @@ -4036,6 +4048,7 @@ echo "PYTHON=$python" >> $config_host_mak
>  echo "CC=$cc" >> $config_host_mak
>  echo "CC_I386=$cc_i386" >> $config_host_mak
>  echo "HOST_CC=$host_cc" >> $config_host_mak
> +echo "CXX=$cxx" >> $config_host_mak
>  echo "OBJCC=$objcc" >> $config_host_mak
>  echo "AR=$ar" >> $config_host_mak
>  echo "AS=$as" >> $config_host_mak
> diff --git a/rules.mak b/rules.mak
> index 4499745..abc2e84 100644
> --- a/rules.mak
> +++ b/rules.mak
> @@ -8,9 +8,13 @@ MAKEFLAGS += -rR
>  %.d:
>  %.h:
>  %.c:
> +%.cpp:
>  %.m:
>  %.mak:
>  
> +# Flags for C++ compilation
> +QEMU_CXXFLAGS = -D__STDC_LIMIT_MACROS $(filter-out -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wold-style-declaration -Wold-style-definition -Wredundant-decls, $(QEMU_CFLAGS))
> +
>  # Flags for dependency generation
>  QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d
>  
> @@ -50,6 +54,9 @@ endif
>  %.o: %.asm
>  	$(call quiet-command,$(AS) $(ASFLAGS) -o $@ $<,"  AS    $(TARGET_DIR)$@")
>  
> +%.o: %.cpp
> +	$(call quiet-command,$(CXX) $(QEMU_INCLUDES) $(QEMU_CXXFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  CXX   $(TARGET_DIR)$@")
> +
>  %.o: %.m
>  	$(call quiet-command,$(OBJCC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  OBJC  $(TARGET_DIR)$@")
>  
> @@ -70,7 +77,7 @@ quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1))
>  cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \
>                >/dev/null 2>&1 && echo OK), $2, $3)
>  
> -VPATH_SUFFIXES = %.c %.h %.S %.m %.mak %.texi %.sh %.rc
> +VPATH_SUFFIXES = %.c %.h %.S %.cpp %.m %.mak %.texi %.sh %.rc
>  set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1)))
>  
>  # find-in-path
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Laszlo Ersek June 25, 2013, 8:15 a.m. UTC | #2
On 06/06/13 17:06, Tomoki Sekiyama wrote:
> Add configuration for c++ compiler (${cross_prefix}g++ as default) in
> configure and Makefiles.
> 
> Currently, usage of c++ language is only for access to Windows VSS
> using COM+ services in qemu-guest-agent for Windows.
> 
> Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
> ---
>  configure |   13 +++++++++++++
>  rules.mak |    9 ++++++++-
>  2 files changed, 21 insertions(+), 1 deletion(-)

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
diff mbox

Patch

diff --git a/configure b/configure
index 1654413..a2fc3f3 100755
--- a/configure
+++ b/configure
@@ -251,6 +251,8 @@  for opt do
   ;;
   --cc=*) CC="$optarg"
   ;;
+  --cxx=*) CXX="$optarg"
+  ;;
   --source-path=*) source_path="$optarg"
   ;;
   --cpu=*) cpu="$optarg"
@@ -281,6 +283,12 @@  else
   cc="${CC-${cross_prefix}gcc}"
 fi
 
+if test -z "${CXX}${cross_prefix}"; then
+  cxx="c++"
+else
+  cxx="${CXX-${cross_prefix}g++}"
+fi
+
 ar="${AR-${cross_prefix}ar}"
 as="${AS-${cross_prefix}as}"
 cpp="${CPP-$cc -E}"
@@ -614,6 +622,8 @@  for opt do
   ;;
   --host-cc=*) host_cc="$optarg"
   ;;
+  --cxx=*) cxx="$optarg"
+  ;;
   --objcc=*) objcc="$optarg"
   ;;
   --make=*) make="$optarg"
@@ -1015,6 +1025,7 @@  echo "  --cross-prefix=PREFIX    use PREFIX for compile tools [$cross_prefix]"
 echo "  --cc=CC                  use C compiler CC [$cc]"
 echo "  --host-cc=CC             use C compiler CC [$host_cc] for code run at"
 echo "                           build time"
+echo "  --cxx=CXX                use C++ compiler CXX [$cxx]"
 echo "  --objcc=OBJCC            use Objective-C compiler OBJCC [$objcc]"
 echo "  --extra-cflags=CFLAGS    append extra C compiler flags QEMU_CFLAGS"
 echo "  --extra-ldflags=LDFLAGS  append extra linker flags LDFLAGS"
@@ -3459,6 +3470,7 @@  fi
 echo "Source path       $source_path"
 echo "C compiler        $cc"
 echo "Host C compiler   $host_cc"
+echo "C++ compiler      $cxx"
 echo "Objective-C compiler $objcc"
 echo "CFLAGS            $CFLAGS"
 echo "QEMU_CFLAGS       $QEMU_CFLAGS"
@@ -4036,6 +4048,7 @@  echo "PYTHON=$python" >> $config_host_mak
 echo "CC=$cc" >> $config_host_mak
 echo "CC_I386=$cc_i386" >> $config_host_mak
 echo "HOST_CC=$host_cc" >> $config_host_mak
+echo "CXX=$cxx" >> $config_host_mak
 echo "OBJCC=$objcc" >> $config_host_mak
 echo "AR=$ar" >> $config_host_mak
 echo "AS=$as" >> $config_host_mak
diff --git a/rules.mak b/rules.mak
index 4499745..abc2e84 100644
--- a/rules.mak
+++ b/rules.mak
@@ -8,9 +8,13 @@  MAKEFLAGS += -rR
 %.d:
 %.h:
 %.c:
+%.cpp:
 %.m:
 %.mak:
 
+# Flags for C++ compilation
+QEMU_CXXFLAGS = -D__STDC_LIMIT_MACROS $(filter-out -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wold-style-declaration -Wold-style-definition -Wredundant-decls, $(QEMU_CFLAGS))
+
 # Flags for dependency generation
 QEMU_DGFLAGS += -MMD -MP -MT $@ -MF $(*D)/$(*F).d
 
@@ -50,6 +54,9 @@  endif
 %.o: %.asm
 	$(call quiet-command,$(AS) $(ASFLAGS) -o $@ $<,"  AS    $(TARGET_DIR)$@")
 
+%.o: %.cpp
+	$(call quiet-command,$(CXX) $(QEMU_INCLUDES) $(QEMU_CXXFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  CXX   $(TARGET_DIR)$@")
+
 %.o: %.m
 	$(call quiet-command,$(OBJCC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<,"  OBJC  $(TARGET_DIR)$@")
 
@@ -70,7 +77,7 @@  quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1))
 cc-option = $(if $(shell $(CC) $1 $2 -S -o /dev/null -xc /dev/null \
               >/dev/null 2>&1 && echo OK), $2, $3)
 
-VPATH_SUFFIXES = %.c %.h %.S %.m %.mak %.texi %.sh %.rc
+VPATH_SUFFIXES = %.c %.h %.S %.cpp %.m %.mak %.texi %.sh %.rc
 set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1)))
 
 # find-in-path