changeset 25271:4ba5a1593296

add new configure option to disable VIDIX PCI device name database (saves a 300 kB on mplayer binary)
author ben
date Tue, 04 Dec 2007 18:10:20 +0000
parents f2a95277b9cf
children 21bd7360eb03
files configure vidix/Makefile vidix/pci_db2c.awk
diffstat 3 files changed, 22 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Tue Dec 04 15:26:56 2007 +0000
+++ b/configure	Tue Dec 04 18:10:20 2007 +0000
@@ -337,6 +337,7 @@
   --with-vidix-drivers[=*] list of VIDIX drivers to be compiled in
                            Available: cyberblade,ivtv,mach64,mga,mga_crtc2,
                            nvidia,pm2,pm3,radeon,rage128,savage,sis,unichrome
+  --disable-vidix-pcidb    disable VIDIX PCI device name database
   --enable-gl              enable OpenGL video output [autodetect]
   --enable-dga2            enable DGA 2 support [autodetect]
   --enable-dga1            enable DGA 1 support [autodetect]
@@ -610,6 +611,7 @@
 _smbsupport=auto
 _vidix_internal=auto
 _vidix_external=auto
+_vidix_pcidb=yes
 _joystick=no
 _xvid=auto
 _x264=auto
@@ -997,6 +999,7 @@
   --with-vidix-drivers=*)
     _vidix_drivers=`echo $ac_option | cut -d '=' -f 2`
     ;;
+  --disable-vidix-pcidb)        _vidix_pcidb=no         ;;
   --enable-joystick)	_joystick=yes	;;
   --disable-joystick)	_joystick=no	;;
   --enable-xvid)	_xvid=yes	;;
@@ -4257,6 +4260,13 @@
   _novomodules="xvidix $_novomodules"
 fi
 
+echocheck "VIDIX PCI device name database"
+echores "$_vidix_pcidb"
+if test "$_vidix_pcidb" = yes ; then
+  _vidix_pcidb_val=1
+else
+  _vidix_pcidb_val=0
+fi
 
 echocheck "/dev/mga_vid"
 if test "$_mga" = auto ; then
@@ -7574,6 +7584,7 @@
 VIDIX = $_vidix
 VIDIX_INTERNAL = $_vidix_internal
 VIDIX_EXTERNAL = $_vidix_external
+VIDIX_PCIDB = $_vidix_pcidb_val
 CONFIG_PP = yes
 MP3LAME = $_mp3lame
 LIBMENU = $_menu
--- a/vidix/Makefile	Tue Dec 04 15:26:56 2007 +0000
+++ b/vidix/Makefile	Tue Dec 04 18:10:20 2007 +0000
@@ -47,7 +47,7 @@
 	$(CC) -c $(CFLAGS) -DRAGE128 -o $@ $<
 
 pci_names.c pci_dev_ids.c: pci.db
-	LC_ALL=C awk -f pci_db2c.awk $<
+	LC_ALL=C awk -f pci_db2c.awk $< $(VIDIX_PCIDB)
 
 clean::
 	rm -f pci_*.c pci_*.h
--- a/vidix/pci_db2c.awk	Tue Dec 04 15:26:56 2007 +0000
+++ b/vidix/pci_db2c.awk	Tue Dec 04 18:10:20 2007 +0000
@@ -26,12 +26,13 @@
 
 BEGIN {
 
-    if(ARGC != 2) {
+    if(ARGC != 3) {
 # check for arguments:
 	print "Usage awk -f pci_db2c.awk pci.db (and make sure pci.db file exists first)";
 	exit(1);
     }
     in_file = ARGV[1];
+    with_pci_db = ARGV[2];
     vendor_file = "pci_vendors.h";
     ids_file = "pci_ids.h"
     name_file = "pci_names.c"
@@ -60,9 +61,11 @@
     print_name_struct(name_h_file);
     print "#include <stddef.h>">name_file
     print "#include \"pci_names.h\"">name_file
+    if (with_pci_db) {
     print "#include \"pci_dev_ids.c\"">name_file
     print "">name_file
     print "static struct vendor_id_s vendor_ids[] = {">name_file
+    }
     first_pass=1;
     init_name_db();
     while(getline <in_file) 
@@ -78,7 +81,7 @@
 		printf("#define VENDOR_%s\t", svend_name) >vendor_file;
 		if(length(svend_name) < 9) printf("\t") >vendor_file;
 		printf("0x%s /*%s*/\n",field[2], name_field) >vendor_file;
-		printf("{ 0x%s, \"%s\", dev_lst_%s },\n",field[2], name_field, field[2]) >name_file;
+		if (with_pci_db) printf("{ 0x%s, \"%s\", dev_lst_%s },\n",field[2], name_field, field[2]) >name_file;
 		printf("/* Vendor: %s: %s */\n", field[2], name_field) > ids_file
 		if(first_pass == 1) { first_pass=0; }
 		else	{ print "{ 0xFFFF,  NULL }\n};" >dev_ids_file; }
@@ -118,7 +121,7 @@
     print "#endif/*PCI_IDS_INCLUDED*/">ids_file
     print "">name_h_file
     print "#endif/*PCI_NAMES_INCLUDED*/">name_h_file
-    print "};">name_file
+    if (with_pci_db) print "};">name_file
     print "{ 0xFFFF,  NULL }" >dev_ids_file;
     print "};">dev_ids_file
     print_func_bodies(name_file);
@@ -172,16 +175,19 @@
    print "">out_file
    print "const char *pci_vendor_name(unsigned short id)" >out_file
    print "{" >out_file
+   if (with_pci_db) {
    print "  unsigned i;" >out_file
    print "  for(i=0;i<sizeof(vendor_ids)/sizeof(struct vendor_id_s);i++)">out_file
    print "  {" >out_file
    print "\tif(vendor_ids[i].id == id) return vendor_ids[i].name;" >out_file
    print "  }" >out_file
+   }
    print "  return NULL;" >out_file
    print "}">out_file
    print "" >out_file
    print "const char *pci_device_name(unsigned short vendor_id, unsigned short device_id)" >out_file
    print "{" >out_file
+   if (with_pci_db) {
    print "  unsigned i, j;" >out_file
    print "  for(i=0;i<sizeof(vendor_ids)/sizeof(struct vendor_id_s);i++)">out_file
    print "  {" >out_file
@@ -196,6 +202,7 @@
    print "\t  break;" >out_file
    print "\t}" >out_file
    print "  }" >out_file
+   }
    print "  return NULL;">out_file
    print "}">out_file
    return