Skip to contentSkip to conversation

More configure/Makefile cleanups

PATCH Superseded [email protected] 2 participants 22 messages Jul 20, 2009 – Jul 21, 2009 Kbuild

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover More configure/Makefile cleanups

From: Juan Quintela <[email protected]>

Hi

More configuration cleanups on top of my previous series.
This one:
- when we test for a library, if we need it, we add the
library to LIBS after checking. Found that we were checking for 2 xen libraries and then adding 3 to LIBS.
- starting moving variables to CPPCFLAGS.
- Big SDL cleanup. SDL configuration have very old cruft there, from testing for target_sofmmu before it was set, to testing for "$sdl" = "yes" on the else part of tesing "$sdl" = yes.
- I added a configuration define: CONFIG_NOWIN32, I just needed a way to compile files for WIN32 or the rest. If anyone has a better suggestion for th ename, it is welcome.

After this series Makefile is basically clean from logic:

(simple-config-4)$ grep ifdef Makefile
ifdef BUILD_DOCS
ifdef INSTALL_BLOBS
(simple-config-4)$ grep ifndef Makefile
ifndef CONFIG_WIN32

ToDo:
- do the same for Makefile.target
- what to do with CFLAGS/CPPFLAGS. At this point we have things like:

    sdl.o audio/sdlaudio.o sdl_zoom.o baum.o: CFLAGS += $(SDL_CFLAGS)

Problem is that SDL_CFLAGS ends on fedora (I guess other unix got similar):
-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT
I felt nervous compling some files with -REENTRANT and other without it. Should we use a single CFLAGS for all files? I would prefer to have a single CFLAGS, but it is not my call to make that decision. What everybody else thinks?

Coments, suggestions?

Later, Juan.

Juan Quintela (20):
add coreaudio libs at the same place that the rest of the audior
drivers
move the decision of using threads or not in audio from Makefile to
configure
Add CONFIG_NOWIN32
Use CONFIG_NOWIN32 previus define to simplify Makefile add $fmod_inc to CPPFLAGS
add SLIRP directory to include list in case it is needed fold VNC_TLS_CFLAGS into CPPCFLAGS
fold VNC_SASL_CFLAGS into CPPCFLAGS
put together uses of -lvdeplug
-lz is needed for all binaries, move it to LIBS
put together uses of xen libraries
the else part of this test is obsolete We are testing for sdl = yes
inside the else part of the test if sdl = yes
sdl_config var is never changed from sdl-config value remove old sdl config code that was commented
define SDL_CFLAGS value when we test for SDL
target_mmu is defined later, at that point has no value use sdl_{cflags,libs} insteaf of calling sdl-config
Add -lX11 to sdl_libs when needed, and remove sdl_x11 variable move SDL mingw32 hack to SDL detection
move SDL static configuration near SDL detection

 Makefile        |   50 +++---------------------
 Makefile.target |   10 -----
 configure       |  117 ++++++++++++++++++++++++-------------------------------
 3 files changed, 57 insertions(+), 120 deletions(-)
#1 lore raw

PATCH 1/20 add coreaudio libs at the same place that the rest of the audior drivers

From: Juan Quintela <[email protected]>

---
 configure |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
configure +2 -2
index f1a5e8c..4317b2f 100755
@@ -1630,6 +1630,8 @@ for drv in $audio_drv_list; do
         LIBS="$LIBS -lpulse-simple"
     elif test "$drv" = "esd"; then
         LIBS="$LIBS -lesd"
+    elif test "$drv" = "coreaudio"; then
+	LIBS="$LIBS -framework CoreAudio"
     fi
 done
 echo "" >>$config_host_h
@@ -1693,8 +1695,6 @@ if test "$cocoa" = "yes" ; then
   echo "#define CONFIG_COCOA 1" >> $config_host_h
   echo "CONFIG_COCOA=y" >> $config_host_mak
   LIBS="$LIBS -F/System/Library/Frameworks -framework Cocoa -framework IOKit"
-  # You can't configure coreaudio out for cocoa at this moment
-  LIBS="$LIBS -framework CoreAudio"
 fi
 if test "$curses" = "yes" ; then
   echo "#define CONFIG_CURSES 1" >> $config_host_h
Signature · 1 line
1.6.2.5
#2 lore raw

PATCH 2/20 move the decision of using threads or not in audio from Makefile to configure

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 Makefile  |   17 ++---------------
 configure |   11 +++++++++++
 2 files changed, 13 insertions(+), 15 deletions(-)
Makefile +2 -15
index b62d8a0..5a2570e 100644
@@ -102,23 +102,10 @@ else
 obj-y += migration-exec.o
 endif
 
-ifdef CONFIG_COREAUDIO
-AUDIO_PT = y
-endif
 ifdef CONFIG_FMOD
 audio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(FMOD_CFLAGS) $(CPPFLAGS)
 endif
