Skip to contentSkip to conversation

More Makefile/configure simplification

PATCH Superseded Juan Quintela 5 participants 54 messages Jul 30, 2009 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover More Makefile/configure simplification

Hi

More cleanps coming:
- 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

ToDo:
- End LIBS movement to ./configure
Question: We want to separate user-only and softmmu. We agreed here. But, do we want to separate softmmu and qemu-io/nbd/... LIBS?
- Makefile.target still needs more intelligence moved to ./configure
- Once previous two items are finished, start being able to comile/not compile drivers.

Call for testers: if you use qemu on darwin/sparc solaris, it is a good idea that you test that I haven't break anything. If you are interested in testing/compiling prereleases, please email me.

Later, Juan.

Juan Quintela (42):
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 CFLAGS
split CFLAGS very long line
move common 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

 Makefile                   |   23 +--
 Makefile.hw                |    4 +-
 Makefile.target            |  110 ++------
 configure                  |  687 ++++++++++++++++++++++----------------------
 create_config              |    6 -
 pc-bios/optionrom/Makefile |    6 +-
 rules.mak                  |    6 +-
 7 files changed, 378 insertions(+), 464 deletions(-)
#1 lore raw

PATCH 1/42 strip binary is not used anywhere

---
 configure |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
configure +0 -2
index 8160bed..c4139c7 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 2/42 oss variable don't exist anymore

In reply to Juan Quintela
---
 configure |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
configure +0 -1
index c4139c7..55eb001 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 3/42 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 55eb001..a1305f7 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 4/42 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 a1305f7..1538563 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 5/42 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 1538563..47e846b 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
#6 lore raw

PATCH 6/42 remove not needed rt variable

In reply to Juan Quintela
---
 configure |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
configure +1 -7
index 47e846b..f152d46 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
#7 lore raw

PATCH 7/42 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 f152d46..cee9103 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
#9 lore raw

PATCH 9/42 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 996f970..baa41f4 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
#8 lore raw

PATCH 8/42 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 cee9103..996f970 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
#10 lore raw

PATCH 10/42 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 baa41f4..f014f07 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 11/42 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 f014f07..5b1caea 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
#13 lore raw

PATCH 13/42 remove unused temporal files

In reply to Juan Quintela
---
 configure |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
configure +1 -4
index d1d9432..697f767 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 14/42 Add CURL_CFLAGS

In reply to Juan Quintela
---
 Makefile  |    1 +
 configure |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)
Makefile +1 -0
index c510ff3..ca569b0 100644
@@ -160,6 +160,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 697f767..d43bbc6 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
#12 lore raw

PATCH 12/42 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 5b1caea..d1d9432 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
#15 lore raw

PATCH 15/42 __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 d43bbc6..9079500 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 16/42 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 9079500..8ae22bf 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 17/42 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 8ae22bf..c228b50 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 18/42 refactor kqemu selection for both mingw32

In reply to Juan Quintela
---
 configure |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
configure +3 -6
index c228b50..fe20294 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
#20 lore raw

PATCH 20/42 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 ed288a7..ff6c8ff 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
#19 lore raw

PATCH 19/42 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 fe20294..ed288a7 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
#21 lore raw

PATCH 21/42 refactor $cpu selection in various places

In reply to Juan Quintela
---
 configure |   63 ++++++++++++------------------------------------------------
 1 files changed, 13 insertions(+), 50 deletions(-)
configure +13 -50
index ff6c8ff..262cf4c 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
#22 lore raw

PATCH 22/42 reindent Operating System selection configure

In reply to Juan Quintela
---
 configure |  164 +++++++++++++++++++++++++++++++------------------------------
 1 files changed, 83 insertions(+), 81 deletions(-)
configure +83 -81
index 262cf4c..3132267 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
#23 lore raw

PATCH 23/42 We use -lz for all binaries

In reply to Juan Quintela
---
 Makefile |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
Makefile +1 -3
index ca569b0..8f21428 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
@@ -209,8 +209,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 24/42 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 8f21428..402879f 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 3132267..85f5ad2 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 25/42 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 402879f..cc1c98a 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 85f5ad2..2d4a037 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
#26 lore raw

