Commit 2358a4940b7f9b863fa8084960f40517985df8c1

Authored by Juan Quintela
Committed by Anthony Liguori
1 parent 2f7bb878

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 <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
audio/audio.c
... ... @@ -37,8 +37,13 @@
37 37  
38 38 #define SW_NAME(sw) (sw)->name ? (sw)->name : "unknown"
39 39  
  40 +
  41 +/* Order of CONFIG_AUDIO_DRIVERS is import.
  42 + The 1st one is the one used by default, that is the reason
  43 + that we generate the list.
  44 +*/
40 45 static struct audio_driver *drvtab[] = {
41   - AUDIO_DRIVERS
  46 + CONFIG_AUDIO_DRIVERS
42 47 &no_audio_driver,
43 48 &wav_audio_driver
44 49 };
... ...
configure
... ... @@ -1486,9 +1486,8 @@ echo &quot;# Automatically generated by configure - do not modify&quot; &gt; $config_host_mak
1486 1486 printf "# Configured with:" >> $config_host_mak
1487 1487 printf " '%s'" "$0" "$@" >> $config_host_mak
1488 1488 echo >> $config_host_mak
1489   -echo "/* Automatically generated by configure - do not modify */" > $config_host_h
1490 1489  
1491   -echo "#define CONFIG_QEMU_SHAREDIR \"$prefix$datasuffix\"" >> $config_host_h
  1490 +echo "CONFIG_QEMU_SHAREDIR=\"$prefix$datasuffix\"" >> $config_host_mak
1492 1491  
1493 1492 case "$cpu" in
1494 1493 i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|sparc|sparc64)
... ... @@ -1503,26 +1502,21 @@ case &quot;$cpu&quot; in
1503 1502 ;;
1504 1503 esac
1505 1504 echo "ARCH=$ARCH" >> $config_host_mak
1506   -arch_name=`echo $ARCH | tr '[:lower:]' '[:upper:]'`
1507   -echo "#define HOST_$arch_name 1" >> $config_host_h
1508   -
1509 1505 if test "$debug_tcg" = "yes" ; then
1510   - echo "#define CONFIG_DEBUG_TCG 1" >> $config_host_h
  1506 + echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
1511 1507 fi
1512 1508 if test "$debug" = "yes" ; then
1513   - echo "#define CONFIG_DEBUG_EXEC 1" >> $config_host_h
  1509 + echo "CONFIG_DEBUG_EXEC=y" >> $config_host_mak
1514 1510 fi
1515 1511 if test "$strip_opt" = "yes" ; then
1516 1512 echo "STRIP_OPT=-s" >> $config_host_mak
1517 1513 fi
1518 1514 if test "$bigendian" = "yes" ; then
1519 1515 echo "HOST_WORDS_BIGENDIAN=y" >> $config_host_mak
1520   - echo "#define HOST_WORDS_BIGENDIAN 1" >> $config_host_h
1521 1516 fi
1522   -echo "#define HOST_LONG_BITS $hostlongbits" >> $config_host_h
  1517 +echo "HOST_LONG_BITS=$hostlongbits" >> $config_host_mak
1523 1518 if test "$mingw32" = "yes" ; then
1524 1519 echo "CONFIG_WIN32=y" >> $config_host_mak
1525   - echo "#define CONFIG_WIN32 1" >> $config_host_h
1526 1520 else
1527 1521 echo "CONFIG_POSIX=y" >> $config_host_mak
1528 1522 cat > $TMPC << EOF
... ... @@ -1530,7 +1524,7 @@ else
1530 1524 int main(void) { return bswap_32(0); }
1531 1525 EOF
1532 1526 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1533   - echo "#define CONFIG_BYTESWAP_H 1" >> $config_host_h
  1527 + echo "CONFIG_BYTESWAP_H=y" >> $config_host_mak