-ifdef CONFIG_ESD
-AUDIO_PT = y
-AUDIO_PT_INT = y
-endif
-ifdef CONFIG_PA
-AUDIO_PT = y
-AUDIO_PT_INT = y
-endif
-ifdef AUDIO_PT
-LDFLAGS += -pthread
-endif
+
 
 audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o
 audio-obj-$(CONFIG_SDL) += sdlaudio.o
@@ -129,7 +116,7 @@ audio-obj-$(CONFIG_DSOUND) += dsoundaudio.o
 audio-obj-$(CONFIG_FMOD) += fmodaudio.o
 audio-obj-$(CONFIG_ESD) += esdaudio.o
 audio-obj-$(CONFIG_PA) += paaudio.o
-audio-obj-$(AUDIO_PT_INT) += audio_pt_int.o
+audio-obj-$(CONFIG_AUDIO_PT_INT) += audio_pt_int.o
 audio-obj-y += wavcapture.o
 obj-y += $(addprefix audio/, $(audio-obj-y))
 
configure +11 -0
index 4317b2f..4c478a1 100755
@@ -1627,13 +1627,24 @@ for drv in $audio_drv_list; do
     elif test "$drv" = "dsound"; then
         LIBS="$LIBS -lole32 -ldxguid"
     elif test "$drv" = "pa"; then
+        audio_pt="yes"
+        audio_pt_int="yes"
         LIBS="$LIBS -lpulse-simple"
     elif test "$drv" = "esd"; then
+        audio_pt="yes"
+        audio_pt_int="yes"
         LIBS="$LIBS -lesd"
     elif test "$drv" = "coreaudio"; then
+        audio_pt="yes"
 	LIBS="$LIBS -framework CoreAudio"
     fi
 done
+if test "$audio_pt" == "yes" ; then
+  LDFLAGS="$LDFLAGS -pthread"
+fi
+if test "$audio_pt_int" == "yes" ; then
+  echo "CONFIG_AUDIO_PT_INT=y" >> $config_host_mak
+fi
 echo "" >>$config_host_h
 if test "$mixemu" = "yes" ; then
   echo "CONFIG_MIXEMU=y" >> $config_host_mak
Signature · 1 line
1.6.2.5
#3 lore raw

PATCH 3/20 Add CONFIG_NOWIN32

In reply to [email protected]

From: Juan Quintela <[email protected]>

We need a way to define posix-like

---
 configure |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
configure +1 -0
index 4c478a1..cadaeaf 100755
@@ -1537,6 +1537,7 @@ if test "$mingw32" = "yes" ; then
   echo "#define CONFIG_WIN32 1" >> $config_host_h
   LIBS="$LIBS -lwinmm -lws2_32 -liphlpapi"
 else
+  echo "CONFIG_NOWIN32=y" >> $config_host_mak
   cat > $TMPC << EOF
 #include <byteswap.h>
 int main(void) { return bswap_32(0); }
Signature · 1 line
1.6.2.5
#4 lore raw

PATCH 4/20 Use CONFIG_NOWIN32 previus define to simplify Makefile

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 Makefile |   22 +++++-----------------
 1 files changed, 5 insertions(+), 17 deletions(-)
Makefile +5 -17
index 5a2570e..be5452c 100644
@@ -50,21 +50,13 @@ recurse-all: $(SUBDIR_RULES)
 
 block-obj-y = cutils.o cache-utils.o qemu-malloc.o qemu-option.o module.o
 block-obj-y += nbd.o block.o aio.o aes.o
+block-obj-$(CONFIG_AIO) += posix-aio-compat.o
 
 block-nested-y += cow.o qcow.o vmdk.o cloop.o dmg.o bochs.o vpc.o vvfat.o
 block-nested-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o
 block-nested-y += parallels.o nbd.o
-
-
-ifdef CONFIG_WIN32
-block-nested-y += raw-win32.o
-else
-ifdef CONFIG_AIO
-block-obj-y += posix-aio-compat.o
-endif
-block-nested-y += raw-posix.o
-endif
-
+block-nested-$(CONFIG_WIN32) += raw-win32.o
+block-nested-$(CONFIG_NOWIN32) += raw-posix.o
 block-nested-$(CONFIG_CURL) += curl.o
 
 block-obj-y +=  $(addprefix block/, $(block-nested-y))
@@ -95,12 +87,8 @@ obj-y += msmouse.o ps2.o
 obj-y += qdev.o qdev-properties.o ssi.o
 
 obj-$(CONFIG_BRLAPI) += baum.o