PATCH 26/42 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 cc1c98a..3c9b2bd 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 2d4a037..c0bd253 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 27/42 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 3c9b2bd..d662e48 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 c0bd253..bf93f4d 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 28/42 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 d662e48..dc85d01 100644
@@ -27,10 +27,6 @@ else
 DOCS=
 endif
 
-ifdef CONFIG_WIN32
-LIBS+=-lwinmm -lws2_32 -liphlpapi
-endif
-
 build-all: $(TOOLS) $(DOCS) roms 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 bf93f4d..1babbaf 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 29/42 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 30/42 Rename CPPFLAGS to CFLAGS

In reply to Juan Quintela
---
 Makefile                   |   12 ++++++------
 Makefile.hw                |    6 +++---
 Makefile.target            |   32 ++++++++++++++++----------------
 configure                  |    2 +-
 pc-bios/optionrom/Makefile |    6 +++---
 rules.mak                  |    6 +++---
 6 files changed, 32 insertions(+), 32 deletions(-)
Makefile +6 -6
index dc85d01..62848f1 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
+CFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@
+CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+CFLAGS += -U_FORTIFY_SOURCE
 LIBS+=-lz
 
 ifdef BUILD_DOCS
@@ -98,7 +98,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: CFLAGS := $(FMOD_CFLAGS) $(CFLAGS)
 endif
 ifdef CONFIG_ESD
 AUDIO_PT = y
@@ -135,7 +135,7 @@ obj-$(CONFIG_COCOA) += cocoa.o
 obj-$(CONFIG_IOTHREAD) += qemu-thread.o
 
 ifdef CONFIG_SLIRP
-CPPFLAGS+=-I$(SRC_PATH)/slirp
+CFLAGS+=-I$(SRC_PATH)/slirp
 endif
 
 slirp-obj-y = cksum.o if.o ip_icmp.o ip_input.o ip_output.o
@@ -149,7 +149,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)
+CFLAGS+=$(CURL_CFLAGS)
 LIBS+=$(CURL_LIBS)
 
 cocoa.o: cocoa.m
Makefile.hw +3 -3
index 131ae51..804ace1 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
+CFLAGS += -I. -I.. -I$(SRC_PATH) -MMD -MP -MT $@
+CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+CFLAGS+=-I$(SRC_PATH)/fpu
 
 obj-y =
 obj-y += virtio.o virtio-pci.o
Makefile.target +16 -16
index 0bc46e0..f53bee2 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
-CPPFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
+CFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
 
 ifdef CONFIG_USER_ONLY
 # user emulator name
@@ -44,8 +44,8 @@ ifeq ($(ARCH),ia64)
 CFLAGS+=-mno-sdata
 endif
 
-CPPFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-CPPFLAGS+=-U_FORTIFY_SOURCE
+CFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
+CFLAGS+=-U_FORTIFY_SOURCE
 LIBS+=-lm
 ifdef CONFIG_SOLARIS
 ifdef CONFIG_NEEDS_LIBSUNMATH
@@ -68,16 +68,16 @@ 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
-CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
+CFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
 ifeq ($(ARCH),sparc64)
-CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
+CFLAGS+=-I$(SRC_PATH)/tcg/sparc
 endif
 ifdef CONFIG_SOFTFLOAT
 libobj-y += fpu/softfloat.o
 else
 libobj-y += fpu/softfloat-native.o
 endif
-CPPFLAGS+=-I$(SRC_PATH)/fpu
+CFLAGS+=-I$(SRC_PATH)/fpu
 libobj-y += op_helper.o helper.o
 
 ifeq ($(TARGET_BASE_ARCH), arm)
@@ -161,7 +161,7 @@ cpu-exec.o: CFLAGS += $(HELPER_CFLAGS)
 ifdef CONFIG_LINUX_USER
 
 VPATH+=:$(SRC_PATH)/linux-user:$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
-CPPFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
+CFLAGS+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR)
 
 # profiling code
 ifdef TARGET_GPROF
@@ -203,7 +203,7 @@ endif #CONFIG_LINUX_USER
 ifdef CONFIG_DARWIN_USER
 
 VPATH+=:$(SRC_PATH)/darwin-user
-CPPFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
+CFLAGS+=-I$(SRC_PATH)/darwin-user -I$(SRC_PATH)/darwin-user/$(TARGET_ARCH)
 
 # Leave some space for the regular program loading zone
 LDFLAGS+=-Wl,-segaddr,__STD_PROG_ZONE,0x1000 -image_base 0x0e000000
@@ -227,7 +227,7 @@ endif #CONFIG_DARWIN_USER
 ifdef CONFIG_BSD_USER
 
 VPATH+=:$(SRC_PATH)/bsd-user
-CPPFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
+CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ARCH)
 
 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
@@ -285,12 +285,12 @@ adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
 endif
 
 ifdef CONFIG_VNC_TLS
-CPPFLAGS += $(VNC_TLS_CFLAGS)
+CFLAGS += $(VNC_TLS_CFLAGS)
 LIBS += $(VNC_TLS_LIBS)
 endif
 
 ifdef CONFIG_VNC_SASL
-CPPFLAGS += $(VNC_SASL_CFLAGS)
+CFLAGS += $(VNC_SASL_CFLAGS)
 LIBS += $(VNC_SASL_LIBS)
 endif
 
@@ -325,7 +325,7 @@ 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)
-CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
+CFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
 endif
 
 # shared objects
@@ -347,7 +347,7 @@ obj-ppc-y += ppce500_pci.o ppce500_mpc8544ds.o
 obj-ppc-$(CONFIG_KVM) += kvm_ppc.o
 
 ifeq ($(TARGET_BASE_ARCH), ppc)
-CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
+CFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
 endif
 
 obj-ppc-$(CONFIG_FDT) += device_tree.o
@@ -363,7 +363,7 @@ obj-mips-y += pflash_cfi01.o
 obj-mips-y += vmware_vga.o
 
 ifeq ($(TARGET_BASE_ARCH), mips)
-CPPFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
+CFLAGS += -DHAS_AUDIO -DHAS_AUDIO_CHOICE
 endif
 
 obj-microblaze-y = petalogix_s3adsp1800_mmu.o
@@ -424,7 +424,7 @@ 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)
-CPPFLAGS += -DHAS_AUDIO
+CFLAGS += -DHAS_AUDIO
 endif
 
 obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o
@@ -441,7 +441,7 @@ COCOA_LIBS+=-framework CoreAudio
 endif
 endif
 ifdef CONFIG_SLIRP
-CPPFLAGS+=-I$(SRC_PATH)/slirp
+CFLAGS+=-I$(SRC_PATH)/slirp
 endif
 
 # specific flags are needed for non soft mmu emulator
configure +1 -1
index 1babbaf..6972cdf 100755
@@ -2114,5 +2114,5 @@ for hwlib in 32 64; do
   rm -f $d/Makefile
   ln -s $source_path/Makefile.hw $d/Makefile
   echo "HWLIB=libqemuhw$hwlib.a" > $d/config.mak
-  echo "CPPFLAGS=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
+  echo "CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" >> $d/config.mak
 done
pc-bios/optionrom/Makefile +3 -3
index ace142d..b9099d7 100644
@@ -5,9 +5,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..7661e35 100644
@@ -1,12 +1,12 @@
 
 %.o: %.c