1534 1528 fi
1535 1529 cat > $TMPC << EOF
1536 1530 #include <sys/endian.h>
... ... @@ -1539,62 +1533,51 @@ EOF
1539 1533 int main(void) { return bswap32(0); }
1540 1534 EOF
1541 1535 if $cc $ARCH_CFLAGS -o $TMPE $TMPC >/dev/null 2> /dev/null ; then
1542   - echo "#define CONFIG_MACHINE_BSWAP_H 1" >> $config_host_h
  1536 + echo "CONFIG_MACHINE_BSWAP_H=y" >> $config_host_mak
1543 1537 fi
1544 1538 fi
1545 1539  
1546 1540 if test "$darwin" = "yes" ; then
1547 1541 echo "CONFIG_DARWIN=y" >> $config_host_mak
1548   - echo "#define CONFIG_DARWIN 1" >> $config_host_h
1549 1542 fi
1550 1543  
1551 1544 if test "$aix" = "yes" ; then
1552 1545 echo "CONFIG_AIX=y" >> $config_host_mak
1553   - echo "#define CONFIG_AIX 1" >> $config_host_h
1554 1546 fi
1555 1547  
1556 1548 if test "$solaris" = "yes" ; then
1557 1549 echo "CONFIG_SOLARIS=y" >> $config_host_mak
1558   - echo "#define CONFIG_SOLARIS 1" >> $config_host_h
1559   - echo "#define CONFIG_SOLARIS_VERSION $solarisrev" >> $config_host_h
  1550 + echo "CONFIG_SOLARIS_VERSION=$solarisrev" >> $config_host_mak
1560 1551 if test "$needs_libsunmath" = "yes" ; then
1561 1552 echo "CONFIG_NEEDS_LIBSUNMATH=y" >> $config_host_mak
1562   - echo "#define CONFIG_NEEDS_LIBSUNMATH 1" >> $config_host_h
1563 1553 fi
1564 1554 fi
1565 1555 if test -n "$sparc_cpu"; then
1566 1556 echo "CONFIG__sparc_${sparc_cpu}__=y" >> $config_host_mak
1567   - echo "#define __sparc_${sparc_cpu}__ 1" >> $config_host_h
1568 1557 fi
1569 1558 if test "$gprof" = "yes" ; then
1570 1559 echo "TARGET_GPROF=yes" >> $config_host_mak
1571   - echo "#define TARGET_GPROF 1" >> $config_host_h
1572 1560 fi
1573 1561 if test "$static" = "yes" ; then
1574 1562 echo "CONFIG_STATIC=y" >> $config_host_mak
1575   - echo "#define CONFIG_STATIC 1" >> $config_host_h
1576 1563 LDFLAGS="$LDFLAGS -static"
1577 1564 fi
1578 1565 if test $profiler = "yes" ; then
1579   - echo "#define CONFIG_PROFILER 1" >> $config_host_h
  1566 + echo "CONFIG_PROFILER=y" >> $config_host_mak
1580 1567 fi
1581 1568 if test "$slirp" = "yes" ; then
1582 1569 echo "CONFIG_SLIRP=y" >> $config_host_mak
1583   - echo "#define CONFIG_SLIRP 1" >> $config_host_h
1584 1570 fi
1585 1571 if test "$vde" = "yes" ; then
1586 1572 echo "CONFIG_VDE=y" >> $config_host_mak
1587   - echo "#define CONFIG_VDE 1" >> $config_host_h
1588 1573 echo "VDE_LIBS=$vde_libs" >> $config_host_mak
1589 1574 fi
1590 1575 for card in $audio_card_list; do
1591 1576 def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
1592 1577 echo "$def=y" >> $config_host_mak
1593   - echo "#define $def 1" >> $config_host_h
1594 1578 done
1595   -echo "#define AUDIO_DRIVERS \\" >> $config_host_h
  1579 +echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
