Skip to contentSkip to conversation

More Makefile/configure simplification

PATCH In review Juan Quintela 5 participants 91 messages Aug 3, 2009 – Aug 26, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover More Makefile/configure simplification

Hi

I compiled natively on x86_64 linux and crosscompiled it for windows. Compilation in a different build directory also works.

v2:
- split CFLAGS into QEMU_CFLAGS and CFLAGS to enable:
make CFLAGS="-O3" foo.o
make CFLAGS=""
- We have now LIBS/libs_softmmu/libs_tools
Everything that is in libs_tools is also in libs_softmmu, namely curl and vde
- We have now LIBS and QEMU_CFLAGS per target
- all *_LIBS have been folded in the right LIBS variable
- All arch/os setup/libs/cflags moved to ./configure
- AUDIO_PT is gone, it setup to linke with -pthread, but the LDFLAGS was used only for executables in main Makefile, and none of them use sound. It was not used for the targets, that is where it would make a difference.
- aio is renamed to posix_aio

v1:
- CPPFLAGS is gone, long life to CFLAGS
- Refactor common CFLAGS setup to ./configure
- Use same CFLAGS for all configure tests
- ARCH/OS_CFLAGS/LDFLAGS are gone, we add to CFLAGS as we find more options
- new functions complie_prog() compile_object(), test case compilation is done with one function
- LIBS: Start LIBS reorganization, common stuff moved to ./configure
- libs_softmmu created for libraries that are only for softmmu
- moved compilation tests out of the creation of configuration files, make things way easier.
- Moved sparc_cpu setup to a single place
- minor cleanups/refactors/.. here and there

Comments?

ToDo:
- move all the handling of options to the start of the file
- change meanining of options to:
foo="no" -> don't even try
foo="" -> try to detect, and go with detected result
foo="yes" -> detect, and if it is not found, just exit with an error message.
Distributions really want to be able to tell:
./configure --enable-kvm --enable-vnc-tls ...
And if it didn't found anything, just exit. Packager would sort the right BuildRequires at this point.
- Start thinking how to enable/disable drivers

Later, Juan.

Juan Quintela (81):
strip binary is not used anywhere
oss variable don't exist anymore
Use CFLAGS from enviroment, ARCH_CFLAGS hasn't been defined yet move cpu command line setting to the beggining
move check_linker_flags sooner than starting of printing variables remove not needed rt variable
move checks for bswap32/bswap_32 sooner than starting of printing
variables
move general CFLAGS/LDFLAGS definitions after last $cc run We want to add options at the beggining, not at the end of variables Remove OS_{CFLAGS,LDFLAGS} and ARCH_{LDFLAGS,CFLAGS}
move EXTRA_CFLAGS/LDFLAGS to the very beginning
create compile_object/compile_prog functions
remove unused temporal files
Add CURL_CFLAGS
__sparc_*__ is defined through -D__sparc_*__
move mingw32 code after selection of OS
This variables can't be set here
refactor kqemu selection for both mingw32
move sparc_cpu arg parsing to the begining
refactor sparc_cpu code to be in a single place
refactor $cpu selection in various places
reindent Operating System selection configure
We use -lz for all binaries
We want to pass LIB through configuration files now PTHREADLIBS was used for all binaries
CLOCKLIBS was used for all binaries
Move to configure CONFIG_SOLARIS libraries needed always Move to configure CONFIG_WIN32 libraries needed always
We set -Werror through configure now
Rename CPPFLAGS to QEMU_CFLAGS
split QEMU_CFLAGS very long line
move common QEMU_CFLAGS to configure
Refactor HELPER_CFLAGS
move SDL_LIBS Win32 hack to configure
Add libs_softmmu variable
Add SDL_LIBS to libs_softmmu
gcc generates the right dependency for this file
move coreaudio libraries to coreaudio selection
Move sound library selection to sound selection
files are only compiled when CONFIG_ADLIB is defined
Test if we need -lutil in ,/configure
Fold CURSES_LIBS into libsoftmmu_libs
Fold VNC_TLS_LIBS into libs_softmmu
Fold VNC_SASL_LIBS into libs_softmmu
Fold XEN_LIBS into libs_softmmu
Fold BLUEZ_LIBS into libs_softmmu
Fold FDT_LIBS into libs_softmmu
Fold BRLAPI_LIBS into libs_softmmu
remove duplicated TARGET_GPROF code
\!CONFIG_USER_ONLY == CONFIG_SOFTMMU
Introduce CONFIG_NOSOFTFLOAT and simplify Makefile.target permit to add things to LDFLAGS for target
refactor linker_script common part and change quoting permit to add things to CFLAGS per target
fix typo, there should be bsd_user there
Move alpha CFLAGS target to configure
Move ia64 QEMU_CFLAGS target to configure
this bit was already generated in configure
Fold TARGET_GPROF handling in configure
Generate more conmmon CFLAGS
Added CONFIG_NEED_MMU for microblaze and cris
Move dis-* selection to configure
Use only one KVM_CFLAGS
Use one less HELPER_CFLAGS
Make slirp include dir globlal in cflags
FMOD_CFLAGS is not set when CONFIG_FMOD is undef
AUDIO_PT is not needed
Generate CONFIG_AUDIO_PT_INT in configure
CONFIG_POSIX makes more sense that not CONFIG_WIN32 remove last 3 uses of :=, everywhere else uses += or = Consolidate audio flags in configure
We also need TARGET_<arechname> in Makefiles
use TARGET_<arch name> for selection
Disable aio in mingw32
Add libs_tools support
VDE libs are used both by tools and softmmu
CURL libs are used both by tools and softmmu
Add cocoa libs at Darwin selection time
convert gprof flags to style of rest of Makefile
Move libsunpath to use the same style than everything else rename aio/CONFIG_AIO to posix_aio/CONFIG_POSIX_AIO

 Makefile                   |   59 +---
 Makefile.hw                |    4 +-
 Makefile.target            |  275 ++------------
 block/raw-posix.c          |   26 +-
 configure                  |  864 +++++++++++++++++++++++++-------------------
 create_config              |    8 -
 pc-bios/optionrom/Makefile |    6 +-
 rules.mak                  |    6 +-
 8 files changed, 555 insertions(+), 693 deletions(-)
#1 lore raw

PATCH v2 1/81 strip binary is not used anywhere

---
 configure |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
configure +0 -2
index 36db3b2..b7d86af 100755
@@ -33,7 +33,6 @@ host_cc="gcc"
 ar="ar"
 make="make"
 install="install"
-strip="strip"
 objcopy="objcopy"
 ld="ld"
 
@@ -54,7 +53,6 @@ done
 
 cc="${cross_prefix}${cc}"
 ar="${cross_prefix}${ar}"
-strip="${cross_prefix}${strip}"
 objcopy="${cross_prefix}${objcopy}"
 ld="${cross_prefix}${ld}"
 
Signature · 1 line
1.6.2.5
#2 lore raw

PATCH v2 2/81 oss variable don't exist anymore

In reply to Juan Quintela
---
 configure |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
configure +0 -1
index b7d86af..c70da30 100755
@@ -682,7 +682,6 @@ fi
 if test "$mingw32" = "yes" ; then
     linux="no"
     EXESUF=".exe"
-    oss="no"
     linux_user="no"
     bsd_user="no"
     OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
Signature · 1 line
1.6.2.5
#3 lore raw

PATCH v2 3/81 Use CFLAGS from enviroment, ARCH_CFLAGS hasn't been defined yet

In reply to Juan Quintela
---
 configure |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
configure +2 -2
index c70da30..efd8c96 100755
@@ -61,7 +61,7 @@ cat > $TMPC <<EOF
 int main(void) {}
 EOF
 
-if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
+if $cc $CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
   : C compiler works ok
 else
     echo "ERROR: \"$cc\" either does not exist or does not work"
@@ -75,7 +75,7 @@ cat > $TMPC <<EOF
 #endif
 int main(void) { return 0; }
 EOF
-  $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
+  $cc $CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
 }
 
 if check_define __i386__ ; then
Signature · 1 line
1.6.2.5
#4 lore raw

PATCH v2 4/81 move cpu command line setting to the beggining

In reply to Juan Quintela
---
 configure |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
configure +8 -2
index efd8c96..ebec8d6 100755
@@ -21,6 +21,7 @@ TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
 trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
 
 # default parameters
+cpu=""
 prefix=""
 interp_prefix="/usr/gnemul/qemu-%M"
 static="no"
@@ -44,6 +45,8 @@ for opt do
   ;;
   --cc=*) cc="$optarg"
   ;;
+  --cpu=*) cpu="$optarg"
+  ;;
   esac
 done
 
@@ -78,7 +81,10 @@ EOF
   $cc $CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
 }
 
-if check_define __i386__ ; then
+if test ! -z "$cpu" ; then
+  # command line argument
+  :
+elif check_define __i386__ ; then
   cpu="i386"
 elif check_define __x86_64__ ; then
   cpu="x86_64"
@@ -386,7 +392,7 @@ for opt do
   ;;
   --extra-ldflags=*) EXTRA_LDFLAGS="$optarg"
   ;;
-  --cpu=*) cpu="$optarg"
+  --cpu=*)
   ;;
   --target-list=*) target_list="$optarg"
   ;;
Signature · 1 line
1.6.2.5
#5 lore raw

PATCH v2 5/81 move check_linker_flags sooner than starting of printing variables

In reply to Juan Quintela
---
 configure |   64 +++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 33 insertions(+), 31 deletions(-)
configure +33 -31
index ebec8d6..2594bb2 100755
@@ -1394,6 +1394,37 @@ if test "$rt" = "yes" ; then
   CLOCKLIBS="-lrt"
 fi
 
+# Determine what linker flags to use to force archive inclusion
+check_linker_flags()
+{
+    w2=
+    if test "$2" ; then
+	w2=-Wl,$2
+    fi
+    $cc $ARCH_CFLAGS -o $TMPE $OS_CFLAGS $TMPC -Wl,$1 ${w2} >/dev/null 2>/dev/null
+}
+
+cat > $TMPC << EOF
+int main(void) { }
+EOF
+if check_linker_flags --whole-archive --no-whole-archive ; then
+    # GNU ld
+    arlibs_begin="-Wl,--whole-archive"
+    arlibs_end="-Wl,--no-whole-archive"
+elif check_linker_flags -z,allextract -z,defaultextract ; then
+    # Solaris ld
+    arlibs_begin"=-Wl,-z,allextract"
+    arlibs_end="-Wl,-z,defaultextract"
+elif check_linker_flags -all_load ; then
+    # Mac OS X
+    arlibs_begin="-all_load"
+    arlibs_end=""
+else
+    echo "Error: your linker does not support --whole-archive or -z."
+    echo "Please report to [email protected]"
+    exit 1
+fi
+
 if test "$mingw32" = "yes" ; then
   if test -z "$prefix" ; then
       prefix="c:\\\\Program Files\\\\Qemu"
@@ -1702,37 +1733,6 @@ bsd)
 ;;
 esac
 
-# Determine what linker flags to use to force archive inclusion
-check_linker_flags()
-{
-    w2=
-    if test "$2" ; then
-	w2=-Wl,$2
-    fi
-    $cc $ARCH_CFLAGS -o $TMPE $OS_CFLAGS $TMPC -Wl,$1 ${w2} >/dev/null 2>/dev/null
-}
-
-cat > $TMPC << EOF
-int main(void) { }
-EOF
-if check_linker_flags --whole-archive --no-whole-archive ; then
-    # GNU ld
-    echo "ARLIBS_BEGIN=-Wl,--whole-archive" >> $config_host_mak
-    echo "ARLIBS_END=-Wl,--no-whole-archive" >> $config_host_mak
-elif check_linker_flags -z,allextract -z,defaultextract ; then
-    # Solaris ld
-    echo "ARLIBS_BEGIN=-Wl,-z,allextract" >> $config_host_mak
-    echo "ARLIBS_END=-Wl,-z,defaultextract" >> $config_host_mak
-elif check_linker_flags -all_load ; then
-    # Mac OS X
-    echo "ARLIBS_BEGIN=-all_load" >> $config_host_mak
-    echo "ARLIBS_END=" >> $config_host_mak
-else
-    echo "Error: your linker does not support --whole-archive or -z."
-    echo "Please report to [email protected]"
-    exit 1
-fi
-
 tools=
 if test `expr "$target_list" : ".*softmmu.*"` != 0 ; then
   tools="qemu-img\$(EXESUF) $tools"
@@ -1772,6 +1772,8 @@ echo "OBJCOPY=$objcopy" >> $config_host_mak
 echo "LD=$ld" >> $config_host_mak
 echo "CFLAGS=$CFLAGS $OS_CFLAGS $ARCH_CFLAGS $EXTRA_CFLAGS" >> $config_host_mak
 echo "LDFLAGS=$LDFLAGS $OS_LDFLAGS $ARCH_LDFLAGS $EXTRA_LDFLAGS" >> $config_host_mak
+echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
+echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
 echo "EXESUF=$EXESUF" >> $config_host_mak
 echo "PTHREADLIBS=$PTHREADLIBS" >> $config_host_mak
 echo "CLOCKLIBS=$CLOCKLIBS" >> $config_host_mak
Signature · 1 line
1.6.2.5
#7 lore raw

PATCH v2 7/81 move checks for bswap32/bswap_32 sooner than starting of printing variables

In reply to Juan Quintela
---
 configure |   44 ++++++++++++++++++++++++++++----------------
 1 files changed, 28 insertions(+), 16 deletions(-)
configure +28 -16
index 9f6ce79..3b46695 100755
@@ -1374,6 +1374,28 @@ if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x
   build_docs="no"
 fi
 
+# Search for bsawp_32 function
+byteswap_h=no
+cat > $TMPC << EOF
+#include <byteswap.h>
+int main(void) { return bswap_32(0); }
+EOF
+if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
+  byteswap_h=yes
+fi
+
+# Search for bsawp_32 function
+bswap_h=no
+cat > $TMPC << EOF
+#include <sys/endian.h>
+#include <sys/types.h>
+#include <machine/bswap.h>
+int main(void) { return bswap32(0); }
+EOF
+if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
+  bswap_h=yes
+fi
+
 ##########################################
 # Do we need librt
 cat > $TMPC <<EOF
@@ -1548,22 +1570,6 @@ if test "$mingw32" = "yes" ; then
   echo "CONFIG_WIN32=y" >> $config_host_mak
 else
   echo "CONFIG_POSIX=y" >> $config_host_mak
-  cat > $TMPC << EOF
-#include <byteswap.h>
-int main(void) { return bswap_32(0); }
-EOF
-  if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
-    echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
-  fi
-  cat > $TMPC << EOF
-#include <sys/endian.h>
-#include <sys/types.h>
-#include <machine/bswap.h>
-int main(void) { return bswap32(0); }
-EOF
-  if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
-    echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
-  fi
 fi
 
 if test "$darwin" = "yes" ; then
@@ -1670,6 +1676,12 @@ fi
 if test "$inotify" = "yes" ; then
   echo "CONFIG_INOTIFY=y" >> $config_host_mak
 fi
+if test "$byteswap_h" = "yes" ; then
+  echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
+fi
+if test "$bswap_h" = "yes" ; then
+  echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
+fi
 if test "$curl" = "yes" ; then
   echo "CONFIG_CURL=y" >> $config_host_mak
   echo "CURL_LIBS=$curl_libs" >> $config_host_mak
Signature · 1 line
1.6.2.5
#6 lore raw

PATCH v2 6/81 remove not needed rt variable

In reply to Juan Quintela
---
 configure |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
configure +1 -7
index 2594bb2..9f6ce79 100755
@@ -1376,21 +1376,15 @@ fi
 
 ##########################################
 # Do we need librt
-CLOCKLIBS=""
 cat > $TMPC <<EOF
 #include <signal.h>
 #include <time.h>
 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
 EOF
 
-rt=no
 if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
-  :
+  CLOCKLIBS=""
 elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
-  rt=yes
-fi
-
-if test "$rt" = "yes" ; then
   CLOCKLIBS="-lrt"
 fi
 
Signature · 1 line
1.6.2.5
#8 lore raw

PATCH v2 8/81 move general CFLAGS/LDFLAGS definitions after last $cc run

In reply to Juan Quintela
---
 configure |   63 +++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 33 insertions(+), 30 deletions(-)
configure +33 -30
index 3b46695..7b0ff90 100755
@@ -530,36 +530,6 @@ for opt do
   esac
 done
 
-# default flags for all hosts
-CFLAGS="$CFLAGS -g -fno-strict-aliasing"
-if test "$debug" = "no" ; then
-  CFLAGS="$CFLAGS -O2"
-fi
-CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
-LDFLAGS="$LDFLAGS -g"
-
-# Consult white-list to determine whether to enable werror
-# by default.  Only enable by default for git builds
-if test -z "$werror" ; then
-    z_version=`cut -f3 -d. $source_path/VERSION`
-    if test "$z_version" = "50" -a \
-        "$linux" = "yes" ; then
-        werror="yes"
-    else
-        werror="no"
-    fi
-fi
-
-if test "$werror" = "yes" ; then
-    CFLAGS="$CFLAGS -Werror"
-fi
-
-if test "$solaris" = "no" ; then
-    if ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
-        LDFLAGS="$LDFLAGS -Wl,--warn-common"
-    fi
-fi
-
 #
 # If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
 # ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
@@ -1441,6 +1411,39 @@ else
     exit 1
 fi
 
+# End of CC checks
+# After here, no more $cc or $ld runs
+
+# default flags for all hosts
+CFLAGS="$CFLAGS -g -fno-strict-aliasing"
+if test "$debug" = "no" ; then
+  CFLAGS="$CFLAGS -O2"
+fi
+CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
+LDFLAGS="$LDFLAGS -g"
+
+# Consult white-list to determine whether to enable werror
+# by default.  Only enable by default for git builds
+if test -z "$werror" ; then
+    z_version=`cut -f3 -d. $source_path/VERSION`
+    if test "$z_version" = "50" -a \
+        "$linux" = "yes" ; then
+        werror="yes"
+    else
+        werror="no"
+    fi
+fi
+
+if test "$werror" = "yes" ; then
+    CFLAGS="$CFLAGS -Werror"
+fi
+
+if test "$solaris" = "no" ; then
+    if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
+        LDFLAGS="$LDFLAGS -Wl,--warn-common"
+    fi
+fi
+
 if test "$mingw32" = "yes" ; then
   if test -z "$prefix" ; then
       prefix="c:\\\\Program Files\\\\Qemu"
Signature · 1 line
1.6.2.5
#9 lore raw

PATCH v2 9/81 We want to add options at the beggining, not at the end of variables

In reply to Juan Quintela
---
 configure |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
configure +7 -7
index 7b0ff90..a4a7d13 100755
@@ -1415,12 +1415,12 @@ fi
 # After here, no more $cc or $ld runs
 
 # default flags for all hosts
-CFLAGS="$CFLAGS -g -fno-strict-aliasing"
+CFLAGS="-g -fno-strict-aliasing $CFLAGS"
 if test "$debug" = "no" ; then
-  CFLAGS="$CFLAGS -O2"
+  CFLAGS="-O2 $CFLAGS"
 fi
-CFLAGS="$CFLAGS -Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls"
-LDFLAGS="$LDFLAGS -g"
+CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls $CFLAGS"
+LDFLAGS="-g $LDFLAGS"
 
 # Consult white-list to determine whether to enable werror
 # by default.  Only enable by default for git builds
@@ -1435,12 +1435,12 @@ if test -z "$werror" ; then
 fi
 
 if test "$werror" = "yes" ; then
-    CFLAGS="$CFLAGS -Werror"
+    CFLAGS="-Werror $CFLAGS"
 fi
 
 if test "$solaris" = "no" ; then
     if $ld --version 2>/dev/null | grep "GNU ld" >/dev/null 2>/dev/null ; then
-        LDFLAGS="$LDFLAGS -Wl,--warn-common"
+        LDFLAGS="-Wl,--warn-common $LDFLAGS"
     fi
 fi
 
@@ -1598,7 +1598,7 @@ if test "$gprof" = "yes" ; then
 fi
 if test "$static" = "yes" ; then
   echo "CONFIG_STATIC=y" >> $config_host_mak
-  LDFLAGS="$LDFLAGS -static"
+  LDFLAGS="-static $LDFLAGS"
 fi
 if test $profiler = "yes" ; then
   echo "CONFIG_PROFILER=y" >> $config_host_mak
Signature · 1 line
1.6.2.5
#10 lore raw

PATCH v2 10/81 Remove OS_{CFLAGS, LDFLAGS} and ARCH_{LDFLAGS, CFLAGS}

In reply to Juan Quintela

Fold its values into LDFLAGS and CFLAGS

---
 configure |  127 +++++++++++++++++++++++++++++++------------------------------
 1 files changed, 64 insertions(+), 63 deletions(-)
configure +64 -63
index a4a7d13..537e7bb 100755
@@ -224,7 +224,7 @@ fi
 case $targetos in
 CYGWIN*)
 mingw32="yes"
-OS_CFLAGS="-mno-cygwin"
+CFLAGS="-mno-cygwin $CFLAGS"
 if [ "$cpu" = "i386" ] ; then
     kqemu="yes"
 fi
@@ -282,16 +282,16 @@ if [ "$cpu" = "i386" ] ; then
     [ "$is_x86_64" = "1" ] && cpu=x86_64
 fi
 if [ "$cpu" = "x86_64" ] ; then
-    OS_CFLAGS="-arch x86_64"
-    LDFLAGS="-arch x86_64"
+    CFLAGS="-arch x86_64 $CFLAGS"
+    LDFLAGS="-arch x86_64 $LDFLAGS"
 else
-    OS_CFLAGS="-mdynamic-no-pic"
+    CFLAGS="-mdynamic-no-pic $CFLAGS"
 fi
 darwin_user="yes"
 cocoa="yes"
 audio_drv_list="coreaudio"
 audio_possible_drivers="coreaudio sdl fmod"
-OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
+LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
 ;;
 SunOS)
     solaris="yes"
@@ -325,7 +325,7 @@ SunOS)
         audio_drv_list="oss"
     fi
     audio_possible_drivers="oss sdl"
-    OS_CFLAGS=-std=gnu99
+    CFLAGS="-std=gnu99 $CFLAGS"
 ;;
 AIX)
 aix="yes"
@@ -479,18 +479,18 @@ for opt do
       sparc_cpu="$optarg"
       case $sparc_cpu in
         v7|v8)
-          ARCH_CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__"
-          ARCH_LDFLAGS="-m32"
+          CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $CFLAGS"
+          LDFLAGS="-m32 $LDFLAGS"
           cpu="sparc"
         ;;
         v8plus|v8plusa)
-          ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"
-          ARCH_LDFLAGS="-m32"
+          CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $CFLAGS"
+          LDFLAGS="-m32 $LDFLAGS"
           cpu="sparc"
         ;;
         v9)
-          ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__"
-          ARCH_LDFLAGS="-m64"
+          CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $CFLAGS"
+          LDFLAGS="-m64 $LDFLAGS"
           cpu="sparc64"
         ;;
         *)
@@ -532,40 +532,40 @@ done
 
 #
 # If cpu ~= sparc and  sparc_cpu hasn't been defined, plug in the right
-# ARCH_CFLAGS/ARCH_LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
+# CFLAGS/LDFLAGS (assume sparc_v8plus for 32-bit and sparc_v9 for 64-bit)
 #
 host_guest_base="no"
 case "$cpu" in
     sparc) if test -z "$sparc_cpu" ; then
-               ARCH_CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__"
-               ARCH_LDFLAGS="-m32"
+               CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__ $CFLAGS"
+               LDFLAGS="-m32 $LDFLAGS"
            fi
-           ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g2 -ffixed-g3"
+           CFLAGS="-ffixed-g2 -ffixed-g3 $CFLAGS"
            if test "$solaris" = "no" ; then
-               ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g6"
+               CFLAGS="-ffixed-g1 -ffixed-g6 $CFLAGS"
            fi
            ;;
     sparc64) if test -z "$sparc_cpu" ; then
-               ARCH_CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__"
-               ARCH_LDFLAGS="-m64"
+               CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $CFLAGS"
+               LDFLAGS="-m64 $LDFLAGS"
            fi
            if test "$solaris" = "no" ; then
-               ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g5 -ffixed-g6 -ffixed-g7"
+               CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $CFLAGS"
            else
-               ARCH_CFLAGS="$ARCH_CFLAGS -ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7"
+               CFLAGS="-ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7 $CFLAGS"
            fi
            ;;
     s390)
-           ARCH_CFLAGS="-march=z900"
+           CFLAGS="-march=z900 $CFLAGS"
            ;;
     i386)
-           ARCH_CFLAGS="-m32"
-           ARCH_LDFLAGS="-m32"
+           CFLAGS="-m32 $CFLAGS"
+           LDFLAGS="-m32 $LDFLAGS"
            host_guest_base="yes"
            ;;
     x86_64)
-           ARCH_CFLAGS="-m64"
-           ARCH_LDFLAGS="-m64"
+           CFLAGS="-m64 $CFLAGS"
+           LDFLAGS="-m64 $LDFLAGS"
            host_guest_base="yes"
            ;;
     arm*)
@@ -660,7 +660,7 @@ if test "$mingw32" = "yes" ; then
     EXESUF=".exe"
     linux_user="no"
     bsd_user="no"
-    OS_CFLAGS="$OS_CFLAGS -DWIN32_LEAN_AND_MEAN -DWINVER=0x501"
+    CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $CFLAGS"
 fi
 
 if test ! -x "$(which cgcc 2>/dev/null)"; then
@@ -774,7 +774,7 @@ int main(int argc, char ** argv){
 }
 EOF
 
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
+if $cc $CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
 $TMPE && bigendian="yes"
 else
 echo big/little test failed
@@ -820,7 +820,7 @@ void foo()
 }
 EOF
 
-if $cc $ARCH_CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
+if $cc $CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
   :
 else
    nptl="no"
@@ -833,7 +833,7 @@ cat > $TMPC << EOF
 #include <zlib.h>
 int main(void) { zlibVersion(); return 0; }
 EOF
-if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
+if $cc $CFLAGS -o $TMPE $TMPC -lz > /dev/null 2> /dev/null ; then
     :
 else
     echo
@@ -853,7 +853,7 @@ if test "$xen" = "yes" ; then
 #include <xs.h>
 int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
 EOF
-  if $cc $CFLAGS $ARCH_CFLAGS -c -o $TMPO $TMPC $LDFLAGS $xen_libs 2> /dev/null > /dev/null ; then
+  if $cc $CFLAGS -c -o $TMPO $TMPC $LDFLAGS $xen_libs 2> /dev/null > /dev/null ; then
     :
   else
     xen="no"
@@ -874,7 +874,7 @@ int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
 EOF
   sdl_cflags=`sdl-config --cflags 2> /dev/null`
   sdl_libs=`sdl-config --libs 2> /dev/null`
-  if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $sdl_cflags $TMPC $sdl_libs > $TMPSDLLOG 2>&1 ; then
+  if $cc $CFLAGS -o $TMPE $sdl_cflags $TMPC $sdl_libs > $TMPSDLLOG 2>&1 ; then
     _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
     if test "$_sdlversion" -lt 121 ; then
       sdl_too_old=yes
@@ -891,7 +891,7 @@ EOF
          sdl_libs="$sdl_libs `aalib-config --static-libs >2 /dev/null`"
          sdl_cflags="$sd_cflags `aalib-config --cflags >2 /dev/null`"
       fi
-      if $cc -o $TMPE ${OS_CFLAGS} $sdl_cflags $TMPC $sdl_libs > /dev/null 2> /dev/null; then
+      if $cc -o $TMPE $CFLAGS $sdl_cflags $TMPC $sdl_libs > /dev/null 2> /dev/null; then
 	:
       else
         sdl=no
@@ -910,7 +910,7 @@ if test "$sdl" = "yes" ; then
 #endif
 int main(void) { return 0; }
 EOF
-  if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $sdl_cflags $TMPC $sdl_libs > /dev/null 2>&1 ; then
+  if $cc $CFLAGS -o $TMPE $sdl_cflags $TMPC $sdl_libs > /dev/null 2>&1 ; then
     sdl_libs="$sdl_libs -lX11"
   fi
 fi
@@ -924,7 +924,7 @@ int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
 EOF
     vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
     vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
-    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
+    if $cc $CFLAGS -o $TMPE $vnc_tls_cflags $TMPC \
            $vnc_tls_libs > /dev/null 2> /dev/null ; then
 	:
     else
@@ -943,7 +943,7 @@ EOF
     # Assuming Cyrus-SASL installed in /usr prefix
     vnc_sasl_cflags=""
     vnc_sasl_libs="-lsasl2"
-    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
+    if $cc $CFLAGS -o $TMPE $vnc_sasl_cflags $TMPC \
            $vnc_sasl_libs 2> /dev/null > /dev/null ; then
 	:
     else
@@ -962,7 +962,7 @@ int main(void)
     return 0;
 }
 EOF
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
+if $cc $CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
    fnmatch="yes"
 fi
 
@@ -980,7 +980,7 @@ int main(void)
     return 0;
 }
 EOF
-  if $cc $ARCH_CFLAGS -o $TMPE $TMPC $vde_libs > /dev/null 2> /dev/null ; then
+  if $cc $CFLAGS -o $TMPE $TMPC $vde_libs > /dev/null 2> /dev/null ; then
     vde=yes
   fi
 fi
@@ -999,7 +999,7 @@ audio_drv_probe()
 #include <$hdr>
 int main(void) { $exp }
 EOF
-    if $cc $ARCH_CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
+    if $cc $CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
         :
     else
         echo
@@ -1064,7 +1064,7 @@ if test "$brlapi" = "yes" ; then
 #include <brlapi.h>
 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
 EOF
-  if $cc ${ARCH_CFLAGS} -o $TMPE ${OS_CFLAGS} $TMPC $brlapi_libs > /dev/null 2> /dev/null ; then
+  if $cc $CFLAGS -o $TMPE $TMPC $brlapi_libs > /dev/null 2> /dev/null ; then
     brlapi=yes
   fi
 fi
@@ -1080,9 +1080,9 @@ if test "$curses" = "yes" ; then
 #endif
 int main(void) { resize_term(0, 0); return curses_version(); }
 EOF
-  if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lncurses > /dev/null 2> /dev/null ; then
+  if $cc $CFLAGS -o $TMPE $TMPC -lncurses > /dev/null 2> /dev/null ; then
     curses_libs="-lncurses"
-  elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
+  elif $cc $CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
     curses_libs="-lcurses"
   else
     curses=no
@@ -1099,7 +1099,7 @@ if test "$curl" = "yes" ; then
 int main(void) { return curl_easy_init(); }
 EOF
   curl_libs=`curl-config --libs 2>/dev/null`
- if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
+ if $cc $CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
     curl=yes
   fi
 fi # test "$curl"
@@ -1116,7 +1116,7 @@ int main(void) { return bt_error(0); }
 EOF
   bluez_cflags=`pkg-config --cflags bluez 2> /dev/null`
   bluez_libs=`pkg-config --libs bluez 2> /dev/null`
-  if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $bluez_cflags $TMPC \
+  if $cc $CFLAGS -o $TMPE $bluez_cflags $TMPC \
       $bluez_libs > /dev/null 2> /dev/null ; then
     :
   else
@@ -1156,14 +1156,14 @@ EOF
   else
       kvm_cflags=""
   fi
-  if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC \
+  if $cc $CFLAGS -o $TMPE $kvm_cflags $TMPC \
       > /dev/null 2>/dev/null ; then
     :
   else
     kvm="no";
     if [ -x "`which awk 2>/dev/null`" ] && \
        [ -x "`which grep 2>/dev/null`" ]; then
