📄 configure.c
字号:
{ char buf[1024]; int i = 0; FILE *oldf; fprintf (stderr, "Copying old configuration from `%s'\n", filename); if ((oldf = fopen (filename, "r")) == NULL) { fprintf (stderr, "Couldn't open previous configuration file\n"); perror (filename); return 0; } while (fgets (buf, 1024, oldf) != NULL) { char tmp[100]; if (buf[0] != '#') { printf ("%s", buf); strncpy (tmp, buf, 8); tmp[8] = 0; if (strcmp (tmp, "/*build ") == 0) rebuild_file (&buf[8]); continue; } strncpy (tmp, buf, 8); tmp[8] = 0; if (strcmp (tmp, "#define ") == 0) { char *id = &buf[8]; i = 0; while (id[i] && id[i] != ' ' && id[i] != '\t' && id[i] != '\n') i++; strncpy (tmp, id, i); tmp[i] = 0; if (strcmp (tmp, "SELECTED_SOUND_OPTIONS") == 0) continue; if (strcmp (tmp, "KERNEL_SOUNDCARD") == 0) continue; if (strcmp (tmp, "JAZZ_DMA16") == 0) /* Rename it (hack) */ { printf ("#define SB_DMA2 %s\n", &buf[18]); continue; } if (strcmp (tmp, "SB16_DMA") == 0) /* Rename it (hack) */ { printf ("#define SB_DMA2 %s\n", &buf[16]); continue; } tmp[8] = 0; /* Truncate the string */ if (strcmp (tmp, "EXCLUDE_") == 0) continue; /* Skip excludes */ strncpy (tmp, id, i); tmp[7] = 0; /* Truncate the string */ if (strcmp (tmp, "CONFIG_") == 0) { strncpy (tmp, &id[7], i - 7); tmp[i - 7] = 0; for (i = 0; i <= OPT_LAST; i++) if (strcmp (hw_table[i].macro, tmp) == 0) { selected_options |= (1 << i); break; } continue; } printf ("%s", buf); continue; } if (strcmp (tmp, "#undef ") == 0) { char *id = &buf[8]; i = 0; while (id[i] && id[i] != ' ' && id[i] != '\t' && id[i] != '\n') i++; strncpy (tmp, id, i); tmp[7] = 0; /* Truncate the string */ if (strcmp (tmp, "CONFIG_") == 0) continue; strncpy (tmp, id, i); tmp[8] = 0; /* Truncate the string */ if (strcmp (tmp, "EXCLUDE_") != 0) continue; /* Not a #undef EXCLUDE_ line */ strncpy (tmp, &id[8], i - 8); tmp[i - 8] = 0; for (i = 0; i <= OPT_LAST; i++) if (strcmp (hw_table[i].macro, tmp) == 0) { selected_options |= (1 << i); break; } continue; } printf ("%s", buf); } fclose (oldf); for (i = 0; i <= OPT_LAST; i++) if (!hw_table[i].alias) if (selected_options & B (i)) printf ("#define CONFIG_%s\n", hw_table[i].macro); else printf ("#undef CONFIG_%s\n", hw_table[i].macro); printf ("\n"); i = 0; while (extra_options[i].name != NULL) { if (selected_options & extra_options[i].mask) printf ("#define CONFIG_%s\n", extra_options[i].name); else printf ("#undef CONFIG_%s\n", extra_options[i].name); i++; } printf ("\n"); printf ("#define SELECTED_SOUND_OPTIONS\t0x%08x\n", selected_options); fprintf (stderr, "Old configuration copied.\n");#if defined(linux) || defined(Solaris) build_defines ();#endif old_config_used = 1; return 1;}#if defined(linux) || defined(Solaris)voidbuild_defines (void){ FILE *optf; int i; if ((optf = fopen (".defines", "w")) == NULL) { perror (".defines"); exit (-1); } for (i = 0; i <= OPT_LAST; i++) if (!hw_table[i].alias) if (selected_options & B (i)) fprintf (optf, "CONFIG_%s=y\n", hw_table[i].macro); fprintf (optf, "\n"); i = 0; while (extra_options[i].name != NULL) { if (selected_options & extra_options[i].mask) fprintf (optf, "CONFIG_%s=y\n", extra_options[i].name); i++; } fprintf (optf, "\n"); fclose (optf);}#endifvoidask_parameters (void){ int num; build_defines (); /* * IRQ and DMA settings */#if 0 /* Disable this broken question. */ ask_int_choice (B (OPT_AEDSP16), "AEDSP16_BASE", "I/O base for Audio Excel DSP 16", FMT_HEX, 0x220, "220 or 240");#endif ask_int_choice (B (OPT_SB), "SBC_BASE", "I/O base for SB", FMT_HEX, 0x220, "Check from manual of the card"); ask_int_choice (B (OPT_SB), "SBC_IRQ", "Sound Blaster IRQ", FMT_INT, 7, "Check from manual of the card"); ask_int_choice (B (OPT_SB), "SBC_DMA", "Sound Blaster DMA", FMT_INT, 1, "0, 1 or 3"); ask_int_choice (B (OPT_SB), "SB_DMA2", "Sound Blaster 16 bit DMA (_REQUIRED_for SB16, Jazz16, SMW)", FMT_INT, 5, "5, 6 or 7 (use 1 for 8 bit cards)"); ask_int_choice (B (OPT_SB), "SB_MPU_BASE", "MPU401 I/O base of SB16, Jazz16 and ES1688", FMT_HEX, 0, "Check from manual of the card"); ask_int_choice (B (OPT_SB), "SB_MPU_IRQ", "SB MPU401 IRQ (Jazz16, SM Wave and ES1688)", FMT_INT, -1, "Use -1 with SB16"); ask_int_choice (B (OPT_PAS), "PAS_IRQ", "PAS16 IRQ", FMT_INT, 10, "3, 4, 5, 7, 9, 10, 11, 12, 14 or 15"); ask_int_choice (B (OPT_PAS), "PAS_DMA", "PAS16 DMA", FMT_INT, 3, "0, 1, 3, 5, 6 or 7"); if (selected_options & B (OPT_PAS)) { if (think_positively ("Enable Joystick port on ProAudioSpectrum", 0, "Enable this option if you want to use the joystick port provided\n" "on the PAS sound card.\n")) printf ("#define PAS_JOYSTICK_ENABLE\n"); if (think_positively ("Enable PAS16 bus clock option", 0, "The PAS16 can be noisy with some motherboards. There is a command\n" "line switch (:T?) in the DOS driver for PAS16 which solves this.\n" "Don't enable this feature unless you have problems and have to use\n" "this switch with DOS\n")) printf ("#define BROKEN_BUS_CLOCK\n"); if (think_positively ("Disable SB mode of PAS16", 0, "You should disable SB emulation of PAS16 if you want to use\n" "Another SB compatible card in the same system\n")) printf ("#define DISABLE_SB_EMULATION\n"); } ask_int_choice (B (OPT_GUS), "GUS_BASE", "I/O base for GUS", FMT_HEX, 0x220, "210, 220, 230, 240, 250 or 260"); ask_int_choice (B (OPT_GUS), "GUS_IRQ", "GUS IRQ", FMT_INT, 15, "3, 5, 7, 9, 11, 12 or 15"); ask_int_choice (B (OPT_GUS), "GUS_DMA", "GUS DMA", FMT_INT, 6, "1, 3, 5, 6 or 7"); ask_int_choice (B (OPT_GUS), "GUS_DMA2", "Second DMA channel for GUS", FMT_INT, -1, "1, 3, 5, 6 or 7"); ask_int_choice (B (OPT_GUS16), "GUS16_BASE", "I/O base for the 16 bit daughtercard of GUS", FMT_HEX, 0x530, "530, 604, E80 or F40"); ask_int_choice (B (OPT_GUS16), "GUS16_IRQ", "GUS 16 bit daughtercard IRQ", FMT_INT, 7, "3, 4, 5, 7, or 9"); ask_int_choice (B (OPT_GUS16), "GUS16_DMA", "GUS DMA", FMT_INT, 3, "0, 1 or 3"); ask_int_choice (B (OPT_MPU401), "MPU_BASE", "I/O base for MPU401", FMT_HEX, 0x330, "Check from manual of the card"); ask_int_choice (B (OPT_MPU401), "MPU_IRQ", "MPU401 IRQ", FMT_INT, 9, "Check from manual of the card"); ask_int_choice (B (OPT_MAUI), "MAUI_BASE", "I/O base for Maui", FMT_HEX, 0x330, "210, 230, 260, 290, 300, 320, 338 or 330"); ask_int_choice (B (OPT_MAUI), "MAUI_IRQ", "Maui IRQ", FMT_INT, 9, "5, 9, 12 or 15"); ask_int_choice (B (OPT_UART6850), "U6850_BASE", "I/O base for UART 6850 MIDI port", FMT_HEX, 0, "(Unknown)"); ask_int_choice (B (OPT_UART6850), "U6850_IRQ", "UART6850 IRQ", FMT_INT, -1, "(Unknown)"); ask_int_choice (B (OPT_PSS), "PSS_BASE", "PSS I/O base", FMT_HEX, 0x220, "220 or 240"); ask_int_choice (B (OPT_PSS), "PSS_MSS_BASE", "PSS audio I/O base", FMT_HEX, 0x530, "530, 604, E80 or F40"); ask_int_choice (B (OPT_PSS), "PSS_MSS_IRQ", "PSS audio IRQ", FMT_INT, 11, "7, 9, 10 or 11"); ask_int_choice (B (OPT_PSS), "PSS_MSS_DMA", "PSS audio DMA", FMT_INT, 3, "0, 1 or 3"); ask_int_choice (B (OPT_PSS), "PSS_MPU_BASE", "PSS MIDI I/O base", FMT_HEX, 0x330, ""); ask_int_choice (B (OPT_PSS), "PSS_MPU_IRQ", "PSS MIDI IRQ", FMT_INT, 9, "3, 4, 5, 7 or 9"); ask_int_choice (B (OPT_MSS), "MSS_BASE", "MSS/WSS I/O base", FMT_HEX, 0x530, "530, 604, E80 or F40"); ask_int_choice (B (OPT_MSS), "MSS_IRQ", "MSS/WSS IRQ", FMT_INT, 11, "7, 9, 10 or 11"); ask_int_choice (B (OPT_MSS), "MSS_DMA", "MSS/WSS DMA", FMT_INT, 3, "0, 1 or 3"); ask_int_choice (B (OPT_SSCAPE), "SSCAPE_BASE", "SoundScape MIDI I/O base", FMT_HEX, 0x330, "320, 330, 340 or 350"); ask_int_choice (B (OPT_SSCAPE), "SSCAPE_IRQ", "SoundScape MIDI IRQ", FMT_INT, 9, ""); ask_int_choice (B (OPT_SSCAPE), "SSCAPE_DMA", "SoundScape initialization DMA", FMT_INT, 3, "0, 1 or 3"); ask_int_choice (B (OPT_SSCAPE), "SSCAPE_MSS_BASE", "SoundScape audio I/O base", FMT_HEX, 0x534, "534, 608, E84 or F44"); ask_int_choice (B (OPT_SSCAPE), "SSCAPE_MSS_IRQ", "SoundScape audio IRQ", FMT_INT, 11, "7, 9, 10 or 11"); if (selected_options & B (OPT_SSCAPE)) { int reveal_spea; reveal_spea = think_positively ( "Is your SoundScape card made/marketed by Reveal or Spea", 0, "Enable if you have a SoundScape card with the Reveal or\n" "Spea name on it.\n"); if (reveal_spea) printf ("#define REVEAL_SPEA\n"); } ask_int_choice (B (OPT_TRIX), "TRIX_BASE", "AudioTrix audio I/O base", FMT_HEX, 0x530, "530, 604, E80 or F40"); ask_int_choice (B (OPT_TRIX), "TRIX_IRQ", "AudioTrix audio IRQ", FMT_INT, 11, "7, 9, 10 or 11"); ask_int_choice (B (OPT_TRIX), "TRIX_DMA", "AudioTrix audio DMA", FMT_INT, 0, "0, 1 or 3"); ask_int_choice (B (OPT_TRIX), "TRIX_DMA2", "AudioTrix second (duplex) DMA", FMT_INT, 3, "0, 1 or 3"); ask_int_choice (B (OPT_TRIX), "TRIX_MPU_BASE", "AudioTrix MIDI I/O base", FMT_HEX, 0x330, "330, 370, 3B0 or 3F0"); ask_int_choice (B (OPT_TRIX), "TRIX_MPU_IRQ", "AudioTrix MIDI IRQ", FMT_INT, 9, "3, 4, 5, 7 or 9"); ask_int_choice (B (OPT_TRIX), "TRIX_SB_BASE", "AudioTrix SB I/O base", FMT_HEX, 0x220, "220, 210, 230, 240, 250, 260 or 270"); ask_int_choice (B (OPT_TRIX), "TRIX_SB_IRQ", "AudioTrix SB IRQ", FMT_INT, 7, "3, 4, 5 or 7"); ask_int_choice (B (OPT_TRIX), "TRIX_SB_DMA", "AudioTrix SB DMA", FMT_INT, 1, "1 or 3"); ask_int_choice (B (OPT_CS4232), "CS4232_BASE", "CS4232 audio I/O base", FMT_HEX, 0x530, "530, 604, E80 or F40"); ask_int_choice (B (OPT_CS4232), "CS4232_IRQ", "CS4232 audio IRQ", FMT_INT, 11, "5, 7, 9, 11, 12 or 15"); ask_int_choice (B (OPT_CS4232), "CS4232_DMA", "CS4232 audio DMA", FMT_INT, 0, "0, 1 or 3"); ask_int_choice (B (OPT_CS4232), "CS4232_DMA2", "CS4232 second (duplex) DMA", FMT_INT, 3,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -