From 2358a4940b7f9b863fa8084960f40517985df8c1 Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Mon, 27 Jul 2009 16:13:25 +0200 Subject: [PATCH] Generate config-host.h from config-host.mak Generate CONFIG_AUDIO_DRIVERS. Order is important here, because the first driver in the list is the one used by default. Signed-off-by: Juan Quintela Signed-off-by: Anthony Liguori --- audio/audio.c | 7 ++++- configure | 82 ++++++++++++++++++--------------------------------- create_config | 53 +++++++++++++++++++++++++++++++-- 3 files changed, 84 insertions(+), 58 deletions(-) diff --git a/audio/audio.c b/audio/audio.c index 694a83e4ec..0a3830dc43 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -37,8 +37,13 @@ #define SW_NAME(sw) (sw)->name ? (sw)->name : "unknown" + +/* Order of CONFIG_AUDIO_DRIVERS is import. + The 1st one is the one used by default, that is the reason + that we generate the list. +*/ static struct audio_driver *drvtab[] = { - AUDIO_DRIVERS + CONFIG_AUDIO_DRIVERS &no_audio_driver, &wav_audio_driver }; diff --git a/configure b/configure index 977acae46a..c915ada2f3 100755 --- a/configure +++ b/configure @@ -1486,9 +1486,8 @@ echo "# Automatically generated by configure - do not modify" > $config_host_mak printf "# Configured with:" >> $config_host_mak printf " '%s'" "$0" "$@" >> $config_host_mak echo >> $config_host_mak -echo "/* Automatically generated by configure - do not modify */" > $config_host_h -echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_host_h +echo "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak case "$cpu" in i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|sparc|sparc64) @@ -1503,26 +1502,21 @@ case "$cpu" in ;; esac echo "ARCH=$ARCH" >> $config_host_mak -arch_name=`echo $ARCH | tr '[:lower:]' '[:upper:]'` -echo "#define HOST_$arch_name 1" >> $config_host_h - if test "$debug_tcg" = "yes" ; then - echo "#define CONFIG_DEBUG_TCG 1" >> $config_host_h + echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak fi if test "$debug" = "yes" ; then - echo "#define CONFIG_DEBUG_EXEC 1" >> $config_host_h + echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak fi if test "$strip_opt" = "yes" ; then echo "STRIP_OPT=-s" >> $config_host_mak fi if test "$bigendian" = "yes" ; then echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak - echo "#define HOST_WORDS_BIGENDIAN 1" >> $config_host_h fi -echo "#define HOST_LONG_BITS $hostlongbits" >> $config_host_h +echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak if test "$mingw32" = "yes" ; then echo "CONFIG_WIN32=y" >> $config_host_mak - echo "#define CONFIG_WIN32 1" >> $config_host_h else echo "CONFIG_POSIX=y" >> $config_host_mak cat > $TMPC << EOF @@ -1530,7 +1524,7 @@ else int main(void) { return bswap_32(0); } EOF if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then - echo "#define CONFIG_BYTESWAP_H 1" >> $config_host_h + echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak fi cat > $TMPC << EOF #include @@ -1539,62 +1533,51 @@ EOF int main(void) { return bswap32(0); } EOF if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then - echo "#define CONFIG_MACHINE_BSWAP_H 1" >> $config_host_h + echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak fi fi if test "$darwin" = "yes" ; then echo "CONFIG_DARWIN=y" >> $config_host_mak - echo "#define CONFIG_DARWIN 1" >> $config_host_h fi if test "$aix" = "yes" ; then echo "CONFIG_AIX=y" >> $config_host_mak - echo "#define CONFIG_AIX 1" >> $config_host_h fi if test "$solaris" = "yes" ; then echo "CONFIG_SOLARIS=y" >> $config_host_mak - echo "#define CONFIG_SOLARIS 1" >> $config_host_h - echo "#define CONFIG_SOLARIS_VERSION $solarisrev" >> $config_host_h + echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak if test "$needs_libsunmath" = "yes" ; then echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak - echo "#define CONFIG_NEEDS_LIBSUNMATH 1" >> $config_host_h fi fi if test -n "$sparc_cpu"; then echo "CONFIG__sparc_${sparc_cpu}__=y" >> $config_host_mak - echo "#define __sparc_${sparc_cpu}__ 1" >> $config_host_h fi if test "$gprof" = "yes" ; then echo "TARGET_GPROF=yes" >> $config_host_mak - echo "#define TARGET_GPROF 1" >> $config_host_h fi if test "$static" = "yes" ; then echo "CONFIG_STATIC=y" >> $config_host_mak - echo "#define CONFIG_STATIC 1" >> $config_host_h LDFLAGS="$LDFLAGS -static" fi if test $profiler = "yes" ; then - echo "#define CONFIG_PROFILER 1" >> $config_host_h + echo "CONFIG_PROFILER=y" >> $config_host_mak fi if test "$slirp" = "yes" ; then echo "CONFIG_SLIRP=y" >> $config_host_mak - echo "#define CONFIG_SLIRP 1" >> $config_host_h fi if test "$vde" = "yes" ; then echo "CONFIG_VDE=y" >> $config_host_mak - echo "#define CONFIG_VDE 1" >> $config_host_h echo "VDE_LIBS=$vde_libs" >> $config_host_mak fi for card in $audio_card_list; do def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'` echo "$def=y" >> $config_host_mak - echo "#define $def 1" >> $config_host_h done -echo "#define AUDIO_DRIVERS \\" >> $config_host_h +echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak for drv in $audio_drv_list; do - echo " &${drv}_audio_driver, \\" >>$config_host_h def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'` echo "$def=y" >> $config_host_mak if test "$drv" = "fmod"; then @@ -1604,32 +1587,25 @@ for drv in $audio_drv_list; do echo "OSS_LIBS=$oss_lib" >> $config_host_mak fi done -echo "" >>$config_host_h if test "$mixemu" = "yes" ; then echo "CONFIG_MIXEMU=y" >> $config_host_mak - echo "#define CONFIG_MIXEMU 1" >> $config_host_h fi if test "$vnc_tls" = "yes" ; then echo "CONFIG_VNC_TLS=y" >> $config_host_mak echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak echo "VNC_TLS_LIBS=$vnc_tls_libs" >> $config_host_mak - echo "#define CONFIG_VNC_TLS 1" >> $config_host_h fi if test "$vnc_sasl" = "yes" ; then echo "CONFIG_VNC_SASL=y" >> $config_host_mak echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak echo "VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_host_mak - echo "#define CONFIG_VNC_SASL 1" >> $config_host_h fi if test "$fnmatch" = "yes" ; then - echo "#define CONFIG_FNMATCH 1" >> $config_host_h + echo "CONFIG_FNMATCH=y" >> $config_host_mak fi qemu_version=`head $source_path/VERSION` echo "VERSION=$qemu_version" >>$config_host_mak -echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_host_h - -echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_host_h - +echo "PKGVERSION=$pkgversion" >>$config_host_mak echo "SRC_PATH=$source_path" >> $config_host_mak if [ "$source_path_used" = "yes" ]; then echo "VPATH=$source_path" >> $config_host_mak @@ -1639,84 +1615,75 @@ if [ "$build_docs" = "yes" ] ; then echo "BUILD_DOCS=yes" >> $config_host_mak fi if test "$sdl" = "yes" ; then - echo "#define CONFIG_SDL 1" >> $config_host_h 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 - echo "#define CONFIG_COCOA 1" >> $config_host_h echo "CONFIG_COCOA=y" >> $config_host_mak fi if test "$curses" = "yes" ; then - echo "#define CONFIG_CURSES 1" >> $config_host_h echo "CONFIG_CURSES=y" >> $config_host_mak echo "CURSES_LIBS=$curses_libs" >> $config_host_mak fi if test "$atfile" = "yes" ; then - echo "#define CONFIG_ATFILE 1" >> $config_host_h + echo "CONFIG_ATFILE=y" >> $config_host_mak fi if test "$utimens" = "yes" ; then - echo "#define CONFIG_UTIMENSAT 1" >> $config_host_h + echo "CONFIG_UTIMENSAT=y" >> $config_host_mak fi if test "$pipe2" = "yes" ; then - echo "#define CONFIG_PIPE2 1" >> $config_host_h + echo "CONFIG_PIPE2=y" >> $config_host_mak fi if test "$splice" = "yes" ; then - echo "#define CONFIG_SPLICE 1" >> $config_host_h + echo "CONFIG_SPLICE=y" >> $config_host_mak fi if test "$inotify" = "yes" ; then - echo "#define CONFIG_INOTIFY 1" >> $config_host_h + echo "CONFIG_INOTIFY=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 - echo "#define CONFIG_CURL 1" >> $config_host_h fi if test "$brlapi" = "yes" ; then echo "CONFIG_BRLAPI=y" >> $config_host_mak - echo "#define CONFIG_BRLAPI 1" >> $config_host_h echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak fi if test "$bluez" = "yes" ; then echo "CONFIG_BLUEZ=y" >> $config_host_mak echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak echo "BLUEZ_LIBS=$bluez_libs" >> $config_host_mak - echo "#define CONFIG_BLUEZ 1" >> $config_host_h fi if test "$xen" = "yes" ; then echo "CONFIG_XEN=y" >> $config_host_mak echo "XEN_LIBS=$xen_libs" >> $config_host_mak fi if test "$aio" = "yes" ; then - echo "#define CONFIG_AIO 1" >> $config_host_h echo "CONFIG_AIO=y" >> $config_host_mak fi if test "$io_thread" = "yes" ; then echo "CONFIG_IOTHREAD=y" >> $config_host_mak - echo "#define CONFIG_IOTHREAD 1" >> $config_host_h fi if test "$blobs" = "yes" ; then echo "INSTALL_BLOBS=yes" >> $config_host_mak fi if test "$iovec" = "yes" ; then - echo "#define CONFIG_IOVEC 1" >> $config_host_h + echo "CONFIG_IOVEC=y" >> $config_host_mak fi if test "$preadv" = "yes" ; then - echo "#define CONFIG_PREADV 1" >> $config_host_h + echo "CONFIG_PREADV=y" >> $config_host_mak fi if test "$fdt" = "yes" ; then echo "CONFIG_FDT=y" >> $config_host_mak - echo "#define CONFIG_FDT 1" >> $config_host_h echo "FDT_LIBS=$fdt_libs" >> $config_host_mak fi # XXX: suppress that if [ "$bsd" = "yes" ] ; then - echo "#define CONFIG_BSD 1" >> $config_host_h + echo "CONFIG_BSD=y" >> $config_host_mak fi -echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_host_h +echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak # USB host support case "$usb" in @@ -1803,6 +1770,10 @@ 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 + +$source_path/create_config < $config_host_mak >> $config_host_h + if test -f ${config_host_h}~ ; then if cmp -s $config_host_h ${config_host_h}~ ; then mv ${config_host_h}~ $config_host_h @@ -2069,7 +2040,10 @@ if test "$target_bsd_user" = "yes" ; then echo "CONFIG_BSD_USER=y" >> $config_mak fi -$source_path/create_config < $config_mak > $config_h +echo "/* Automatically generated by configure - do not modify */" > $config_h +echo "#include \"../config-host.h\"" >> $config_h + +$source_path/create_config < $config_mak >> $config_h if test -f ${config_h}~ ; then if cmp -s $config_h ${config_h}~ ; then diff --git a/create_config b/create_config index 8b7b365d7f..8e757f363a 100755 --- a/create_config +++ b/create_config @@ -1,11 +1,35 @@ #!/bin/sh -echo "/* Automatically generated by configure - do not modify */" -echo "#include \"../config-host.h\"" - while read line; do case $line in + VERSION=*) # configuration + version=${line#*=} + echo "#define QEMU_VERSION \"$version\"" + ;; + PKGVERSION=*) # configuration + pkgversion=${line#*=} + echo "#define QEMU_PKGVERSION \"$pkgversion\"" + ;; + ARCH=*) # configuration + arch=${line#*=} + 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 \\" + for drv in $drivers; do + echo " &${drv}_audio_driver,\\" + done + echo "" + ;; CONFIG_*=y) # configuration name=${line%=*} echo "#define $name 1" @@ -15,6 +39,26 @@ case $line in value=${line#*=} echo "#define $name $value" ;; + ARCH=*) # configuration + arch=${line#*=} + arch_name=`echo $arch | tr '[:lower:]' '[:upper:]'` + echo "#define HOST_$arch_name 1" + ;; + HOST_USB=*) + # do nothing + ;; + HOST_CC=*) + # do nothing + ;; + HOST_*=y) # configuration + name=${line%=*} + echo "#define $name 1" + ;; + HOST_*=*) # configuration + name=${line%=*} + value=${line#*=} + echo "#define $name $value" + ;; TARGET_ARCH=*) # configuration target_arch=${line#*=} arch_name=`echo $target_arch | tr '[:lower:]' '[:upper:]'` @@ -37,6 +81,9 @@ case $line in TARGET_ARCH2=*) # do nothing ;; + TARGET_DIRS=*) + # do nothing + ;; TARGET_*=y) # configuration name=${line%=*} echo "#define $name 1"