-      kvmerr=`LANG=C $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $kvm_cflags $TMPC 2>&1 \
+      kvmerr=`LANG=C $cc $CFLAGS -o $TMPE $kvm_cflags $TMPC 2>&1 \
 	| grep "error: " \
 	| awk -F "error: " '{if (NR>1) printf(", "); printf("%s",$2);}'`
       if test "$kvmerr" != "" ; then
@@ -1187,7 +1187,7 @@ cat > $TMPC << EOF
 int main(void) { pthread_create(0,0,0,0); return 0; }
 EOF
   for pthread_lib in $PTHREADLIBS_LIST; do
-    if $cc $ARCH_CFLAGS -o $TMPE $TMPC $pthread_lib 2> /dev/null > /dev/null ; then
+    if $cc $CFLAGS -o $TMPE $TMPC $pthread_lib 2> /dev/null > /dev/null ; then
       pthread=yes
       PTHREADLIBS="$pthread_lib"
       break
@@ -1209,7 +1209,7 @@ cat > $TMPC <<EOF
 int main(void) { struct iovec iov; return 0; }
 EOF
 iovec=no
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
+if $cc $CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
   iovec=yes
 fi
 
@@ -1222,7 +1222,7 @@ cat > $TMPC <<EOF
 int main(void) { preadv; }
 EOF
 preadv=no
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
+if $cc $CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
   preadv=yes
 fi
 
@@ -1234,7 +1234,7 @@ if test "$fdt" = "yes" ; then
   cat > $TMPC << EOF
 int main(void) { return 0; }
 EOF
-  if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC $fdt_libs 2> /dev/null > /dev/null ; then
+  if $cc $CFLAGS -o $TMPE $TMPC $fdt_libs 2> /dev/null > /dev/null ; then
     fdt=yes
   fi
 fi
@@ -1258,7 +1258,7 @@ main(void)
 	return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
 }
 EOF
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
+if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
   atfile=yes
 fi
 
@@ -1278,7 +1278,7 @@ main(void)
 	return inotify_init();
 }
 EOF
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
+if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
   inotify=yes
 fi
 
@@ -1297,7 +1297,7 @@ int main(void)
     return 0;
 }
 EOF
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
   utimens=yes
 fi
 
@@ -1315,7 +1315,7 @@ int main(void)
     return 0;
 }
 EOF
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
   pipe2=yes
 fi
 
@@ -1335,7 +1335,7 @@ int main(void)
     return 0;
 }
 EOF
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
   splice=yes
 fi
 
@@ -1350,7 +1350,7 @@ cat > $TMPC << EOF
 #include <byteswap.h>
 int main(void) { return bswap_32(0); }
 EOF
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
+if $cc $CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
   byteswap_h=yes
 fi
 
@@ -1362,7 +1362,7 @@ cat > $TMPC << EOF
 #include <machine/bswap.h>
 int main(void) { return bswap32(0); }
 EOF
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
+if $cc $CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
   bswap_h=yes
 fi
 
@@ -1374,9 +1374,9 @@ cat > $TMPC <<EOF
 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
 EOF
 
-if $cc $ARCH_CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
+if $cc $CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
   CLOCKLIBS=""
-elif $cc $ARCH_CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
+elif $cc $CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
   CLOCKLIBS="-lrt"
 fi
 
@@ -1387,7 +1387,7 @@ check_linker_flags()
     if test "$2" ; then
 	w2=-Wl,$2
     fi
-    $cc $ARCH_CFLAGS -o $TMPE $OS_CFLAGS $TMPC -Wl,$1 ${w2} >/dev/null 2>/dev/null
+    $cc $CFLAGS -o $TMPE $TMPC -Wl,$1 ${w2} >/dev/null 2>/dev/null
 }
 
 cat > $TMPC << EOF
@@ -1472,7 +1472,8 @@ fi
 echo "Source path       $source_path"
 echo "C compiler        $cc"
 echo "Host C compiler   $host_cc"
-echo "ARCH_CFLAGS       $ARCH_CFLAGS"
+echo "CFLAGS            $CFLAGS"
+echo "LDFLAGS           $LDFLAGS"
 echo "make              $make"
 echo "install           $install"
 echo "host CPU          $cpu"
@@ -1779,8 +1780,8 @@ fi
 echo "AR=$ar" >> $config_host_mak
 echo "OBJCOPY=$objcopy" >> $config_host_mak
 echo "LD=$ld" >> $config_host_mak
-echo "CFLAGS=$CFLAGS $OS_CFLAGS $ARCH_CFLAGS $EXTRA_CFLAGS" >> $config_host_mak
-echo "LDFLAGS=$LDFLAGS $OS_LDFLAGS $ARCH_LDFLAGS $EXTRA_LDFLAGS" >> $config_host_mak
+echo "CFLAGS=$CFLAGS $EXTRA_CFLAGS" >> $config_host_mak
+echo "LDFLAGS=$LDFLAGS $EXTRA_LDFLAGS" >> $config_host_mak
 echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
 echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
 echo "EXESUF=$EXESUF" >> $config_host_mak
Signature · 1 line
1.6.2.5
#11 lore raw

PATCH v2 11/81 move EXTRA_CFLAGS/LDFLAGS to the very beginning

In reply to Juan Quintela

Now, we compile all the tests with the values passed through the command line.

---
 configure |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
configure +8 -4
index 537e7bb..35b3c7e 100755
@@ -47,6 +47,10 @@ for opt do
   ;;
   --cpu=*) cpu="$optarg"
   ;;
+  --extra-cflags=*) CFLAGS="$optarg $CFLAGS"
+  ;;
+  --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
+  ;;
   esac
 done
 
@@ -388,9 +392,9 @@ for opt do
   ;;
   --install=*) install="$optarg"
   ;;
-  --extra-cflags=*) EXTRA_CFLAGS="$optarg"
+  --extra-cflags=*)
   ;;
-  --extra-ldflags=*) EXTRA_LDFLAGS="$optarg"
+  --extra-ldflags=*)
   ;;
   --cpu=*)
   ;;
@@ -1780,8 +1784,8 @@ fi
 echo "AR=$ar" >> $config_host_mak
 echo "OBJCOPY=$objcopy" >> $config_host_mak
 echo "LD=$ld" >> $config_host_mak
-echo "CFLAGS=$CFLAGS $EXTRA_CFLAGS" >> $config_host_mak
-echo "LDFLAGS=$LDFLAGS $EXTRA_LDFLAGS" >> $config_host_mak
+echo "CFLAGS=$CFLAGS" >> $config_host_mak
+echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
 echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
 echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
 echo "EXESUF=$EXESUF" >> $config_host_mak
Signature · 1 line
1.6.2.5
#12 lore raw

PATCH v2 12/81 create compile_object/compile_prog functions

In reply to Juan Quintela

Instead of repeating the code through the file, create this two functions and call them in all $cc invocations.

---
 configure |   82 ++++++++++++++++++++++++++++++++----------------------------
 1 files changed, 44 insertions(+), 38 deletions(-)
configure +44 -38
index 35b3c7e..a6899b7 100755
@@ -20,6 +20,16 @@ TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
 
 trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
 
+compile_object() {
+  $cc $CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
+}
+
+compile_prog() {
+  local_cflags="$1"
+  local_ldflags="$2"
+  $cc $CFLAGS $local_cflags -o $TMPE $TMPC $LDFLAGS $local_ldflags > /dev/null 2> /dev/null
+}
+
 # default parameters
 cpu=""
 prefix=""
@@ -68,7 +78,7 @@ cat > $TMPC <<EOF
 int main(void) {}
 EOF
 
-if $cc $CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
+if compile_object ; then
   : C compiler works ok
 else
     echo "ERROR: \"$cc\" either does not exist or does not work"
@@ -82,7 +92,7 @@ cat > $TMPC <<EOF
 #endif
 int main(void) { return 0; }
 EOF
-  $cc $CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
+  compile_object
 }
 
 if test ! -z "$cpu" ; then
@@ -778,7 +788,7 @@ int main(int argc, char ** argv){
 }
 EOF
 
-if $cc $CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
+if compile_prog "" "" ; then
 $TMPE && bigendian="yes"
 else
 echo big/little test failed
@@ -824,7 +834,7 @@ void foo()
 }
 EOF
 
-if $cc $CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null ; then
+if compile_object ; then
   :
 else
    nptl="no"
@@ -837,7 +847,7 @@ cat > $TMPC << EOF
 #include <zlib.h>
 int main(void) { zlibVersion(); return 0; }
 EOF
-if $cc $CFLAGS -o $TMPE $TMPC -lz > /dev/null 2> /dev/null ; then
+if compile_prog "" "-lz" ; then
     :
 else
     echo
@@ -857,7 +867,7 @@ if test "$xen" = "yes" ; then
 #include <xs.h>
 int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
 EOF
-  if $cc $CFLAGS -c -o $TMPO $TMPC $LDFLAGS $xen_libs 2> /dev/null > /dev/null ; then
+  if compile_prog "" "$xen_libs" ; then
     :
   else
     xen="no"
@@ -878,7 +888,7 @@ int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
 EOF
   sdl_cflags=`sdl-config --cflags 2> /dev/null`
   sdl_libs=`sdl-config --libs 2> /dev/null`
-  if $cc $CFLAGS -o $TMPE $sdl_cflags $TMPC $sdl_libs > $TMPSDLLOG 2>&1 ; then
+  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
     _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
     if test "$_sdlversion" -lt 121 ; then
       sdl_too_old=yes
@@ -895,7 +905,7 @@ EOF
          sdl_libs="$sdl_libs `aalib-config --static-libs >2 /dev/null`"
          sdl_cflags="$sd_cflags `aalib-config --cflags >2 /dev/null`"
       fi
-      if $cc -o $TMPE $CFLAGS $sdl_cflags $TMPC $sdl_libs > /dev/null 2> /dev/null; then
+      if compile_prog "$sdl_cflags" "$sdl_libs" ; then
 	:
       else
         sdl=no
@@ -914,7 +924,7 @@ if test "$sdl" = "yes" ; then
 #endif
 int main(void) { return 0; }
 EOF
-  if $cc $CFLAGS -o $TMPE $sdl_cflags $TMPC $sdl_libs > /dev/null 2>&1 ; then
+  if compile_prog "$sdl_cflags" "$sdl_libs" ; then
     sdl_libs="$sdl_libs -lX11"
   fi
 fi
@@ -928,8 +938,7 @@ int main(void) { gnutls_session_t s; gnutls_init(&s, GNUTLS_SERVER); return 0; }
 EOF
     vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
     vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
-    if $cc $CFLAGS -o $TMPE $vnc_tls_cflags $TMPC \
-           $vnc_tls_libs > /dev/null 2> /dev/null ; then
+    if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
 	:
     else
 	vnc_tls="no"
@@ -947,8 +956,7 @@ EOF
     # Assuming Cyrus-SASL installed in /usr prefix
     vnc_sasl_cflags=""
     vnc_sasl_libs="-lsasl2"
-    if $cc $CFLAGS -o $TMPE $vnc_sasl_cflags $TMPC \
-           $vnc_sasl_libs 2> /dev/null > /dev/null ; then
+    if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
 	:
     else
 	vnc_sasl="no"
@@ -966,7 +974,7 @@ int main(void)
     return 0;
 }
 EOF
-if $cc $CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
+if compile_prog "" "" ; then
    fnmatch="yes"
 fi
 
@@ -984,7 +992,7 @@ int main(void)
     return 0;
 }
 EOF
-  if $cc $CFLAGS -o $TMPE $TMPC $vde_libs > /dev/null 2> /dev/null ; then
+  if compile_prog "" "$vde_libs" ; then
     vde=yes
   fi
 fi
@@ -1003,7 +1011,7 @@ audio_drv_probe()
 #include <$hdr>
 int main(void) { $exp }
 EOF
-    if $cc $CFLAGS $cfl -o $TMPE $TMPC $lib > /dev/null 2> /dev/null ; then
+    if compile_prog "$cfl" "$lib" ; then
         :
     else
         echo
@@ -1068,7 +1076,7 @@ if test "$brlapi" = "yes" ; then
 #include <brlapi.h>
 int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
 EOF
-  if $cc $CFLAGS -o $TMPE $TMPC $brlapi_libs > /dev/null 2> /dev/null ; then
+  if compile_prog "" "$brlapi_libs" ; then
     brlapi=yes
   fi
 fi
@@ -1084,9 +1092,9 @@ if test "$curses" = "yes" ; then
 #endif
 int main(void) { resize_term(0, 0); return curses_version(); }
 EOF
-  if $cc $CFLAGS -o $TMPE $TMPC -lncurses > /dev/null 2> /dev/null ; then
+  if compile_prog "" "-lncurses" ; then
     curses_libs="-lncurses"
-  elif $cc $CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
+  elif compile_prog "" "-lcurses" ; then
     curses_libs="-lcurses"
   else
     curses=no
@@ -1103,7 +1111,7 @@ if test "$curl" = "yes" ; then
 int main(void) { return curl_easy_init(); }
 EOF
   curl_libs=`curl-config --libs 2>/dev/null`
- if $cc $CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
+ if compile_prog "" "$curl_libs" ; then
     curl=yes
   fi
 fi # test "$curl"
@@ -1120,8 +1128,7 @@ int main(void) { return bt_error(0); }
 EOF
   bluez_cflags=`pkg-config --cflags bluez 2> /dev/null`
   bluez_libs=`pkg-config --libs bluez 2> /dev/null`
-  if $cc $CFLAGS -o $TMPE $bluez_cflags $TMPC \
-      $bluez_libs > /dev/null 2> /dev/null ; then
+  if compile_prog "$bluez_cflags" "$bluez_libs" ; then
     :
   else
     bluez="no"
@@ -1160,8 +1167,7 @@ EOF
   else
       kvm_cflags=""
   fi
-  if $cc $CFLAGS -o $TMPE $kvm_cflags $TMPC \
-      > /dev/null 2>/dev/null ; then
+  if compile_prog "$kvm_cflags" "" ; then
     :
   else
     kvm="no";
@@ -1191,7 +1197,7 @@ cat > $TMPC << EOF
 int main(void) { pthread_create(0,0,0,0); return 0; }
 EOF
   for pthread_lib in $PTHREADLIBS_LIST; do
-    if $cc $CFLAGS -o $TMPE $TMPC $pthread_lib 2> /dev/null > /dev/null ; then
+    if compile_prog "" "$pthread_lib" ; then
       pthread=yes
       PTHREADLIBS="$pthread_lib"
       break
@@ -1213,7 +1219,7 @@ cat > $TMPC <<EOF
 int main(void) { struct iovec iov; return 0; }
 EOF
 iovec=no
-if $cc $CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
+if compile_prog "" "" ; then
   iovec=yes
 fi
 
@@ -1226,7 +1232,7 @@ cat > $TMPC <<EOF
 int main(void) { preadv; }
 EOF
 preadv=no
-if $cc $CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
+if compile_prog "" "" ; then
   preadv=yes
 fi
 
@@ -1238,7 +1244,7 @@ if test "$fdt" = "yes" ; then
   cat > $TMPC << EOF
 int main(void) { return 0; }
 EOF
-  if $cc $CFLAGS -o $TMPE $TMPC $fdt_libs 2> /dev/null > /dev/null ; then
+  if compile_prog "" "$fdt_libs" ; then
     fdt=yes
   fi
 fi
@@ -1262,7 +1268,7 @@ main(void)
 	return (unlinkat(AT_FDCWD, "nonexistent_file", 0));
 }
 EOF
-if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
+if compile_prog "" "" ; then
   atfile=yes
 fi
 
@@ -1282,7 +1288,7 @@ main(void)
 	return inotify_init();
 }
 EOF
-if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null > /dev/null ; then
+if compile_prog "" "" ; then
   inotify=yes
 fi
 
@@ -1301,7 +1307,7 @@ int main(void)
     return 0;
 }
 EOF
-if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+if compile_prog "" "" ; then
   utimens=yes
 fi
 
@@ -1319,7 +1325,7 @@ int main(void)
     return 0;
 }
 EOF
-if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+if compile_prog "" "" ; then
   pipe2=yes
 fi
 
@@ -1339,7 +1345,7 @@ int main(void)
     return 0;
 }
 EOF
-if $cc $CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+if compile_prog "" "" ; then
   splice=yes
 fi
 
@@ -1354,7 +1360,7 @@ cat > $TMPC << EOF
 #include <byteswap.h>
 int main(void) { return bswap_32(0); }
 EOF
-if $cc $CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
+if compile_prog "" "" ; then
   byteswap_h=yes
 fi
 
@@ -1366,7 +1372,7 @@ cat > $TMPC << EOF
 #include <machine/bswap.h>
 int main(void) { return bswap32(0); }
 EOF
-if $cc $CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
+if compile_prog "" "" ; then
   bswap_h=yes
 fi
 
@@ -1378,9 +1384,9 @@ cat > $TMPC <<EOF
 int main(void) { clockid_t id; return clock_gettime(id, NULL); }
 EOF
 
-if $cc $CFLAGS -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
+if compile_prog "" "" ; then
   CLOCKLIBS=""
-elif $cc $CFLAGS -o $TMPE $TMPC -lrt > /dev/null 2> /dev/null ; then
+elif compile_prog "" "-lrt" ; then
   CLOCKLIBS="-lrt"
 fi
 
@@ -1391,7 +1397,7 @@ check_linker_flags()
     if test "$2" ; then
 	w2=-Wl,$2
     fi
-    $cc $CFLAGS -o $TMPE $TMPC -Wl,$1 ${w2} >/dev/null 2>/dev/null
+    compile_prog "" "-Wl,$1 ${w2}"
 }
 
 cat > $TMPC << EOF
Signature · 1 line
1.6.2.5
#13 lore raw

PATCH v2 13/81 remove unused temporal files

In reply to Juan Quintela
---
 configure |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
configure +1 -4
index a6899b7..2074daf 100755
@@ -14,11 +14,8 @@ fi
 TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c"
 TMPO="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.o"
 TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}"
-TMPS="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.S"
-TMPI="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.i"
-TMPSDLLOG="${TMPDIR1}/qemu-conf-sdl-$$-${RANDOM}.log"
 
-trap "rm -f $TMPC $TMPO $TMPE $TMPS $TMPI $TMPSDLLOG; exit" 0 2 3 15
+trap "rm -f $TMPC $TMPO $TMPE ; exit" 0 2 3 15
 
 compile_object() {
   $cc $CFLAGS -c -o $TMPO $TMPC > /dev/null 2> /dev/null
Signature · 1 line
1.6.2.5
#14 lore raw

PATCH v2 14/81 Add CURL_CFLAGS

In reply to Juan Quintela
---
 Makefile  |    1 +
 configure |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)
Makefile +1 -0
index d3f999e..fb16eb0 100644
@@ -167,6 +167,7 @@ LIBS+=$(VDE_LIBS)
 obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o
 obj-$(CONFIG_XEN) += xen_console.o xenfb.o xen_disk.o xen_nic.o
 
+CPPFLAGS+=$(CURL_CFLAGS)
 LIBS+=$(CURL_LIBS)
 
 cocoa.o: cocoa.m
configure +3 -1
index 2074daf..03467cd 100755
@@ -1107,8 +1107,9 @@ if test "$curl" = "yes" ; then
 #include <curl/curl.h>
 int main(void) { return curl_easy_init(); }
 EOF
+  curl_cflags=`curl-config --cflags 2>/dev/null`
   curl_libs=`curl-config --libs 2>/dev/null`
- if compile_prog "" "$curl_libs" ; then
+  if compile_prog "$curl_cflags" "$curl_libs" ; then
     curl=yes
   fi
 fi # test "$curl"
@@ -1695,6 +1696,7 @@ if test "$bswap_h" = "yes" ; then
 fi
 if test "$curl" = "yes" ; then
   echo "CONFIG_CURL=y" >> $config_host_mak
+  echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
   echo "CURL_LIBS=$curl_libs" >> $config_host_mak
 fi
 if test "$brlapi" = "yes" ; then
Signature · 1 line
1.6.2.5
#15 lore raw

PATCH v2 15/81 __sparc_*__ is defined through -D__sparc_*__

In reply to Juan Quintela
---
 configure     |    3 ---
 create_config |    6 ------
 2 files changed, 0 insertions(+), 9 deletions(-)
configure +0 -3
index 03467cd..6e59f74 100755
@@ -1599,9 +1599,6 @@ if test "$solaris" = "yes" ; then
     echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
   fi
 fi
-if test -n "$sparc_cpu"; then
-  echo "CONFIG__sparc_${sparc_cpu}__=y" >> $config_host_mak
-fi
 if test "$gprof" = "yes" ; then
   echo "TARGET_GPROF=yes" >> $config_host_mak
 fi
create_config +0 -6
index 8e757f3..9dcbc5f 100755
@@ -16,12 +16,6 @@ case $line in
     arch_name=`echo $arch | tr '[:lower:]' '[:upper:]'`
     echo "#define HOST_$arch_name 1"
     ;;
- CONFIG__sparc_*=y) # configuration
-    name=${line%=*}
-    name=${name#CONFIG}
-    value=${line#*=}
-    echo "#define $name $value"
-    ;;
  CONFIG_AUDIO_DRIVERS=*)
     drivers=${line#*=}
     echo "#define CONFIG_AUDIO_DRIVERS \\"
Signature · 1 line
1.6.2.5
#16 lore raw

PATCH v2 16/81 move mingw32 code after selection of OS

In reply to Juan Quintela
---
 configure |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
configure +8 -8
index 6e59f74..d283c34 100755
@@ -364,6 +364,14 @@ if [ "$bsd" = "yes" ] ; then
   bsd_user="yes"
 fi
 
+if test "$mingw32" = "yes" ; then
+  linux="no"
+  EXESUF=".exe"
+  linux_user="no"
+  bsd_user="no"
+  CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $CFLAGS"
+fi
+
 # find source path
 source_path=`dirname "$0"`
 source_path_used="no"
@@ -666,14 +674,6 @@ echo "NOTE: The object files are built at the place where configure is launched"
 exit 1
 fi
 
-if test "$mingw32" = "yes" ; then
-    linux="no"
-    EXESUF=".exe"
-    linux_user="no"
-    bsd_user="no"
-    CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $CFLAGS"
-fi
-
 if test ! -x "$(which cgcc 2>/dev/null)"; then
     sparse="no"
 fi
Signature · 1 line
1.6.2.5
#17 lore raw

PATCH v2 17/81 This variables can't be set here

In reply to Juan Quintela
---
 configure |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
configure +0 -3
index d283c34..a844ad4 100755
@@ -365,10 +365,7 @@ if [ "$bsd" = "yes" ] ; then
 fi
 
 if test "$mingw32" = "yes" ; then
-  linux="no"
   EXESUF=".exe"
-  linux_user="no"
-  bsd_user="no"
   CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $CFLAGS"
 fi
 
Signature · 1 line
1.6.2.5
#18 lore raw

PATCH v2 18/81 refactor kqemu selection for both mingw32

In reply to Juan Quintela
---
 configure |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
configure +3 -6
index a844ad4..5d69420 100755
@@ -236,16 +236,10 @@ case $targetos in
 CYGWIN*)
 mingw32="yes"
 CFLAGS="-mno-cygwin $CFLAGS"
-if [ "$cpu" = "i386" ] ; then
-    kqemu="yes"
-fi
 audio_possible_drivers="sdl"
 ;;
 MINGW32*)
 mingw32="yes"
-if [ "$cpu" = "i386" ] ; then
-    kqemu="yes"
-fi
 audio_possible_drivers="dsound sdl fmod"
 ;;
 GNU/kFreeBSD)
@@ -365,6 +359,9 @@ if [ "$bsd" = "yes" ] ; then
 fi
 
 if test "$mingw32" = "yes" ; then
+  if [ "$cpu" = "i386" ] ; then
+    kqemu="yes"
+  fi
   EXESUF=".exe"
   CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $CFLAGS"
 fi
Signature · 1 line
1.6.2.5
#19 lore raw

PATCH v2 19/81 move sparc_cpu arg parsing to the begining

In reply to Juan Quintela
---
 configure |   46 ++++++++++++++++++++++++----------------------
 1 files changed, 24 insertions(+), 22 deletions(-)
configure +24 -22
index 5d69420..0f1299b 100755
@@ -58,6 +58,30 @@ for opt do
   ;;
   --extra-ldflags=*) LDFLAGS="$optarg $LDFLAGS"
   ;;
+  --sparc_cpu=*)
+    sparc_cpu="$optarg"
+    case $sparc_cpu in
+    v7|v8)
+      CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $CFLAGS"
+      LDFLAGS="-m32 $LDFLAGS"
+      cpu="sparc"
+    ;;
+    v8plus|v8plusa)
+      CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $CFLAGS"
+      LDFLAGS="-m32 $LDFLAGS"
+      cpu="sparc"
+    ;;
+    v9)
+      CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $CFLAGS"
+      LDFLAGS="-m64 $LDFLAGS"
+      cpu="sparc64"
+    ;;
+    *)
+      echo "undefined SPARC architecture. Exiting";
+      exit 1
+    ;;
+    esac
+  ;;
   esac
 done
 
@@ -489,28 +513,6 @@ for opt do
   --enable-uname-release=*) uname_release="$optarg"
   ;;
   --sparc_cpu=*)
-      sparc_cpu="$optarg"
-      case $sparc_cpu in
-        v7|v8)
-          CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $CFLAGS"
-          LDFLAGS="-m32 $LDFLAGS"
-          cpu="sparc"
-        ;;
-        v8plus|v8plusa)
-          CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $CFLAGS"
-          LDFLAGS="-m32 $LDFLAGS"
-          cpu="sparc"
-        ;;
-        v9)
-          CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $CFLAGS"
-          LDFLAGS="-m64 $LDFLAGS"
-          cpu="sparc64"
-        ;;
-        *)
-          echo "undefined SPARC architecture. Exiting";
-          exit 1
-        ;;
-      esac
   ;;
   --enable-werror) werror="yes"
   ;;
Signature · 1 line
1.6.2.5
#20 lore raw

PATCH v2 20/81 refactor sparc_cpu code to be in a single place

In reply to Juan Quintela
---
 configure |   45 +++++++++++++++++++++------------------------
 1 files changed, 21 insertions(+), 24 deletions(-)
configure +21 -24
index 0f1299b..b2bd378 100755
@@ -32,6 +32,7 @@ cpu=""
 prefix=""
 interp_prefix="/usr/gnemul/qemu-%M"
 static="no"
+sparc_cpu=""
 cross_prefix=""
 cc="gcc"
 audio_drv_list=""
@@ -61,19 +62,10 @@ for opt do
   --sparc_cpu=*)
     sparc_cpu="$optarg"
     case $sparc_cpu in
-    v7|v8)
-      CFLAGS="-m32 -mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $CFLAGS"
-      LDFLAGS="-m32 $LDFLAGS"
-      cpu="sparc"
-    ;;
-    v8plus|v8plusa)
-      CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $CFLAGS"
-      LDFLAGS="-m32 $LDFLAGS"
+    v7|v8|v8plus|v8plusa)
       cpu="sparc"
     ;;
     v9)
-      CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $CFLAGS"
-      LDFLAGS="-m64 $LDFLAGS"
       cpu="sparc64"
     ;;
     *)
@@ -551,23 +543,28 @@ done
 #
 host_guest_base="no"
 case "$cpu" in
-    sparc) if test -z "$sparc_cpu" ; then
-               CFLAGS="-m32 -mcpu=ultrasparc -D__sparc_v8plus__ $CFLAGS"
-               LDFLAGS="-m32 $LDFLAGS"
-           fi
-           CFLAGS="-ffixed-g2 -ffixed-g3 $CFLAGS"
+    sparc) case $sparc_cpu in
+           v7|v8)
+             CFLAGS="-mcpu=${sparc_cpu} -D__sparc_${sparc_cpu}__ $CFLAGS"
+           ;;
+           v8plus|v8plusa)
+             CFLAGS="-mcpu=ultrasparc -D__sparc_${sparc_cpu}__ $CFLAGS"
+           ;;
+           *) # sparc_cpu not defined in the command line
+             CFLAGS="-mcpu=ultrasparc -D__sparc_v8plus__ $CFLAGS"
+           esac
+           LDFLAGS="-m32 $LDFLAGS"
+           CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $CFLAGS"
            if test "$solaris" = "no" ; then
-               CFLAGS="-ffixed-g1 -ffixed-g6 $CFLAGS"
+             CFLAGS="-ffixed-g1 -ffixed-g6 $CFLAGS"
            fi
            ;;
-    sparc64) if test -z "$sparc_cpu" ; then
-               CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $CFLAGS"
-               LDFLAGS="-m64 $LDFLAGS"
-           fi
-           if test "$solaris" = "no" ; then
-               CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $CFLAGS"
-           else
-               CFLAGS="-ffixed-g1 -ffixed-g5 -ffixed-g6 -ffixed-g7 $CFLAGS"
+    sparc64)
+           CFLAGS="-m64 -mcpu=ultrasparc -D__sparc_v9__ $CFLAGS"
+           LDFLAGS="-m64 $LDFLAGS"
+           CFLAGS="-ffixed-g5 -ffixed-g6 -ffixed-g7 $CFLAGS"
+           if test "$solaris" != "no" ; then
+             CFLAGS="-ffixed-g1 $CFLAGS"
            fi
            ;;
     s390)
Signature · 1 line
1.6.2.5
#21 lore raw

PATCH v2 21/81 refactor $cpu selection in various places

In reply to Juan Quintela
---
 configure |   63 ++++++++++++------------------------------------------------
 1 files changed, 13 insertions(+), 50 deletions(-)
configure +13 -50
index b2bd378..809f8e5 100755
@@ -76,7 +76,6 @@ for opt do
   ;;
   esac
 done
-
 # OS specific
 # Using uname is really, really broken.  Once we have the right set of checks
 # we can eliminate it's usage altogether
@@ -135,57 +134,30 @@ fi
 
 target_list=""
 case "$cpu" in
+  alpha|cris|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|sparc64)
+    cpu="$cpu"
+  ;;
   i386|i486|i586|i686|i86pc|BePC)
     cpu="i386"
   ;;
   x86_64|amd64)
     cpu="x86_64"
   ;;
-  alpha)
-    cpu="alpha"
-  ;;
   armv*b)
     cpu="armv4b"
   ;;
   armv*l)
     cpu="armv4l"
   ;;
-  cris)
-    cpu="cris"
-  ;;
   parisc|parisc64)
     cpu="hppa"
   ;;
-  ia64)
-    cpu="ia64"
-  ;;
-  m68k)
-    cpu="m68k"
-  ;;
-  microblaze)
-    cpu="microblaze"
-  ;;
-  mips)
-    cpu="mips"
-  ;;
-  mips64)
-    cpu="mips64"
-  ;;
-  ppc)
-    cpu="ppc"
-  ;;
-  ppc64)
-    cpu="ppc64"
-  ;;
   s390*)
     cpu="s390"
   ;;
   sparc|sun4[cdmuv])
     cpu="sparc"
   ;;
-  sparc64)
-    cpu="sparc64"
-  ;;
   *)
     cpu="unknown"
   ;;
@@ -787,30 +759,21 @@ fi
 else
 
 # if cross compiling, cannot launch a program, so make a static guess
-if test "$cpu" = "armv4b" \
-     -o "$cpu" = "hppa" \
-     -o "$cpu" = "m68k" \
-     -o "$cpu" = "mips" \
-     -o "$cpu" = "mips64" \
-     -o "$cpu" = "ppc" \
-     -o "$cpu" = "ppc64" \
-     -o "$cpu" = "s390" \
-     -o "$cpu" = "sparc" \
-     -o "$cpu" = "sparc64"; then
-    bigendian="yes"
-fi
+case "$cpu" in
+  armv4b|hppa|m68k|mips|mips64|ppc|ppc64|s390|sparc|sparc64)
+    bigendian=yes
+  ;;
+esac
 
 fi
 
 # host long bits test
 hostlongbits="32"
-if test "$cpu" = "x86_64" \
-     -o "$cpu" = "alpha" \
-     -o "$cpu" = "ia64" \
-     -o "$cpu" = "sparc64" \
-     -o "$cpu" = "ppc64"; then
-    hostlongbits="64"
-fi
+case "$cpu" in
+  x86_64|alpha|ia64|sparc64|ppc64)
+    hostlongbits=64
+  ;;
+esac
 
 # Check host NPTL support
 cat > $TMPC <<EOF
Signature · 1 line
1.6.2.5
#23 lore raw

PATCH v2 23/81 We use -lz for all binaries

In reply to Juan Quintela
---
 Makefile |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
Makefile +1 -3
index fb16eb0..1108b93 100644
@@ -19,7 +19,7 @@ VPATH=$(SRC_PATH):$(SRC_PATH)/hw
 CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@
 CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 CPPFLAGS += -U_FORTIFY_SOURCE
-LIBS=
+LIBS=-lz
 
 ifdef BUILD_DOCS
 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
@@ -216,8 +216,6 @@ qemu-nbd$(EXESUF):  qemu-nbd.o qemu-tool.o tool-osdep.o $(block-obj-y)
 
 qemu-io$(EXESUF):  qemu-io.o qemu-tool.o tool-osdep.o cmd.o $(block-obj-y)
 
-qemu-img$(EXESUF) qemu-nbd$(EXESUF) qemu-io$(EXESUF): LIBS += -lz
-
 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
 	$(call quiet-command,sh $(SRC_PATH)/hxtool -h < $< > $@,"  GEN   $@")
 
Signature · 1 line
1.6.2.5
#24 lore raw

PATCH v2 24/81 We want to pass LIB through configuration files now

In reply to Juan Quintela
---
 Makefile        |    2 +-
 Makefile.target |    1 -
 configure       |    1 +
 3 files changed, 2 insertions(+), 2 deletions(-)
Makefile +1 -1
index 1108b93..5149476 100644
@@ -19,7 +19,7 @@ VPATH=$(SRC_PATH):$(SRC_PATH)/hw
 CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@
 CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 CPPFLAGS += -U_FORTIFY_SOURCE
-LIBS=-lz
+LIBS+=-lz
 
 ifdef BUILD_DOCS
 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
Makefile.target +0 -1
index 49ba08d..787df81 100644
@@ -5,7 +5,6 @@ TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
 CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
 #CFLAGS+=-Werror
-LIBS=
 
 ifdef CONFIG_USER_ONLY
 # user emulator name
configure +1 -0
index c78eda1..bcdb1be 100755
@@ -1748,6 +1748,7 @@ echo "CFLAGS=$CFLAGS" >> $config_host_mak
 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
 echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
 echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
+echo "LIBS=$LIBS" >> $config_host_mak
 echo "EXESUF=$EXESUF" >> $config_host_mak
 echo "PTHREADLIBS=$PTHREADLIBS" >> $config_host_mak
 echo "CLOCKLIBS=$CLOCKLIBS" >> $config_host_mak
Signature · 1 line
1.6.2.5
#25 lore raw

PATCH v2 25/81 PTHREADLIBS was used for all binaries

In reply to Juan Quintela
---
 Makefile        |    1 -
 Makefile.target |    1 -
 configure       |    4 +---
 3 files changed, 1 insertions(+), 5 deletions(-)
Makefile +0 -1
index 5149476..62f753b 100644
@@ -27,7 +27,6 @@ else
 DOCS=
 endif
 
-LIBS+=$(PTHREADLIBS)
 LIBS+=$(CLOCKLIBS)
 
 ifdef CONFIG_SOLARIS
Makefile.target +0 -1
index 787df81..9c7cabe 100644
@@ -202,7 +202,6 @@ signal.o: CFLAGS += $(HELPER_CFLAGS)
 ARLIBS=../libqemu_user.a libqemu.a
 endif #CONFIG_LINUX_USER
 
-LIBS+= $(PTHREADLIBS)
 LIBS+= $(CLOCKLIBS)
 
 #########################################################
configure +1 -3
index bcdb1be..94a5697 100755
@@ -1144,7 +1144,6 @@ fi
 ##########################################
 # pthread probe
 PTHREADLIBS_LIST="-lpthread -lpthreadGC2"
-PTHREADLIBS=""
 
 if test "$pthread" = yes; then
   pthread=no
@@ -1155,7 +1154,7 @@ EOF
   for pthread_lib in $PTHREADLIBS_LIST; do
     if compile_prog "" "$pthread_lib" ; then
       pthread=yes
-      PTHREADLIBS="$pthread_lib"
+      LIBS="$pthread_lib $LIBS"
       break
     fi
   done
@@ -1750,7 +1749,6 @@ echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
 echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
 echo "LIBS=$LIBS" >> $config_host_mak
 echo "EXESUF=$EXESUF" >> $config_host_mak
-echo "PTHREADLIBS=$PTHREADLIBS" >> $config_host_mak
 echo "CLOCKLIBS=$CLOCKLIBS" >> $config_host_mak
 
 echo "/* Automatically generated by configure - do not modify */" > $config_host_h
Signature · 1 line
1.6.2.5
#22 lore raw

PATCH v2 22/81 reindent Operating System selection configure

In reply to Juan Quintela
---
 configure |  164 +++++++++++++++++++++++++++++++------------------------------
 1 files changed, 83 insertions(+), 81 deletions(-)
configure +83 -81
index 809f8e5..c78eda1 100755
@@ -220,121 +220,123 @@ elif check_define __sun__ ; then
 else
   targetos=`uname -s`
 fi
+
 case $targetos in
 CYGWIN*)
-mingw32="yes"
-CFLAGS="-mno-cygwin $CFLAGS"
-audio_possible_drivers="sdl"
+  mingw32="yes"
+  CFLAGS="-mno-cygwin $CFLAGS"
+  audio_possible_drivers="sdl"
 ;;
 MINGW32*)
-mingw32="yes"
-audio_possible_drivers="dsound sdl fmod"
+  mingw32="yes"
+  audio_possible_drivers="dsound sdl fmod"
 ;;
 GNU/kFreeBSD)
-audio_drv_list="oss"
-audio_possible_drivers="oss sdl esd pa"
-if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
+  audio_drv_list="oss"
+  audio_possible_drivers="oss sdl esd pa"
+  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
     kqemu="yes"
-fi
+  fi
 ;;
 FreeBSD)
-bsd="yes"
-audio_drv_list="oss"
-audio_possible_drivers="oss sdl esd pa"
-if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
+  bsd="yes"
+  audio_drv_list="oss"
+  audio_possible_drivers="oss sdl esd pa"
+  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
     kqemu="yes"
-fi
+  fi
 ;;
 DragonFly)
-bsd="yes"
-audio_drv_list="oss"
-audio_possible_drivers="oss sdl esd pa"
-if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
+  bsd="yes"
+  audio_drv_list="oss"
+  audio_possible_drivers="oss sdl esd pa"
+  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
     kqemu="yes"
-fi
-aio="no"
+  fi
+  aio="no"
 ;;
 NetBSD)
-bsd="yes"
-audio_drv_list="oss"
-audio_possible_drivers="oss sdl esd"
-oss_lib="-lossaudio"
+  bsd="yes"
+  audio_drv_list="oss"
+  audio_possible_drivers="oss sdl esd"
+  oss_lib="-lossaudio"
 ;;
 OpenBSD)
-bsd="yes"
-audio_drv_list="oss"
-audio_possible_drivers="oss sdl esd"
-oss_lib="-lossaudio"
+  bsd="yes"
+  audio_drv_list="oss"
+  audio_possible_drivers="oss sdl esd"
+  oss_lib="-lossaudio"
 ;;
 Darwin)
-bsd="yes"
-darwin="yes"
-# on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can run 64-bit userspace code
-if [ "$cpu" = "i386" ] ; then
+  bsd="yes"
+  darwin="yes"
+  # on Leopard most of the system is 32-bit, so we have to ask the kernel it if we can
+  # run 64-bit userspace code
+  if [ "$cpu" = "i386" ] ; then
     is_x86_64=`sysctl -n hw.optional.x86_64`
     [ "$is_x86_64" = "1" ] && cpu=x86_64
-fi
-if [ "$cpu" = "x86_64" ] ; then
+  fi
+  if [ "$cpu" = "x86_64" ] ; then
     CFLAGS="-arch x86_64 $CFLAGS"
     LDFLAGS="-arch x86_64 $LDFLAGS"
-else
+  else
     CFLAGS="-mdynamic-no-pic $CFLAGS"
-fi
-darwin_user="yes"
-cocoa="yes"
-audio_drv_list="coreaudio"
-audio_possible_drivers="coreaudio sdl fmod"
-LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
+  fi
+  darwin_user="yes"
+  cocoa="yes"
+  audio_drv_list="coreaudio"
+  audio_possible_drivers="coreaudio sdl fmod"
+  LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
 ;;
 SunOS)
-    solaris="yes"
-    make="gmake"
-    install="ginstall"
-    needs_libsunmath="no"
-    solarisrev=`uname -r | cut -f2 -d.`
-    # have to select again, because `uname -m` returns i86pc
-    # even on an x86_64 box.
-    solariscpu=`isainfo -k`
-    if test "${solariscpu}" = "amd64" ; then
-        cpu="x86_64"
-    fi
-    if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
-        if test "$solarisrev" -le 9 ; then
-            if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
-                needs_libsunmath="yes"
-            else
-                echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
-                echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
-                echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
-                echo "Studio 11 can be downloaded from www.sun.com."
-                exit 1
-            fi
-        fi
-        if test "$solarisrev" -ge 9 ; then
-            kqemu="yes"
-        fi
+  solaris="yes"
+  make="gmake"
+  install="ginstall"
+  needs_libsunmath="no"
+  solarisrev=`uname -r | cut -f2 -d.`
+  # have to select again, because `uname -m` returns i86pc
+  # even on an x86_64 box.
+  solariscpu=`isainfo -k`
+  if test "${solariscpu}" = "amd64" ; then
+    cpu="x86_64"
+  fi
+  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
+    if test "$solarisrev" -le 9 ; then
+      if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
+        needs_libsunmath="yes"
+      else
+        echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
+        echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
+        echo "C99 math features in libm.so in Solaris 8/x86 and Solaris 9/x86"
+        echo "Studio 11 can be downloaded from www.sun.com."
+        exit 1
+      fi
     fi
-    if test -f /usr/include/sys/soundcard.h ; then
-        audio_drv_list="oss"
+    if test "$solarisrev" -ge 9 ; then
+      kqemu="yes"
     fi
-    audio_possible_drivers="oss sdl"
-    CFLAGS="-std=gnu99 $CFLAGS"
+  fi
+  if test -f /usr/include/sys/soundcard.h ; then
+    audio_drv_list="oss"
+  fi
+  audio_possible_drivers="oss sdl"
+  CFLAGS="-std=gnu99 $CFLAGS"
 ;;
 AIX)
-aix="yes"
-make="gmake"
+  aix="yes"
+  make="gmake"
 ;;
 *)
-audio_drv_list="oss"
-audio_possible_drivers="oss alsa sdl esd pa"
-linux="yes"
-linux_user="yes"
-usb="linux"
-kvm="yes"
-if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
+  audio_drv_list="oss"
+  audio_possible_drivers="oss alsa sdl esd pa"
+  linux="yes"
+  linux_user="yes"
+  usb="linux"
+  kvm="yes"
+  if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
     kqemu="yes"
     audio_possible_drivers="$audio_possible_drivers fmod"
-fi
+  fi
 ;;
 esac
 
Signature · 1 line
1.6.2.5
#26 lore raw

PATCH v2 26/81 CLOCKLIBS was used for all binaries

In reply to Juan Quintela
---
 Makefile        |    2 --
 Makefile.target |    2 --
 configure       |    5 ++---
 3 files changed, 2 insertions(+), 7 deletions(-)
Makefile +0 -2
index 62f753b..1362b53 100644
@@ -27,8 +27,6 @@ else
 DOCS=
 endif
 
-LIBS+=$(CLOCKLIBS)
-
 ifdef CONFIG_SOLARIS
 LIBS+=-lsocket -lnsl -lresolv
 endif
Makefile.target +0 -2
index 9c7cabe..5d05e71 100644
@@ -202,8 +202,6 @@ signal.o: CFLAGS += $(HELPER_CFLAGS)
 ARLIBS=../libqemu_user.a libqemu.a
 endif #CONFIG_LINUX_USER
 
-LIBS+= $(CLOCKLIBS)
-
 #########################################################
 # Darwin user emulator target
 
configure +2 -3
index 94a5697..1d05169 100755
@@ -1340,9 +1340,9 @@ int main(void) { clockid_t id; return clock_gettime(id, NULL); }
 EOF
 
 if compile_prog "" "" ; then
-  CLOCKLIBS=""
+  :
 elif compile_prog "" "-lrt" ; then
-  CLOCKLIBS="-lrt"
+  LIBS="-lrt $LIBS"
 fi
 
 # Determine what linker flags to use to force archive inclusion
@@ -1749,7 +1749,6 @@ echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
 echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
 echo "LIBS=$LIBS" >> $config_host_mak
 echo "EXESUF=$EXESUF" >> $config_host_mak
-echo "CLOCKLIBS=$CLOCKLIBS" >> $config_host_mak
 
 echo "/* Automatically generated by configure - do not modify */" > $config_host_h
 
Signature · 1 line
1.6.2.5
#27 lore raw

PATCH v2 27/81 Move to configure CONFIG_SOLARIS libraries needed always

In reply to Juan Quintela
---
 Makefile        |    4 ----
 Makefile.target |    1 -
 configure       |    1 +
 3 files changed, 1 insertions(+), 5 deletions(-)
Makefile +0 -4
index 1362b53..88e13e6 100644
@@ -27,10 +27,6 @@ else
 DOCS=
 endif
 
-ifdef CONFIG_SOLARIS
-LIBS+=-lsocket -lnsl -lresolv
-endif
-
 ifdef CONFIG_WIN32
 LIBS+=-lwinmm -lws2_32 -liphlpapi
 endif
Makefile.target +0 -1
index 5d05e71..b77c496 100644
@@ -52,7 +52,6 @@ ifdef CONFIG_WIN32
 LIBS+=-lwinmm -lws2_32 -liphlpapi
 endif
 ifdef CONFIG_SOLARIS
-LIBS+=-lsocket -lnsl -lresolv
 ifdef CONFIG_NEEDS_LIBSUNMATH
 LIBS+=-lsunmath
 LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
configure +1 -0
index 1d05169..811952c 100755
@@ -321,6 +321,7 @@ SunOS)
   fi
   audio_possible_drivers="oss sdl"
   CFLAGS="-std=gnu99 $CFLAGS"
+  LIBS="-lsocket -lnsl -lresolv $LIBS"
 ;;
 AIX)
   aix="yes"
Signature · 1 line
1.6.2.5
#28 lore raw

PATCH v2 28/81 Move to configure CONFIG_WIN32 libraries needed always

In reply to Juan Quintela
---
 Makefile        |    4 ----
 Makefile.target |    3 ---
 configure       |    1 +
 3 files changed, 1 insertions(+), 7 deletions(-)
Makefile +0 -4
index 88e13e6..0ea8b46 100644
@@ -27,10 +27,6 @@ else
 DOCS=
 endif
 
-ifdef CONFIG_WIN32
-LIBS+=-lwinmm -lws2_32 -liphlpapi
-endif
-
 build-all: $(TOOLS) $(DOCS) recurse-all
 
 config-host.mak: configure
Makefile.target +0 -3
index b77c496..fdcf480 100644
@@ -48,9 +48,6 @@ endif
 CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
 CPPFLAGS+=-U_FORTIFY_SOURCE
 LIBS+=-lm
-ifdef CONFIG_WIN32
-LIBS+=-lwinmm -lws2_32 -liphlpapi
-endif
 ifdef CONFIG_SOLARIS
 ifdef CONFIG_NEEDS_LIBSUNMATH
 LIBS+=-lsunmath
configure +1 -0
index 811952c..bc60dc1 100755
@@ -355,6 +355,7 @@ if test "$mingw32" = "yes" ; then
   fi
   EXESUF=".exe"
   CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $CFLAGS"
+  LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
 fi
 
 # find source path
Signature · 1 line
1.6.2.5
#29 lore raw

PATCH v2 29/81 We set -Werror through configure now

In reply to Juan Quintela
---
 Makefile.target |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
Makefile.target +0 -1
index fdcf480..0bc46e0 100644
@@ -4,7 +4,6 @@ include $(SRC_PATH)/rules.mak
 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
 CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
-#CFLAGS+=-Werror
 
 ifdef CONFIG_USER_ONLY
 # user emulator name
Signature · 1 line
1.6.2.5
#30 lore raw

PATCH v2 30/81 Rename CPPFLAGS to QEMU_CFLAGS

In reply to Juan Quintela

Now we have to variables: QEMU_CFLAGS: flags without which we can't compile
CFLAGS: "-g -O2"

We can now run:

make CFLAGS="-fbar" foo.o
make CFLAGS="" foo.o
make CFLAGS="-O3" foo.o

And it all should work.

---
 Makefile                   |   18 ++++++------
 Makefile.hw                |    6 ++--
 Makefile.target            |   64 ++++++++++++++++++++++----------------------
 configure                  |   57 ++++++++++++++++++++------------------
 pc-bios/optionrom/Makefile |    6 ++--
 rules.mak                  |    6 ++--
 6 files changed, 80 insertions(+), 77 deletions(-)
Makefile +9 -9
index 0ea8b46..37eba6b 100644
@@ -16,9 +16,9 @@ endif
 
 VPATH=$(SRC_PATH):$(SRC_PATH)/hw
 
-CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@
-CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-CPPFLAGS += -U_FORTIFY_SOURCE
+QEMU_CFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@
+QEMU_CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+QEMU_CFLAGS += -U_FORTIFY_SOURCE
 LIBS+=-lz
 
 ifdef BUILD_DOCS
@@ -105,7 +105,7 @@ ifdef CONFIG_COREAUDIO
 AUDIO_PT = y
 endif
 ifdef CONFIG_FMOD
-audio/audio.o audio/fmodaudio.o: CPPFLAGS := $(FMOD_CFLAGS) $(CPPFLAGS)
+audio/audio.o audio/fmodaudio.o: QEMU_CFLAGS := $(FMOD_CFLAGS) $(QEMU_CFLAGS)
 endif
 ifdef CONFIG_ESD
 AUDIO_PT = y
@@ -142,7 +142,7 @@ obj-$(CONFIG_COCOA) += cocoa.o
 obj-$(CONFIG_IOTHREAD) += qemu-thread.o
 
 ifdef CONFIG_SLIRP
-CPPFLAGS+=-I$(SRC_PATH)/slirp
+QEMU_CFLAGS+=-I$(SRC_PATH)/slirp
 endif
 
 slirp-obj-y = cksum.o if.o ip_icmp.o ip_input.o ip_output.o
@@ -156,7 +156,7 @@ LIBS+=$(VDE_LIBS)
 obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o
 obj-$(CONFIG_XEN) += xen_console.o xenfb.o xen_disk.o xen_nic.o
 
-CPPFLAGS+=$(CURL_CFLAGS)
+QEMU_CFLAGS+=$(CURL_CFLAGS)
 LIBS+=$(CURL_LIBS)
 
 cocoa.o: cocoa.m
@@ -167,7 +167,7 @@ sdl_zoom.o: sdl_zoom.c sdl_zoom.h sdl_zoom_template.h
 
 sdl.o: sdl.c keymaps.h sdl_keysym.h sdl_zoom.h
 
-sdl.o audio/sdlaudio.o sdl_zoom.o baum.o: CFLAGS += $(SDL_CFLAGS)
+sdl.o audio/sdlaudio.o sdl_zoom.o baum.o: QEMU_CFLAGS += $(SDL_CFLAGS)
 
 acl.o: acl.h acl.c
 
@@ -175,7 +175,7 @@ vnc.h: vnc-tls.h vnc-auth-vencrypt.h vnc-auth-sasl.h keymaps.h
 
 vnc.o: vnc.c vnc.h vnc_keysym.h vnchextile.h d3des.c d3des.h acl.h
 
-vnc.o: CFLAGS += $(VNC_TLS_CFLAGS)
+vnc.o: QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
 
 vnc-tls.o: vnc-tls.c vnc.h
 
@@ -185,7 +185,7 @@ vnc-auth-sasl.o: vnc-auth-sasl.c vnc.h
 
 curses.o: curses.c keymaps.h curses_keys.h
 
-bt-host.o: CFLAGS += $(BLUEZ_CFLAGS)
+bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
 
 libqemu_common.a: $(obj-y)
 
Makefile.hw +3 -3
index 131ae51..052eb1a 100644
@@ -8,9 +8,9 @@ include $(SRC_PATH)/rules.mak
 
 VPATH=$(SRC_PATH):$(SRC_PATH)/hw
 
-CPPFLAGS += -I. -I.. -I$(SRC_PATH) -MMD -MP -MT $@
-CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-CPPFLAGS+=-I$(SRC_PATH)/fpu
+QEMU_CFLAGS += -I. -I.. -I$(SRC_PATH) -MMD -MP -MT $@
+QEMU_CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+QEMU_CFLAGS+=-I$(SRC_PATH)/fpu
 
 obj-y =
 obj-y += virtio.o virtio-pci.o
Makefile.target +32 -32

212 lines not on this page · raw message

configure +30 -27

180 lines not on this page · raw message

pc-bios/optionrom/Makefile +3 -3
index 7ddc242..f6a596f 100644
@@ -7,9 +7,9 @@ include $(SRC_PATH)/rules.mak
 
 VPATH=$(SRC_PATH)/pc-bios/optionrom
 
-CPPFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
-CPPFLAGS += -I$(SRC_PATH)
-CPPFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector,"")
+CFLAGS = -Wall -Wstrict-prototypes -Werror -fomit-frame-pointer -fno-builtin
+CFLAGS += -I$(SRC_PATH)
+CFLAGS += $(call cc-option, $(CFLAGS), -fno-stack-protector,"")
 
 build-all: multiboot.bin
 
rules.mak +3 -3
index f9d0ca0..c0315ac 100644
@@ -1,12 +1,12 @@
 
 %.o: %.c
-	$(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<,"  CC    $(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<,"  CC    $(TARGET_DIR)$@")
 
 %.o: %.S
-	$(call quiet-command,$(CC) $(CPPFLAGS) -c -o $@ $<,"  AS    $(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CLAGS) -c -o $@ $<,"  AS    $(TARGET_DIR)$@")
 
 %.o: %.m
-	$(call quiet-command,$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<,"  OBJC  $(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) -c -o $@ $<,"  OBJC  $(TARGET_DIR)$@")
 
 LINK = $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(1) $(ARLIBS_BEGIN) $(ARLIBS) $(ARLIBS_END) $(LIBS),"  LINK  $(TARGET_DIR)$@")
 
Signature · 1 line
1.6.2.5
#31 lore raw

PATCH v2 31/81 split QEMU_CFLAGS very long line

In reply to Juan Quintela
---
 configure |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
configure +2 -1
index 3093de4..51469fd 100755
@@ -1387,7 +1387,8 @@ CFLAGS="-g $CFLAGS"
 if test "$debug" = "no" ; then
   CFLAGS="-O2 $CFLAGS"
 fi
-QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
+QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
+QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
 LDFLAGS="-g $LDFLAGS"
 
 # Consult white-list to determine whether to enable werror
Signature · 1 line
1.6.2.5
#32 lore raw

PATCH v2 32/81 move common QEMU_CFLAGS to configure

In reply to Juan Quintela
---
 Makefile        |    3 ---
 Makefile.hw     |    4 +---
 Makefile.target |    4 +---
 configure       |    3 +++
 4 files changed, 5 insertions(+), 9 deletions(-)
Makefile +0 -3
index 37eba6b..cd130a0 100644
@@ -16,9 +16,6 @@ endif
 
 VPATH=$(SRC_PATH):$(SRC_PATH)/hw
 
-QEMU_CFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@
-QEMU_CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-QEMU_CFLAGS += -U_FORTIFY_SOURCE
 LIBS+=-lz
 
 ifdef BUILD_DOCS
Makefile.hw +1 -3
index 052eb1a..139412e 100644
@@ -8,9 +8,7 @@ include $(SRC_PATH)/rules.mak
 
 VPATH=$(SRC_PATH):$(SRC_PATH)/hw
 
-QEMU_CFLAGS += -I. -I.. -I$(SRC_PATH) -MMD -MP -MT $@
-QEMU_CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-QEMU_CFLAGS+=-I$(SRC_PATH)/fpu
+QEMU_CFLAGS+=-I.. -I$(SRC_PATH)/fpu
 
 obj-y =
 obj-y += virtio.o virtio-pci.o
Makefile.target +1 -3
index fcf6eeb..60eba31 100644
@@ -3,7 +3,7 @@ include $(SRC_PATH)/rules.mak
 
 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw
-QEMU_CFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
+QEMU_CFLAGS+= -I.. -I$(TARGET_PATH) -DNEED_CPU_H
 
 ifdef CONFIG_USER_ONLY
 # user emulator name
@@ -44,8 +44,6 @@ ifeq ($(ARCH),ia64)
 QEMU_CFLAGS+=-mno-sdata
 endif
 
-QEMU_CFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-QEMU_CFLAGS+=-U_FORTIFY_SOURCE
 LIBS+=-lm
 ifdef CONFIG_SOLARIS
 ifdef CONFIG_NEEDS_LIBSUNMATH
configure +3 -0
index 51469fd..01e667f 100755
@@ -1389,6 +1389,9 @@ if test "$debug" = "no" ; then
 fi
 QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
+QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
+QEMU_CFLAGS="-U_FORTIFY_SOURCE $QEMU_CFLAGS"
+QEMU_CFLAGS="-I. -I\$(SRC_PATH) -MMD -MP -MT \$@ $QEMU_CFLAGS"
 LDFLAGS="-g $LDFLAGS"
 
 # Consult white-list to determine whether to enable werror
Signature · 1 line
1.6.2.5
#33 lore raw

PATCH v2 33/81 Refactor HELPER_CFLAGS

In reply to Juan Quintela

Calculate its value in ./configure.
Put together all its uses

---
 Makefile.target |   28 ++++------------------------
 configure       |    4 ++++
 2 files changed, 8 insertions(+), 24 deletions(-)
Makefile.target +4 -24
index 60eba31..d5e38b3 100644
@@ -19,22 +19,10 @@ endif
 
 PROGS=$(QEMU_PROG)
 
-HELPER_CFLAGS=
-
-ifeq ($(ARCH),i386)
-HELPER_CFLAGS+=-fomit-frame-pointer
-endif
-
 ifeq ($(subst ppc64,ppc,$(ARCH))$(TARGET_BASE_ARCH),ppcppc)
 translate.o: QEMU_CFLAGS := $(QEMU_CFLAGS) $(call cc-option, $(QEMU_CFLAGS), -fno-unit-at-a-time,)
 endif
 
-ifeq ($(ARCH),sparc)
-  ifneq ($(CONFIG_SOLARIS),y)
-    HELPER_CFLAGS+=-ffixed-i0
-  endif
-endif
-
 ifeq ($(ARCH),alpha)
 # Ensure there's only a single GP
 QEMU_CFLAGS+=-msmall-data
@@ -153,6 +141,10 @@ op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 
 cpu-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 
+# Note: this is a workaround. The real fix is to avoid compiling
+# cpu_signal_handler() in cpu-exec.c.
+signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
+
 #########################################################
 # Linux user emulator target
 
@@ -188,10 +180,6 @@ obj-arm-y += arm-semi.o
 
 obj-m68k-y += m68k-sim.o m68k-semi.o
 
-# Note: this is a workaround. The real fix is to avoid compiling
-# cpu_signal_handler() in cpu-exec.c.
-signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
-
 ARLIBS=../libqemu_user.a libqemu.a
 endif #CONFIG_LINUX_USER
 
@@ -211,10 +199,6 @@ LIBS+=-lmx
 obj-y = main.o commpage.o machload.o mmap.o signal.o syscall.o thunk.o \
         gdbstub.o gdbstub-xml.o ioport-user.o
 
-# Note: this is a workaround. The real fix is to avoid compiling
-# cpu_signal_handler() in cpu-exec.c.
-signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
-
 ARLIBS=libqemu.a
 
 endif #CONFIG_DARWIN_USER
@@ -231,10 +215,6 @@ obj-y = main.o bsdload.o elfload.o mmap.o path.o signal.o strace.o syscall.o \
         gdbstub.o gdbstub-xml.o ioport-user.o
 obj-y += uaccess.o
 
-# Note: this is a workaround. The real fix is to avoid compiling
-# cpu_signal_handler() in cpu-exec.c.
-signal.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
-
 ARLIBS=libqemu.a ../libqemu_user.a
 
 endif #CONFIG_BSD_USER
configure +4 -0
index 01e667f..1a3ced7 100755
@@ -44,6 +44,7 @@ make="make"
 install="install"
 objcopy="objcopy"
 ld="ld"
+helper_cflags=""
 
 # parse CC options first
 for opt do
@@ -533,6 +534,7 @@ case "$cpu" in
            QEMU_CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $QEMU_CFLAGS"
            if test "$solaris" = "no" ; then
              QEMU_CFLAGS="-ffixed-g1 -ffixed-g6 $QEMU_CFLAGS"
+             helper_cflags="-ffixed-i0"
            fi
            ;;
     sparc64)
@@ -549,6 +551,7 @@ case "$cpu" in
     i386)
            QEMU_CFLAGS="-m32 $QEMU_CFLAGS"
            LDFLAGS="-m32 $LDFLAGS"
+           helper_cflags="-fomit-frame-pointer"
            host_guest_base="yes"
            ;;
     x86_64)
@@ -1753,6 +1756,7 @@ echo "OBJCOPY=$objcopy" >> $config_host_mak
 echo "LD=$ld" >> $config_host_mak
 echo "CFLAGS=$CFLAGS" >> $config_host_mak
 echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
+echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
 echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
 echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
Signature · 1 line
1.6.2.5
#34 lore raw

PATCH v2 34/81 move SDL_LIBS Win32 hack to configure

In reply to Juan Quintela
---
 Makefile.target |    4 ----
 configure       |    3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)
Makefile.target +0 -4
index d5e38b3..69fb53a 100644
@@ -441,10 +441,6 @@ ifeq ($(ARCH),ia64)
 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
 endif
 
-ifdef CONFIG_WIN32
-SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
-endif
-
 # profiling code
 ifdef TARGET_GPROF
 LDFLAGS+=-p
configure +3 -0
index 1a3ced7..b704e7f 100755
@@ -887,6 +887,9 @@ EOF
   if compile_prog "$sdl_cflags" "$sdl_libs" ; then
     sdl_libs="$sdl_libs -lX11"
   fi
+  if test "$mingw32" = "yes" ; then
+    sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
+  fi
 fi
 
 ##########################################
Signature · 1 line
1.6.2.5
#35 lore raw

PATCH v2 35/81 Add libs_softmmu variable

In reply to Juan Quintela

It is used only for softmmu variables

---
 configure |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
configure +3 -1
index b704e7f..1edff5f 100755
@@ -45,6 +45,7 @@ install="install"
 objcopy="objcopy"
 ld="ld"
 helper_cflags=""
+libs_softmmu=""
 
 # parse CC options first
 for opt do
@@ -1763,7 +1764,7 @@ echo "HELPER_CFLAGS=$helper_cflags" >> $config_host_mak
 echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
 echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
 echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
-echo "LIBS=$LIBS" >> $config_host_mak
+echo "LIBS+=$LIBS" >> $config_host_mak
 echo "EXESUF=$EXESUF" >> $config_host_mak
 
 echo "/* Automatically generated by configure - do not modify */" > $config_host_h
@@ -2006,6 +2007,7 @@ if test "$target_bigendian" = "yes" ; then
 fi
 if test "$target_softmmu" = "yes" ; then
   echo "CONFIG_SOFTMMU=y" >> $config_mak
+  echo "LIBS+=$libs_softmmu" >> $config_mak
 fi
 if test "$target_user_only" = "yes" ; then
   echo "CONFIG_USER_ONLY=y" >> $config_mak
Signature · 1 line
1.6.2.5
#36 lore raw

PATCH v2 36/81 Add SDL_LIBS to libs_softmmu

In reply to Juan Quintela
---
 Makefile.target |    2 +-
 configure       |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Makefile.target +1 -1
index 69fb53a..37e8e0f 100644
@@ -453,7 +453,7 @@ vl.o: qemu-options.h
 
 monitor.o: qemu-monitor.h
 
-LIBS += $(SDL_LIBS) $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)
+LIBS += $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)
 ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
 
 endif # !CONFIG_USER_ONLY
configure +1 -1
index 1edff5f..cfa641e 100755
@@ -891,6 +891,7 @@ EOF
   if test "$mingw32" = "yes" ; then
     sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
   fi
+  libs_softmmu="$sdl_libs $libs_softmmu"
 fi
 
 ##########################################
@@ -1632,7 +1633,6 @@ if [ "$build_docs" = "yes" ] ; then
 fi
 if test "$sdl" = "yes" ; then
   echo "CONFIG_SDL=y" >> $config_host_mak
-  echo "SDL_LIBS=$sdl_libs" >> $config_host_mak
   echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
 fi
 if test "$cocoa" = "yes" ; then
Signature · 1 line
1.6.2.5
#37 lore raw

PATCH v2 37/81 gcc generates the right dependency for this file

In reply to Juan Quintela
---
 Makefile.target |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
Makefile.target +0 -4
index 37e8e0f..951063e 100644
@@ -163,10 +163,6 @@ obj-y = main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
       elfload.o linuxload.o uaccess.o envlist.o gdbstub.o gdbstub-xml.o \
       ioport-user.o
 obj-$(TARGET_HAS_BFLT) += flatload.o
-
-ifdef TARGET_HAS_ELFLOAD32
-elfload32.o: elfload.c
-endif
 obj-$(TARGET_HAS_ELFLOAD32) += elfload32.o
 
 ifeq ($(TARGET_ARCH), i386)
Signature · 1 line
1.6.2.5
#38 lore raw

PATCH v2 38/81 move coreaudio libraries to coreaudio selection

In reply to Juan Quintela
---
 Makefile.target |    3 ---
 configure       |    6 +++++-
 2 files changed, 5 insertions(+), 4 deletions(-)
Makefile.target +0 -3
index 951063e..75861f7 100644
@@ -410,9 +410,6 @@ obj-m68k-y += m68k-semi.o dummy_m68k.o
 
 ifdef CONFIG_COCOA
 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
-ifdef CONFIG_COREAUDIO
-COCOA_LIBS+=-framework CoreAudio
-endif
 endif
 ifdef CONFIG_SLIRP
 QEMU_CFLAGS+=-I$(SRC_PATH)/slirp
configure +5 -1
index cfa641e..738bef8 100755
@@ -1015,7 +1015,11 @@ for drv in $audio_drv_list; do
         "pa_simple *s = NULL; pa_simple_free(s); return 0;"
     ;;
 
-    oss|sdl|core|wav|dsound)
+    coreaudio)
+      libs_softmmu="-framework CoreAudio $libs_softmmu"
+    ;;
+
+    oss|sdl|wav|dsound)
     # XXX: Probes for CoreAudio, DirectSound, SDL(?)
     ;;
 
Signature · 1 line
1.6.2.5
#39 lore raw

PATCH v2 39/81 Move sound library selection to sound selection

In reply to Juan Quintela
---
 Makefile.target |   18 ------------------
 configure       |   17 +++++++++++++----
 2 files changed, 13 insertions(+), 22 deletions(-)
Makefile.target +0 -18
index 75861f7..04963c3 100644
@@ -227,24 +227,6 @@ obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o
 obj-$(CONFIG_KVM) += kvm.o kvm-all.o
 
 LIBS+=-lz
-ifdef CONFIG_ALSA
-LIBS += -lasound
-endif
-ifdef CONFIG_ESD
-LIBS += -lesd
-endif
-ifdef CONFIG_PA
-LIBS += -lpulse-simple
-endif
-ifdef CONFIG_DSOUND
-LIBS += -lole32 -ldxguid
-endif
-ifdef CONFIG_FMOD
-LIBS += $(FMOD_LIBS)
-endif
-ifdef CONFIG_OSS
-LIBS += $(OSS_LIBS)
-endif
 
 sound-obj-y =
 sound-obj-$(CONFIG_SB16) += sb16.o
configure +13 -4
index 738bef8..3b37d97 100755
@@ -993,6 +993,7 @@ for drv in $audio_drv_list; do
     alsa)
     audio_drv_probe $drv alsa/asoundlib.h -lasound \
         "snd_pcm_t **handle; return snd_pcm_close(*handle);"
+    libs_softmmu="-lasound $libs_softmmu"
     ;;
 
     fmod)
@@ -1004,22 +1005,33 @@ for drv in $audio_drv_list; do
         exit 1
     fi
     audio_drv_probe $drv fmod.h $fmod_lib "return FSOUND_GetVersion();" "-I $fmod_inc"
+    libs_softmmu="$fmod_lib $libs_softmmu"
     ;;
 
     esd)
     audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
+    libs_softmmu="-lesd $libs_softmmu"
     ;;
 
     pa)
     audio_drv_probe $drv pulse/simple.h -lpulse-simple \
         "pa_simple *s = NULL; pa_simple_free(s); return 0;"
+    libs_softmmu="-lpulse-simple $libs_softmmu"
     ;;
 
     coreaudio)
       libs_softmmu="-framework CoreAudio $libs_softmmu"
     ;;
 
-    oss|sdl|wav|dsound)
+    dsound)
+      libs_softmmu="-lole32 -ldxguid $libs_softmmu"
+    ;;
+
+    oss)
+      libs_softmmu="$oss_lib $libs_softmmu"
+    ;;
+
+    sdl|wav)
     # XXX: Probes for CoreAudio, DirectSound, SDL(?)
     ;;
 
@@ -1602,10 +1614,7 @@ for drv in $audio_drv_list; do
     def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
     echo "$def=y" >> $config_host_mak
     if test "$drv" = "fmod"; then
-        echo "FMOD_LIBS=$fmod_lib" >> $config_host_mak
         echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
-    elif test "$drv" = "oss"; then
-        echo "OSS_LIBS=$oss_lib" >> $config_host_mak
     fi
 done
 if test "$mixemu" = "yes" ; then
Signature · 1 line
1.6.2.5
#40 lore raw

PATCH v2 40/81 files are only compiled when CONFIG_ADLIB is defined

In reply to Juan Quintela
---
 Makefile.target |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
Makefile.target +0 -2
index 04963c3..4c0d5ba 100644
@@ -236,9 +236,7 @@ sound-obj-$(CONFIG_ADLIB) += fmopl.o adlib.o
 sound-obj-$(CONFIG_GUS) += gus.o gusemu_hal.o gusemu_mixer.o
 sound-obj-$(CONFIG_CS4231A) += cs4231a.o
 
-ifdef CONFIG_ADLIB
 adlib.o fmopl.o: QEMU_CFLAGS := ${QEMU_CFLAGS} -DBUILD_Y8950=0
-endif
 
 ifdef CONFIG_VNC_TLS
 QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
Signature · 1 line
1.6.2.5
#41 lore raw

PATCH v2 41/81 Test if we need -lutil in ,/configure

In reply to Juan Quintela
---
 Makefile.target |   10 ----------
 configure       |    5 +++++
 2 files changed, 5 insertions(+), 10 deletions(-)
Makefile.target +0 -10
index 4c0d5ba..6a61dfd 100644
@@ -395,16 +395,6 @@ ifdef CONFIG_SLIRP
 QEMU_CFLAGS+=-I$(SRC_PATH)/slirp
 endif
 
-# specific flags are needed for non soft mmu emulator
-ifndef CONFIG_DARWIN
-ifndef CONFIG_WIN32
-ifndef CONFIG_SOLARIS
-ifndef CONFIG_AIX
-LIBS+=-lutil
-endif
-endif
-endif
-endif
 ifdef TARGET_GPROF
 vl.o: QEMU_CFLAGS+=-p
 LDFLAGS+=-p
configure +5 -0
index 3b37d97..24c0e5a 100755
@@ -1402,6 +1402,11 @@ else
     exit 1
 fi
 
+if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaries" != yes -a \
+        "$aix" != "yes" ; then
+    libs_softmmu="-lutil $libs_softmmu"
+fi
+
 # End of CC checks
 # After here, no more $cc or $ld runs
 
Signature · 1 line
1.6.2.5
#42 lore raw

PATCH v2 42/81 Fold CURSES_LIBS into libsoftmmu_libs

In reply to Juan Quintela
---
 Makefile.target |    2 +-
 configure       |    5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)
Makefile.target +1 -1
index 6a61dfd..da8b861 100644
@@ -416,7 +416,7 @@ vl.o: qemu-options.h
 
 monitor.o: qemu-monitor.h
 
-LIBS += $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)
+LIBS += $(COCOA_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)
 ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
 
 endif # !CONFIG_USER_ONLY
configure +2 -3
index 24c0e5a..e778bbc 100755
@@ -1074,9 +1074,9 @@ if test "$curses" = "yes" ; then
 int main(void) { resize_term(0, 0); return curses_version(); }
 EOF
   if compile_prog "" "-lncurses" ; then
-    curses_libs="-lncurses"
+    libs_softmmu="-lncurses $libs_softmmu"
   elif compile_prog "" "-lcurses" ; then
-    curses_libs="-lcurses"
+    libs_softmmu="-lcurses $libs_softmmu"
   else
     curses=no
   fi
@@ -1658,7 +1658,6 @@ if test "$cocoa" = "yes" ; then
 fi
 if test "$curses" = "yes" ; then
   echo "CONFIG_CURSES=y" >> $config_host_mak
-  echo "CURSES_LIBS=$curses_libs" >> $config_host_mak
 fi
 if test "$atfile" = "yes" ; then
   echo "CONFIG_ATFILE=y" >> $config_host_mak
Signature · 1 line
1.6.2.5
#43 lore raw

PATCH v2 43/81 Fold VNC_TLS_LIBS into libs_softmmu

In reply to Juan Quintela
---
 Makefile.target |    3 ---
 configure       |    3 +--
 2 files changed, 1 insertions(+), 5 deletions(-)
Makefile.target +0 -3
index da8b861..b5500e4 100644
@@ -238,10 +238,7 @@ sound-obj-$(CONFIG_CS4231A) += cs4231a.o
 
 adlib.o fmopl.o: QEMU_CFLAGS := ${QEMU_CFLAGS} -DBUILD_Y8950=0
 
-ifdef CONFIG_VNC_TLS
 QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
-LIBS += $(VNC_TLS_LIBS)
-endif
 
 ifdef CONFIG_VNC_SASL
 QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
configure +1 -2
index e778bbc..2226695 100755
@@ -904,7 +904,7 @@ EOF
     vnc_tls_cflags=`pkg-config --cflags gnutls 2> /dev/null`
     vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
     if compile_prog "$vnc_tls_cflags" "$vnc_tls_libs" ; then
-	:
+	libs_softmmu="$vnc_tls_libs $libs_softmmu"
     else
 	vnc_tls="no"
     fi
@@ -1628,7 +1628,6 @@ fi
 if test "$vnc_tls" = "yes" ; then
   echo "CONFIG_VNC_TLS=y" >> $config_host_mak
   echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
-  echo "VNC_TLS_LIBS=$vnc_tls_libs" >> $config_host_mak
 fi
 if test "$vnc_sasl" = "yes" ; then
   echo "CONFIG_VNC_SASL=y" >> $config_host_mak
Signature · 1 line
1.6.2.5
#44 lore raw

PATCH v2 44/81 Fold VNC_SASL_LIBS into libs_softmmu

In reply to Juan Quintela
---
 Makefile.target |    4 ----
 configure       |    3 +--
 2 files changed, 1 insertions(+), 6 deletions(-)
Makefile.target +0 -4
index b5500e4..3253c23 100644
@@ -239,11 +239,7 @@ sound-obj-$(CONFIG_CS4231A) += cs4231a.o
 adlib.o fmopl.o: QEMU_CFLAGS := ${QEMU_CFLAGS} -DBUILD_Y8950=0
 
 QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
-
-ifdef CONFIG_VNC_SASL
 QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
-LIBS += $(VNC_SASL_LIBS)
-endif
 
 ifdef CONFIG_BLUEZ
 LIBS += $(BLUEZ_LIBS)
configure +1 -2
index 2226695..059be1a 100755
@@ -922,7 +922,7 @@ EOF
     vnc_sasl_cflags=""
     vnc_sasl_libs="-lsasl2"
     if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then
-	:
+	libs_softmmu="$vnc_sasl_libs $libs_softmmu"
     else
 	vnc_sasl="no"
     fi
@@ -1632,7 +1632,6 @@ fi
 if test "$vnc_sasl" = "yes" ; then
   echo "CONFIG_VNC_SASL=y" >> $config_host_mak
   echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
-  echo "VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_host_mak
 fi
 if test "$fnmatch" = "yes" ; then
   echo "CONFIG_FNMATCH=y" >> $config_host_mak
Signature · 1 line
1.6.2.5
#45 lore raw

PATCH v2 45/81 Fold XEN_LIBS into libs_softmmu

In reply to Juan Quintela
---
 Makefile.target |    3 ---
 configure       |    3 +--
 2 files changed, 1 insertions(+), 5 deletions(-)
Makefile.target +0 -3
index 3253c23..f8d3d9e 100644
@@ -247,9 +247,6 @@ endif
 
 # xen backend driver support
 obj-$(CONFIG_XEN) += xen_machine_pv.o xen_domainbuild.o
-ifeq ($(CONFIG_XEN), y)
-  LIBS += $(XEN_LIBS)
-endif
 
 # USB layer
 obj-y += usb-ohci.o
configure +1 -2
index 059be1a..13ae0e2 100755
@@ -829,7 +829,7 @@ if test "$xen" = "yes" ; then
 int main(void) { xs_daemon_open(); xc_interface_open(); return 0; }
 EOF
   if compile_prog "" "$xen_libs" ; then
-    :
+    libs_softmmu="$xen_libs $libs_softmmu"
   else
     xen="no"
   fi
@@ -1694,7 +1694,6 @@ if test "$bluez" = "yes" ; then
 fi
 if test "$xen" = "yes" ; then
   echo "CONFIG_XEN=y" >> $config_host_mak
-  echo "XEN_LIBS=$xen_libs" >> $config_host_mak
 fi
 if test "$aio" = "yes" ; then
   echo "CONFIG_AIO=y" >> $config_host_mak
Signature · 1 line
1.6.2.5
#46 lore raw

PATCH v2 46/81 Fold BLUEZ_LIBS into libs_softmmu

In reply to Juan Quintela
---
 Makefile.target |    4 ----
 configure       |    3 +--
 2 files changed, 1 insertions(+), 6 deletions(-)
Makefile.target +0 -4
index f8d3d9e..4ea21c0 100644
@@ -241,10 +241,6 @@ adlib.o fmopl.o: QEMU_CFLAGS := ${QEMU_CFLAGS} -DBUILD_Y8950=0
 QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
 QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
 
-ifdef CONFIG_BLUEZ
-LIBS += $(BLUEZ_LIBS)
-endif
-
 # xen backend driver support
 obj-$(CONFIG_XEN) += xen_machine_pv.o xen_domainbuild.o
 
configure +1 -2
index 13ae0e2..9945bfe 100755
@@ -1111,7 +1111,7 @@ EOF
   bluez_cflags=`pkg-config --cflags bluez 2> /dev/null`
   bluez_libs=`pkg-config --libs bluez 2> /dev/null`
   if compile_prog "$bluez_cflags" "$bluez_libs" ; then
-    :
+    libs_softmmu="$bluez_libs $libs_softmmu"
   else
     bluez="no"
   fi
@@ -1690,7 +1690,6 @@ fi
 if test "$bluez" = "yes" ; then
   echo "CONFIG_BLUEZ=y" >> $config_host_mak
   echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
-  echo "BLUEZ_LIBS=$bluez_libs" >> $config_host_mak
 fi
 if test "$xen" = "yes" ; then
   echo "CONFIG_XEN=y" >> $config_host_mak
Signature · 1 line
1.6.2.5
#47 lore raw

PATCH v2 47/81 Fold FDT_LIBS into libs_softmmu

In reply to Juan Quintela
---
 Makefile.target |    2 --
 configure       |    2 +-
 2 files changed, 1 insertions(+), 3 deletions(-)
Makefile.target +0 -2
index 4ea21c0..705b8df 100644
@@ -291,7 +291,6 @@ QEMU_CFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
 endif
 
 obj-ppc-$(CONFIG_FDT) += device_tree.o
-LIBS+= $(FDT_LIBS)
 
 obj-mips-y = mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
 obj-mips-y += mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
@@ -317,7 +316,6 @@ obj-microblaze-y += xilinx_ethlite.o
 obj-microblaze-y += pflash_cfi02.o
 
 obj-microblaze-$(CONFIG_FDT) += device_tree.o
-LIBS+= $(FDT_LIBS)
 
 # Boards
 obj-cris-y = cris_pic_cpu.o etraxfs.o axis_dev88.o
configure +1 -1
index 9945bfe..4a19917 100755
@@ -1227,6 +1227,7 @@ int main(void) { return 0; }
 EOF
   if compile_prog "" "$fdt_libs" ; then
     fdt=yes
+    libs_softmmu="$fdt_libs $libs_softmmu"
   fi
 fi
 
@@ -1711,7 +1712,6 @@ if test "$preadv" = "yes" ; then
 fi
 if test "$fdt" = "yes" ; then
   echo "CONFIG_FDT=y" >> $config_host_mak
-  echo "FDT_LIBS=$fdt_libs" >> $config_host_mak
 fi
 
 # XXX: suppress that
Signature · 1 line
1.6.2.5
#48 lore raw

PATCH v2 48/81 Fold BRLAPI_LIBS into libs_softmmu

In reply to Juan Quintela
---
 Makefile        |    3 ---
 Makefile.target |    2 +-
 configure       |    2 +-
 3 files changed, 2 insertions(+), 5 deletions(-)
Makefile +0 -3
index cd130a0..1b7839a 100644
@@ -92,9 +92,6 @@ obj-y += msmouse.o ps2.o
 obj-y += qdev.o qdev-properties.o ssi.o
 
 obj-$(CONFIG_BRLAPI) += baum.o
-
-LIBS+=$(BRLAPI_LIBS)
-
 obj-$(CONFIG_WIN32) += tap-win32.o
 obj-$(CONFIG_POSIX) += migration-exec.o
 
Makefile.target +1 -1
index 705b8df..d13309a 100644
@@ -400,7 +400,7 @@ vl.o: qemu-options.h
 
 monitor.o: qemu-monitor.h
 
-LIBS += $(COCOA_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)
+LIBS += $(COCOA_LIBS) $(VDE_LIBS) $(CURL_LIBS)
 ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
 
 endif # !CONFIG_USER_ONLY
configure +1 -1
index 4a19917..fd7c6b0 100755
@@ -1059,6 +1059,7 @@ int main( void ) { return brlapi__openConnection (NULL, NULL, NULL); }
 EOF
   if compile_prog "" "$brlapi_libs" ; then
     brlapi=yes
+    libs_softmmu="$brlapi_libs $libs_softmmu"
   fi
 fi
 
@@ -1686,7 +1687,6 @@ if test "$curl" = "yes" ; then
 fi
 if test "$brlapi" = "yes" ; then
   echo "CONFIG_BRLAPI=y" >> $config_host_mak
-  echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak
 fi
 if test "$bluez" = "yes" ; then
   echo "CONFIG_BLUEZ=y" >> $config_host_mak
Signature · 1 line
1.6.2.5
#49 lore raw

PATCH v2 49/81 remove duplicated TARGET_GPROF code

In reply to Juan Quintela
---
 Makefile.target |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)
Makefile.target +1 -6
index d13309a..5c3b212 100644
@@ -379,11 +379,6 @@ ifdef CONFIG_SLIRP
 QEMU_CFLAGS+=-I$(SRC_PATH)/slirp
 endif
 
-ifdef TARGET_GPROF
-vl.o: QEMU_CFLAGS+=-p
-LDFLAGS+=-p
-endif
-
 ifeq ($(ARCH),ia64)
 LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
 endif
@@ -391,7 +386,7 @@ endif
 # profiling code
 ifdef TARGET_GPROF
 LDFLAGS+=-p
-main.o: QEMU_CFLAGS+=-p
+main.o vl.o: QEMU_CFLAGS+=-p
 endif
 
 vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS)
Signature · 1 line
1.6.2.5
#50 lore raw

PATCH v2 50/81 \!CONFIG_USER_ONLY == CONFIG_SOFTMMU

In reply to Juan Quintela

Use this to simplify Makefile.target and remove negative logic

---
 Makefile.target |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)
Makefile.target +4 -8
index 5c3b212..6234648 100644
@@ -77,9 +77,7 @@ endif
 ifeq ($(TARGET_BASE_ARCH), cris)
 libobj-y += cris-dis.o
 
-ifndef CONFIG_USER_ONLY
-libobj-y += mmu.o
-endif
+libobj-$(CONFIG_SOFTMMU) += mmu.o
 endif
 
 # NOTE: the disassembler code is only needed for debugging
@@ -99,9 +97,7 @@ libobj-y += ppc-dis.o
 endif
 ifeq ($(findstring microblaze, $(TARGET_BASE_ARCH) $(ARCH)),microblaze)
 libobj-y += microblaze-dis.o
-ifndef CONFIG_USER_ONLY
-libobj-y += mmu.o
-endif
+libobj-$(CONFIG_SOFTMMU) += mmu.o
 endif
 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
 libobj-y += mips-dis.o
@@ -217,7 +213,7 @@ endif #CONFIG_BSD_USER
 
 #########################################################
 # System emulator target
-ifndef CONFIG_USER_ONLY
+ifdef CONFIG_SOFTMMU
 
 obj-y = vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o \
         gdbstub.o gdbstub-xml.o msix.o ioport.o
@@ -398,7 +394,7 @@ monitor.o: qemu-monitor.h
 LIBS += $(COCOA_LIBS) $(VDE_LIBS) $(CURL_LIBS)
 ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
 
-endif # !CONFIG_USER_ONLY
+endif # CONFIG_SOFTMMU
 
 $(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) $(ARLIBS)
 	$(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y))
Signature · 1 line
1.6.2.5
#51 lore raw

PATCH v2 51/81 Introduce CONFIG_NOSOFTFLOAT and simplify Makefile.target

In reply to Juan Quintela
---
 Makefile.target |    8 +++-----
 configure       |    3 +++
 2 files changed, 6 insertions(+), 5 deletions(-)
Makefile.target +3 -5
index 6234648..cff80c7 100644
@@ -58,12 +58,10 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
 ifeq ($(ARCH),sparc64)
 QEMU_CFLAGS+=-I$(SRC_PATH)/tcg/sparc
 endif
-ifdef CONFIG_SOFTFLOAT
-libobj-y += fpu/softfloat.o
-else
-libobj-y += fpu/softfloat-native.o
-endif
 QEMU_CFLAGS+=-I$(SRC_PATH)/fpu
+
+libobj-$(CONFIG_SOFTFLOAT) += fpu/softfloat.o
+libobj-$(CONFIG_NOSOFTFLOAT) += fpu/softfloat-native.o
 libobj-y += op_helper.o helper.o
 
 ifeq ($(TARGET_BASE_ARCH), arm)
configure +3 -0
index fd7c6b0..8cfd4ad 100755
@@ -2043,6 +2043,9 @@ case "$target_arch2" in
   arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|sparc|sparc64|sparc32plus)
     echo "CONFIG_SOFTFLOAT=y" >> $config_mak
     ;;
+  *)
+    echo "CONFIG_NOSOFTFLOAT=y" >> $config_mak
+    ;;
 esac
 
 if test "$target_user_only" = "yes" -a "$bflt" = "yes"; then
Signature · 1 line
1.6.2.5
#52 lore raw

PATCH v2 52/81 permit to add things to LDFLAGS for target

In reply to Juan Quintela
---
 configure |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)
configure +7 -9
index 8cfd4ad..f38eff6 100755
@@ -2073,37 +2073,35 @@ if test "$target_linux_user" = "yes" -o "$target_linux_user" = "yes" ; then
   case "$ARCH" in
   i386)
     if test "$gprof" = "yes" -o "$static" = "yes" ; then
-      ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld'
+      ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld $ldflags'
     else
       # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
       # that the kernel ELF loader considers as an executable. I think this
       # is the simplest way to make it self virtualizable!
-      ldflags='-Wl,-shared'
+      ldflags='-Wl,-shared $ldflags'
     fi
     ;;
   sparc)
     # -static is used to avoid g1/g3 usage by the dynamic linker
-    ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
+    ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static $ldflags'
     ;;
   ia64)
-    ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
+    ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static $ldflags'
     ;;
   x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64)
-    ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld'
+    ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld $ldflags'
     ;;
   esac
 fi
 if test "$target_softmmu" = "yes" ; then
   case "$ARCH" in
   ia64)
-    ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
+    ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static $ldflags'
     ;;
   esac
 fi
 
-if test "$ldflags" != "" ; then
-  echo "LDFLAGS+=$ldflags" >> $config_mak
-fi
+echo "LDFLAGS+=$ldflags" >> $config_mak
 
 echo "/* Automatically generated by configure - do not modify */" > $config_h
 echo "#include \"../config-host.h\"" >> $config_h
Signature · 1 line
1.6.2.5
#53 lore raw

PATCH v2 53/81 refactor linker_script common part and change quoting

In reply to Juan Quintela
---
 configure |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
configure +7 -6
index f38eff6..4ba42b3 100755
@@ -2069,34 +2069,35 @@ fi
 # generate LDFLAGS for targets
 
 ldflags=""
+linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
 if test "$target_linux_user" = "yes" -o "$target_linux_user" = "yes" ; then
   case "$ARCH" in
   i386)
     if test "$gprof" = "yes" -o "$static" = "yes" ; then
-      ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld $ldflags'
+      ldflags="$linker_script $ldflags"
     else
       # WARNING: this LDFLAGS is _very_ tricky : qemu is an ELF shared object
       # that the kernel ELF loader considers as an executable. I think this
       # is the simplest way to make it self virtualizable!
-      ldflags='-Wl,-shared $ldflags'
+      ldflags="-Wl,-shared $ldflags"
     fi
     ;;
   sparc)
     # -static is used to avoid g1/g3 usage by the dynamic linker
-    ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static $ldflags'
+    ldflags="$linker_script -static $ldflags"
     ;;
   ia64)
-    ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static $ldflags'
+    ldflags="-Wl,-G0 $linker_script -static $ldflags"
     ;;
   x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64)
-    ldflags='-Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld $ldflags'
+    ldflags="$linker_script $ldflags"
     ;;
   esac
 fi
 if test "$target_softmmu" = "yes" ; then
   case "$ARCH" in
   ia64)
-    ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static $ldflags'
+    ldflags="-Wl,-G0 $linker_script -static $ldflags"
     ;;
   esac
 fi
Signature · 1 line
1.6.2.5
#54 lore raw

PATCH v2 54/81 permit to add things to CFLAGS per target

In reply to Juan Quintela
---
 configure |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
configure +3 -1
index 4ba42b3..9387840 100755
@@ -2066,8 +2066,9 @@ if test "$target_bsd_user" = "yes" ; then
   echo "CONFIG_BSD_USER=y" >> $config_mak
 fi
 
-# generate LDFLAGS for targets
+# generate QEMU_CFLAGS/LDFLAGS for targets
 
+cflags=""
 ldflags=""
 linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
 if test "$target_linux_user" = "yes" -o "$target_linux_user" = "yes" ; then
@@ -2103,6 +2104,7 @@ if test "$target_softmmu" = "yes" ; then
 fi
 
 echo "LDFLAGS+=$ldflags" >> $config_mak
+echo "QEMU_CFLAGS+=$cflags" >> $config_mak
 
 echo "/* Automatically generated by configure - do not modify */" > $config_h
 echo "#include \"../config-host.h\"" >> $config_h
Signature · 1 line
1.6.2.5
#55 lore raw

PATCH v2 55/81 fix typo, there should be bsd_user there

In reply to Juan Quintela
---
 configure |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
configure +2 -1
index 9387840..c658260 100755
@@ -2071,7 +2071,8 @@ fi
 cflags=""
 ldflags=""
 linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
-if test "$target_linux_user" = "yes" -o "$target_linux_user" = "yes" ; then
+
+if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
   case "$ARCH" in
   i386)
     if test "$gprof" = "yes" -o "$static" = "yes" ; then
Signature · 1 line
1.6.2.5
#56 lore raw

PATCH v2 56/81 Move alpha CFLAGS target to configure

In reply to Juan Quintela
---
 Makefile.target |    5 -----
 configure       |    9 ++++++++-
 2 files changed, 8 insertions(+), 6 deletions(-)
Makefile.target +0 -5
index cff80c7..d5d62cb 100644
@@ -23,11 +23,6 @@ ifeq ($(subst ppc64,ppc,$(ARCH))$(TARGET_BASE_ARCH),ppcppc)
 translate.o: QEMU_CFLAGS := $(QEMU_CFLAGS) $(call cc-option, $(QEMU_CFLAGS), -fno-unit-at-a-time,)
 endif
 
-ifeq ($(ARCH),alpha)
-# Ensure there's only a single GP
-QEMU_CFLAGS+=-msmall-data
-endif
-
 ifeq ($(ARCH),ia64)
 QEMU_CFLAGS+=-mno-sdata
 endif
configure +8 -1
index c658260..02a400a 100755
@@ -2070,8 +2070,15 @@ fi
 
 cflags=""
 ldflags=""
-linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
 
+case "$ARCH" in
+alpha)
+  # Ensure there's only a single GP
+  cflags="-msmall-data $cflags"
+;;
+esac
+
+linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
   case "$ARCH" in
   i386)
Signature · 1 line
1.6.2.5
#57 lore raw

PATCH v2 57/81 Move ia64 QEMU_CFLAGS target to configure

In reply to Juan Quintela
---
 Makefile.target |    4 ----
 configure       |    3 +++
 2 files changed, 3 insertions(+), 4 deletions(-)
Makefile.target +0 -4
index d5d62cb..61bde35 100644
@@ -23,10 +23,6 @@ ifeq ($(subst ppc64,ppc,$(ARCH))$(TARGET_BASE_ARCH),ppcppc)
 translate.o: QEMU_CFLAGS := $(QEMU_CFLAGS) $(call cc-option, $(QEMU_CFLAGS), -fno-unit-at-a-time,)
 endif
 
-ifeq ($(ARCH),ia64)
-QEMU_CFLAGS+=-mno-sdata
-endif
-
 LIBS+=-lm
 ifdef CONFIG_SOLARIS
 ifdef CONFIG_NEEDS_LIBSUNMATH
configure +3 -0
index 02a400a..780c697 100755
@@ -2076,6 +2076,9 @@ alpha)
   # Ensure there's only a single GP
   cflags="-msmall-data $cflags"
 ;;
+ia64)
+  cflags="-mno-sdata $cflags"
+;;
 esac
 
 linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
Signature · 1 line
1.6.2.5
#58 lore raw

PATCH v2 58/81 this bit was already generated in configure

In reply to Juan Quintela
---
 Makefile.target |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
Makefile.target +0 -4
index 61bde35..0386c13 100644
@@ -364,10 +364,6 @@ ifdef CONFIG_SLIRP
 QEMU_CFLAGS+=-I$(SRC_PATH)/slirp
 endif
 
-ifeq ($(ARCH),ia64)
-LDFLAGS+=-Wl,-G0 -Wl,-T,$(SRC_PATH)/ia64.ld
-endif
-
 # profiling code
 ifdef TARGET_GPROF
 LDFLAGS+=-p
Signature · 1 line
1.6.2.5
#59 lore raw

PATCH v2 59/81 Fold TARGET_GPROF handling in configure

In reply to Juan Quintela
---
 Makefile.target |    7 -------
 configure       |   14 +++++++++++---
 2 files changed, 11 insertions(+), 10 deletions(-)
Makefile.target +0 -7
index 0386c13..8fbf9ca 100644
@@ -138,12 +138,6 @@ ifdef CONFIG_LINUX_USER
 VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
 QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
 
-# profiling code
-ifdef TARGET_GPROF
-LDFLAGS+=-p
-QEMU_CFLAGS+=-p
-endif
-
 obj-y = main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
       elfload.o linuxload.o uaccess.o envlist.o gdbstub.o gdbstub-xml.o \
       ioport-user.o
@@ -366,7 +360,6 @@ endif
 
 # profiling code
 ifdef TARGET_GPROF
-LDFLAGS+=-p
 main.o vl.o: QEMU_CFLAGS+=-p
 endif
 
configure +11 -3
index 780c697..00ebf11 100755
@@ -1595,9 +1595,6 @@ if test "$solaris" = "yes" ; then
     echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
   fi
 fi
-if test "$gprof" = "yes" ; then
-  echo "TARGET_GPROF=yes" >> $config_host_mak
-fi
 if test "$static" = "yes" ; then
   echo "CONFIG_STATIC=y" >> $config_host_mak
   LDFLAGS="-static $LDFLAGS"
@@ -2081,6 +2078,17 @@ ia64)
 ;;
 esac
 
+if test "$gprof" = "yes" ; then
+  echo "TARGET_GPROF=yes" >> $config_mak
+  if test "$target_linux_user" = "yes" ; then
+    cflags="-p $cflags"
+    ldflags="-p $ldflags"
+  fi
+  if test "$target_softmmu" = "yes" ; then
+    ldflags="-p $ldflags"
+  fi
+fi
+
 linker_script="-Wl,-T../config-host.ld -Wl,-T,\$(SRC_PATH)/\$(ARCH).ld"
 if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
   case "$ARCH" in
Signature · 1 line
1.6.2.5
#60 lore raw

PATCH v2 60/81 Generate more conmmon CFLAGS

In reply to Juan Quintela
---
 Makefile.target |    7 -------
 configure       |    8 ++++++++
 2 files changed, 8 insertions(+), 7 deletions(-)
Makefile.target +0 -7
index 8fbf9ca..7fff12d 100644
@@ -43,14 +43,7 @@ all: $(PROGS)
 # cpu emulator library
 libobj-y = exec.o translate-all.o cpu-exec.o translate.o host-utils.o
 libobj-$(CONFIG_KQEMU) += kqemu.o
-# TCG code generator
 libobj-y += tcg/tcg.o tcg/tcg-runtime.o
-QEMU_CFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
-ifeq ($(ARCH),sparc64)
-QEMU_CFLAGS+=-I$(SRC_PATH)/tcg/sparc
-endif
-QEMU_CFLAGS+=-I$(SRC_PATH)/fpu
-
 libobj-$(CONFIG_SOFTFLOAT) += fpu/softfloat.o
 libobj-$(CONFIG_NOSOFTFLOAT) += fpu/softfloat-native.o
 libobj-y += op_helper.o helper.o
configure +8 -0
index 00ebf11..b5055e2 100755
@@ -2068,6 +2068,14 @@ fi
 cflags=""
 ldflags=""
 
+if test "$ARCH" = "sparc64" ; then
+  cflags="-I\$(SRC_PATH)/tcg/sparc $cflags"
+else
+  cflags="-I\$(SRC_PATH)/tcg/\$(ARCH) $cflags"
+fi
+cflags="-I\$(SRC_PATH)/tcg $cflags"
+cflags="-I\$(SRC_PATH)/fpu $cflags"
+
 case "$ARCH" in
 alpha)
   # Ensure there's only a single GP
Signature · 1 line
1.6.2.5
#61 lore raw

PATCH v2 61/81 Added CONFIG_NEED_MMU for microblaze and cris

In reply to Juan Quintela
---
 Makefile.target |    4 +---
 configure       |    6 ++++++
 2 files changed, 7 insertions(+), 3 deletions(-)
Makefile.target +1 -3
index 7fff12d..78f89d5 100644
@@ -47,6 +47,7 @@ libobj-y += tcg/tcg.o tcg/tcg-runtime.o
 libobj-$(CONFIG_SOFTFLOAT) += fpu/softfloat.o
 libobj-$(CONFIG_NOSOFTFLOAT) += fpu/softfloat-native.o
 libobj-y += op_helper.o helper.o
+libobj-$(CONFIG_NEED_MMU) += mmu.o
 
 ifeq ($(TARGET_BASE_ARCH), arm)
 libobj-y += neon_helper.o iwmmxt_helper.o
@@ -58,8 +59,6 @@ endif
 
 ifeq ($(TARGET_BASE_ARCH), cris)
 libobj-y += cris-dis.o
-
-libobj-$(CONFIG_SOFTMMU) += mmu.o
 endif
 
 # NOTE: the disassembler code is only needed for debugging
@@ -79,7 +78,6 @@ libobj-y += ppc-dis.o
 endif
 ifeq ($(findstring microblaze, $(TARGET_BASE_ARCH) $(ARCH)),microblaze)
 libobj-y += microblaze-dis.o
-libobj-$(CONFIG_SOFTMMU) += mmu.o
 endif
 ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
 libobj-y += mips-dis.o
configure +6 -0
index b5055e2..e2e11f4 100755
@@ -2086,6 +2086,12 @@ ia64)
 ;;
 esac
 
+if test "$target_softmmu" = "yes" -a \( \
+        "$TARGET_ARCH" = "microblaze" -o \
+        "$TARGET_ARCH" = "cris" \) ; then
+  echo "CONFIG_NEED_MMU=y" >> $config_mak
+fi
+
 if test "$gprof" = "yes" ; then
   echo "TARGET_GPROF=yes" >> $config_mak
   if test "$target_linux_user" = "yes" ; then
Signature · 1 line
1.6.2.5
#62 lore raw

PATCH v2 62/81 Move dis-* selection to configure

In reply to Juan Quintela
---
 Makefile.target |   53 ++++++++++++-----------------------------------------
 configure       |   41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 53 insertions(+), 41 deletions(-)
Makefile.target +12 -41
index 78f89d5..9053b00 100644
@@ -57,49 +57,20 @@ ifeq ($(TARGET_BASE_ARCH), alpha)
 libobj-y += alpha_palcode.o
 endif
 
-ifeq ($(TARGET_BASE_ARCH), cris)
-libobj-y += cris-dis.o
-endif
-
 # NOTE: the disassembler code is only needed for debugging
 libobj-y += disas.o
-ifeq ($(findstring i386, $(TARGET_ARCH) $(ARCH)),i386)
-USE_I386_DIS=y
-endif
-ifeq ($(findstring x86_64, $(TARGET_ARCH) $(ARCH)),x86_64)
-USE_I386_DIS=y
-endif
-libobj-$(USE_I386_DIS) += i386-dis.o
-ifeq ($(findstring alpha, $(TARGET_ARCH) $(ARCH)),alpha)
-libobj-y += alpha-dis.o
-endif
-ifeq ($(findstring ppc, $(TARGET_BASE_ARCH) $(ARCH)),ppc)
-libobj-y += ppc-dis.o
-endif
-ifeq ($(findstring microblaze, $(TARGET_BASE_ARCH) $(ARCH)),microblaze)
-libobj-y += microblaze-dis.o
-endif
-ifeq ($(findstring mips, $(TARGET_BASE_ARCH) $(ARCH)),mips)
-libobj-y += mips-dis.o
-endif
-ifeq ($(findstring sparc, $(TARGET_BASE_ARCH) $(ARCH)),sparc)
-libobj-y += sparc-dis.o
-endif
-ifeq ($(findstring arm, $(TARGET_ARCH) $(ARCH)),arm)
-libobj-y += arm-dis.o
-endif
-ifeq ($(findstring m68k, $(TARGET_ARCH) $(ARCH)),m68k)
-libobj-y += m68k-dis.o
-endif
-ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
-libobj-y += sh4-dis.o
-endif
-ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
-libobj-y += hppa-dis.o
-endif
-ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
-libobj-y += s390-dis.o
-endif
+libobj-$(CONFIG_ALPHA_DIS) += alpha-dis.o
+libobj-$(CONFIG_ARM_DIS) += arm-dis.o
+libobj-$(CONFIG_CRIS_DIS) += cris-dis.o
+libobj-$(CONFIG_HPPA_DIS) += hppa-dis.o
+libobj-$(CONFIG_I386_DIS) += i386-dis.o
+libobj-$(CONFIG_M68K_DIS) += m68k-dis.o
+libobj-$(CONFIG_MICROBLAZE_DIS) += microblaze-dis.o
+libobj-$(CONFIG_MIPS_DIS) += mips-dis.o
+libobj-$(CONFIG_PPC_DIS) += ppc-dis.o
+libobj-$(CONFIG_S390_DIS) += s390-dis.o
+libobj-$(CONFIG_SH4_DIS) += sh4-dis.o
+libobj-$(CONFIG_SPARC_DIS) += sparc-dis.o
 
 # libqemu
 
configure +41 -0

47 lines not on this page · raw message

Signature · 1 line
1.6.2.5
#63 lore raw

PATCH v2 63/81 Use only one KVM_CFLAGS

In reply to Juan Quintela
---
 Makefile.target |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
Makefile.target +1 -2
index 9053b00..3f90d07 100644
@@ -32,8 +32,7 @@ QEMU_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
 endif
 endif
 
-kvm.o: QEMU_CFLAGS+=$(KVM_CFLAGS)
-kvm-all.o: QEMU_CFLAGS+=$(KVM_CFLAGS)
+kvm.o kvm-all.o: QEMU_CFLAGS+=$(KVM_CFLAGS)
 
 all: $(PROGS)
 # Dummy command so that make thinks it has done something
Signature · 1 line
1.6.2.5
#64 lore raw

PATCH v2 64/81 Use one less HELPER_CFLAGS

In reply to Juan Quintela
---
 Makefile.target |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
Makefile.target +1 -3
index 3f90d07..dfbb5e9 100644
@@ -83,9 +83,7 @@ tcg/tcg.o: cpu.h
 
 # HELPER_CFLAGS is used for all the code compiled with static register
 # variables
-op_helper.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
-
-cpu-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
+op_helper.o cpu-exec.o: QEMU_CFLAGS += $(HELPER_CFLAGS)
 
 # Note: this is a workaround. The real fix is to avoid compiling
 # cpu_signal_handler() in cpu-exec.c.
Signature · 1 line
1.6.2.5
#67 lore raw

PATCH v2 67/81 AUDIO_PT is not needed

In reply to Juan Quintela

AUDIO_PT only changes LDFLAGS to include -pthread, but it change it in Makefile, and audio files are linked only on Makefile.target

---
 Makefile |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)
Makefile +0 -8
index 6ecc1ae..df8fb0e 100644
@@ -95,21 +95,13 @@ obj-$(CONFIG_BRLAPI) += baum.o
 obj-$(CONFIG_WIN32) += tap-win32.o
 obj-$(CONFIG_POSIX) += migration-exec.o
 
-ifdef CONFIG_COREAUDIO
-AUDIO_PT = y
-endif
 audio/audio.o audio/fmodaudio.o: QEMU_CFLAGS += $(FMOD_CFLAGS)
 ifdef CONFIG_ESD
-AUDIO_PT = y
 AUDIO_PT_INT = y
 endif
 ifdef CONFIG_PA
-AUDIO_PT = y
 AUDIO_PT_INT = y
 endif
-ifdef AUDIO_PT
-LDFLAGS += -pthread
-endif
 
 audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o
 audio-obj-$(CONFIG_SDL) += sdlaudio.o
Signature · 1 line
1.6.2.5
#66 lore raw

PATCH v2 66/81 FMOD_CFLAGS is not set when CONFIG_FMOD is undef

In reply to Juan Quintela
---
 Makefile |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
Makefile +1 -3
index 270ca59..6ecc1ae 100644
@@ -98,9 +98,7 @@ obj-$(CONFIG_POSIX) += migration-exec.o
 ifdef CONFIG_COREAUDIO
 AUDIO_PT = y
 endif
-ifdef CONFIG_FMOD
-audio/audio.o audio/fmodaudio.o: QEMU_CFLAGS := $(FMOD_CFLAGS) $(QEMU_CFLAGS)
-endif
+audio/audio.o audio/fmodaudio.o: QEMU_CFLAGS += $(FMOD_CFLAGS)
 ifdef CONFIG_ESD
 AUDIO_PT = y
 AUDIO_PT_INT = y
Signature · 1 line
1.6.2.5
#65 lore raw

PATCH v2 65/81 Make slirp include dir globlal in cflags

In reply to Juan Quintela

We already include it everywhere

---
 Makefile        |    4 ----
 Makefile.target |    3 ---
 configure       |    1 +
 3 files changed, 1 insertions(+), 7 deletions(-)
Makefile +0 -4
index 1b7839a..270ca59 100644
@@ -135,10 +135,6 @@ obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o
 obj-$(CONFIG_COCOA) += cocoa.o
 obj-$(CONFIG_IOTHREAD) += qemu-thread.o
 
-ifdef CONFIG_SLIRP
-QEMU_CFLAGS+=-I$(SRC_PATH)/slirp
-endif
-
 slirp-obj-y = cksum.o if.o ip_icmp.o ip_input.o ip_output.o
 slirp-obj-y += slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o
 slirp-obj-y += tcp_subr.o tcp_timer.o udp.o bootp.o tftp.o
Makefile.target +0 -3
index dfbb5e9..a4d269d 100644
@@ -313,9 +313,6 @@ obj-m68k-y += m68k-semi.o dummy_m68k.o
 ifdef CONFIG_COCOA
 COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
 endif
-ifdef CONFIG_SLIRP
-QEMU_CFLAGS+=-I$(SRC_PATH)/slirp
-endif
 
 # profiling code
 ifdef TARGET_GPROF
configure +1 -0
index a6494ca..9d54aaa 100755
@@ -1604,6 +1604,7 @@ if test $profiler = "yes" ; then
 fi
 if test "$slirp" = "yes" ; then
   echo "CONFIG_SLIRP=y" >> $config_host_mak
+  CFLAGS="-I\$(SRC_PATH)/slirp $CFLAGS"
 fi
 if test "$vde" = "yes" ; then
   echo "CONFIG_VDE=y" >> $config_host_mak
Signature · 1 line
1.6.2.5
#68 lore raw

PATCH v2 68/81 Generate CONFIG_AUDIO_PT_INT in configure

In reply to Juan Quintela
---
 Makefile  |    8 +-------
 configure |    6 ++++++
 2 files changed, 7 insertions(+), 7 deletions(-)
Makefile +1 -7
index df8fb0e..09d9ed0 100644
@@ -96,12 +96,6 @@ obj-$(CONFIG_WIN32) += tap-win32.o
 obj-$(CONFIG_POSIX) += migration-exec.o
 
 audio/audio.o audio/fmodaudio.o: QEMU_CFLAGS += $(FMOD_CFLAGS)
-ifdef CONFIG_ESD
-AUDIO_PT_INT = y
-endif
-ifdef CONFIG_PA
-AUDIO_PT_INT = y
-endif
 
 audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o
 audio-obj-$(CONFIG_SDL) += sdlaudio.o
@@ -112,7 +106,7 @@ audio-obj-$(CONFIG_DSOUND) += dsoundaudio.o
 audio-obj-$(CONFIG_FMOD) += fmodaudio.o
 audio-obj-$(CONFIG_ESD) += esdaudio.o
 audio-obj-$(CONFIG_PA) += paaudio.o
-audio-obj-$(AUDIO_PT_INT) += audio_pt_int.o
+audio-obj-$(CONFIG_AUDIO_PT_INT) += audio_pt_int.o
 audio-obj-y += wavcapture.o
 obj-y += $(addprefix audio/, $(audio-obj-y))
 
configure +6 -0
index 9d54aaa..9bc2303 100755
@@ -46,6 +46,7 @@ objcopy="objcopy"
 ld="ld"
 helper_cflags=""
 libs_softmmu=""
+audio_pt_int=""
 
 # parse CC options first
 for opt do
@@ -1011,12 +1012,14 @@ for drv in $audio_drv_list; do
     esd)
     audio_drv_probe $drv esd.h -lesd 'return esd_play_stream(0, 0, "", 0);'
     libs_softmmu="-lesd $libs_softmmu"
+    audio_pt_int="yes"
     ;;
 
     pa)
     audio_drv_probe $drv pulse/simple.h -lpulse-simple \
         "pa_simple *s = NULL; pa_simple_free(s); return 0;"
     libs_softmmu="-lpulse-simple $libs_softmmu"
+    audio_pt_int="yes"
     ;;
 
     coreaudio)
@@ -1622,6 +1625,9 @@ for drv in $audio_drv_list; do
         echo "FMOD_CFLAGS=-I$fmod_inc" >> $config_host_mak
     fi
 done
+if test "$audio_pt_int" = "yes" ; then
+  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
+fi
 if test "$mixemu" = "yes" ; then
   echo "CONFIG_MIXEMU=y" >> $config_host_mak
 fi
Signature · 1 line
1.6.2.5
#69 lore raw

PATCH v2 69/81 CONFIG_POSIX makes more sense that not CONFIG_WIN32

In reply to Juan Quintela
---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +1 -1
index 09d9ed0..ed21e4c 100644
@@ -217,7 +217,7 @@ endif
 install-doc: $(DOCS)
 	$(INSTALL_DIR) "$(DESTDIR)$(docdir)"
 	$(INSTALL_DATA) qemu-doc.html  qemu-tech.html "$(DESTDIR)$(docdir)"
-ifndef CONFIG_WIN32
+ifdef CONFIG_POSIX
 	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
 	$(INSTALL_DATA) qemu.1 qemu-img.1 "$(DESTDIR)$(mandir)/man1"
 	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
Signature · 1 line
1.6.2.5
#70 lore raw

PATCH v2 70/81 remove last 3 uses of :=, everywhere else uses += or =

In reply to Juan Quintela
---
 Makefile.target |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Makefile.target +3 -3
index a4d269d..6b3d40f 100644
@@ -20,7 +20,7 @@ endif
 PROGS=$(QEMU_PROG)
 
 ifeq ($(subst ppc64,ppc,$(ARCH))$(TARGET_BASE_ARCH),ppcppc)
-translate.o: QEMU_CFLAGS := $(QEMU_CFLAGS) $(call cc-option, $(QEMU_CFLAGS), -fno-unit-at-a-time,)
+translate.o: QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-unit-at-a-time,)
 endif
 
 LIBS+=-lm
@@ -107,7 +107,7 @@ ifeq ($(TARGET_ARCH), i386)
 obj-y += vm86.o
 endif
 
-nwfpe-obj-y := fpa11.o fpa11_cpdo.o fpa11_cpdt.o fpa11_cprt.o fpopcode.o
+nwfpe-obj-y = fpa11.o fpa11_cpdo.o fpa11_cpdt.o fpa11_cprt.o fpopcode.o
 nwfpe-obj-y += single_cpdo.o double_cpdo.o extended_cpdo.o
 obj-arm-y +=  $(addprefix nwfpe/, $(nwfpe-obj-y))
 obj-arm-y += arm-semi.o
@@ -174,7 +174,7 @@ sound-obj-$(CONFIG_ADLIB) += fmopl.o adlib.o
 sound-obj-$(CONFIG_GUS) += gus.o gusemu_hal.o gusemu_mixer.o
 sound-obj-$(CONFIG_CS4231A) += cs4231a.o
 
-adlib.o fmopl.o: QEMU_CFLAGS := ${QEMU_CFLAGS} -DBUILD_Y8950=0
+adlib.o fmopl.o: QEMU_CFLAGS += -DBUILD_Y8950=0
 
 QEMU_CFLAGS += $(VNC_TLS_CFLAGS)
 QEMU_CFLAGS += $(VNC_SASL_CFLAGS)
Signature · 1 line
1.6.2.5
#75 lore raw

PATCH v2 71/81 Consolidate audio flags in configure

In reply to Juan Quintela
---
 Makefile.target |   17 -----------------
 configure       |   11 +++++++++++
 2 files changed, 11 insertions(+), 17 deletions(-)
Makefile.target +0 -17
index 6b3d40f..22d1d53 100644
@@ -202,10 +202,6 @@ obj-i386-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
 obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
 obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o
 
-ifeq ($(TARGET_BASE_ARCH), i386)
-QEMU_CFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
-endif
-
 # shared objects
 obj-ppc-y = ppc.o ide.o vga.o $(sound-obj-y) dma.o openpic.o
 # PREP target
@@ -223,11 +219,6 @@ obj-ppc-y += ppc440.o ppc440_bamboo.o
 # PowerPC E500 boards
 obj-ppc-y += ppce500_pci.o ppce500_mpc8544ds.o
 obj-ppc-$(CONFIG_KVM) += kvm_ppc.o
-
-ifeq ($(TARGET_BASE_ARCH), ppc)
-QEMU_CFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
-endif
-
 obj-ppc-$(CONFIG_FDT) += device_tree.o
 
 obj-mips-y = mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
@@ -239,10 +230,6 @@ obj-mips-y += mipsnet.o
 obj-mips-y += pflash_cfi01.o
 obj-mips-y += vmware_vga.o
 
-ifeq ($(TARGET_BASE_ARCH), mips)
-QEMU_CFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
-endif
-
 obj-microblaze-y = petalogix_s3adsp1800_mmu.o
 
 obj-microblaze-y += microblaze_pic_cpu.o
@@ -299,10 +286,6 @@ obj-arm-y += syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
 obj-arm-y += syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
 obj-arm-y += syborg_virtio.o
 
-ifeq ($(TARGET_BASE_ARCH), arm)
-QEMU_CFLAGS += -DHAS_AUDIO
-endif
-
 obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
 obj-sh4-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o serial.o
 obj-sh4-y += ide.o
configure +11 -0
index 9bc2303..ccf0fa2 100755
@@ -2134,6 +2134,17 @@ ia64)
 ;;
 esac
 
+if test "$target_softmmu" = "yes" ; then
+  case "$TARGET_BASE_ARCH" in
+  arm)
+    cflags="-DHAS_AUDIO $cflags"
+  ;;
+  i386|mips|ppc)
+    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
+  ;;
+  esac
+fi
+
 if test "$target_softmmu" = "yes" -a \( \
         "$TARGET_ARCH" = "microblaze" -o \
         "$TARGET_ARCH" = "cris" \) ; then
Signature · 1 line
1.6.2.5
#76 lore raw

PATCH v2 72/81 We also need TARGET_<arechname> in Makefiles

In reply to Juan Quintela
---
 configure     |    2 ++
 create_config |    2 --
 2 files changed, 2 insertions(+), 2 deletions(-)
configure +2 -0
index ccf0fa2..5cd3b85 100755
@@ -1980,6 +1980,8 @@ case "$target_arch2" in
   ;;
 esac
 echo "TARGET_ARCH=$TARGET_ARCH" >> $config_mak
+target_arch_name="`echo $TARGET_ARCH | tr '[:lower:]' '[:upper:]'`"
+echo "TARGET_$target_arch_name=y" >> $config_mak
 echo "TARGET_ARCH2=$target_arch2" >> $config_mak
 # TARGET_BASE_ARCH needs to be defined after TARGET_ARCH
 if [ "$TARGET_BASE_ARCH" = "" ]; then
create_config +0 -2
index 9dcbc5f..5bc8fb6 100755
@@ -55,9 +55,7 @@ case $line in
     ;;
  TARGET_ARCH=*) # configuration
     target_arch=${line#*=}
-    arch_name=`echo $target_arch | tr '[:lower:]' '[:upper:]'`
     echo "#define TARGET_ARCH \"$target_arch\""
-    echo "#define TARGET_$arch_name 1"
     ;;
  TARGET_BASE_ARCH=*) # configuration
     target_base_arch=${line#*=}
Signature · 1 line
1.6.2.5
#77 lore raw

PATCH v2 73/81 use TARGET_<arch name> for selection

In reply to Juan Quintela
---
 Makefile.target |   14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)
Makefile.target +3 -11
index 22d1d53..2e49e73 100644
@@ -47,14 +47,8 @@ libobj-$(CONFIG_SOFTFLOAT) += fpu/softfloat.o
 libobj-$(CONFIG_NOSOFTFLOAT) += fpu/softfloat-native.o
 libobj-y += op_helper.o helper.o
 libobj-$(CONFIG_NEED_MMU) += mmu.o
-
-ifeq ($(TARGET_BASE_ARCH), arm)
-libobj-y += neon_helper.o iwmmxt_helper.o
-endif
-
-ifeq ($(TARGET_BASE_ARCH), alpha)
-libobj-y += alpha_palcode.o
-endif
+libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o
+libobj-$(TARGET_ALPHA) += alpha_palcode.o
 
 # NOTE: the disassembler code is only needed for debugging
 libobj-y += disas.o
@@ -103,9 +97,7 @@ obj-y = main.o syscall.o strace.o mmap.o signal.o path.o thunk.o \
 obj-$(TARGET_HAS_BFLT) += flatload.o
 obj-$(TARGET_HAS_ELFLOAD32) += elfload32.o
 
-ifeq ($(TARGET_ARCH), i386)
-obj-y += vm86.o
-endif
+obj-$(TARGET_I386) += vm86.o
 
 nwfpe-obj-y = fpa11.o fpa11_cpdo.o fpa11_cpdt.o fpa11_cprt.o fpopcode.o
 nwfpe-obj-y += single_cpdo.o double_cpdo.o extended_cpdo.o
Signature · 1 line
1.6.2.5
#78 lore raw

PATCH v2 74/81 Disable aio in mingw32

In reply to Juan Quintela
---
 configure |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
configure +1 -0
index 5cd3b85..e77a7e9 100755
@@ -359,6 +359,7 @@ if test "$mingw32" = "yes" ; then
   EXESUF=".exe"
   QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
   LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
+  aio=no
 fi
 
 # find source path
Signature · 1 line
1.6.2.5
#80 lore raw

PATCH v2 76/81 VDE libs are used both by tools and softmmu

In reply to Juan Quintela
---
 Makefile        |    2 --
 Makefile.target |    2 +-
 configure       |    3 ++-
 3 files changed, 3 insertions(+), 4 deletions(-)
Makefile +0 -2
index d466c38..7fe36c4 100644
@@ -124,8 +124,6 @@ slirp-obj-y += slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o
 slirp-obj-y += tcp_subr.o tcp_timer.o udp.o bootp.o tftp.o
 obj-$(CONFIG_SLIRP) += $(addprefix slirp/, $(slirp-obj-y))
 
-LIBS+=$(VDE_LIBS)
-
 # xen backend driver support
 obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o
 obj-$(CONFIG_XEN) += xen_console.o xenfb.o xen_disk.o xen_nic.o
Makefile.target +1 -1
index 2e49e73..01275f8 100644
@@ -300,7 +300,7 @@ vl.o: qemu-options.h
 
 monitor.o: qemu-monitor.h
 
-LIBS += $(COCOA_LIBS) $(VDE_LIBS) $(CURL_LIBS)
+LIBS += $(COCOA_LIBS) $(CURL_LIBS)
 ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
 
 endif # CONFIG_SOFTMMU
configure +2 -1
index 1a91c86..1da827b 100755
@@ -962,6 +962,8 @@ int main(void)
 EOF
   if compile_prog "" "$vde_libs" ; then
     vde=yes
+    libs_softmmu="$vde_libs $libs_softmmu"
+    libs_tools="$vde_libs $libs_tools"
   fi
 fi
 
@@ -1613,7 +1615,6 @@ if test "$slirp" = "yes" ; then
 fi
 if test "$vde" = "yes" ; then
   echo "CONFIG_VDE=y" >> $config_host_mak
-  echo "VDE_LIBS=$vde_libs" >> $config_host_mak
 fi
 for card in $audio_card_list; do
     def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
Signature · 1 line
1.6.2.5
#79 lore raw

PATCH v2 75/81 Add libs_tools support

In reply to Juan Quintela

Libraries used by qemu-<tools>

---
 Makefile  |    2 +-
 configure |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)
Makefile +1 -1
index ed21e4c..d466c38 100644
@@ -16,7 +16,7 @@ endif
 
 VPATH=$(SRC_PATH):$(SRC_PATH)/hw
 
-LIBS+=-lz
+LIBS+=-lz $(LIBS_TOOLS)
 
 ifdef BUILD_DOCS
 DOCS=qemu-doc.html qemu-tech.html qemu.1 qemu-img.1 qemu-nbd.8
configure +2 -0
index e77a7e9..1a91c86 100755
@@ -46,6 +46,7 @@ objcopy="objcopy"
 ld="ld"
 helper_cflags=""
 libs_softmmu=""
+libs_tools=""
 audio_pt_int=""
 
 # parse CC options first
@@ -1783,6 +1784,7 @@ echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
 echo "ARLIBS_BEGIN=$arlibs_begin" >> $config_host_mak
 echo "ARLIBS_END=$arlibs_end" >> $config_host_mak
 echo "LIBS+=$LIBS" >> $config_host_mak
+echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
 echo "EXESUF=$EXESUF" >> $config_host_mak
 
 echo "/* Automatically generated by configure - do not modify */" > $config_host_h
Signature · 1 line
1.6.2.5
#81 lore raw

PATCH v2 77/81 CURL libs are used both by tools and softmmu

In reply to Juan Quintela
---
 Makefile        |    1 -
 Makefile.target |    2 +-
 configure       |    3 ++-
 3 files changed, 3 insertions(+), 3 deletions(-)
Makefile +0 -1
index 7fe36c4..7742461 100644
@@ -129,7 +129,6 @@ obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o
 obj-$(CONFIG_XEN) += xen_console.o xenfb.o xen_disk.o xen_nic.o
 
 QEMU_CFLAGS+=$(CURL_CFLAGS)
-LIBS+=$(CURL_LIBS)
 
 cocoa.o: cocoa.m
 
Makefile.target +1 -1
index 01275f8..01fc052 100644
@@ -300,7 +300,7 @@ vl.o: qemu-options.h
 
 monitor.o: qemu-monitor.h
 
-LIBS += $(COCOA_LIBS) $(CURL_LIBS)
+LIBS += $(COCOA_LIBS)
 ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
 
 endif # CONFIG_SOFTMMU
configure +2 -1
index 1da827b..046531a 100755
@@ -1103,6 +1103,8 @@ EOF
   curl_libs=`curl-config --libs 2>/dev/null`
   if compile_prog "$curl_cflags" "$curl_libs" ; then
     curl=yes
+    libs_tools="$curl_libs $libs_tools"
+    libs_softmmu="$curl_libs $libs_softmmu"
   fi
 fi # test "$curl"
 
@@ -1690,7 +1692,6 @@ fi
 if test "$curl" = "yes" ; then
   echo "CONFIG_CURL=y" >> $config_host_mak
   echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
-  echo "CURL_LIBS=$curl_libs" >> $config_host_mak
 fi
 if test "$brlapi" = "yes" ; then
   echo "CONFIG_BRLAPI=y" >> $config_host_mak
Signature · 1 line
1.6.2.5
#82 lore raw

PATCH v2 78/81 Add cocoa libs at Darwin selection time

In reply to Juan Quintela
---
 Makefile.target |    5 -----
 configure       |    1 +
 2 files changed, 1 insertions(+), 5 deletions(-)
Makefile.target +0 -5
index 01fc052..8ae889e 100644
@@ -285,10 +285,6 @@ obj-sh4-y += ide.o
 obj-m68k-y = an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
 obj-m68k-y += m68k-semi.o dummy_m68k.o
 
-ifdef CONFIG_COCOA
-COCOA_LIBS=-F/System/Library/Frameworks -framework Cocoa -framework IOKit
-endif
-
 # profiling code
 ifdef TARGET_GPROF
 main.o vl.o: QEMU_CFLAGS+=-p
@@ -300,7 +296,6 @@ vl.o: qemu-options.h
 
 monitor.o: qemu-monitor.h
 
-LIBS += $(COCOA_LIBS)
 ARLIBS=../libqemu_common.a libqemu.a $(HWLIB)
 
 endif # CONFIG_SOFTMMU
configure +1 -0
index 046531a..6ea79f8 100755
@@ -291,6 +291,7 @@ Darwin)
   audio_drv_list="coreaudio"
   audio_possible_drivers="coreaudio sdl fmod"
   LDFLAGS="-framework CoreFoundation -framework IOKit $LDFLAGS"
+  libs_softmmu="-F/System/Library/Frameworks -framework Cocoa -framework IOKit $libs_softmmu"
 ;;
 SunOS)
   solaris="yes"
Signature · 1 line
1.6.2.5
#83 lore raw

PATCH v2 79/81 convert gprof flags to style of rest of Makefile

In reply to Juan Quintela
---
 Makefile.target |    5 +----
 configure       |    1 +
 2 files changed, 2 insertions(+), 4 deletions(-)
Makefile.target +1 -4
index 8ae889e..79fc5a7 100644
@@ -285,10 +285,7 @@ obj-sh4-y += ide.o
 obj-m68k-y = an5206.o mcf5206.o mcf_uart.o mcf_intc.o mcf5208.o mcf_fec.o
 obj-m68k-y += m68k-semi.o dummy_m68k.o
 
-# profiling code
-ifdef TARGET_GPROF
-main.o vl.o: QEMU_CFLAGS+=-p
-endif
+main.o vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS)
 
 vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS)
 
configure +1 -0
index 6ea79f8..d325c25 100755
@@ -2167,6 +2167,7 @@ if test "$gprof" = "yes" ; then
   fi
   if test "$target_softmmu" = "yes" ; then
     ldflags="-p $ldflags"
+    echo "GPROF_CFLAGS=-p" >> $config_mak
   fi
 fi
 
Signature · 1 line
1.6.2.5
#84 lore raw

PATCH v2 80/81 Move libsunpath to use the same style than everything else

In reply to Juan Quintela
---
 Makefile.target |    7 -------
 configure       |    3 +++
 2 files changed, 3 insertions(+), 7 deletions(-)
Makefile.target +0 -7
index 79fc5a7..485a8c8 100644
@@ -24,13 +24,6 @@ translate.o: QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-unit-at-a-tim
 endif
 
 LIBS+=-lm
-ifdef CONFIG_SOLARIS
-ifdef CONFIG_NEEDS_LIBSUNMATH
-LIBS+=-lsunmath
-LDFLAGS+=-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib
-QEMU_CFLAGS+=-I/opt/SUNWspro/prod/include/cc
-endif
-endif
 
 kvm.o kvm-all.o: QEMU_CFLAGS+=$(KVM_CFLAGS)
 
configure +3 -0
index d325c25..80e2838 100755
@@ -309,6 +309,9 @@ SunOS)
     if test "$solarisrev" -le 9 ; then
       if test -f /opt/SUNWspro/prod/lib/libsunmath.so.1; then
         needs_libsunmath="yes"
+        QEMU_CFLAGS="-I/opt/SUNWspro/prod/include/cc $QEMU_CFLAGS"
+        LDFLAGS="-L/opt/SUNWspro/prod/lib -R/opt/SUNWspro/prod/lib $LDFLAGS"
+        LIBS="-lsunmath $LIBS"
       else
         echo "QEMU will not link correctly on Solaris 8/X86 or 9/x86 without"
         echo "libsunmath from the Sun Studio compilers tools, due to a lack of"
Signature · 1 line
1.6.2.5
#85 lore raw

PATCH v2 81/81 rename aio/CONFIG_AIO to posix_aio/CONFIG_POSIX_AIO

In reply to Juan Quintela
---
 Makefile          |    2 +-
 block/raw-posix.c |   26 +++++++++++++-------------
 configure         |   18 +++++++++---------
 3 files changed, 23 insertions(+), 23 deletions(-)
Makefile +1 -1
index 7742461..47599e7 100644
@@ -55,7 +55,7 @@ recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
 
 block-obj-y = cutils.o cache-utils.o qemu-malloc.o qemu-option.o module.o
 block-obj-y += nbd.o block.o aio.o aes.o
-block-obj-$(CONFIG_AIO) += posix-aio-compat.o
+block-obj-$(CONFIG_POSIX_AIO) += posix-aio-compat.o
 
 block-nested-y += cow.o qcow.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o
 block-nested-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o
block/raw-posix.c +13 -13
index bdee07f..7f4c562 100644
@@ -27,7 +27,7 @@
 #include "qemu-log.h"
 #include "block_int.h"
 #include "module.h"
-#ifdef CONFIG_AIO
+#ifdef CONFIG_POSIX_AIO
 #include "posix-aio-compat.h"
 #endif
 
@@ -489,7 +489,7 @@ static int raw_write(BlockDriverState *bs, int64_t sector_num,
     return ret;
 }
 
-#ifdef CONFIG_AIO
+#ifdef CONFIG_POSIX_AIO
 /***********************************************************/
 /* Unix AIO using POSIX AIO */
 
@@ -725,12 +725,12 @@ static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs,
     }
     return &acb->common;
 }
-#else /* CONFIG_AIO */
+#else /* CONFIG_POSIX_AIO */
 static int posix_aio_init(void)
 {
     return 0;
 }
-#endif /* CONFIG_AIO */
+#endif /* CONFIG_POSIX_AIO */
 
 
 static void raw_close(BlockDriverState *bs)
@@ -906,7 +906,7 @@ static BlockDriver bdrv_raw = {
     .bdrv_create = raw_create,
     .bdrv_flush = raw_flush,
 
-#ifdef CONFIG_AIO
+#ifdef CONFIG_POSIX_AIO
     .bdrv_aio_readv = raw_aio_readv,
     .bdrv_aio_writev = raw_aio_writev,
 #endif
@@ -1026,7 +1026,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
 #endif
 
     s->type = FTYPE_FILE;
-#if defined(__linux__) && defined(CONFIG_AIO)
+#if defined(__linux__) && defined(CONFIG_POSIX_AIO)
     if (strstart(filename, "/dev/sg", NULL)) {
         bs->sg = 1;
     }
@@ -1092,7 +1092,7 @@ static int hdev_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
     return ioctl(s->fd, req, buf);
 }
 
-#ifdef CONFIG_AIO
+#ifdef CONFIG_POSIX_AIO
 static BlockDriverAIOCB *hdev_aio_ioctl(BlockDriverState *bs,
         unsigned long int req, void *buf,
         BlockDriverCompletionFunc *cb, void *opaque)
@@ -1183,7 +1183,7 @@ static BlockDriver bdrv_host_device = {
     .bdrv_create        = hdev_create,
     .bdrv_flush		= raw_flush,
 
-#ifdef CONFIG_AIO
+#ifdef CONFIG_POSIX_AIO
     .bdrv_aio_readv	= raw_aio_readv,
     .bdrv_aio_writev	= raw_aio_writev,
 #endif
@@ -1195,7 +1195,7 @@ static BlockDriver bdrv_host_device = {
     /* generic scsi device */
 #ifdef __linux__
     .bdrv_ioctl         = hdev_ioctl,
-#ifdef CONFIG_AIO
+#ifdef CONFIG_POSIX_AIO
     .bdrv_aio_ioctl     = hdev_aio_ioctl,
 #endif
 #endif
@@ -1283,7 +1283,7 @@ static BlockDriver bdrv_host_floppy = {
     .bdrv_create        = hdev_create,
     .bdrv_flush         = raw_flush,
 
-#ifdef CONFIG_AIO
+#ifdef CONFIG_POSIX_AIO
     .bdrv_aio_readv     = raw_aio_readv,
     .bdrv_aio_writev    = raw_aio_writev,
 #endif
@@ -1365,7 +1365,7 @@ static BlockDriver bdrv_host_cdrom = {
     .bdrv_create        = hdev_create,
     .bdrv_flush         = raw_flush,
 
-#ifdef CONFIG_AIO
+#ifdef CONFIG_POSIX_AIO
     .bdrv_aio_readv     = raw_aio_readv,
     .bdrv_aio_writev    = raw_aio_writev,
 #endif
@@ -1381,7 +1381,7 @@ static BlockDriver bdrv_host_cdrom = {
 
     /* generic scsi device */
     .bdrv_ioctl         = hdev_ioctl,
-#ifdef CONFIG_AIO
+#ifdef CONFIG_POSIX_AIO
     .bdrv_aio_ioctl     = hdev_aio_ioctl,
 #endif
 };
@@ -1488,7 +1488,7 @@ static BlockDriver bdrv_host_cdrom = {
     .bdrv_create        = hdev_create,
     .bdrv_flush         = raw_flush,
 
-#ifdef CONFIG_AIO
+#ifdef CONFIG_POSIX_AIO
     .bdrv_aio_readv     = raw_aio_readv,
     .bdrv_aio_writev    = raw_aio_writev,
 #endif
configure +9 -9
index 80e2838..2f6310a 100755
@@ -198,7 +198,7 @@ uname_release=""
 curses="yes"
 curl="yes"
 pthread="yes"
-aio="yes"
+posix_aio="yes"
 io_thread="no"
 nptl="yes"
 mixemu="no"
@@ -257,7 +257,7 @@ DragonFly)
   if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
     kqemu="yes"
   fi
-  aio="no"
+  posix_aio="no"
 ;;
 NetBSD)
   bsd="yes"
@@ -364,7 +364,7 @@ if test "$mingw32" = "yes" ; then
   EXESUF=".exe"
   QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
   LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
-  aio=no
+  posix_aio=no
 fi
 
 # find source path
@@ -505,7 +505,7 @@ for opt do
   ;;
   --disable-pthread) pthread="no"
   ;;
-  --disable-aio) aio="no"
+  --disable-aio) posix_aio="no"
   ;;
   --enable-io-thread) io_thread="yes"
   ;;
@@ -645,7 +645,7 @@ echo "  --enable-uname-release=R Return R for uname -r in usermode emulation"
 echo "  --sparc_cpu=V            Build qemu for Sparc architecture v7, v8, v8plus, v8plusa, v9"
 echo "  --disable-vde            disable support for vde network"
 echo "  --disable-pthread        disable pthread support"
-echo "  --disable-aio            disable AIO support"
+echo "  --disable-aio            disable POSIX AIO support"
 echo "  --enable-io-thread       enable IO thread"
 echo "  --disable-blobs          disable installing provided firmware blobs"
 echo "  --kerneldir=PATH         look for kernel includes in PATH"
@@ -1201,7 +1201,7 @@ EOF
 fi
 
 if test "$pthread" = no; then
-   aio=no
+   posix_aio=no
    io_thread=no
 fi
 
@@ -1535,7 +1535,7 @@ echo "uname -r          $uname_release"
 echo "NPTL support      $nptl"
 echo "GUEST_BASE        $guest_base"
 echo "vde support       $vde"
-echo "AIO support       $aio"
+echo "POSIX AIO support $posix_aio"
 echo "IO thread         $io_thread"
 echo "Install blobs     $blobs"
 echo -e "KVM support       $kvm"
@@ -1707,8 +1707,8 @@ fi
 if test "$xen" = "yes" ; then
   echo "CONFIG_XEN=y" >> $config_host_mak
 fi
-if test "$aio" = "yes" ; then
-  echo "CONFIG_AIO=y" >> $config_host_mak
+if test "$posix_aio" = "yes" ; then
+  echo "CONFIG_POSIX_AIO=y" >> $config_host_mak
 fi
 if test "$io_thread" = "yes" ; then
   echo "CONFIG_IOTHREAD=y" >> $config_host_mak
Signature · 1 line
1.6.2.5
#86 lore raw

Re: [Qemu-devel] [PATCH 81/81] rename aio/CONFIG_AIO to posix_aio/CONFIG_POSIX_AIO

Quoted 2 lines · Juan Quintela

It's not actually posix-aio, but...

We should just get rid of CONFIG_AIO altogether. We should always enable it.

Regards,

Anthony Liguori

#87 lore raw

Re: [Qemu-devel] [PATCH 81/81] rename aio/CONFIG_AIO to posix_aio/CONFIG_POSIX_AIO

Quoted 8 lines · Anthony Liguori
Quoted 2 lines · Juan Quintela

It's not actually posix-aio, but...

We should just get rid of CONFIG_AIO altogether. We should always enable it.

Yes. I have a patch for it, but the second patch ontop that removes the non-aio raw-posix code still has an issue. I can send the CONFIG_AIO removal patch alone in a few minutes if you care.

#88 lore raw

Re: [Qemu-devel] [PATCH 81/81] rename aio/CONFIG_AIO to posix_aio/CONFIG_POSIX_AIO

Quoted 7 lines · Christoph Hellwig
Quoted 5 lines · Anthony Liguori
Quoted 3 lines · Juan Quintela
Quoted 9 lines
Quoted 4 lines

It's not actually posix-aio, but...

We should just get rid of CONFIG_AIO altogether. We should always enable it.

Yes. I have a patch for it, but the second patch ontop that removes the non-aio raw-posix code still has an issue. I can send the CONFIG_AIO removal patch alone in a few minutes if you care.

I'm about to push Juan's latest refactoring so you should probably wait a few hours as you'll have to rebase.

Signature · 3 lines
Regards,

Anthony Liguori
#89 lore raw

Re: [Qemu-devel] [PATCH 81/81] rename aio/CONFIG_AIO to posix_aio/CONFIG_POSIX_AIO

Quoted 2 lines · Anthony Liguori

I'm about to push Juan's latest refactoring so you should probably wait a few hours as you'll have to rebase.

Sounds like a plan, I'll send it as soon as I have the rest of the series to rebase against.

#90 lore raw

[Qemu-devel] Re: [PATCH 81/81] rename aio/CONFIG_AIO to posix_aio/CONFIG_POSIX_AIO

In reply to Anthony Liguori
Quoted 8 lines · Anthony Liguori
Quoted 2 lines · Juan Quintela

It's not actually posix-aio, but...

We should just get rid of CONFIG_AIO altogether. We should always enable it.

Ok, about it. Win people complained that what qemu was missing was windows aio, not that window's don't have aio. if it is going altogether, the better :)

Later, Juan.

Quoted 3 lines

Regards,

Anthony Liguori

#71 lore raw

Re: [Qemu-devel] [PATCH 70/81] remove last 3 uses of :=, everywhere else uses += or =

In reply to Juan Quintela
Quoted 18 lines · Juan Quintela

---
 Makefile.target |    6 +++---

 1 files changed, 3 insertions(+), 3 deletions(-)
Makefile.target +1 -1
index a4d269d..6b3d40f 100644
@@ -20,7 +20,7 @@ endif
  PROGS=$(QEMU_PROG)
 
  ifeq ($(subst ppc64,ppc,$(ARCH))$(TARGET_BASE_ARCH),ppcppc)
-translate.o: QEMU_CFLAGS := $(QEMU_CFLAGS) $(call cc-option, $(QEMU_CFLAGS), -fno-unit-at-a-time,)
+translate.o: QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-unit-at-a-time,)

 endif

Quoted 1 line

 LIBS+=-lm

This change breaks the build with PPC host and PPC target:
Makefile:25: *** Recursive variable `QEMU_CFLAGS' references itself (eventually). Stop.