-
-ifdef CONFIG_WIN32
-obj-y += tap-win32.o
-else
-obj-y += migration-exec.o
-endif
+obj-$(CONFIG_WIN32) += tap-win32.o
+obj-$(CONFIG_NOWIN32) += migration-exec.o
 
 ifdef CONFIG_FMOD
 audio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(FMOD_CFLAGS) $(CPPFLAGS)
Signature · 1 line
1.6.2.5
#5 lore raw

PATCH 5/20 add $fmod_inc to CPPFLAGS

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 Makefile  |    5 -----
 configure |    2 +-
 2 files changed, 1 insertions(+), 6 deletions(-)
Makefile +0 -5
index be5452c..3c2ab01 100644
@@ -90,11 +90,6 @@ obj-$(CONFIG_BRLAPI) += baum.o
 obj-$(CONFIG_WIN32) += tap-win32.o
 obj-$(CONFIG_NOWIN32) += migration-exec.o
 
-ifdef CONFIG_FMOD
-audio/audio.o audio/fmodaudio.o: CPPFLAGS := -I$(FMOD_CFLAGS) $(CPPFLAGS)
-endif
-
-
 audio-obj-y = audio.o noaudio.o wavaudio.o mixeng.o
 audio-obj-$(CONFIG_SDL) += sdlaudio.o
 audio-obj-$(CONFIG_OSS) += ossaudio.o
configure +1 -1
index cadaeaf..9b1234c 100755
@@ -1620,7 +1620,7 @@ for drv in $audio_drv_list; do
     echo "$def=y" >> $config_host_mak
     if test "$drv" = "fmod"; then
         LIBS="$LIBS $fmod_lib"
-        echo "FMOD_CFLAGS=$fmod_inc" >> $config_host_mak
+        CPPFLAGS="$CPPFLAGS -I$fmod_inc"
     elif test "$drv" = "oss"; then
         LIBS="$LIBS $oss_lib"
     elif test "$drv" = "alsa"; then
Signature · 1 line
1.6.2.5
#6 lore raw

PATCH 6/20 add SLIRP directory to include list in case it is needed

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 Makefile  |    4 ----
 configure |    1 +
 2 files changed, 1 insertions(+), 4 deletions(-)
Makefile +0 -4
index 3c2ab01..bdbb87c 100644
@@ -112,10 +112,6 @@ obj-$(CONFIG_VNC_SASL) += vnc-auth-sasl.o
 obj-$(CONFIG_COCOA) += cocoa.o
 obj-$(CONFIG_IOTHREAD) += qemu-thread.o
 
-ifdef CONFIG_SLIRP
-CPPFLAGS+=-I$(SRC_PATH)/slirp
-endif
-
 slirp-obj-y = cksum.o if.o ip_icmp.o ip_input.o ip_output.o
 slirp-obj-y += slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o
 slirp-obj-y += tcp_subr.o tcp_timer.o udp.o bootp.o tftp.o
configure +1 -0
index 9b1234c..90bc793 100755
@@ -1602,6 +1602,7 @@ fi
 if test "$slirp" = "yes" ; then
   echo "CONFIG_SLIRP=y" >> $config_host_mak
   echo "#define CONFIG_SLIRP 1" >> $config_host_h
+  CPPFLAGS="$CPPFLAGS -I$source_path/slirp"
 fi
 if test "$vde" = "yes" ; then
   echo "CONFIG_VDE=y" >> $config_host_mak
Signature · 1 line
1.6.2.5
#7 lore raw

PATCH 7/20 fold VNC_TLS_CFLAGS into CPPCFLAGS

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 Makefile        |    2 --
 Makefile.target |    4 ----
 configure       |    7 +++----
 3 files changed, 3 insertions(+), 10 deletions(-)
Makefile +0 -2
index bdbb87c..098f972 100644
@@ -137,8 +137,6 @@ vnc.h: vnc-tls.h vnc-auth-vencrypt.h vnc-auth-sasl.h keymaps.h
 
 vnc.o: vnc.c vnc.h vnc_keysym.h vnchextile.h d3des.c d3des.h acl.h
 
-vnc.o: CFLAGS += $(VNC_TLS_CFLAGS)
-
 vnc-tls.o: vnc-tls.c vnc.h
 
 vnc-auth-vencrypt.o: vnc-auth-vencrypt.c vnc.h
Makefile.target +0 -4
index 8621c76..7c81a27 100644
@@ -414,10 +414,6 @@ ifdef CONFIG_ADLIB
 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
 endif
 
-ifdef CONFIG_VNC_TLS
-CPPFLAGS += $(VNC_TLS_CFLAGS)
-endif
-
 ifdef CONFIG_VNC_SASL
 CPPFLAGS += $(VNC_SASL_CFLAGS)
 endif
configure +3 -4
index 90bc793..bd4436d 100755
@@ -967,9 +967,10 @@ EOF
     vnc_tls_libs=`pkg-config --libs gnutls 2> /dev/null`
     if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_tls_cflags $TMPC \
            $vnc_tls_libs > /dev/null 2> /dev/null ; then