1596 1580 for drv in $audio_drv_list; do
1597   - echo " &${drv}_audio_driver, \\" >>$config_host_h
1598 1581 def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
1599 1582 echo "$def=y" >> $config_host_mak
1600 1583 if test "$drv" = "fmod"; then
... ... @@ -1604,32 +1587,25 @@ for drv in $audio_drv_list; do
1604 1587 echo "OSS_LIBS=$oss_lib" >> $config_host_mak
1605 1588 fi
1606 1589 done
1607   -echo "" >>$config_host_h
1608 1590 if test "$mixemu" = "yes" ; then
1609 1591 echo "CONFIG_MIXEMU=y" >> $config_host_mak
1610   - echo "#define CONFIG_MIXEMU 1" >> $config_host_h
1611 1592 fi
1612 1593 if test "$vnc_tls" = "yes" ; then
1613 1594 echo "CONFIG_VNC_TLS=y" >> $config_host_mak
1614 1595 echo "VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_host_mak
1615 1596 echo "VNC_TLS_LIBS=$vnc_tls_libs" >> $config_host_mak
1616   - echo "#define CONFIG_VNC_TLS 1" >> $config_host_h
1617 1597 fi
1618 1598 if test "$vnc_sasl" = "yes" ; then
1619 1599 echo "CONFIG_VNC_SASL=y" >> $config_host_mak
1620 1600 echo "VNC_SASL_CFLAGS=$vnc_sasl_cflags" >> $config_host_mak
1621 1601 echo "VNC_SASL_LIBS=$vnc_sasl_libs" >> $config_host_mak
1622   - echo "#define CONFIG_VNC_SASL 1" >> $config_host_h
1623 1602 fi
1624 1603 if test "$fnmatch" = "yes" ; then
1625   - echo "#define CONFIG_FNMATCH 1" >> $config_host_h
  1604 + echo "CONFIG_FNMATCH=y" >> $config_host_mak
1626 1605 fi
1627 1606 qemu_version=`head $source_path/VERSION`
1628 1607 echo "VERSION=$qemu_version" >>$config_host_mak
1629   -echo "#define QEMU_VERSION \"$qemu_version\"" >> $config_host_h
1630   -
1631   -echo "#define QEMU_PKGVERSION \"$pkgversion\"" >> $config_host_h
1632   -
  1608 +echo "PKGVERSION=$pkgversion" >>$config_host_mak
1633 1609 echo "SRC_PATH=$source_path" >> $config_host_mak
1634 1610 if [ "$source_path_used" = "yes" ]; then
1635 1611 echo "VPATH=$source_path" >> $config_host_mak
... ... @@ -1639,84 +1615,75 @@ if [ &quot;$build_docs&quot; = &quot;yes&quot; ] ; then
1639 1615 echo "BUILD_DOCS=yes" >> $config_host_mak
1640 1616 fi
1641 1617 if test "$sdl" = "yes" ; then
1642   - echo "#define CONFIG_SDL 1" >> $config_host_h
1643 1618 echo "CONFIG_SDL=y" >> $config_host_mak
1644 1619 echo "SDL_LIBS=$sdl_libs" >> $config_host_mak
1645 1620 echo "SDL_CFLAGS=$sdl_cflags" >> $config_host_mak
1646 1621 fi
1647 1622 if test "$cocoa" = "yes" ; then
1648   - echo "#define CONFIG_COCOA 1" >> $config_host_h
1649 1623 echo "CONFIG_COCOA=y" >> $config_host_mak
1650 1624 fi
1651 1625 if test "$curses" = "yes" ; then
1652   - echo "#define CONFIG_CURSES 1" >> $config_host_h
1653 1626 echo "CONFIG_CURSES=y" >> $config_host_mak
1654 1627 echo "CURSES_LIBS=$curses_libs" >> $config_host_mak
1655 1628 fi
1656 1629 if test "$atfile" = "yes" ; then
1657   - echo "#define CONFIG_ATFILE 1" >> $config_host_h
  1630 + echo "CONFIG_ATFILE=y" >> $config_host_mak
1658 1631 fi
1659 1632 if test "$utimens" = "yes" ; then
1660   - echo "#define CONFIG_UTIMENSAT 1" >> $config_host_h
  1633 + echo "CONFIG_UTIMENSAT=y" >> $config_host_mak
1661 1634 fi
1662 1635 if test "$pipe2" = "yes" ; then
1663   - echo "#define CONFIG_PIPE2 1" >> $config_host_h
  1636 + echo "CONFIG_PIPE2=y" >> $config_host_mak