I don't know why you want to remove all :=, but it seems like this hunk should be reverted.

-Hollis

#72 lore raw

[Qemu-devel] Re: [PATCH 70/81] remove last 3 uses of :=, everywhere else uses += or =

Quoted 19 lines · Hollis Blanchard
Quoted 18 lines · Juan Quintela

---
 Makefile.target |    6 +++---

 1 files changed, 3 insertions(+), 3 deletions(-)
Makefile.target +1 -1
index a4d269d..6b3d40f 100644
@@ -20,7 +20,7 @@ endif
  PROGS=$(QEMU_PROG)
 
  ifeq ($(subst ppc64,ppc,$(ARCH))$(TARGET_BASE_ARCH),ppcppc)
-translate.o: QEMU_CFLAGS := $(QEMU_CFLAGS) $(call cc-option, $(QEMU_CFLAGS), -fno-unit-at-a-time,)
+translate.o: QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-unit-at-a-time,)

 endif

Quoted 8 lines
Quoted 1 line

 LIBS+=-lm

This change breaks the build with PPC host and PPC target:
Makefile:25: *** Recursive variable `QEMU_CFLAGS' references itself (eventually). Stop.

I don't know why you want to remove all :=, but it seems like this hunk should be reverted.

Could you check two things:

a- remove the whole block, it should not be needed anymore (or that I
have been told)
b- if a) don't work, tryng to change the interior bit to

translate.o: QEMU_CFLAGS += $(call cc-option, $(CFLAGS),-fno-unit-at-a-time,)

And if so, we can do this change. What we pass as 2nd argument shouldn't matter for this test.

call cc-option is complicated to get right, sorry :(

Later, Juan.

#73 lore raw

Re: [Qemu-devel] Re: [PATCH 70/81] remove last 3 uses of :=, everywhere else uses += or =

Quoted 26 lines · Juan Quintela
Quoted 25 lines · Hollis Blanchard
Quoted 18 lines · Juan Quintela

---
 Makefile.target |    6 +++---

 1 files changed, 3 insertions(+), 3 deletions(-)
Makefile.target +1 -1
index a4d269d..6b3d40f 100644
@@ -20,7 +20,7 @@ endif
  PROGS=$(QEMU_PROG)
 
  ifeq ($(subst ppc64,ppc,$(ARCH))$(TARGET_BASE_ARCH),ppcppc)
-translate.o: QEMU_CFLAGS := $(QEMU_CFLAGS) $(call cc-option, $(QEMU_CFLAGS), -fno-unit-at-a-time,)
+translate.o: QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-unit-at-a-time,)

 endif

Quoted 1 line

 LIBS+=-lm

This change breaks the build with PPC host and PPC target:
Makefile:25: *** Recursive variable `QEMU_CFLAGS' references itself (eventually).  Stop.