-	:
+        CPPFLAGS="$CPPFLAGS $vnc_tls_cflags"
+        LIBS="$LIBS $vnc_tls_libs"
     else
-	vnc_tls="no"
+        vnc_tls="no"
     fi
 fi
 
@@ -1654,9 +1655,7 @@ if test "$mixemu" = "yes" ; then
 fi
 if test "$vnc_tls" = "yes" ; then
   echo "CONFIG_VNC_TLS=y" >> $config_host_mak
-  echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
   echo "#define CONFIG_VNC_TLS 1" >> $config_host_h
- LIBS="$LIBS $vnc_tls_libs"
 fi
 if test "$vnc_sasl" = "yes" ; then
   echo "CONFIG_VNC_SASL=y" >> $config_host_mak
Signature · 1 line
1.6.2.5
#8 lore raw

PATCH 8/20 fold VNC_SASL_CFLAGS into CPPCFLAGS

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 Makefile.target |    4 ----
 configure       |    7 +++----
 2 files changed, 3 insertions(+), 8 deletions(-)
Makefile.target +0 -4
index 7c81a27..601e97e 100644
@@ -414,10 +414,6 @@ ifdef CONFIG_ADLIB
 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
 endif
 
-ifdef CONFIG_VNC_SASL
-CPPFLAGS += $(VNC_SASL_CFLAGS)
-endif
-
 # xen backend driver support
 obj-$(CONFIG_XEN) += xen_machine_pv.o xen_domainbuild.o
 
configure +3 -4
index bd4436d..1b5f30b 100755
@@ -987,9 +987,10 @@ EOF
     vnc_sasl_libs="-lsasl2"
     if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $vnc_sasl_cflags $TMPC \
            $vnc_sasl_libs 2> /dev/null > /dev/null ; then
-	:
+        CPPFLAGS="$CPPFLAGS $vnc_sasl_cflags"
+        LIBS="$LIBS $vnc_sasl_libs"
     else
-	vnc_sasl="no"
+        vnc_sasl="no"
     fi
 fi
 
@@ -1659,9 +1660,7 @@ if test "$vnc_tls" = "yes" ; then
 fi
 if test "$vnc_sasl" = "yes" ; then
   echo "CONFIG_VNC_SASL=y" >> $config_host_mak
-  echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
   echo "#define CONFIG_VNC_SASL 1" >> $config_host_h
-  LIBS="$LIBS $vnc_sasl_libs"
 fi
 if test "$fnmatch" = "yes" ; then
   echo "#define HAVE_FNMATCH_H 1" >> $config_host_h
Signature · 1 line
1.6.2.5
#9 lore raw

PATCH 9/20 put together uses of -lvdeplug

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 configure |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
configure +3 -3
index 1b5f30b..0972738 100755
@@ -1021,8 +1021,9 @@ int main(void)
     return 0;
 }
 EOF
-    if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lvdeplug > /dev/null 2> /dev/null ; then
-        :
+    vde_libs="-lvdeplug"
+    if $cc $ARCH_CFLAGS -o $TMPE $TMPC $vde_libs > /dev/null 2> /dev/null ; then
+        LIBS="$LIBS $vde_libs"
     else
         vde="no"
     fi
@@ -1609,7 +1610,6 @@ fi
 if test "$vde" = "yes" ; then
   echo "CONFIG_VDE=y" >> $config_host_mak
   echo "#define CONFIG_VDE 1" >> $config_host_h
-  LIBS="$LIBS -lvdeplug"
 fi
 for card in $audio_card_list; do
     def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
Signature · 1 line
1.6.2.5
#10 lore raw

PATCH 10/20 -lz is needed for all binaries, move it to LIBS

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 Makefile        |    2 --
 Makefile.target |    2 --
 configure       |    2 +-
 3 files changed, 1 insertions(+), 5 deletions(-)
Makefile +0 -2
index 098f972..a94ea4c 100644
@@ -165,8 +165,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   $@")
 
Makefile.target +0 -2
index 601e97e..45d382a 100644
@@ -400,8 +400,6 @@ obj-y = vl.o osdep.o monitor.o pci.o loader.o isa_mmio.o machine.o \
 obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-console.o
 obj-$(CONFIG_KVM) += kvm.o kvm-all.o
 
-LIBS+=-lz
-
 sound-obj-y =
 sound-obj-$(CONFIG_SB16) += sb16.o
 sound-obj-$(CONFIG_ES1370) += es1370.o
configure +1 -1
index 0972738..4596eb1 100755
@@ -869,7 +869,7 @@ cat > $TMPC << EOF
 int main(void) { zlibVersion(); return 0; }
 EOF
 if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $TMPC -lz > /dev/null 2> /dev/null ; then