1664 1637 fi
1665 1638 if test "$splice" = "yes" ; then
1666   - echo "#define CONFIG_SPLICE 1" >> $config_host_h
  1639 + echo "CONFIG_SPLICE=y" >> $config_host_mak
1667 1640 fi
1668 1641 if test "$inotify" = "yes" ; then
1669   - echo "#define CONFIG_INOTIFY 1" >> $config_host_h
  1642 + echo "CONFIG_INOTIFY=y" >> $config_host_mak
1670 1643 fi
1671 1644 if test "$curl" = "yes" ; then
1672 1645 echo "CONFIG_CURL=y" >> $config_host_mak
1673 1646 echo "CURL_LIBS=$curl_libs" >> $config_host_mak
1674   - echo "#define CONFIG_CURL 1" >> $config_host_h
1675 1647 fi
1676 1648 if test "$brlapi" = "yes" ; then
1677 1649 echo "CONFIG_BRLAPI=y" >> $config_host_mak
1678   - echo "#define CONFIG_BRLAPI 1" >> $config_host_h
1679 1650 echo "BRLAPI_LIBS=$brlapi_libs" >> $config_host_mak
1680 1651 fi
1681 1652 if test "$bluez" = "yes" ; then
1682 1653 echo "CONFIG_BLUEZ=y" >> $config_host_mak
1683 1654 echo "BLUEZ_CFLAGS=$bluez_cflags" >> $config_host_mak
1684 1655 echo "BLUEZ_LIBS=$bluez_libs" >> $config_host_mak
1685   - echo "#define CONFIG_BLUEZ 1" >> $config_host_h
1686 1656 fi
1687 1657 if test "$xen" = "yes" ; then
1688 1658 echo "CONFIG_XEN=y" >> $config_host_mak
1689 1659 echo "XEN_LIBS=$xen_libs" >> $config_host_mak
1690 1660 fi
1691 1661 if test "$aio" = "yes" ; then
1692   - echo "#define CONFIG_AIO 1" >> $config_host_h
1693 1662 echo "CONFIG_AIO=y" >> $config_host_mak
1694 1663 fi
1695 1664 if test "$io_thread" = "yes" ; then
1696 1665 echo "CONFIG_IOTHREAD=y" >> $config_host_mak
1697   - echo "#define CONFIG_IOTHREAD 1" >> $config_host_h
1698 1666 fi
1699 1667 if test "$blobs" = "yes" ; then
1700 1668 echo "INSTALL_BLOBS=yes" >> $config_host_mak
1701 1669 fi
1702 1670 if test "$iovec" = "yes" ; then
1703   - echo "#define CONFIG_IOVEC 1" >> $config_host_h
  1671 + echo "CONFIG_IOVEC=y" >> $config_host_mak
1704 1672 fi
1705 1673 if test "$preadv" = "yes" ; then
1706   - echo "#define CONFIG_PREADV 1" >> $config_host_h
  1674 + echo "CONFIG_PREADV=y" >> $config_host_mak
1707 1675 fi
1708 1676 if test "$fdt" = "yes" ; then
1709 1677 echo "CONFIG_FDT=y" >> $config_host_mak
1710   - echo "#define CONFIG_FDT 1" >> $config_host_h
1711 1678 echo "FDT_LIBS=$fdt_libs" >> $config_host_mak
1712 1679 fi
1713 1680  
1714 1681 # XXX: suppress that
1715 1682 if [ "$bsd" = "yes" ] ; then
1716   - echo "#define CONFIG_BSD 1" >> $config_host_h
  1683 + echo "CONFIG_BSD=y" >> $config_host_mak
1717 1684 fi
1718 1685  
1719   -echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_host_h
  1686 +echo "CONFIG_UNAME_RELEASE=\"$uname_release\"" >> $config_host_mak
1720 1687  
1721 1688 # USB host support
1722 1689 case "$usb" in
... ... @@ -1803,6 +1770,10 @@ echo &quot;EXESUF=$EXESUF&quot; &gt;&gt; $config_host_mak
1803 1770 echo "PTHREADLIBS=$PTHREADLIBS" >> $config_host_mak
1804 1771 echo "CLOCKLIBS=$CLOCKLIBS" >> $config_host_mak
1805 1772  
  1773 +echo "/* Automatically generated by configure - do not modify */" > $config_host_h
  1774 +
  1775 +$source_path/create_config < $config_host_mak >> $config_host_h
  1776 +
