This source file includes following definitions.
- can_select_option
- think_positively
- ask_value
- ask_int_choice
- rebuild_file
- use_old_config
- build_defines
- ask_parameters
- dump_script
- dump_fixed_local
- dump_fixed_defines
- main
- bin2hex
1
2
3
4
5
6 #define DISABLED_OPTIONS (B(OPT_SPNP)|B(OPT_AEDSP16)|B(OPT_UNUSED1)|B(OPT_UNUSED2))
7
8
9
10 #define COPYING2
11
12 #include <stdio.h>
13 #include <unistd.h>
14 #include <stdlib.h>
15 #include <fcntl.h>
16 #include <string.h>
17
18 #define B(x) (1 << (x))
19
20
21
22
23
24 #define OPT_PAS 0
25 #define OPT_SB 1
26 #define OPT_ADLIB 2
27 #define OPT_LAST_MUTUAL 2
28
29 #define OPT_GUS 3
30 #define OPT_MPU401 4
31 #define OPT_UART6850 5
32 #define OPT_PSS 6
33 #define OPT_GUS16 7
34 #define OPT_GUSMAX 8
35 #define OPT_MSS 9
36 #define OPT_SSCAPE 10
37 #define OPT_TRIX 11
38 #define OPT_MAD16 12
39 #define OPT_CS4232 13
40 #define OPT_MAUI 14
41 #define OPT_SPNP 15
42
43 #define OPT_HIGHLEVEL 16
44 #define OPT_UNUSED1 16
45 #define OPT_UNUSED2 17
46 #define OPT_AEDSP16 18
47 #define OPT_AUDIO 19
48 #define OPT_MIDI_AUTO 20
49 #define OPT_MIDI 21
50 #define OPT_YM3812_AUTO 22
51 #define OPT_YM3812 23
52 #define OPT_LAST 23
53
54 #define DUMMY_OPTS (B(OPT_MIDI_AUTO)|B(OPT_YM3812_AUTO))
55
56 #define ANY_DEVS (B(OPT_AUDIO)|B(OPT_MIDI)|B(OPT_GUS)| \
57 B(OPT_MPU401)|B(OPT_PSS)|B(OPT_GUS16)|B(OPT_GUSMAX)| \
58 B(OPT_MSS)|B(OPT_SSCAPE)|B(OPT_UART6850)|B(OPT_TRIX)| \
59 B(OPT_MAD16)|B(OPT_CS4232)|B(OPT_MAUI))
60 #define AUDIO_CARDS (B (OPT_PSS) | B (OPT_SB) | B (OPT_PAS) | B (OPT_GUS) | \
61 B (OPT_MSS) | B (OPT_GUS16) | B (OPT_GUSMAX) | B (OPT_TRIX) | \
62 B (OPT_SSCAPE)| B(OPT_MAD16) | B(OPT_CS4232))
63 #define MIDI_CARDS (B (OPT_PSS) | B (OPT_SB) | B (OPT_PAS) | B (OPT_MPU401) | \
64 B (OPT_GUS) | B (OPT_TRIX) | B (OPT_SSCAPE)|B(OPT_MAD16) | \
65 B (OPT_CS4232)|B(OPT_MAUI))
66 #define MPU_DEVS (B(OPT_PSS)|B(OPT_SSCAPE)|B(OPT_TRIX)|B(OPT_MAD16)|\
67 B(OPT_CS4232)|B(OPT_SPNP)|B(OPT_MAUI))
68 #define AD1848_DEVS (B(OPT_GUS16)|B(OPT_MSS)|B(OPT_PSS)|B(OPT_GUSMAX)|\
69 B(OPT_SSCAPE)|B(OPT_TRIX)|B(OPT_MAD16)|B(OPT_CS4232)|\
70 B(OPT_SPNP))
71 #define SEQUENCER_DEVS (OPT_MIDI|OPT_YM3812|OPT_ADLIB|OPT_GUS|OPT_MAUI|MIDI_CARDS)
72
73
74
75
76
77
78 typedef struct
79 {
80 unsigned long conditions;
81 unsigned long exclusive_options;
82 char macro[20];
83 int verify;
84 int alias;
85 int default_answ;
86 }
87
88 hw_entry;
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105 hw_entry hw_table[] =
106 {
107
108
109
110 {0, 0, "PAS", 1, 0, 0},
111 {0, 0, "SB", 1, 0, 0},
112 {0, B (OPT_PAS) | B (OPT_SB), "ADLIB", 1, 0, 0},
113
114 {0, 0, "GUS", 1, 0, 0},
115 {0, 0, "MPU401", 1, 0, 0},
116 {0, 0, "UART6850", 1, 0, 0},
117 {0, 0, "PSS", 1, 0, 0},
118 {B (OPT_GUS), 0, "GUS16", 1, 0, 0},
119 {B (OPT_GUS), B (OPT_GUS16), "GUSMAX", 1, 0, 0},
120 {0, 0, "MSS", 1, 0, 0},
121 {0, 0, "SSCAPE", 1, 0, 0},
122 {0, 0, "TRIX", 1, 0, 0},
123 {0, 0, "MAD16", 1, 0, 0},
124 {0, 0, "CS4232", 1, 0, 0},
125 {0, 0, "MAUI", 1, 0, 0},
126 {0, 0, "SPNP", 1, 0, 0},
127
128 {B (OPT_SB), B (OPT_PAS), "UNUSED1", 1, 0, 1},
129 {B (OPT_SB) | B (OPT_UNUSED1), B (OPT_PAS), "UNUSED2", 1, 0, 1},
130 {B (OPT_UNUSED1) | B (OPT_MSS) | B (OPT_MPU401), 0, "AEDSP16", 1, 0, 0},
131 {AUDIO_CARDS, 0, "AUDIO", 1, 0, 1},
132 {B (OPT_MPU401) | B (OPT_MAUI), 0, "MIDI_AUTO", 0, OPT_MIDI, 0},
133 {MIDI_CARDS, 0, "MIDI", 1, 0, 1},
134 {B (OPT_ADLIB), 0, "YM3812_AUTO", 0, OPT_YM3812, 0},
135 {B (OPT_PSS) | B (OPT_SB) | B (OPT_PAS) | B (OPT_ADLIB) | B (OPT_MSS) | B (OPT_PSS), B (OPT_YM3812_AUTO), "YM3812", 1, 0, 1}
136 };
137
138 char *questions[] =
139 {
140 "ProAudioSpectrum 16 support",
141 "SoundBlaster (SB, SBPro, SB16, clones) support",
142 "Generic OPL2/OPL3 FM synthesizer support",
143 "Gravis Ultrasound support",
144 "MPU-401 support (NOT for SB16)",
145 "6850 UART Midi support",
146 "PSS (ECHO-ADI2111) support",
147 "16 bit sampling option of GUS (_NOT_ GUS MAX)",
148 "GUS MAX support",
149 "Microsoft Sound System support",
150 "Ensoniq Soundscape support",
151 "MediaTriX AudioTriX Pro support",
152 "Support for MAD16 and/or Mozart based cards",
153 "Support for Crystal CS4232 based (PnP) cards",
154 "Support for Turtle Beach Wave Front (Maui, Tropez) synthesizers",
155 "Support for PnP sound cards (_EXPERIMENTAL_)",
156
157 "*** Unused option 1 ***",
158 "*** Unused option 2 ***",
159 "Audio Excel DSP 16 initialization support",
160 "/dev/dsp and /dev/audio support",
161 "This should not be asked",
162 "MIDI interface support",
163 "This should not be asked",
164 "FM synthesizer (YM3812/OPL-3) support",
165 "Is the sky really falling"
166 };
167
168
169 char *help[] =
170 {
171 "Enable this option only if you have a Pro Audio Spectrum 16,\n"
172 "Pro Audio Studio 16, or Logitech SoundMan 16. Don't enable this if\n"
173 "you have some other card made by MediaVision or Logitech as\n"
174 "they are not PAS16 compatible.\n",
175
176 "Enable this if you have an original SoundBlaster card made by\n"
177 "Creative Labs or a 100%% hardware compatible clone. For an\n"
178 "unknown card you may want to try this if it claims to be\n"
179 "SoundBlaster compatible.\n",
180
181 "Enable this option if your sound card has a Yamaha OPL2 or OPL3\n"
182 "FM synthesizer chip.\n",
183
184 "Enable this option for any type of Gravis Ultrasound card\n"
185 "including the GUS or GUS MAX.\n",
186
187 "The MPU401 interface is supported by almost all sound cards. However,\n"
188 "some natively supported cards have their own driver for\n"
189 "MPU401. Enabling the MPU401 option with these cards will cause a\n"
190 "conflict. Also enabling MPU401 on a system that doesn't really have a\n"
191 "MPU401 could cause some trouble. It's safe to enable this if you have a\n"
192 "true MPU401 MIDI interface card.\n",
193
194 "This option enables support for MIDI interfaces based on the 6850\n"
195 "UART chip. This interface is rarely found on sound cards.\n",
196
197 "Enable this option if you have an Orchid SW32, Cardinal DSP16 or other\n"
198 "sound card based on the PSS chipset (AD1848 codec, ADSP-2115 DSP chip,\n"
199 "and Echo ESC614 ASIC CHIP).\n",
200
201 "Enable this if you have installed the 16-bit sampling daughtercard on\n"
202 "your GUS card. Do not use if you have a GUS MAX as enabling this option\n"
203 "disables GUS MAX support.\n",
204
205 "Enable this option if you have a Gravis Ultrasound MAX sound\n"
206 "card\n",
207
208 "Enable this option if you have the original Windows Sound System\n"
209 "card made by Microsoft or the Aztech SG 16 Pro or NX16 Pro.\n",
210
211 "Enable this if you have a sound card based on the Ensoniq\n"
212 "Soundscape chipset. Such cards are being manufactured by Ensoniq,\n"
213 "Spea and Reveal (Reveal makes other cards as well).\n",
214
215 "Enable this option if you have the AudioTriX Pro sound card\n"
216 "manufactured by MediaTrix.\n",
217
218 "Enable this if your card has a Mozart (OAK OTI-601) or MAD16 (OPTi\n"
219 "82C928 or 82C929) audio interface chip. These chips are currently\n"
220 "quite common so it's possible that many no-name cards have one of\n"
221 "them. In addition the MAD16 chip is used in some cards made by known\n"
222 "manufacturers such as Turtle Beach (Tropez), Reveal (some models) and\n"
223 "Diamond (latest ones).\n",
224
225 "Enable this if you have a card based on the Crystal CS4232 chip set.\n",
226
227 "Enable this option if you have a Turtle Beach Wave Front, Maui,\n"
228 "or Tropez sound card.\n",
229
230 "Use this option to enable experimental support for cards that\n"
231 "use the Plug and Play protocol.\n",
232
233 "Enable this option if your card is a SoundBlaster Pro or\n"
234 "SoundBlaster 16. It also works with many SoundBlaster Pro clones.\n",
235
236 "Enable this if you have a SoundBlaster 16, including the AWE32.\n",
237
238 "Enable this if you have an Audio Excel DSP16 card. See the file\n"
239 "Readme.aedsp16 for more information.\n",
240
241 "This option enables the A/D and D/A converter (PCM) devices\n"
242 "supported by almost all sound cards.\n",
243
244 "This should not be asked",
245
246 "This enables the dev/midixx devices and access to any MIDI ports\n"
247 "using /dev/sequencer and /dev/music. This option also affects any\n"
248 "MPU401 and/or General MIDI compatible devices.\n",
249
250 "This should not be asked",
251
252 "This enables the Yamaha FM synthesizer chip used on many sound\n"
253 "cards.\n",
254
255 "Is the sky really falling"
256 };
257
258 struct kludge
259 {
260 char *name;
261 int mask;
262 }
263 extra_options[] =
264 {
265 {
266 "MPU_EMU", MPU_DEVS
267 }
268 ,
269 {
270 "AD1848", AD1848_DEVS
271 }
272 ,
273 {
274 "SEQUENCER", SEQUENCER_DEVS
275 }
276 ,
277 {
278 NULL, 0
279 }
280 };
281
282 char *oldconf = "/etc/soundconf";
283
284 int old_config_used = 0;
285 int def_size, sb_base = 0;
286
287 unsigned long selected_options = 0;
288 int sb_dma = 0;
289
290 int dump_only = 0;
291
292 void build_defines (void);
293
294 #include "hex2hex.h"
295 int bin2hex (char *path, char *target, char *varname);
296
297 int
298 can_select_option (int nr)
299 {
300 #if 0
301 switch (nr)
302 {
303 case OPT_LAST_MUTUAL + 1:
304 fprintf (stderr, "\nThe following cards should work with any other cards.\n"
305 "CAUTION! Don't enable MPU-401 if you don't have it.\n");
306 break;
307
308 case OPT_HIGHLEVEL:
309 fprintf (stderr, "\nSelect one or more of the following options\n");
310 break;
311
312
313 }
314 #endif
315
316 if (hw_table[nr].conditions)
317 if (!(hw_table[nr].conditions & selected_options))
318 return 0;
319
320 if (hw_table[nr].exclusive_options)
321 if (hw_table[nr].exclusive_options & selected_options)
322 return 0;
323
324 if (DISABLED_OPTIONS & B (nr))
325 return 0;
326
327 return 1;
328 }
329
330 int
331 think_positively (char *prompt, int def_answ, char *help)
332 {
333 char answ[512];
334 int len;
335
336 response:
337 fprintf(stderr, prompt);
338 if (def_answ)
339 fprintf(stderr, " [Y/n/?] ");
340 else
341 fprintf(stderr, " [N/y/?] ");
342
343 if ((len = read (0, answ, sizeof (answ))) < 1)
344 {
345 fprintf (stderr, "\n\nERROR! Cannot read stdin\n");
346
347 perror ("stdin");
348 printf ("invalid_configuration__run_make_config_again\n");
349 exit (-1);
350 }
351
352 if (len < 2)
353
354
355 return def_answ;
356
357 if (answ[0] == '?') {
358 fprintf(stderr, "\n");
359 fprintf(stderr, help);
360 fprintf(stderr, "\n");
361 goto response;
362 }
363
364 answ[len - 1] = 0;
365
366 if (!strcmp (answ, "y") || !strcmp (answ, "Y"))
367 return 1;
368
369 return 0;
370 }
371
372 int
373 ask_value (char *format, int default_answer)
374 {
375 char answ[512];
376 int len, num;
377
378 play_it_again_Sam:
379
380 if ((len = read (0, answ, sizeof (answ))) < 1)
381 {
382 fprintf (stderr, "\n\nERROR! Cannot read stdin\n");
383
384 perror ("stdin");
385 printf ("invalid_configuration__run_make_config_again\n");
386 exit (-1);
387 }
388
389 if (len < 2)
390
391
392 return default_answer;
393
394 answ[len - 1] = 0;
395
396 if (sscanf (answ, format, &num) != 1)
397 {
398 fprintf (stderr, "Illegal format. Try again: ");
399 goto play_it_again_Sam;
400 }
401
402 return num;
403 }
404
405 #define FMT_HEX 1
406 #define FMT_INT 2
407
408 void
409 ask_int_choice (int mask, char *macro,
410 char *question,
411 int format,
412 int defa,
413 char *choices)
414 {
415 int num, i;
416
417 if (dump_only)
418 {
419
420 for (i = 0; i < OPT_LAST; i++)
421 if (!(DISABLED_OPTIONS & B (i)))
422 if (mask == B (i))
423 {
424 unsigned int j;
425
426 for (j = 0; j < strlen (choices); j++)
427 if (choices[j] == '\'')
428 choices[j] = '_';
429
430 printf ("\nif [ \"$CONFIG_%s\" = \"y\" ]; then\n",
431 hw_table[i].macro);
432 if (format == FMT_INT)
433 printf ("int '%s %s' %s %d\n", question, choices, macro, defa);
434 else
435 printf ("hex '%s %s' %s %x\n", question, choices, macro, defa);
436 printf ("fi\n");
437 }
438 }
439 else
440 {
441 if (!(mask & selected_options))
442 return;
443
444 fprintf (stderr, "\n%s\n", question);
445 if (strcmp(choices, ""))
446 fprintf (stderr, "Possible values are: %s\n", choices);
447
448 if (format == FMT_INT)
449 {
450 if (defa == -1)
451 fprintf (stderr, "\t(-1 disables this feature)\n");
452 fprintf (stderr, "The default value is %d\n", defa);
453 fprintf (stderr, "Enter the value: ");
454 num = ask_value ("%d", defa);
455 if (num == -1)
456 return;
457 fprintf (stderr, "%s set to %d.\n", question, num);
458 printf ("#define %s %d\n", macro, num);
459 }
460 else
461 {
462 if (defa == 0)
463 fprintf (stderr, "\t(0 disables this feature)\n");
464 fprintf (stderr, "The default value is %x\n", defa);
465 fprintf (stderr, "Enter the value: ");
466 num = ask_value ("%x", defa);
467 if (num == 0)
468 return;
469 fprintf (stderr, "%s set to %x.\n", question, num);
470 printf ("#define %s 0x%x\n", macro, num);
471 }
472 }
473 }
474
475 void
476 rebuild_file (char *line)
477 {
478 char *method, *next, *old, *var, *p;
479
480 method = p = line;
481
482 while (*p && *p != ' ')
483 p++;
484 *p++ = 0;
485
486 old = p;
487 while (*p && *p != ' ')
488 p++;
489 *p++ = 0;
490
491 next = p;
492 while (*p && *p != ' ')
493 p++;
494 *p++ = 0;
495
496 var = p;
497 while (*p && *p != ' ')
498 p++;
499 *p++ = 0;
500
501 fprintf (stderr, "Rebuilding file `%s' (%s %s)\n", next, method, old);
502
503 if (strcmp (method, "bin2hex") == 0)
504 {
505 if (!bin2hex (old, next, var))
506 {
507 fprintf (stderr, "Rebuild failed\n");
508 exit (-1);
509 }
510 }
511 else if (strcmp (method, "hex2hex") == 0)
512 {
513 if (!hex2hex (old, next, var))
514 {
515 fprintf (stderr, "Rebuild failed\n");
516 exit (-1);
517 }
518 }
519 else
520 {
521 fprintf (stderr, "Failed to build `%s' - unknown method %s\n",
522 next, method);
523 exit (-1);
524 }
525 }
526
527 int
528 use_old_config (char *filename)
529 {
530 char buf[1024];
531 int i = 0;
532
533 FILE *oldf;
534
535 fprintf (stderr, "Copying old configuration from `%s'\n", filename);
536
537 if ((oldf = fopen (filename, "r")) == NULL)
538 {
539 fprintf (stderr, "Couldn't open previous configuration file\n");
540 perror (filename);
541 return 0;
542 }
543
544 while (fgets (buf, 1024, oldf) != NULL)
545 {
546 char tmp[100];
547
548 if (buf[0] != '#')
549 {
550 printf ("%s", buf);
551
552 strncpy (tmp, buf, 8);
553 tmp[8] = 0;
554
555 if (strcmp (tmp, "/*build ") == 0)
556 rebuild_file (&buf[8]);
557
558 continue;
559 }
560
561 strncpy (tmp, buf, 8);
562 tmp[8] = 0;
563
564 if (strcmp (tmp, "#define ") == 0)
565 {
566 char *id = &buf[8];
567
568 i = 0;
569 while (id[i] && id[i] != ' ' &&
570 id[i] != '\t' && id[i] != '\n')
571 i++;
572
573 strncpy (tmp, id, i);
574 tmp[i] = 0;
575
576 if (strcmp (tmp, "SELECTED_SOUND_OPTIONS") == 0)
577 continue;
578
579 if (strcmp (tmp, "KERNEL_SOUNDCARD") == 0)
580 continue;
581
582 if (strcmp (tmp, "JAZZ_DMA16") == 0)
583 {
584 printf("#define SB_DMA2 %s\n",
585 &buf[18]);
586 continue;
587 }
588
589 if (strcmp (tmp, "SB16_DMA") == 0)
590 {
591 printf("#define SB_DMA2 %s\n",
592 &buf[16]);
593 continue;
594 }
595
596 tmp[8] = 0;
597 if (strcmp (tmp, "EXCLUDE_") == 0)
598 continue;
599
600 strncpy (tmp, id, i);
601 tmp[7] = 0;
602
603 if (strcmp (tmp, "CONFIG_") == 0)
604 {
605 strncpy (tmp, &id[7], i - 7);
606 tmp[i - 7] = 0;
607
608 for (i = 0; i <= OPT_LAST; i++)
609 if (strcmp (hw_table[i].macro, tmp) == 0)
610 {
611 selected_options |= (1 << i);
612 break;
613 }
614 continue;
615 }
616
617 printf ("%s", buf);
618 continue;
619 }
620
621 if (strcmp (tmp, "#undef ") == 0)
622 {
623 char *id = &buf[8];
624
625 i = 0;
626 while (id[i] && id[i] != ' ' &&
627 id[i] != '\t' && id[i] != '\n')
628 i++;
629
630 strncpy (tmp, id, i);
631 tmp[7] = 0;
632 if (strcmp (tmp, "CONFIG_") == 0)
633 continue;
634
635 strncpy (tmp, id, i);
636
637 tmp[8] = 0;
638 if (strcmp (tmp, "EXCLUDE_") != 0)
639 continue;
640 strncpy (tmp, &id[8], i - 8);
641 tmp[i - 8] = 0;
642
643 for (i = 0; i <= OPT_LAST; i++)
644 if (strcmp (hw_table[i].macro, tmp) == 0)
645 {
646 selected_options |= (1 << i);
647 break;
648 }
649 continue;
650 }
651
652 printf ("%s", buf);
653 }
654 fclose (oldf);
655
656 for (i = 0; i <= OPT_LAST; i++)
657 if (!hw_table[i].alias)
658 if (selected_options & B (i))
659 printf ("#define CONFIG_%s\n", hw_table[i].macro);
660 else
661 printf ("#undef CONFIG_%s\n", hw_table[i].macro);
662
663
664 printf ("\n");
665
666 i = 0;
667
668 while (extra_options[i].name != NULL)
669 {
670 if (selected_options & extra_options[i].mask)
671 printf ("#define CONFIG_%s\n", extra_options[i].name);
672 else
673 printf ("#undef CONFIG_%s\n", extra_options[i].name);
674 i++;
675 }
676
677 printf ("\n");
678
679 printf ("#define SELECTED_SOUND_OPTIONS\t0x%08x\n", selected_options);
680 fprintf (stderr, "Old configuration copied.\n");
681
682 #ifdef linux
683 build_defines ();
684 #endif
685 old_config_used = 1;
686 return 1;
687 }
688
689 #ifdef linux
690 void
691 build_defines (void)
692 {
693 FILE *optf;
694 int i;
695
696 if ((optf = fopen (".defines", "w")) == NULL)
697 {
698 perror (".defines");
699 exit (-1);
700 }
701
702
703 for (i = 0; i <= OPT_LAST; i++)
704 if (!hw_table[i].alias)
705 if (selected_options & B (i))
706 fprintf (optf, "CONFIG_%s=y\n", hw_table[i].macro);
707 #if 0
708 else
709 fprintf (optf, "CONFIG_%s=n\n", hw_table[i].macro);
710 #endif
711
712
713 fprintf (optf, "\n");
714
715 i = 0;
716
717 while (extra_options[i].name != NULL)
718 {
719 if (selected_options & extra_options[i].mask)
720 fprintf (optf, "CONFIG_%s=y\n", extra_options[i].name);
721 #if 0
722 else
723 fprintf (optf, "CONFIG_%s=n\n", extra_options[i].name);
724 #endif
725 i++;
726 }
727
728 fprintf (optf, "\n");
729 fclose (optf);
730 }
731 #endif
732
733 void
734 ask_parameters (void)
735 {
736 #ifdef linux
737 int num;
738
739 build_defines ();
740
741
742
743
744 ask_int_choice (B (OPT_AEDSP16), "AEDSP16_BASE",
745 "I/O base for Audio Excel DSP 16",
746 FMT_HEX,
747 0x220,
748 "220 or 240");
749
750 ask_int_choice (B (OPT_SB), "SBC_BASE",
751 "I/O base for SB",
752 FMT_HEX,
753 0x220,
754 "Check from manual of the card");
755
756 ask_int_choice (B (OPT_SB), "SBC_IRQ",
757 "SoundBlaster IRQ",
758 FMT_INT,
759 7,
760 "Check from manual of the card");
761
762 ask_int_choice (B (OPT_SB), "SBC_DMA",
763 "SoundBlaster DMA",
764 FMT_INT,
765 1,
766 "0, 1 or 3");
767
768 ask_int_choice (B (OPT_SB), "SB_DMA2",
769 "SoundBlaster 16 bit DMA (_REQUIRED_for SB16, Jazz16, SMW)",
770 FMT_INT,
771 5,
772 "5, 6 or 7");
773
774 ask_int_choice (B (OPT_SB), "SB_MPU_BASE",
775 "MPU401 I/O base of SB16, Jazz16 and ES1688",
776 FMT_HEX,
777 0,
778 "Check from manual of the card");
779
780 ask_int_choice (B (OPT_SB), "SB_MPU_IRQ",
781 "SB MPU401 IRQ (Jazz16 and ES1688)",
782 FMT_INT,
783 -1,
784 "Check from manual of the card");
785
786 ask_int_choice (B (OPT_PAS), "PAS_IRQ",
787 "PAS16 IRQ",
788 FMT_INT,
789 10,
790 "3, 4, 5, 7, 9, 10, 11, 12, 14 or 15");
791
792 ask_int_choice (B (OPT_PAS), "PAS_DMA",
793 "PAS16 DMA",
794 FMT_INT,
795 3,
796 "0, 1, 3, 5, 6 or 7");
797
798 if (selected_options & B (OPT_PAS))
799 {
800 if (think_positively ("Enable Joystick port on ProAudioSpectrum", 0,
801 "Enable this option if you want to use the joystick port provided\n"
802 "on the PAS sound card.\n"))
803 printf ("#define PAS_JOYSTICK_ENABLE\n");
804
805 if (think_positively ("Enable PAS16 bus clock option", 0,
806 "The PAS16 can be noisy with some motherboards. There is a command\n"
807 "line switch (:T?) in the DOS driver for PAS16 which solves this.\n"
808 "Don't enable this feature unless you have problems and have to use\n"
809 "this switch with DOS\n"))
810 printf ("#define BROKEN_BUS_CLOCK\n");
811
812 if (think_positively ("Disable SB mode of PAS16", 0,
813 "You should disable SB emulation of PAS16 if you want to use\n"
814 "Another SB compatible card in the same system\n"))
815 printf ("#define DISABLE_SB_EMULATION\n");
816 }
817
818 ask_int_choice (B (OPT_GUS), "GUS_BASE",
819 "I/O base for GUS",
820 FMT_HEX,
821 0x220,
822 "210, 220, 230, 240, 250 or 260");
823
824
825 ask_int_choice (B (OPT_GUS), "GUS_IRQ",
826 "GUS IRQ",
827 FMT_INT,
828 15,
829 "3, 5, 7, 9, 11, 12 or 15");
830
831 ask_int_choice (B (OPT_GUS), "GUS_DMA",
832 "GUS DMA",
833 FMT_INT,
834 6,
835 "1, 3, 5, 6 or 7");
836
837 ask_int_choice (B (OPT_GUS), "GUS_DMA2",
838 "Second DMA channel for GUS",
839 FMT_INT,
840 -1,
841 "1, 3, 5, 6 or 7");
842
843 ask_int_choice (B (OPT_GUS16), "GUS16_BASE",
844 "I/O base for the 16 bit daughtercard of GUS",
845 FMT_HEX,
846 0x530,
847 "530, 604, E80 or F40");
848
849
850 ask_int_choice (B (OPT_GUS16), "GUS16_IRQ",
851 "GUS 16 bit daughtercard IRQ",
852 FMT_INT,
853 7,
854 "3, 4, 5, 7, or 9");
855
856 ask_int_choice (B (OPT_GUS16), "GUS16_DMA",
857 "GUS DMA",
858 FMT_INT,
859 3,
860 "0, 1 or 3");
861
862 ask_int_choice (B (OPT_MPU401), "MPU_BASE",
863 "I/O base for MPU401",
864 FMT_HEX,
865 0x330,
866 "Check from manual of the card");
867
868 ask_int_choice (B (OPT_MPU401), "MPU_IRQ",
869 "MPU401 IRQ",
870 FMT_INT,
871 9,
872 "Check from manual of the card");
873
874 ask_int_choice (B (OPT_MAUI), "MAUI_BASE",
875 "I/O base for Maui",
876 FMT_HEX,
877 0x330,
878 "210, 230, 260, 290, 300, 320, 338 or 330");
879
880 ask_int_choice (B (OPT_MAUI), "MAUI_IRQ",
881 "Maui IRQ",
882 FMT_INT,
883 9,
884 "5, 9, 12 or 15");
885
886 ask_int_choice (B (OPT_UART6850), "U6850_BASE",
887 "I/O base for UART 6850 MIDI port",
888 FMT_HEX,
889 0,
890 "(Unknown)");
891
892 ask_int_choice (B (OPT_UART6850), "U6850_IRQ",
893 "UART6850 IRQ",
894 FMT_INT,
895 -1,
896 "(Unknown)");
897
898 ask_int_choice (B (OPT_PSS), "PSS_BASE",
899 "PSS I/O base",
900 FMT_HEX,
901 0x220,
902 "220 or 240");
903
904 ask_int_choice (B (OPT_PSS), "PSS_MSS_BASE",
905 "PSS audio I/O base",
906 FMT_HEX,
907 0x530,
908 "530, 604, E80 or F40");
909
910 ask_int_choice (B (OPT_PSS), "PSS_MSS_IRQ",
911 "PSS audio IRQ",
912 FMT_INT,
913 11,
914 "7, 9, 10 or 11");
915
916 ask_int_choice (B (OPT_PSS), "PSS_MSS_DMA",
917 "PSS audio DMA",
918 FMT_INT,
919 3,
920 "0, 1 or 3");
921
922 ask_int_choice (B (OPT_PSS), "PSS_MPU_BASE",
923 "PSS MIDI I/O base",
924 FMT_HEX,
925 0x330,
926 "");
927
928 ask_int_choice (B (OPT_PSS), "PSS_MPU_IRQ",
929 "PSS MIDI IRQ",
930 FMT_INT,
931 9,
932 "3, 4, 5, 7 or 9");
933
934 ask_int_choice (B (OPT_MSS), "MSS_BASE",
935 "MSS/WSS I/O base",
936 FMT_HEX,
937 0x530,
938 "530, 604, E80 or F40");
939
940 ask_int_choice (B (OPT_MSS), "MSS_IRQ",
941 "MSS/WSS IRQ",
942 FMT_INT,
943 11,
944 "7, 9, 10 or 11");
945
946 ask_int_choice (B (OPT_MSS), "MSS_DMA",
947 "MSS/WSS DMA",
948 FMT_INT,
949 3,
950 "0, 1 or 3");
951
952 ask_int_choice (B (OPT_SSCAPE), "SSCAPE_BASE",
953 "Soundscape MIDI I/O base",
954 FMT_HEX,
955 0x330,
956 "");
957
958 ask_int_choice (B (OPT_SSCAPE), "SSCAPE_IRQ",
959 "Soundscape MIDI IRQ",
960 FMT_INT,
961 9,
962 "");
963
964 ask_int_choice (B (OPT_SSCAPE), "SSCAPE_DMA",
965 "Soundscape initialization DMA",
966 FMT_INT,
967 3,
968 "0, 1 or 3");
969
970 ask_int_choice (B (OPT_SSCAPE), "SSCAPE_MSS_BASE",
971 "Soundscape audio I/O base",
972 FMT_HEX,
973 0x534,
974 "534, 608, E84 or F44");
975
976 ask_int_choice (B (OPT_SSCAPE), "SSCAPE_MSS_IRQ",
977 "Soundscape audio IRQ",
978 FMT_INT,
979 11,
980 "7, 9, 10 or 11");
981
982 ask_int_choice (B (OPT_SSCAPE), "SSCAPE_MSS_DMA",
983 "Soundscape audio DMA",
984 FMT_INT,
985 0,
986 "0, 1 or 3");
987
988 if (selected_options & B (OPT_SSCAPE))
989 {
990 int reveal_spea;
991
992 reveal_spea = think_positively (
993 "Is your SoundScape card made/marketed by Reveal or Spea",
994 0,
995 "Enable if you have a SoundScape card with the Reveal or\n"
996 "Spea name on it.\n");
997 if (reveal_spea)
998 printf ("#define REVEAL_SPEA\n");
999
1000 }
1001
1002 ask_int_choice (B (OPT_TRIX), "TRIX_BASE",
1003 "AudioTriX audio I/O base",
1004 FMT_HEX,
1005 0x530,
1006 "530, 604, E80 or F40");
1007
1008 ask_int_choice (B (OPT_TRIX), "TRIX_IRQ",
1009 "AudioTriX audio IRQ",
1010 FMT_INT,
1011 11,
1012 "7, 9, 10 or 11");
1013
1014 ask_int_choice (B (OPT_TRIX), "TRIX_DMA",
1015 "AudioTriX audio DMA",
1016 FMT_INT,
1017 0,
1018 "0, 1 or 3");
1019
1020 ask_int_choice (B (OPT_TRIX), "TRIX_DMA2",
1021 "AudioTriX second (duplex) DMA",
1022 FMT_INT,
1023 3,
1024 "0, 1 or 3");
1025
1026 ask_int_choice (B (OPT_TRIX), "TRIX_MPU_BASE",
1027 "AudioTriX MIDI I/O base",
1028 FMT_HEX,
1029 0x330,
1030 "330, 370, 3B0 or 3F0");
1031
1032 ask_int_choice (B (OPT_TRIX), "TRIX_MPU_IRQ",
1033 "AudioTriX MIDI IRQ",
1034 FMT_INT,
1035 9,
1036 "3, 4, 5, 7 or 9");
1037
1038 ask_int_choice (B (OPT_TRIX), "TRIX_SB_BASE",
1039 "AudioTriX SB I/O base",
1040 FMT_HEX,
1041 0x220,
1042 "220, 210, 230, 240, 250, 260 or 270");
1043
1044 ask_int_choice (B (OPT_TRIX), "TRIX_SB_IRQ",
1045 "AudioTriX SB IRQ",
1046 FMT_INT,
1047 7,
1048 "3, 4, 5 or 7");
1049
1050 ask_int_choice (B (OPT_TRIX), "TRIX_SB_DMA",
1051 "AudioTriX SB DMA",
1052 FMT_INT,
1053 1,
1054 "1 or 3");
1055
1056 ask_int_choice (B (OPT_CS4232), "CS4232_BASE",
1057 "CS4232 audio I/O base",
1058 FMT_HEX,
1059 0x530,
1060 "530, 604, E80 or F40");
1061
1062 ask_int_choice (B (OPT_CS4232), "CS4232_IRQ",
1063 "CS4232 audio IRQ",
1064 FMT_INT,
1065 11,
1066 "5, 7, 9, 11, 12 or 15");
1067
1068 ask_int_choice (B (OPT_CS4232), "CS4232_DMA",
1069 "CS4232 audio DMA",
1070 FMT_INT,
1071 0,
1072 "0, 1 or 3");
1073
1074 ask_int_choice (B (OPT_CS4232), "CS4232_DMA2",
1075 "CS4232 second (duplex) DMA",
1076 FMT_INT,
1077 3,
1078 "0, 1 or 3");
1079
1080 ask_int_choice (B (OPT_CS4232), "CS4232_MPU_BASE",
1081 "CS4232 MIDI I/O base",
1082 FMT_HEX,
1083 0x330,
1084 "330, 370, 3B0 or 3F0");
1085
1086 ask_int_choice (B (OPT_CS4232), "CS4232_MPU_IRQ",
1087 "CS4232 MIDI IRQ",
1088 FMT_INT,
1089 9,
1090 "5, 7, 9, 11, 12 or 15");
1091
1092 ask_int_choice (B (OPT_MAD16), "MAD16_BASE",
1093 "MAD16 audio I/O base",
1094 FMT_HEX,
1095 0x530,
1096 "530, 604, E80 or F40");
1097
1098 ask_int_choice (B (OPT_MAD16), "MAD16_IRQ",
1099 "MAD16 audio IRQ",
1100 FMT_INT,
1101 11,
1102 "7, 9, 10 or 11");
1103
1104 ask_int_choice (B (OPT_MAD16), "MAD16_DMA",
1105 "MAD16 audio DMA",
1106 FMT_INT,
1107 3,
1108 "0, 1 or 3");
1109
1110 ask_int_choice (B (OPT_MAD16), "MAD16_DMA2",
1111 "MAD16 second (duplex) DMA",
1112 FMT_INT,
1113 0,
1114 "0, 1 or 3");
1115
1116 ask_int_choice (B (OPT_MAD16), "MAD16_MPU_BASE",
1117 "MAD16 MIDI I/O base",
1118 FMT_HEX,
1119 0x330,
1120 "300, 310, 320 or 330 (0 disables)");
1121
1122 ask_int_choice (B (OPT_MAD16), "MAD16_MPU_IRQ",
1123 "MAD16 MIDI IRQ",
1124 FMT_INT,
1125 9,
1126 "5, 7, 9 or 10");
1127 #endif
1128 ask_int_choice (B (OPT_AUDIO), "DSP_BUFFSIZE",
1129 "Audio DMA buffer size",
1130 FMT_INT,
1131 65536,
1132 "4096, 16384, 32768 or 65536");
1133 }
1134
1135 void
1136 dump_script (void)
1137 {
1138 int i;
1139
1140 for (i = 0; i <= OPT_LAST; i++)
1141 if (!(DUMMY_OPTS & B (i)))
1142 if (!(DISABLED_OPTIONS & B (i)))
1143 {
1144 printf ("bool '%s' CONFIG_%s\n", questions[i], hw_table[i].macro);
1145 }
1146
1147
1148
1149
1150 printf ("bool 'Support for SM Wave' CONFIG_SMWAVE\n");
1151
1152 dump_only = 1;
1153 selected_options = 0;
1154 ask_parameters ();
1155
1156 #if 1
1157 printf ("#\n$MAKE -C drivers/sound kernelconfig || exit 1\n");
1158 #endif
1159 }
1160
1161 void
1162 dump_fixed_local (void)
1163 {
1164 int i = 0;
1165
1166 printf ("/* Computer generated file. Please don't edit! */\n\n");
1167 printf ("#define KERNEL_COMPATIBLE_CONFIG\n\n");
1168 printf ("#define SELECTED_SOUND_OPTIONS\t0x%08x\n\n", selected_options);
1169
1170 while (extra_options[i].name != NULL)
1171 {
1172 int n = 0, j;
1173
1174 printf ("#if ");
1175
1176 for (j = 0; j < OPT_LAST; j++)
1177 if (!(DISABLED_OPTIONS & B (j)))
1178 if (extra_options[i].mask & B (j))
1179 {
1180 if (n)
1181 printf (" || ");
1182 if (!(n++ % 2))
1183 printf ("\\\n ");
1184
1185 printf ("defined(CONFIG_%s)", hw_table[j].macro);
1186 }
1187
1188 printf ("\n");
1189 printf ("#\tdefine CONFIG_%s\n", extra_options[i].name);
1190 printf ("#endif\n\n");
1191 i++;
1192 }
1193 }
1194
1195 void
1196 dump_fixed_defines (void)
1197 {
1198 int i = 0;
1199
1200 printf ("# Computer generated file. Please don't edit\n\n");
1201
1202 while (extra_options[i].name != NULL)
1203 {
1204 int j;
1205
1206 for (j = 0; j < OPT_LAST; j++)
1207 if (!(DISABLED_OPTIONS & B (j)))
1208 if (extra_options[i].mask & B (j))
1209 {
1210 printf ("ifdef CONFIG_%s\n", hw_table[j].macro);
1211 printf ("CONFIG_%s=y\n", extra_options[i].name);
1212 printf ("endif\n\n");
1213 }
1214
1215 i++;
1216 }
1217 }
1218
1219 int
1220 main (int argc, char *argv[])
1221 {
1222 int i, full_driver = 1;
1223 char old_config_file[200];
1224
1225 if (getuid () != 0)
1226 {
1227 char *home;
1228
1229 if ((home = getenv ("HOME")) != NULL)
1230 {
1231 sprintf (old_config_file, "%s/.soundconf", home);
1232 oldconf = old_config_file;
1233 }
1234 }
1235
1236 if (argc > 1)
1237 {
1238 if (strcmp (argv[1], "-o") == 0 &&
1239 use_old_config (oldconf))
1240 exit (0);
1241 else if (strcmp (argv[1], "script") == 0)
1242 {
1243 dump_script ();
1244 exit (0);
1245 }
1246 else if (strcmp (argv[1], "fixedlocal") == 0)
1247 {
1248 dump_fixed_local ();
1249 exit (0);
1250 }
1251 else if (strcmp (argv[1], "fixeddefines") == 0)
1252 {
1253 dump_fixed_defines ();
1254 exit (0);
1255 }
1256 }
1257
1258 fprintf (stderr, "\nConfiguring Sound Support\n\n");
1259
1260 if (access (oldconf, R_OK) == 0)
1261 {
1262 char str[255];
1263 sprintf(str, "Old configuration exists in `%s'. Use it", oldconf);
1264 if (think_positively (str, 1,
1265 "Enable this option to load the previously saved configuration file\n"
1266 "for all of the sound driver parameters.\n"))
1267 if (use_old_config (oldconf))
1268 exit (0);
1269 }
1270
1271 printf ("/*\tGenerated by configure. Don't edit!!!!\t*/\n");
1272 printf ("/*\tMaking changes to this file is not as simple as it may look.\t*/\n\n");
1273 printf ("/*\tIf you change the CONFIG_ settings in local.h you\t*/\n");
1274 printf ("/*\t_have_ to edit .defines too.\t*/\n\n");
1275
1276 {
1277
1278
1279
1280
1281 full_driver = 0;
1282
1283 for (i = 0; i <= OPT_LAST; i++)
1284 if (can_select_option (i))
1285 {
1286 if (!(selected_options & B (i)))
1287
1288
1289 if (!hw_table[i].verify)
1290 {
1291 if (hw_table[i].alias)
1292 selected_options |= B (hw_table[i].alias);
1293 else
1294 selected_options |= B (i);
1295 }
1296 else
1297 {
1298 int def_answ = hw_table[i].default_answ;
1299
1300 if (think_positively (questions[i], def_answ, help[i]))
1301 if (hw_table[i].alias)
1302 selected_options |= B (hw_table[i].alias);
1303 else
1304 selected_options |= B (i);
1305 }
1306 }
1307 }
1308
1309 if (selected_options & B (OPT_SB))
1310 {
1311 if (think_positively (
1312 "Support for the SG NX Pro mixer", 0,
1313 "Enable this if you want to support the additional mixer functions\n"
1314 "provided on Sound Galaxy NX Pro sound cards.\n"))
1315 printf ("#define __SGNXPRO__\n");
1316 }
1317
1318 if (selected_options & B (OPT_SB))
1319 {
1320 if (think_positively ("Support for the MV Jazz16 (ProSonic etc.)", 0,
1321 "Enable this if you have an MV Jazz16 or ProSonic sound card.\n"))
1322 {
1323 if (think_positively ("Do you have SoundMan Wave", 0,
1324 "Enable this option of you have the Logitech SoundMan Wave sound card.\n"))
1325 {
1326 printf ("#define SM_WAVE\n");
1327
1328 midi0001_again:
1329 if (think_positively (
1330 "Do you have access to the MIDI0001.BIN file", 1,
1331 "The Logitech SoundMan Wave has a microcontroller which must be\n"
1332 "initialized before MIDI emulation works. This is possible only if the\n"
1333 "microcode file is compiled into the driver.\n"))
1334 {
1335 char path[512];
1336
1337 fprintf (stderr,
1338 "Enter full name of the MIDI0001.BIN file (pwd is sound): ");
1339 scanf ("%s", path);
1340 fprintf (stderr, "including microcode file %s\n", path);
1341
1342 if (!bin2hex (path, "smw-midi0001.h", "smw_ucode"))
1343 {
1344 fprintf (stderr, "Couldn't open file %s\n",
1345 path);
1346 if (think_positively ("Try again with correct path", 1,
1347 "The specified file could not be opened. Enter the correct path to the\n"
1348 "file.\n"))
1349 goto midi0001_again;
1350 }
1351 else
1352 {
1353 printf ("#define SMW_MIDI0001_INCLUDED\n");
1354 printf ("/*build bin2hex %s smw-midi0001.h smw_ucode */\n", path);
1355 }
1356 }
1357 }
1358 }
1359 }
1360
1361 if (selected_options & B (OPT_SB))
1362 {
1363 if (think_positively ("Do you have a Logitech SoundMan Games", 0,
1364 "The Logitech SoundMan Games supports 44 kHz in stereo while the\n"
1365 "standard SB Pro supports just 22 kHz stereo. You have the option of\n"
1366 "enabling SM Games mode. However, enable it only if you are sure that\n"
1367 "your card is an SM Games. Enabling this feature with a plain old SB\n"
1368 "Pro will cause troubles with stereo mode.\n\n"
1369 "DANGER! Read the above once again before answering 'y'\n"
1370 "Answer 'n' if you are unsure what to do!\n"))
1371 printf ("#define SM_GAMES\n");
1372 }
1373
1374 if (selected_options & B (OPT_AEDSP16))
1375 {
1376 int sel1 = 0;
1377
1378 if (selected_options & B (OPT_SB))
1379 {
1380
1381 if (think_positively (
1382 "Do you want support for the Audio Excel SoundBlaster Pro mode",
1383 1,
1384 "Enable this option if you want the Audio Excel sound card to operate\n"
1385 "in SoundBlaster Pro mode.\n"))
1386 {
1387 printf ("#define AEDSP16_SBPRO\n");
1388 sel1 = 1;
1389 }
1390 }
1391
1392 if ((selected_options & B (OPT_MSS)) && (sel1 == 0))
1393 {
1394
1395 if (think_positively (
1396 "Do you want support for the Audio Excel Microsoft Sound System mode",
1397 1,
1398 "Enable this option if you want the Audio Excel sound card to operate\n"
1399 "in Microsoft Sound System mode.\n"))
1400 {
1401 printf ("#define AEDSP16_MSS\n");
1402 sel1 = 1;
1403 }
1404 }
1405
1406 if (sel1 == 0)
1407 {
1408 printf ("invalid_configuration__run_make_config_again\n");
1409 fprintf (stderr, "ERROR!!!!!\nYou must select at least one mode when using Audio Excel!\n");
1410 exit (-1);
1411 }
1412 if (selected_options & B (OPT_MPU401))
1413 printf ("#define AEDSP16_MPU401\n");
1414 }
1415
1416 if (selected_options & B (OPT_PSS))
1417 {
1418 genld_again:
1419 if (think_positively ("Do you wish to include an LD file", 1,
1420 "If you want to emulate the SoundBlaster card and you have a DSPxxx.LD\n"
1421 "file then you must include the LD in the kernel.\n"))
1422 {
1423 char path[512];
1424
1425 fprintf (stderr,
1426 "Enter the path to your LD file (pwd is sound): ");
1427 scanf ("%s", path);
1428 fprintf (stderr, "including LD file %s\n", path);
1429
1430 if (!bin2hex (path, "synth-ld.h", "pss_synth"))
1431 {
1432 fprintf (stderr, "couldn't open `%s' as the LD file\n", path);
1433 if (think_positively ("try again with correct path", 1,
1434 "The given LD file could not opened.\n"))
1435 goto genld_again;
1436 }
1437 else
1438 {
1439 printf ("#define PSS_HAVE_LD\n");
1440 printf ("/*build bin2hex %s synth-ld.h pss_synth */\n", path);
1441 }
1442 }
1443 else
1444 {
1445 FILE *sf = fopen ("synth-ld.h", "w");
1446
1447 fprintf (sf, "/* automaticaly generated by configure */\n");
1448 fprintf (sf, "unsigned char pss_synth[1];\n"
1449 "#define pss_synthLen 0\n");
1450 fclose (sf);
1451 }
1452 }
1453
1454 if (selected_options & B (OPT_TRIX))
1455 {
1456 hex2hex_again:
1457
1458 if (think_positively ("Do you want to include TRXPRO.HEX in your kernel",
1459 1,
1460 "The MediaTriX AudioTrix Pro has an onboard microcontroller which\n"
1461 "needs to be initialized by downloading the code from the file TRXPRO.HEX\n"
1462 "in the DOS driver directory. If you don't have the TRXPRO.HEX file handy\n"
1463 "you may skip this step. However, the SB and MPU-401 modes of AudioTriX\n"
1464 "Pro will not work without this file!\n"))
1465 {
1466 char path[512];
1467
1468 fprintf (stderr,
1469 "Enter the path to your TRXPRO.HEX file (pwd is sound): ");
1470 scanf ("%s", path);
1471 fprintf (stderr, "including HEX file `%s'\n", path);
1472
1473 if (!hex2hex (path, "trix_boot.h", "trix_boot"))
1474 goto hex2hex_again;
1475 printf ("/*build hex2hex %s trix_boot.h trix_boot */\n", path);
1476 printf ("#define INCLUDE_TRIX_BOOT\n");
1477 }
1478 }
1479
1480 if (!(selected_options & ANY_DEVS))
1481 {
1482 printf ("invalid_configuration__run_make_config_again\n");
1483 fprintf (stderr,"\n*** This combination is useless. Sound driver disabled!!! ***\n*** You need to enable support for at least one device ***\n\n");
1484 exit (0);
1485 }
1486
1487 for (i = 0; i <= OPT_LAST; i++)
1488 if (!hw_table[i].alias)
1489 if (selected_options & B (i))
1490 printf ("#define CONFIG_%s\n", hw_table[i].macro);
1491 else
1492 printf ("#undef CONFIG_%s\n", hw_table[i].macro);
1493
1494 printf ("\n");
1495
1496 i = 0;
1497
1498 while (extra_options[i].name != NULL)
1499 {
1500 if (selected_options & extra_options[i].mask)
1501 printf ("#define CONFIG_%s\n", extra_options[i].name);
1502 else
1503 printf ("#undef CONFIG_%s\n", extra_options[i].name);
1504 i++;
1505 }
1506
1507 printf ("\n");
1508
1509 ask_parameters ();
1510
1511 printf ("#define SELECTED_SOUND_OPTIONS\t0x%08lx\n", selected_options);
1512 fprintf (stderr, "\nThe sound driver is now configured.\n");
1513
1514 #if defined(SCO) || defined(ISC) || defined(SYSV)
1515 fprintf (stderr, "Remember to update the System file\n");
1516 #endif
1517
1518 if (!old_config_used)
1519 {
1520 char str[255];
1521 sprintf(str, "Save copy of this configuration to `%s'", oldconf);
1522 if (think_positively (str, 1,
1523 "If you enable this option then the sound driver configuration is\n"
1524 "saved to a file. If you later need to recompile the kernel you have\n"
1525 "the option of using the saved configuration.\n"))
1526 {
1527 char cmd[200];
1528
1529 sprintf (cmd, "cp local.h %s", oldconf);
1530
1531 fclose (stdout);
1532 if (system (cmd) != 0)
1533 perror (cmd);
1534 }
1535 }
1536 exit (0);
1537 }
1538
1539 int
1540 bin2hex (char *path, char *target, char *varname)
1541 {
1542 int fd;
1543 int count;
1544 char c;
1545 int i = 0;
1546
1547 if ((fd = open (path, 0)) > 0)
1548 {
1549 FILE *sf = fopen (target, "w");
1550
1551 fprintf (sf, "/* automatically generated by configure */\n");
1552 fprintf (sf, "static unsigned char %s[] = {\n", varname);
1553 while (1)
1554 {
1555 count = read (fd, &c, 1);
1556 if (count == 0)
1557 break;
1558 if (i != 0 && (i % 10) == 0)
1559 fprintf (sf, "\n");
1560 fprintf (sf, "0x%02lx,", c & 0xFFL);
1561 i++;
1562 }
1563 fprintf (sf, "};\n"
1564 "#define %sLen %d\n", varname, i);
1565 fclose (sf);
1566 close (fd);
1567 return 1;
1568 }
1569
1570 return 0;
1571 }