-    :
+    LIBS="$LIBS -lz"
 else
     echo
     echo "Error: zlib check failed"
Signature · 1 line
1.6.2.5
#11 lore raw

PATCH 11/20 put together uses of xen libraries

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 configure |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
configure +3 -5
index 4596eb1..2de7aeb 100755
@@ -887,8 +887,9 @@ cat > $TMPC <<EOF
 #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 -lxenstore -lxenctrl 2> /dev/null > /dev/null ; then
-      :
+   xen_libs="-lxenstore -lxenctrl -lxenguest"
+   if $cc $CFLAGS $ARCH_CFLAGS -c -o $TMPO $TMPC $LDFLAGS $xen_libs 2> /dev/null > /dev/null ; then
+      LIBS="$LIBS $xen_libs"
    else
       xen="no"
    fi
@@ -1747,9 +1748,6 @@ if test "$bluez" = "yes" ; then
   echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
   LIBS="$LIBS $bluez_libs"
 fi
-if test "$xen" = "yes" ; then
-  LIBS="$LIBS -lxenstore -lxenctrl -lxenguest"
-fi
 if test "$aio" = "yes" ; then
   echo "#define CONFIG_AIO 1" >> $config_host_h
   echo "CONFIG_AIO=y" >> $config_host_mak
Signature · 1 line
1.6.2.5
#12 lore raw

PATCH 12/20 the else part of this test is obsolete We are testing for sdl = yes inside the else part of the test if sdl = yes

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 configure |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
configure +1 -7
index 2de7aeb..a87959c 100755
@@ -934,13 +934,7 @@ EOF
             fi
         fi # static link
     fi # sdl compile test
-else
-    # Make sure to disable cocoa if sdl was set
-    if test "$sdl" = "yes" ; then
-       cocoa="no"
-       audio_drv_list="`echo $audio_drv_list | sed s,coreaudio,,g`"
-    fi
-fi # -z $sdl
+fi
 
 if test "$sdl" = "yes" ; then
 cat > $TMPC <<EOF
Signature · 1 line
1.6.2.5
#13 lore raw

PATCH 13/20 sdl_config var is never changed from sdl-config value

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 configure |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)
configure +11 -12
index a87959c..6368c4d 100755
@@ -901,7 +901,6 @@ fi
 sdl_too_old=no
 
 if test "$sdl" = "yes" ; then
-    sdl_config="sdl-config"
     sdl=no
     sdl_static=no
 
@@ -910,8 +909,8 @@ cat > $TMPC << EOF
 #undef main /* We don't want SDL to override our main() */
 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
 EOF
-    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then
-        _sdlversion=`$sdl_config --version | sed 's/[^0-9]//g'`
+    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `sdl-config --cflags 2> /dev/null` $TMPC `sdl-config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then
+        _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
         if test "$_sdlversion" -lt 121 ; then
             sdl_too_old=yes
         else
@@ -923,13 +922,13 @@ EOF
         # static link with sdl ?
         if test "$sdl" = "yes" ; then
             aa="no"
-            `$sdl_config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
-            sdl_static_libs=`$sdl_config --static-libs 2>/dev/null`
+            `sdl-config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
+            sdl_static_libs=`sdl-config --static-libs 2>/dev/null`
             if [ "$aa" = "yes" ] ; then
                 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
             fi
 
-            if $cc -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
+            if $cc -o $TMPE ${OS_CFLAGS} `sdl-config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
                 sdl_static=yes
             fi
         fi # static link
@@ -946,7 +945,7 @@ cat > $TMPC <<EOF
 #endif
 int main(void) { return 0; }
 EOF
-    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `$sdl_config --cflags 2> /dev/null` $TMPC `$sdl_config --libs 2> /dev/null` > /dev/null 2>&1 ; then
+    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `sdl-config --cflags 2> /dev/null` $TMPC `sdl-config --libs 2> /dev/null` > /dev/null 2>&1 ; then
 	sdl_x11="yes"
     fi
 fi
@@ -1685,16 +1684,16 @@ if test "$sdl1" = "yes" ; then
   if test "$target_softmmu" = "no" -o "$static" = "yes"; then
     LIBS="$LIBS $sdl_static_libs"
   elif test "$sdl_x11" = "yes" ; then
-    LIBS="$LIBS `$sdl_config --libs` -lX11"
+    LIBS="$LIBS `sdl-config --libs` -lX11"
   elif test "$mingw32" = "yes" ; then
-    LIBS="$LIBS `$sdl_config --libs | sed s/-mwindows//g` -mconsole"
+    LIBS="$LIBS `sdl-config --libs | sed s/-mwindows//g` -mconsole"
   else