1806 1777 if test -f ${config_host_h}~ ; then
1807 1778 if cmp -s $config_host_h ${config_host_h}~ ; then
1808 1779 mv ${config_host_h}~ $config_host_h
... ... @@ -2069,7 +2040,10 @@ if test &quot;$target_bsd_user&quot; = &quot;yes&quot; ; then
2069 2040 echo "CONFIG_BSD_USER=y" >> $config_mak
2070 2041 fi
2071 2042  
2072   -$source_path/create_config < $config_mak > $config_h
  2043 +echo "/* Automatically generated by configure - do not modify */" > $config_h
  2044 +echo "#include \"../config-host.h\"" >> $config_h
  2045 +
  2046 +$source_path/create_config < $config_mak >> $config_h
2073 2047  
2074 2048 if test -f ${config_h}~ ; then
2075 2049 if cmp -s $config_h ${config_h}~ ; then
... ...
create_config
1 1 #!/bin/sh
2 2  
3   -echo "/* Automatically generated by configure - do not modify */"
4   -echo "#include \"../config-host.h\""
5   -
6 3 while read line; do
7 4  
8 5 case $line in
  6 + VERSION=*) # configuration
  7 + version=${line#*=}
  8 + echo "#define QEMU_VERSION \"$version\""
  9 + ;;
  10 + PKGVERSION=*) # configuration
  11 + pkgversion=${line#*=}
  12 + echo "#define QEMU_PKGVERSION \"$pkgversion\""
  13 + ;;
  14 + ARCH=*) # configuration
  15 + arch=${line#*=}
  16 + arch_name=`echo $arch | tr '[:lower:]' '[:upper:]'`
  17 + echo "#define HOST_$arch_name 1"
  18 + ;;
  19 + CONFIG__sparc_*=y) # configuration
  20 + name=${line%=*}
  21 + name=${name#CONFIG}
  22 + value=${line#*=}
  23 + echo "#define $name $value"
  24 + ;;
  25 + CONFIG_AUDIO_DRIVERS=*)
  26 + drivers=${line#*=}
  27 + echo "#define CONFIG_AUDIO_DRIVERS \\"
  28 + for drv in $drivers; do
  29 + echo " &${drv}_audio_driver,\\"
  30 + done
  31 + echo ""
  32 + ;;
9 33 CONFIG_*=y) # configuration
10 34 name=${line%=*}
11 35 echo "#define $name 1"
... ... @@ -15,6 +39,26 @@ case $line in
15 39 value=${line#*=}
16 40 echo "#define $name $value"
17 41 ;;
  42 + ARCH=*) # configuration
  43 + arch=${line#*=}
  44 + arch_name=`echo $arch | tr '[:lower:]' '[:upper:]'`
  45 + echo "#define HOST_$arch_name 1"
  46 + ;;
  47 + HOST_USB=*)
  48 + # do nothing
  49 + ;;
  50 + HOST_CC=*)
  51 + # do nothing
  52 + ;;
  53 + HOST_*=y) # configuration
  54 + name=${line%=*}
  55 + echo "#define $name 1"
  56 + ;;
  57 + HOST_*=*) # configuration
  58 + name=${line%=*}
  59 + value=${line#*=}
  60 + echo "#define $name $value"
  61 + ;;
18 62 TARGET_ARCH=*) # configuration
19 63 target_arch=${line#*=}
20 64 arch_name=`echo $target_arch | tr '[:lower:]' '[:upper:]'`
... ... @@ -37,6 +81,9 @@ case $line in
37 81 TARGET_ARCH2=*)
38 82 # do nothing
39 83 ;;
  84 + TARGET_DIRS=*)
  85 + # do nothing
  86 + ;;
40 87 TARGET_*=y) # configuration
41 88 name=${line%=*}
42 89 echo "#define $name 1"
... ...