1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
/*
kinfo.c: A small program that includes several kernel heades
and builds a header defining options for 3dfx_driver.c.
1999/12/22 Joseph Kain <joseph@3dfx.com>
* Initial version
*/
#include <stdio.h>
/* These include files will bring in the information we need */
#include <linux/autoconf.h>
#include <linux/version.h>
int
main (int argc, char **argv)
{
/* Here is the strategy. The old Makefile would have grepped the kernel
* headers and put these defines on the command line. Now we include
* the kernel headers and extract the information. Then we create a
* new header with all of the options we need. */
if (argc == 1)
{
FILE *f = fopen ("kinfo.h", "w");
FILE *p = NULL;
int result;
char temp[1000];
#ifdef CONFIG_MTRR
/* It is not enough to just check if the kernel supports MTRRs, if the
* processor doesn't have MTRRs then its possible (and likely) that
* the kernel was still compiled with MTRR support. So we also have to
* check the processor has MTRRs. */
result = system ("grep mtrr /proc/cpuinfo > /dev/null");
/* See if grep found anything */
if (result == 0) /* Grep reported a match */
{
fprintf (f, "#define HAVE_MTRR\n");
}
#endif
#ifdef CONFIG_SMP
fprintf (f, "#define __SMP__\n");
#endif
#ifdef CONFIG_MODVERSIONS
fprintf (f, "#define MODVERSIONS\n");
#endif
fclose (f);
}
else
{
if (strcmp (argv[1], "--UTS") == 0)
{
printf ("%s", UTS_RELEASE);
}
}
}
|