-    LIBS="$LIBS `$sdl_config --libs`"
+    LIBS="$LIBS `sdl-config --libs`"
   fi
   if [ "${aa}" = "yes" ] ; then
-    echo "SDL_CFLAGS=`$sdl_config --cflags` `aalib-config --cflags`" >> $config_host_mak
+    echo "SDL_CFLAGS=`sdl-config --cflags` `aalib-config --cflags`" >> $config_host_mak
   else
-    echo "SDL_CFLAGS=`$sdl_config --cflags`" >> $config_host_mak
+    echo "SDL_CFLAGS=`sdl-config --cflags`" >> $config_host_mak
   fi
 fi
 if test "$cocoa" = "yes" ; then
Signature · 1 line
1.6.2.5
#14 lore raw

PATCH 14/20 remove old sdl config code that was commented

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 configure |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
configure +0 -3
index 6368c4d..783dbd7 100755
@@ -1480,9 +1480,6 @@ echo "preadv support    $preadv"
 if test $sdl_too_old = "yes"; then
 echo "-> Your SDL version is too old - please upgrade to have SDL support"
 fi
-#if test "$sdl_static" = "no"; then
-#  echo "WARNING: cannot compile statically with SDL - qemu-fast won't have a graphical output"
-#fi
 
 config_host_mak="config-host.mak"
 config_host_h="config-host.h"
Signature · 1 line
1.6.2.5
#15 lore raw

PATCH 15/20 define SDL_CFLAGS value when we test for SDL

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 configure |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
configure +4 -6
index 783dbd7..37d75c0 100755
@@ -924,8 +924,10 @@ EOF
             aa="no"
             `sdl-config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
             sdl_static_libs=`sdl-config --static-libs 2>/dev/null`
+            sdl_cflags=`sdl-config --cflags`
             if [ "$aa" = "yes" ] ; then
                 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
+                sdl_cflags="$sdl_cflags `aalib-config --cflags`"
             fi
 
             if $cc -o $TMPE ${OS_CFLAGS} `sdl-config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
@@ -1678,7 +1680,7 @@ fi
 if test "$sdl1" = "yes" ; then
   echo "#define CONFIG_SDL 1" >> $config_host_h
   echo "CONFIG_SDL=y" >> $config_host_mak
-  if test "$target_softmmu" = "no" -o "$static" = "yes"; then
+  if test "$target_softmmu" = "no" -o $static" = "yes"; then
     LIBS="$LIBS $sdl_static_libs"
   elif test "$sdl_x11" = "yes" ; then
     LIBS="$LIBS `sdl-config --libs` -lX11"
@@ -1687,11 +1689,7 @@ if test "$sdl1" = "yes" ; then
   else
     LIBS="$LIBS `sdl-config --libs`"
   fi
-  if [ "${aa}" = "yes" ] ; then
-    echo "SDL_CFLAGS=`sdl-config --cflags` `aalib-config --cflags`" >> $config_host_mak
-  else
-    echo "SDL_CFLAGS=`sdl-config --cflags`" >> $config_host_mak
-  fi
+  echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
 fi
 if test "$cocoa" = "yes" ; then
   echo "#define CONFIG_COCOA 1" >> $config_host_h
Signature · 1 line
1.6.2.5
#16 lore raw

PATCH 16/20 target_mmu is defined later, at that point has no value

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 configure |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
configure +1 -1
index 37d75c0..ce66d6d 100755
@@ -1680,7 +1680,7 @@ fi
 if test "$sdl1" = "yes" ; then
   echo "#define CONFIG_SDL 1" >> $config_host_h
   echo "CONFIG_SDL=y" >> $config_host_mak
-  if test "$target_softmmu" = "no" -o $static" = "yes"; then
+  if test "$static" = "yes"; then
     LIBS="$LIBS $sdl_static_libs"
   elif test "$sdl_x11" = "yes" ; then
     LIBS="$LIBS `sdl-config --libs` -lX11"
Signature · 1 line
1.6.2.5
#17 lore raw

PATCH 17/20 use sdl_{cflags, libs} insteaf of calling sdl-config

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 configure |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
configure +7 -6
index ce66d6d..d9fc921 100755
@@ -909,7 +909,9 @@ cat > $TMPC << EOF
 #undef main /* We don't want SDL to override our main() */
 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
 EOF
-    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `sdl-config --cflags 2> /dev/null` $TMPC `sdl-config --libs 2> /dev/null` > $TMPSDLLOG 2>&1 ; then
+    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
         _sdlversion=`sdl-config --version | sed 's/[^0-9]//g'`
         if test "$_sdlversion" -lt 121 ; then
             sdl_too_old=yes