Quoted 7 lines
Quoted 2 lines

I don't know why you want to remove all :=, but it seems like this hunk should be reverted.

Could you check two things:

a- remove the whole block, it should not be needed anymore (or that I have been told)

The original commit, from malc, says it's necessary to work around a gcc 4.3.0 bug. If that's true, it's probably not a great idea to remove it.

Quoted 8 lines

b- if a) don't work, tryng to change the interior bit to

translate.o: QEMU_CFLAGS += $(call cc-option, $(CFLAGS),-fno-unit-at-a-time,)

And if so, we can do this change.  What we pass as 2nd argument shouldn't matter for this test.

call cc-option is complicated to get right, sorry :(

If it doesn't matter, better not to pass anything, rather than confuse the reader into thinking it does matter. This seems to work:
translate.o: QEMU_CFLAGS += $(call cc-option, , -fno-unit-at-a-time,)

But strangely, this doesn't:
translate.o: QEMU_CFLAGS += $(call cc-option, "", -fno-unit-at-a-time,)

However, what if the second argument did matter? I don't understand the problem with the original syntax.

Debugging makefiles sucks.

-Hollis

#74 lore raw

[Qemu-devel] Re: [PATCH 70/81] remove last 3 uses of :=, everywhere else uses += or =

Quoted 5 lines · Hollis Blanchard
Quoted 4 lines · Juan Quintela
Quoted 1 line · Hollis Blanchard

On Mon, Aug 3, 2009 at 5:47 AM, Juan Quintela<[email protected]> wrote:

Could you check two things:

Quoted 8 lines
Quoted 2 lines

a- remove the whole block, it should not be needed anymore (or that I have been told)

The original commit, from malc, says it's necessary to work around a gcc 4.3.0 bug. If that's true, it's probably not a great idea to remove it.

From malc:

-fno-unit-at-a-time (-fno-toplevel-reorder which -fno-unit-at-a-time
implies actually) is no longer needed after BlueSwirls work on PPC's translate.

it appears that they changed the file that was misscompiled (I don't have more information).

I was waiting for someone with ppc access to test its removal (only ifeq remaining on Makefile.target that depends of architecture, all other are gone (but I was not able to test this one, hint, hint, :)

Quoted 7 lines
Quoted 7 lines

b- if a) don't work, tryng to change the interior bit to

translate.o: QEMU_CFLAGS += $(call cc-option, $(CFLAGS),-fno-unit-at-a-time,)

And if so, we can do this change.  What we pass as 2nd argument shouldn't matter for this test.

Quoted 8 lines
Quoted 1 line

call cc-option is complicated to get right, sorry :(

If it doesn't matter, better not to pass anything, rather than confuse the reader into thinking it does matter. This seems to work:
translate.o: QEMU_CFLAGS += $(call cc-option, , -fno-unit-at-a-time,)

But strangely, this doesn't:
translate.o: QEMU_CFLAGS += $(call cc-option, "", -fno-unit-at-a-time,)

I told you that call cc-option was bad :)

Look at its definition:

# cc-option
# Usage: CFLAGS+=$(call cc-option, $(CFLAGS), -falign-functions=0, -malign-functions=0)
cc-option = $(shell if $(CC) $(1) $(2) -S -o /dev/null -xc /dev/null \
              > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi
              ;)

it appears that gcc don't like an empty argument in the middle :p Actually, I think that example and macro is just wrong. 2nd argument shouldn't exist at all. We are testing if compiler accept some option, shouldn't be needed any $CFLAGS at all.

But I didn't want to change so many things.

Quoted 2 lines

However, what if the second argument did matter? I don't understand the problem with the original syntax.

There were (at least) 3 different styles on Makefiles, now there is only one.
We had +=, := and I think some other funny variants. Now we only have +=

Later, Juan.