-	$(call quiet-command,$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<,"  CC    $(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) $(CFLAGS) -c -o $@ $<,"  CC    $(TARGET_DIR)$@")
 
 %.o: %.S
-	$(call quiet-command,$(CC) $(CPPFLAGS) -c -o $@ $<,"  AS    $(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) $(CLAGS) -c -o $@ $<,"  AS    $(TARGET_DIR)$@")
 
 %.o: %.m
-	$(call quiet-command,$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<,"  OBJC  $(TARGET_DIR)$@")
+	$(call quiet-command,$(CC) $(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
#40 lore raw

PATCH 31/42 split CFLAGS very long line

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

PATCH 32/42 move common 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 62848f1..22daabe 100644
@@ -16,9 +16,6 @@ endif
 
 VPATH=$(SRC_PATH):$(SRC_PATH)/hw
 
-CFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@
-CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-CFLAGS += -U_FORTIFY_SOURCE
 LIBS+=-lz
 
 ifdef BUILD_DOCS
Makefile.hw +1 -3
index 804ace1..6e21b6b 100644
@@ -8,9 +8,7 @@ include $(SRC_PATH)/rules.mak
 
 VPATH=$(SRC_PATH):$(SRC_PATH)/hw
 
-CFLAGS += -I. -I.. -I$(SRC_PATH) -MMD -MP -MT $@
-CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-CFLAGS+=-I$(SRC_PATH)/fpu
+CFLAGS+=-I.. -I$(SRC_PATH)/fpu
 
 obj-y =
 obj-y += virtio.o virtio-pci.o
Makefile.target +1 -3
index f53bee2..344d8f8 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
-CFLAGS=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH) -MMD -MT $@ -MP -DNEED_CPU_H
+CFLAGS+= -I.. -I$(TARGET_PATH) -DNEED_CPU_H
 
 ifdef CONFIG_USER_ONLY
 # user emulator name
@@ -44,8 +44,6 @@ ifeq ($(ARCH),ia64)
 CFLAGS+=-mno-sdata
 endif
 
-CFLAGS+=-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-CFLAGS+=-U_FORTIFY_SOURCE
 LIBS+=-lm
 ifdef CONFIG_SOLARIS
 ifdef CONFIG_NEEDS_LIBSUNMATH
configure +3 -0
index 7f4ebff..18fe664 100755
@@ -1388,6 +1388,9 @@ if test "$debug" = "no" ; then
 fi
 CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $CFLAGS"
 CFLAGS="-Wstrict-prototypes -Wredundant-decls $CFLAGS"
+CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $CFLAGS"
+CFLAGS="-U_FORTIFY_SOURCE $CFLAGS"
+CFLAGS="-I. -I\$(SRC_PATH) -MMD -MP -MT \$@ $CFLAGS"
 LDFLAGS="-g $LDFLAGS"
 
 # Consult white-list to determine whether to enable werror
Signature · 1 line
1.6.2.5
#42 lore raw

PATCH 33/42 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 344d8f8..04b98be 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: CFLAGS := $(CFLAGS) $(call cc-option, $(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
 CFLAGS+=-msmall-data
@@ -153,6 +141,10 @@ op_helper.o: CFLAGS += $(HELPER_CFLAGS)
 
 cpu-exec.o: CFLAGS += $(HELPER_CFLAGS)
 
+# Note: this is a workaround. The real fix is to avoid compiling
+# cpu_signal_handler() in cpu-exec.c.
+signal.o: 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: 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: 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: CFLAGS += $(HELPER_CFLAGS)
-
 ARLIBS=libqemu.a ../libqemu_user.a
 
 endif #CONFIG_BSD_USER
configure +4 -0
index 18fe664..08c6e12 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
            CFLAGS="-m32 -ffixed-g2 -ffixed-g3 $CFLAGS"
            if test "$solaris" = "no" ; then
              CFLAGS="-ffixed-g1 -ffixed-g6 $CFLAGS"
+             helper_cflags="-ffixed-i0"
            fi
            ;;
     sparc64)
@@ -549,6 +551,7 @@ case "$cpu" in
     i386)
            CFLAGS="-m32 $CFLAGS"
            LDFLAGS="-m32 $LDFLAGS"
+           helper_cflags="-fomit-frame-pointer"
            host_guest_base="yes"
            ;;
     x86_64)
@@ -1750,6 +1753,7 @@ echo "AR=$ar" >> $config_host_mak
 echo "OBJCOPY=$objcopy" >> $config_host_mak
 echo "LD=$ld" >> $config_host_mak
 echo "CFLAGS=$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
#43 lore raw

PATCH 34/42 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 04b98be..ae407d6 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 08c6e12..7bd3f3f 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
#44 lore raw

PATCH 35/42 Add libs_softmmu variable

In reply to Juan Quintela

It is used only for softmmu variables

---
 configure |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
configure +2 -0
index 7bd3f3f..9d17e8e 100755
@@ -45,6 +45,7 @@ install="install"
 objcopy="objcopy"
 ld="ld"
 helper_cflags=""
+libs_softmmu=""
 
 # parse CC options first
 for opt do
@@ -2003,6 +2004,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
#45 lore raw

PATCH 36/42 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 ae407d6..9870cf4 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 9d17e8e..7cacb74 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
 
 ##########################################
@@ -1630,7 +1631,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
#46 lore raw

PATCH 37/42 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 9870cf4..5e6701b 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
#47 lore raw

PATCH 38/42 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 5e6701b..97bd55a 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
 CFLAGS+=-I$(SRC_PATH)/slirp
configure +5 -1
index 7cacb74..208e7f5 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
#48 lore raw

PATCH 39/42 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 97bd55a..0c4d5ca 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 208e7f5..0b9484e 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(?)
     ;;
 
@@ -1600,10 +1612,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
#49 lore raw

PATCH 40/42 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 0c4d5ca..062bdd0 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: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
-endif
 
 ifdef CONFIG_VNC_TLS
 CFLAGS += $(VNC_TLS_CFLAGS)
Signature · 1 line
1.6.2.5
#50 lore raw

PATCH 41/42 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 062bdd0..485cf69 100644
@@ -395,16 +395,6 @@ ifdef CONFIG_SLIRP
 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: CFLAGS+=-p
 LDFLAGS+=-p
configure +5 -0
index 0b9484e..a2f0eb8 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
#51 lore raw

PATCH 42/42 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 485cf69..434c88a 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 a2f0eb8..204883e 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
@@ -1656,7 +1656,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
#52 lore raw

Re: [Qemu-devel] [PATCH 42/42] Fold CURSES_LIBS into libsoftmmu_libs

2009/7/30 Juan Quintela <[email protected]>:

Quoted 15 lines

---
 Makefile.target |    2 +-
 configure       |    5 ++---

 2 files changed, 3 insertions(+), 4 deletions(-)
Makefile.target +0 -0
index 485cf69..434c88a 100644
@@ -416,7 +416,7 @@ vl.o: qemu-options.h
 

 monitor.o: qemu-monitor.h

Makefile.target vl.o: qemu-options.h · line 419

Quoted 2 lines
Makefile.target +1 -1
-LIBS += $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)
+LIBS += $(COCOA_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)

Why different from Cocoa/brlapi/vde/curl?

Cheers

#31 lore raw

[Qemu-devel] Re: [PATCH 30/42] Rename CPPFLAGS to CFLAGS

In reply to Juan Quintela

Just wanted to point out that this is wrong. -I and -D *are* CPPFLAGS.

However, the real issue is that CFLAGS should be reserved for the user at make time (defaulting to something *constant* like -O2 -g or whatever else). Actually so should CPPFLAGS, but at least it is much less likely to be used, while "make CFLAGS=-g" is common during development and supported by almost every package I know of.

You can also call it QEMU_CPPFLAGS or QEMU_CFLAGS and we can be happy.
You then have to add both $(QEMU_CPPFLAGS) and $(CFLAGS) to compilation commands in both configure and Make.

Paolo

#53 lore raw

[Qemu-devel] Re: [PATCH 42/42] Fold CURSES_LIBS into libsoftmmu_libs

In reply to andrzej zaborowski
Quoted 14 lines · andrzej zaborowski

2009/7/30 Juan Quintela <[email protected]>:

Quoted 13 lines

---
 Makefile.target |    2 +-
 configure       |    5 ++---

 2 files changed, 3 insertions(+), 4 deletions(-)
Makefile.target +0 -0
index 485cf69..434c88a 100644
@@ -416,7 +416,7 @@ vl.o: qemu-options.h
 
Quoted 6 lines

Makefile.target vl.o: qemu-options.h · line 419

Quoted 4 lines

 monitor.o: qemu-monitor.h

Makefile.target +1 -1
-LIBS += $(COCOA_LIBS) $(CURSES_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)
+LIBS += $(COCOA_LIBS) $(BRLAPI_LIBS) $(VDE_LIBS) $(CURL_LIBS)

Why different from Cocoa/brlapi/vde/curl?

Not finished yet. Part of the ToDo.

Later, Juan.

#32 lore raw

[Qemu-devel] Re: [PATCH 30/42] Rename CPPFLAGS to CFLAGS

In reply to Paolo Bonzini
Quoted 1 line · Paolo Bonzini

Just wanted to point out that this is wrong. -I and -D *are* CPPFLAGS.

Tell that to sdl-config --cflags and friends :p

Quoted 9 lines

However, the real issue is that CFLAGS should be reserved for the user at make time (defaulting to something *constant* like -O2 -g or whatever else). Actually so should CPPFLAGS, but at least it is much less likely to be used, while "make CFLAGS=-g" is common during development and supported by almost every package I know of.

You can also call it QEMU_CPPFLAGS or QEMU_CFLAGS and we can be happy. You then have to add both $(QEMU_CPPFLAGS) and $(CFLAGS) to compilation commands in both configure and Make.

If there is an agreement about that, I don't care remaining. As things stand now, the difference between CFLAGS and CPPFLAGS in qemu was artificial.

Later, Juan.

#33 lore raw

[Qemu-devel] Re: [PATCH 30/42] Rename CPPFLAGS to CFLAGS

Quoted 1 line

Tell that to sdl-config --cflags and friends :p

But sdl-config and friends do not give out anything that the compiler cares about but not the preprocessor (such as weird -f or -m options).

Anyway...

Quoted 3 lines

If there is an agreement about that, I don't care remaining. As things stand now, the difference between CFLAGS and CPPFLAGS in qemu was artificial.

... agreed, that's why I don't care if you call it CPPFLAGS or QEMU_CFLAGS or QEMU_CPPFLAGS. I just want to preserve the distinction between flags the user may want to override (optimization, debugging), and flags the user should leave alone.

Paolo

#34 lore raw

[Qemu-devel] Re: [PATCH 30/42] Rename CPPFLAGS to CFLAGS

Quoted 4 lines · Paolo Bonzini

... agreed, that's why I don't care if you call it CPPFLAGS or QEMU_CFLAGS or QEMU_CPPFLAGS. I just want to preserve the distinction between flags the user may want to override (optimization, debugging), and flags the user should leave alone.

Ok, and what are that options?
Looking at today Makefiles, the only things that I see that the user could want changing is:
-g
-O2
-fno-strict-aliasing
-fno-unit-at-a-time (ppc)
-msmall-data (alpha)
-mno-sdata (ia64)

Rest of things are -I/-D stuff, that you don't want to touch from the command line at all.

Anything else? Should that be enough?

Later, Juan.

#35 lore raw

[Qemu-devel] Re: [PATCH 30/42] Rename CPPFLAGS to CFLAGS

Quoted 11 lines

Ok, and what are that options?
Looking at today Makefiles, the only things that I see that the user could want changing is:
-g
-O2
-fno-strict-aliasing
-fno-unit-at-a-time (ppc)
-msmall-data (alpha)
-mno-sdata (ia64)

Quoted 4 lines

Rest of things are -I/-D stuff, that you don't want to touch from the command line at all.

Anything else? Should that be enough?

I'd say only "-g -O2".

-f and -m options should be left in QEMU_CFLAGS but CFLAGS should be expanded *after* it so that people can add -fstrict-aliasing/-funit-at-a-time/-mlarge-data/-msdata if they want to enable those options explicitly.

The rationale is that probably "make CFLAGS=-g" would break the build on PPC, Alpha, and IA64; and "make CFLAGS='-O3 -g'" would break the build everywhere due to the lack of -fno-strict-aliasing.

Paolo

#36 lore raw

[Qemu-devel] Re: [PATCH 30/42] Rename CPPFLAGS to CFLAGS

Quoted 17 lines · Paolo Bonzini
Quoted 10 lines

Ok, and what are that options?
Looking at today Makefiles, the only things that I see that the user could want changing is:
-g
-O2
-fno-strict-aliasing
-fno-unit-at-a-time (ppc)
-msmall-data (alpha)
-mno-sdata (ia64)

Quoted 4 lines

Rest of things are -I/-D stuff, that you don't want to touch from the command line at all.

Anything else? Should that be enough?

I'd say only "-g -O2".

Quoted 8 lines

-f and -m options should be left in QEMU_CFLAGS but CFLAGS should be expanded *after* it so that people can add -fstrict-aliasing/-funit-at-a-time/-mlarge-data/-msdata if they want to enable those options explicitly.

The rationale is that probably "make CFLAGS=-g" would break the build on PPC, Alpha, and IA64; and "make CFLAGS='-O3 -g'" would break the build everywhere due to the lack of -fno-strict-aliasing.

Ok, with me, then the proposal is:
rename CFLAGS into QEMU_CFLAGS
leave in CFLAGS only "-g -O2"

Voters that agree?

Later, Juan.

#39 lore raw

Re: [Qemu-devel] Re: [PATCH 30/42] Rename CPPFLAGS to CFLAGS

In reply to Juan Quintela
Quoted 7 lines · Juan Quintela
Quoted 4 lines · Paolo Bonzini

... agreed, that's why I don't care if you call it CPPFLAGS or QEMU_CFLAGS or QEMU_CPPFLAGS. I just want to preserve the distinction between flags the user may want to override (optimization, debugging), and flags the user should leave alone.

Quoted 7 lines

Ok, and what are that options?
Looking at today Makefiles, the only things that I see that the user could want changing is:
-g
-O2
-fno-strict-aliasing
-fno-unit-at-a-time (ppc)

-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.

Quoted 11 lines

-msmall-data (alpha)
-mno-sdata (ia64)

Rest of things are -I/-D stuff, that you don't want to touch from the command line at all.

Anything else? Should that be enough?

Later, Juan.

Signature · 1 line
mailto:[email protected]
#37 lore raw

Re: [Qemu-devel] Re: [PATCH 30/42] Rename CPPFLAGS to CFLAGS

In reply to Juan Quintela
Quoted 11 lines · Juan Quintela
Quoted 10 lines · Paolo Bonzini
Quoted 10 lines

Ok, and what are that options?
Looking at today Makefiles, the only things that I see that the user could want changing is:
-g
-O2
-fno-strict-aliasing
-fno-unit-at-a-time (ppc)
-msmall-data (alpha)
-mno-sdata (ia64)

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

Rest of things are -I/-D stuff, that you don't want to touch from the command line at all.

Ok, with me, then the proposal is:
rename CFLAGS into QEMU_CFLAGS
leave in CFLAGS only "-g -O2"

A good trick is to make sure CFLAGS is included at the _end_ of QEMU_CFLAGS (or that it comes after QEMU_FLAGS in commands), not anywhere else:

   CFLAGS = -g -O2
   QEMU_CFLAGS = -msome-option -fno-strict-aliasing $(CFLAGS)

This way, users can override many options in QEMU_CFLAGS if they have reason to, by supplying the opposite flag, as options coming later usually have precedence:

make CFLAGS='-g -O2 -fstrict-aliasing'

==> gcc -msome-option -fno-strict-alising -g -O2 -fstrict-aliasing <- wins

-- Jamie

#38 lore raw

[Qemu-devel] Re: [PATCH 30/42] Rename CPPFLAGS to CFLAGS

Quoted 26 lines · Jamie Lokier
Quoted 11 lines · Juan Quintela
Quoted 10 lines · Paolo Bonzini
Quoted 10 lines

Ok, and what are that options?
Looking at today Makefiles, the only things that I see that the user could want changing is:
-g
-O2
-fno-strict-aliasing
-fno-unit-at-a-time (ppc)
-msmall-data (alpha)
-mno-sdata (ia64)

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

Rest of things are -I/-D stuff, that you don't want to touch from the command line at all.

Ok, with me, then the proposal is:
rename CFLAGS into QEMU_CFLAGS
leave in CFLAGS only "-g -O2"

A good trick is to make sure CFLAGS is included at the _end_ of QEMU_CFLAGS (or that it comes after QEMU_FLAGS in commands), not anywhere else:

   CFLAGS = -g -O2
   QEMU_CFLAGS = -msome-option -fno-strict-aliasing $(CFLAGS)
Quoted 7 lines

This way, users can override many options in QEMU_CFLAGS if they have reason to, by supplying the opposite flag, as options coming later usually have precedence:

make CFLAGS='-g -O2 -fstrict-aliasing'

   ==> gcc -msome-option -fno-strict-alising -g -O2 -fstrict-aliasing <- wins

That is already done, I moved carefully to always prepend things. Whatever that you put in --extra-cflags goes at the end of the line.

Later, Juan.