@@ -924,13 +926,12 @@ EOF
             aa="no"
             `sdl-config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
             sdl_static_libs=`sdl-config --static-libs 2>/dev/null`
-            sdl_cflags=`sdl-config --cflags`
             if [ "$aa" = "yes" ] ; then
                 sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
                 sdl_cflags="$sdl_cflags `aalib-config --cflags`"
             fi
 
-            if $cc -o $TMPE ${OS_CFLAGS} `sdl-config --cflags 2> /dev/null` $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
+            if $cc -o $TMPE ${OS_CFLAGS} $sdl_cflags $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
                 sdl_static=yes
             fi
         fi # static link
@@ -947,7 +948,7 @@ cat > $TMPC <<EOF
 #endif
 int main(void) { return 0; }
 EOF
-    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} `sdl-config --cflags 2> /dev/null` $TMPC `sdl-config --libs 2> /dev/null` > /dev/null 2>&1 ; then
+    if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $sdl_cflags $TMPC $sdl_libs > /dev/null 2>&1 ; then
 	sdl_x11="yes"
     fi
 fi
@@ -1683,11 +1684,11 @@ if test "$sdl1" = "yes" ; then
   if test "$static" = "yes"; then
     LIBS="$LIBS $sdl_static_libs"
   elif test "$sdl_x11" = "yes" ; then
-    LIBS="$LIBS `sdl-config --libs` -lX11"
+    LIBS="$LIBS $sdl_libs -lX11"
   elif test "$mingw32" = "yes" ; then
     LIBS="$LIBS `sdl-config --libs | sed s/-mwindows//g` -mconsole"
   else
-    LIBS="$LIBS `sdl-config --libs`"
+    LIBS="$LIBS $sdl_libs"
   fi
   echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
 fi
Signature · 1 line
1.6.2.5
#18 lore raw

PATCH 18/20 Add -lX11 to sdl_libs when needed, and remove sdl_x11 variable

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 configure |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)
configure +1 -4
index d9fc921..69ce350 100755
@@ -201,7 +201,6 @@ aix="no"
 blobs="yes"
 fdt="yes"
 sdl="yes"
-sdl_x11="no"
 xen="yes"
 pkgversion=""
 
@@ -949,7 +948,7 @@ cat > $TMPC <<EOF
 int main(void) { return 0; }
 EOF
     if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $sdl_cflags $TMPC $sdl_libs > /dev/null 2>&1 ; then
-	sdl_x11="yes"
+	sdl_libs="$sdl_libs -lX11"
     fi
 fi
 
@@ -1683,8 +1682,6 @@ if test "$sdl1" = "yes" ; then
   echo "CONFIG_SDL=y" >> $config_host_mak
   if test "$static" = "yes"; then
     LIBS="$LIBS $sdl_static_libs"
-  elif test "$sdl_x11" = "yes" ; then
-    LIBS="$LIBS $sdl_libs -lX11"
   elif test "$mingw32" = "yes" ; then
     LIBS="$LIBS `sdl-config --libs | sed s/-mwindows//g` -mconsole"
   else
Signature · 1 line
1.6.2.5
#19 lore raw

PATCH 19/20 move SDL mingw32 hack to SDL detection

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 configure |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
configure +3 -2
index 69ce350..a57f7f6 100755
@@ -950,6 +950,9 @@ EOF
     if $cc $ARCH_CFLAGS -o $TMPE ${OS_CFLAGS} $sdl_cflags $TMPC $sdl_libs > /dev/null 2>&1 ; then
 	sdl_libs="$sdl_libs -lX11"
     fi
+    if test "$mingw32" = "yes" ; then
+        sdl_libs="`echo $sdl_libs | sed s/-mwindows//g` -mconsole"
+    fi
 fi
 
 ##########################################
@@ -1682,8 +1685,6 @@ if test "$sdl1" = "yes" ; then
   echo "CONFIG_SDL=y" >> $config_host_mak
   if test "$static" = "yes"; then
     LIBS="$LIBS $sdl_static_libs"
-  elif test "$mingw32" = "yes" ; then
-    LIBS="$LIBS `sdl-config --libs | sed s/-mwindows//g` -mconsole"
   else
     LIBS="$LIBS $sdl_libs"
   fi
Signature · 1 line
1.6.2.5
#20 lore raw

PATCH 20/20 move SDL static configuration near SDL detection

In reply to [email protected]

From: Juan Quintela <[email protected]>

---
 configure |   29 +++++++++--------------------
 1 files changed, 9 insertions(+), 20 deletions(-)
configure +9 -20
index a57f7f6..6cf71f8 100755
@@ -901,7 +901,6 @@ sdl_too_old=no
 
 if test "$sdl" = "yes" ; then
     sdl=no
-    sdl_static=no
 
 cat > $TMPC << EOF
 #include <SDL.h>
@@ -921,17 +920,19 @@ EOF
         fi
 
         # static link with sdl ?
-        if test "$sdl" = "yes" ; then
+        if test "$sdl" = "yes" -a "$static" = "yes" ; then
             aa="no"
             `sdl-config --static-libs 2>/dev/null | grep \\\-laa > /dev/null` && aa="yes"
-            sdl_static_libs=`sdl-config --static-libs 2>/dev/null`
+            sdl_libs=`sdl-config --static-libs 2>/dev/null`
             if [ "$aa" = "yes" ] ; then
-                sdl_static_libs="$sdl_static_libs `aalib-config --static-libs`"
+                sdl_libs="$sdl_libs `aalib-config --static-libs`"
                 sdl_cflags="$sdl_cflags `aalib-config --cflags`"
             fi
 
-            if $cc -o $TMPE ${OS_CFLAGS} $sdl_cflags $TMPC $sdl_static_libs > /dev/null 2> /dev/null; then
-                sdl_static=yes
+            if $cc -o $TMPE ${OS_CFLAGS} $sdl_cflags $TMPC $sdl_libs > /dev/null 2> /dev/null; then
+                :
+            else
+                sdl=no
             fi
         fi # static link
     fi # sdl compile test
@@ -1444,9 +1445,6 @@ if test "$darwin" = "yes" ; then
     echo "Cocoa support     $cocoa"
 fi
 echo "SDL support       $sdl"
-if test "$sdl" != "no" ; then
-    echo "SDL static link   $sdl_static"
-fi
 echo "curses support    $curses"
 echo "curl support      $curl"
 echo "mingw32 support   $mingw32"
@@ -1675,19 +1673,10 @@ echo "TARGET_DIRS=$target_list" >> $config_host_mak
 if [ "$build_docs" = "yes" ] ; then
   echo "BUILD_DOCS=yes" >> $config_host_mak
 fi
-if test "$static" = "yes"; then
-  sdl1=$sdl_static
-else
-  sdl1=$sdl
-fi
-if test "$sdl1" = "yes" ; then
+if test "$sdl" = "yes" ; then
   echo "#define CONFIG_SDL 1" >> $config_host_h
   echo "CONFIG_SDL=y" >> $config_host_mak
-  if test "$static" = "yes"; then
-    LIBS="$LIBS $sdl_static_libs"
-  else
-    LIBS="$LIBS $sdl_libs"
-  fi
+  LIBS="$LIBS $sdl_libs"
   echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
 fi
 if test "$cocoa" = "yes" ; then
Signature · 1 line
1.6.2.5
#21 lore raw
In reply to [email protected]
Quoted 4 lines · On Tue, Jul 21, 2009 at 1:13 AM, <[email protected]> wrote:

From: Juan Quintela <[email protected]>

Hi

Quoted 12 lines

More configuration cleanups on top of my previous series.
This one:
- when we test for a library, if we need it, we add the
 library to LIBS after checking. Found that we were checking for 2 xen libraries and then adding 3 to LIBS.
- starting moving variables to CPPCFLAGS.
- Big SDL cleanup.  SDL configuration have very old cruft there, from testing for target_sofmmu before it was set, to testing for "$sdl" = "yes" on the else part of tesing "$sdl" = yes.
- I added a configuration define: CONFIG_NOWIN32, I just needed a way to compile files for WIN32 or the rest.  If anyone has a better suggestion for th ename, it is welcome.

The obvious name would be CONFIG_POSIX, but are there any signs of life in !Win32 && !Posix?

Quoted 8 lines

After this series Makefile is basically clean from logic:

(simple-config-4)$ grep ifdef Makefile
ifdef BUILD_DOCS
ifdef INSTALL_BLOBS
(simple-config-4)$ grep ifndef Makefile
ifndef CONFIG_WIN32

Quoted 9 lines

ToDo:
- do the same for Makefile.target
- what to do with CFLAGS/CPPFLAGS.  At this point we have things like:
   sdl.o audio/sdlaudio.o sdl_zoom.o baum.o: CFLAGS += $(SDL_CFLAGS) Problem is that SDL_CFLAGS ends on fedora (I guess other unix got similar):
   -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT
 I felt nervous compling some files with -REENTRANT and other without it. Should we use a single CFLAGS for all files?  I would prefer to have a single CFLAGS, but it is not my call to make that decision.  What everybody else thinks?

There is still HELPER_CFLAGS which needs to be separate from CFLAGS.

Quoted 1 line

Coments, suggestions?

These are actually wishes for new Makefile features:

It would be nice to have one flag to control gcc optimization level, so that we could do something like
rm foo.o; make OPT=""
to recompile foo.o without gcc -O2 flag so that the execution logic etc. is handy for debugging with GDB.

Currently all files are recompiled for each -user target. At least path.c could be compiled only once, other files maybe could use similar approach as libhw32/64 (poisoning etc.).