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_PNP)|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_PNP 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_PNP)|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_PNP))
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, "PNP", 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 (mask == B (i))
422 {
423 unsigned int j;
424
425 for (j = 0; j < strlen (choices); j++)
426 if (choices[j] == '\'')
427 choices[j] = '_';
428
429 printf ("\nif [ \"$CONFIG_%s\" = \"y\" ]; then\n",
430 hw_table[i].macro);
431 if (format == FMT_INT)
432 printf ("int '%s %s' %s %d\n", question, choices, macro, defa);
433 else
434 printf ("hex '%s %s' %s %x\n", question, choices, macro, defa);
435 printf ("fi\n");
436 }
437 }
438 else
439 {
440 if (!(mask & selected_options))
441 return;
442
443 fprintf (stderr, "\n%s\n", question);
444 if (strcmp(choices, ""))
445 fprintf (stderr, "Possible values are: %s\n", choices);
446
447 if (format == FMT_INT)
448 {
449 if (defa == -1)
450 fprintf (stderr, "\t(-1 disables this feature)\n");
451 fprintf (stderr, "The default value is %d\n", defa);
452 fprintf (stderr, "Enter the value: ");
453 num = ask_value ("%d", defa);
454 if (num == -1)
455 return;
456 fprintf (stderr, "%s set to %d.\n", question, num);
457 printf ("#define %s %d\n", macro, num);
458 }
459 else
460 {
461 if (defa == 0)
462 fprintf (stderr, "\t(0 disables this feature)\n");
463 fprintf (stderr, "The default value is %x\n", defa);
464 fprintf (stderr, "Enter the value: ");
465 num = ask_value ("%x", defa);
466 if (num == 0)
467 return;
468 fprintf (stderr, "%s set to %x.\n", question, num);
469 printf ("#define %s 0x%x\n", macro, num);
470 }
471 }
472 }
473
474 void
475 rebuild_file (char *line)
476 {
477 char *method, *next, *old, *var, *p;
478
479 method = p = line;
480
481 while (*p && *p != ' ')
482 p++;
483 *p++ = 0;
484
485 old = p;
486 while (*p && *p != ' ')
487 p++;
488 *p++ = 0;
489
490 next = p;
491 while (*p && *p != ' ')
492 p++;
493 *p++ = 0;
494
495 var = p;
496 while (*p && *p != ' ')
497 p++;
498 *p++ = 0;
499
500 fprintf (stderr, "Rebuilding file `%s' (%s %s)\n", next, method, old);
501
502 if (strcmp (method, "bin2hex") == 0)
503 {
504 if (!bin2hex (old, next, var))
505 {
506 fprintf (stderr, "Rebuild failed\n");
507 exit (-1);
508 }
509 }
510 else if (strcmp (method, "hex2hex") == 0)
511 {
512 if (!hex2hex (old, next, var))
513 {
514 fprintf (stderr, "Rebuild failed\n");
515 exit (-1);
516 }
517 }
518 else
519 {
520 fprintf (stderr, "Failed to build `%s' - unknown method %s\n",
521 next, method);
522 exit (-1);
523 }
524 }
525
526 int
527 use_old_config (char *filename)
528 {
529 char buf[1024];
530 int i = 0;
531
532 FILE *oldf;
533
534 fprintf (stderr, "Copying old configuration from `%s'\n", filename);
535
536 if ((oldf = fopen (filename, "r")) == NULL)
537 {
538 fprintf (stderr, "Couldn't open previous configuration file\n");
539 perror (filename);
540 return 0;
541 }
542
543 while (fgets (buf, 1024, oldf) != NULL)
544 {
545 char tmp[100];
546
547 if (buf[0] != '#')
548 {
549 printf ("%s", buf);
550
551 strncpy (tmp, buf, 8);
552 tmp[8] = 0;
553
554 if (strcmp (tmp, "/*build ") == 0)
555 rebuild_file (&buf[8]);
556
557 continue;
558 }
559
560 strncpy (tmp, buf, 8);
561 tmp[8] = 0;
562
563 if (strcmp (tmp, "#define ") == 0)
564 {
565 char *id = &buf[8];
566
567 i = 0;
568 while (id[i] && id[i] != ' ' &&
569 id[i] != '\t' && id[i] != '\n')
570 i++;
571
572 strncpy (tmp, id, i);
573 tmp[i] = 0;
574
575 if (strcmp (tmp, "SELECTED_SOUND_OPTIONS") == 0)
576 continue;
577
578 if (strcmp (tmp, "KERNEL_SOUNDCARD") == 0)
579 continue;
580
581 if (strcmp (tmp, "JAZZ_DMA16") == 0)
582 {
583 printf("#define SB_DMA2 %s\n",
584 &buf[18]);
585 continue;
586 }
587
588 if (strcmp (tmp, "SB16_DMA") == 0)
589 {
590 printf("#define SB_DMA2 %s\n",
591 &buf[16]);
592 continue;
593 }
594
595 tmp[8] = 0;
596 if (strcmp (tmp, "EXCLUDE_") == 0)
597 continue;
598
599 strncpy (tmp, id, i);
600 tmp[7] = 0;
601
602 if (strcmp (tmp, "CONFIG_") == 0)
603 {
604 strncpy (tmp, &id[7], i - 7);
605 tmp[i - 7] = 0;
606
607 for (i = 0; i <= OPT_LAST; i++)
608 if (strcmp (hw_table[i].macro, tmp) == 0)
609 {
610 selected_options |= (1 << i);
611 break;
612 }
613 continue;
614 }
615
616 printf ("%s", buf);
617 continue;
618 }
619
620 if (strcmp (tmp, "#undef ") == 0)
621 {
622 char *id = &buf[8];
623
624 i = 0;
625 while (id[i] && id[i] != ' ' &&
626 id[i] != '\t' && id[i] != '\n')
627 i++;
628
629 strncpy (tmp, id, i);
630 tmp[7] = 0;
631 if (strcmp (tmp, "CONFIG_") == 0)
632 continue;
633
634 strncpy (tmp, id, i);
635
636 tmp[8] = 0;
637 if (strcmp (tmp, "EXCLUDE_") != 0)
638 continue;
639 strncpy (tmp, &id[8], i - 8);
640 tmp[i - 8] = 0;
641
642 for (i = 0; i <= OPT_LAST; i++)
643 if (strcmp (hw_table[i].macro, tmp) == 0)
644 {
645 selected_options |= (1 << i);
646 break;
647 }
648 continue;
649 }
650
651 printf ("%s", buf);
652 }
653 fclose (oldf);
654
655 for (i = 0; i <= OPT_LAST; i++)
656 if (!hw_table[i].alias)
657 if (selected_options & B (i))
658 printf ("#define CONFIG_%s\n", hw_table[i].macro);
659 else
660 printf ("#undef CONFIG_%s\n", hw_table[i].macro);
661
662
663 printf ("\n");
664
665 i = 0;
666
667 while (extra_options[i].name != NULL)
668 {
669 if (selected_options & extra_options[i].mask)
670 printf ("#define CONFIG_%s\n", extra_options[i].name);
671 else
672 printf ("#undef CONFIG_%s\n", extra_options[i].name);
673 i++;
674 }
675
676 printf ("\n");
677
678 printf ("#define SELECTED_SOUND_OPTIONS\t0x%08x\n", selected_options);
679 fprintf (stderr, "Old configuration copied.\n");
680
681 #ifdef linux
682 build_defines ();
683 #endif
684 old_config_used = 1;
685 return 1;
686 }
687
688 #ifdef linux
689 void
690 build_defines (void)
691 {
692 FILE *optf;
693 int i;
694
695 if ((optf = fopen (".defines", "w")) == NULL)
696 {
697 perror (".defines");
698 exit (-1);
699 }
700
701
702 for (i = 0; i <= OPT_LAST; i++)
703 if (!hw_table[i].alias)
704 if (selected_options & B (i))
705 fprintf (optf, "CONFIG_%s=y\n", hw_table[i].macro);
706 #if 0
707 else
708 fprintf (optf, "CONFIG_%s=n\n", hw_table[i].macro);
709 #endif
710
711
712 fprintf (optf, "\n");
713
714 i = 0;
715
716 while (extra_options[i].name != NULL)
717 {
718 if (selected_options & extra_options[i].mask)
719 fprintf (optf, "CONFIG_%s=y\n", extra_options[i].name);
720 #if 0
721 else
722 fprintf (optf, "CONFIG_%s=n\n", extra_options[i].name);
723 #endif
724 i++;
725 }
726
727 fprintf (optf, "\n");
728 fclose (optf);
729 }
730 #endif
731
732 void
733 ask_parameters (void)
734 {
735 #ifdef linux
736 int num;
737
738 build_defines ();
739
740
741
742
743 ask_int_choice (B (OPT_AEDSP16), "AEDSP16_BASE",
744 "I/O base for Audio Excel DSP 16",
745 FMT_HEX,
746 0x220,
747 "220 or 240");
748
749 ask_int_choice (B (OPT_SB), "SBC_BASE",
750 "I/O base for SB",
751 FMT_HEX,
752 0x220,
753 "Check from manual of the card");
754
755 ask_int_choice (B (OPT_SB), "SBC_IRQ",
756 "SoundBlaster IRQ",
757 FMT_INT,
758 7,
759 "Check from manual of the card");
760
761 ask_int_choice (B (OPT_SB), "SBC_DMA",
762 "SoundBlaster DMA",
763 FMT_INT,
764 1,
765 "0, 1 or 3");
766
767 ask_int_choice (B (OPT_SB), "SB_DMA2",
768 "SoundBlaster 16 bit DMA (_REQUIRED_for SB16, Jazz16, SMW)",
769 FMT_INT,
770 5,
771 "5, 6 or 7");
772
773 ask_int_choice (B (OPT_SB), "SB_MPU_BASE",
774 "MPU401 I/O base of SB16, Jazz16 and ES1688",
775 FMT_HEX,
776 0,
777 "Check from manual of the card");
778
779 ask_int_choice (B (OPT_SB), "SB_MPU_IRQ",
780 "SB MPU401 IRQ (SB16, Jazz16 and ES1688)",
781 FMT_INT,
782 -1,
783 "Check from manual of the card");
784
785 ask_int_choice (B (OPT_PAS), "PAS_IRQ",
786 "PAS16 IRQ",
787 FMT_INT,
788 10,
789 "3, 4, 5, 7, 9, 10, 11, 12, 14 or 15");
790
791 ask_int_choice (B (OPT_PAS), "PAS_DMA",
792 "PAS16 DMA",
793 FMT_INT,
794 3,
795 "0, 1, 3, 5, 6 or 7");
796
797 if (selected_options & B (OPT_PAS))
798 {
799 if (think_positively ("Enable Joystick port on ProAudioSpectrum", 0,
800 "Enable this option if you want to use the joystick port provided\n"
801 "on the PAS sound card.\n"))
802 printf ("#define PAS_JOYSTICK_ENABLE\n");
803
804 if (think_positively ("Enable PAS16 bus clock option", 0,
805 "The PAS16 can be noisy with some motherboards. There is a command\n"
806 "line switch (:T?) in the DOS driver for PAS16 which solves this.\n"
807 "Don't enable this feature unless you have problems and have to use\n"
808 "this switch with DOS\n"))
809 printf ("#define BROKEN_BUS_CLOCK\n");
810
811 if (think_positively ("Disable SB mode of PAS16", 0,
812 "You should disable SB emulation of PAS16 if you want to use\n"
813 "Another SB compatible card in the same system\n"))
814 printf ("#define DISABLE_SB_EMULATION\n");
815 }
816
817 ask_int_choice (B (OPT_GUS), "GUS_BASE",
818 "I/O base for GUS",
819 FMT_HEX,
820 0x220,
821 "210, 220, 230, 240, 250 or 260");
822
823
824 ask_int_choice (B (OPT_GUS), "GUS_IRQ",
825 "GUS IRQ",
826 FMT_INT,
827 15,
828 "3, 5, 7, 9, 11, 12 or 15");
829
830 ask_int_choice (B (OPT_GUS), "GUS_DMA",
831 "GUS DMA",
832 FMT_INT,
833 6,
834 "1, 3, 5, 6 or 7");
835
836 ask_int_choice (B (OPT_GUS), "GUS_DMA2",
837 "Second DMA channel for GUS",
838 FMT_INT,
839 -1,
840 "1, 3, 5, 6 or 7");
841
842 ask_int_choice (B (OPT_GUS16), "GUS16_BASE",
843 "I/O base for the 16 bit daughtercard of GUS",
844 FMT_HEX,
845 0x530,
846 "530, 604, E80 or F40");
847
848
849 ask_int_choice (B (OPT_GUS16), "GUS16_IRQ",
850 "GUS 16 bit daughtercard IRQ",
851 FMT_INT,
852 7,
853 "3, 4, 5, 7, or 9");
854
855 ask_int_choice (B (OPT_GUS16), "GUS16_DMA",
856 "GUS DMA",
857 FMT_INT,
858 3,
859 "0, 1 or 3");
860
861 ask_int_choice (B (OPT_MPU401), "MPU_BASE",
862 "I/O base for MPU401",
863 FMT_HEX,
864 0x330,
865 "Check from manual of the card");
866
867 ask_int_choice (B (OPT_MPU401), "MPU_IRQ",
868 "MPU401 IRQ",
869 FMT_INT,
870 9,
871 "Check from manual of the card");
872
873 ask_int_choice (B (OPT_MAUI), "MAUI_BASE",
874 "I/O base for Maui",
875 FMT_HEX,
876 0x330,
877 "210, 230, 260, 290, 300, 320, 338 or 330");
878
879 ask_int_choice (B (OPT_MAUI), "MAUI_IRQ",
880 "Maui IRQ",
881 FMT_INT,
882 9,
883 "5, 9, 12 or 15");
884
885 ask_int_choice (B (OPT_UART6850), "U6850_BASE",
886 "I/O base for UART 6850 MIDI port",
887 FMT_HEX,
888 0,
889 "(Unknown)");
890
891 ask_int_choice (B (OPT_UART6850), "U6850_IRQ",
892 "UART6850 IRQ",
893 FMT_INT,
894 -1,
895 "(Unknown)");
896
897 ask_int_choice (B (OPT_PSS), "PSS_BASE",
898 "PSS I/O base",
899 FMT_HEX,
900 0x220,
901 "220 or 240");
902
903 ask_int_choice (B (OPT_PSS), "PSS_MSS_BASE",
904 "PSS audio I/O base",
905 FMT_HEX,
906 0x530,
907 "530, 604, E80 or F40");
908
909 ask_int_choice (B (OPT_PSS), "PSS_MSS_IRQ",
910 "PSS audio IRQ",
911 FMT_INT,
912 11,
913 "7, 9, 10 or 11");
914
915 ask_int_choice (B (OPT_PSS), "PSS_MSS_DMA",
916 "PSS audio DMA",
917 FMT_INT,
918 3,
919 "0, 1 or 3");
920
921 ask_int_choice (B (OPT_PSS), "PSS_MPU_BASE",
922 "PSS MIDI I/O base",
923 FMT_HEX,
924 0x330,
925 "");
926
927 ask_int_choice (B (OPT_PSS), "PSS_MPU_IRQ",
928 "PSS MIDI IRQ",
929 FMT_INT,
930 9,
931 "3, 4, 5, 7 or 9");
932
933 ask_int_choice (B (OPT_MSS), "MSS_BASE",
934 "MSS/WSS I/O base",
935 FMT_HEX,
936 0x530,
937 "530, 604, E80 or F40");
938
939 ask_int_choice (B (OPT_MSS), "MSS_IRQ",
940 "MSS/WSS IRQ",
941 FMT_INT,
942 11,
943 "7, 9, 10 or 11");
944
945 ask_int_choice (B (OPT_MSS), "MSS_DMA",
946 "MSS/WSS DMA",
947 FMT_INT,
948 3,
949 "0, 1 or 3");
950
951 ask_int_choice (B (OPT_SSCAPE), "SSCAPE_BASE",
952 "Soundscape MIDI I/O base",
953 FMT_HEX,
954 0x330,
955 "");
956
957 ask_int_choice (B (OPT_SSCAPE), "SSCAPE_IRQ",
958 "Soundscape MIDI IRQ",
959 FMT_INT,
960 9,
961 "");
962
963 ask_int_choice (B (OPT_SSCAPE), "SSCAPE_DMA",
964 "Soundscape initialization DMA",
965 FMT_INT,
966 3,
967 "0, 1 or 3");
968
969 ask_int_choice (B (OPT_SSCAPE), "SSCAPE_MSS_BASE",
970 "Soundscape audio I/O base",
971 FMT_HEX,
972 0x534,
973 "534, 608, E84 or F44");
974
975 ask_int_choice (B (OPT_SSCAPE), "SSCAPE_MSS_IRQ",
976 "Soundscape audio IRQ",
977 FMT_INT,
978 11,
979 "7, 9, 10 or 11");
980
981 ask_int_choice (B (OPT_SSCAPE), "SSCAPE_MSS_DMA",
982 "Soundscape audio DMA",
983 FMT_INT,
984 0,
985 "0, 1 or 3");
986
987 if (selected_options & B (OPT_SSCAPE))
988 {
989 int reveal_spea;
990
991 reveal_spea = think_positively (
992 "Is your SoundScape card made/marketed by Reveal or Spea",
993 0,
994 "Enable if you have a SoundScape card with the Reveal or\n"
995 "Spea name on it.\n");
996 if (reveal_spea)
997 printf ("#define REVEAL_SPEA\n");
998
999 }
1000
1001 ask_int_choice (B (OPT_TRIX), "TRIX_BASE",
1002 "AudioTriX audio I/O base",
1003 FMT_HEX,
1004 0x530,
1005 "530, 604, E80 or F40");
1006
1007 ask_int_choice (B (OPT_TRIX), "TRIX_IRQ",
1008 "AudioTriX audio IRQ",
1009 FMT_INT,
1010 11,
1011 "7, 9, 10 or 11");
1012
1013 ask_int_choice (B (OPT_TRIX), "TRIX_DMA",
1014 "AudioTriX audio DMA",
1015 FMT_INT,
1016 0,
1017 "0, 1 or 3");
1018
1019 ask_int_choice (B (OPT_TRIX), "TRIX_DMA2",
1020 "AudioTriX second (duplex) DMA",
1021 FMT_INT,
1022 3,
1023 "0, 1 or 3");
1024
1025 ask_int_choice (B (OPT_TRIX), "TRIX_MPU_BASE",
1026 "AudioTriX MIDI I/O base",
1027 FMT_HEX,
1028 0x330,
1029 "330, 370, 3B0 or 3F0");
1030
1031 ask_int_choice (B (OPT_TRIX), "TRIX_MPU_IRQ",
1032 "AudioTriX MIDI IRQ",
1033 FMT_INT,
1034 9,
1035 "3, 4, 5, 7 or 9");
1036
1037 ask_int_choice (B (OPT_TRIX), "TRIX_SB_BASE",
1038 "AudioTriX SB I/O base",
1039 FMT_HEX,
1040 0x220,
1041 "220, 210, 230, 240, 250, 260 or 270");
1042
1043 ask_int_choice (B (OPT_TRIX), "TRIX_SB_IRQ",
1044 "AudioTriX SB IRQ",
1045 FMT_INT,
1046 7,
1047 "3, 4, 5 or 7");
1048
1049 ask_int_choice (B (OPT_TRIX), "TRIX_SB_DMA",
1050 "AudioTriX SB DMA",
1051 FMT_INT,
1052 1,
1053 "1 or 3");
1054
1055 ask_int_choice (B (OPT_CS4232), "CS4232_BASE",
1056 "CS4232 audio I/O base",
1057 FMT_HEX,
1058 0x530,
1059 "530, 604, E80 or F40");
1060
1061 ask_int_choice (B (OPT_CS4232), "CS4232_IRQ",
1062 "CS4232 audio IRQ",
1063 FMT_INT,
1064 11,
1065 "5, 7, 9, 11, 12 or 15");
1066
1067 ask_int_choice (B (OPT_CS4232), "CS4232_DMA",
1068 "CS4232 audio DMA",
1069 FMT_INT,
1070 0,
1071 "0, 1 or 3");
1072
1073 ask_int_choice (B (OPT_CS4232), "CS4232_DMA2",
1074 "CS4232 second (duplex) DMA",
1075 FMT_INT,
1076 3,
1077 "0, 1 or 3");
1078
1079 ask_int_choice (B (OPT_CS4232), "CS4232_MPU_BASE",
1080 "CS4232 MIDI I/O base",
1081 FMT_HEX,
1082 0x330,
1083 "330, 370, 3B0 or 3F0");
1084
1085 ask_int_choice (B (OPT_CS4232), "CS4232_MPU_IRQ",
1086 "CS4232 MIDI IRQ",
1087 FMT_INT,
1088 9,
1089 "5, 7, 9, 11, 12 or 15");
1090
1091 ask_int_choice (B (OPT_MAD16), "MAD16_BASE",
1092 "MAD16 audio I/O base",
1093 FMT_HEX,
1094 0x530,
1095 "530, 604, E80 or F40");
1096
1097 ask_int_choice (B (OPT_MAD16), "MAD16_IRQ",
1098 "MAD16 audio IRQ",
1099 FMT_INT,
1100 11,
1101 "7, 9, 10 or 11");
1102
1103 ask_int_choice (B (OPT_MAD16), "MAD16_DMA",
1104 "MAD16 audio DMA",
1105 FMT_INT,
1106 3,
1107 "0, 1 or 3");
1108
1109 ask_int_choice (B (OPT_MAD16), "MAD16_DMA2",
1110 "MAD16 second (duplex) DMA",
1111 FMT_INT,
1112 0,
1113 "0, 1 or 3");
1114
1115 ask_int_choice (B (OPT_MAD16), "MAD16_MPU_BASE",
1116 "MAD16 MIDI I/O base",
1117 FMT_HEX,
1118 0x330,
1119 "300, 310, 320 or 330 (0 disables)");
1120
1121 ask_int_choice (B (OPT_MAD16), "MAD16_MPU_IRQ",
1122 "MAD16 MIDI IRQ",
1123 FMT_INT,
1124 9,
1125 "5, 7, 9 or 10");
1126 #endif
1127 ask_int_choice (B (OPT_AUDIO), "DSP_BUFFSIZE",
1128 "Audio DMA buffer size",
1129 FMT_INT,
1130 65536,
1131 "4096, 16384, 32768 or 65536");
1132 }
1133
1134 void
1135 dump_script (void)
1136 {
1137 int i;
1138
1139 for (i = 0; i <= OPT_LAST; i++)
1140 if (!(DUMMY_OPTS & B (i)))
1141 if (!(DISABLED_OPTIONS & B (i)))
1142 {
1143 printf ("bool '%s' CONFIG_%s\n", questions[i], hw_table[i].macro);
1144 }
1145
1146
1147
1148
1149 printf ("bool 'Support for SM Wave' CONFIG_SMWAVE\n");
1150
1151 dump_only = 1;
1152 selected_options = 0;
1153 ask_parameters ();
1154
1155 #if 1
1156 printf ("#\n$MAKE -C drivers/sound kernelconfig || exit 1\n");
1157 #endif
1158 }
1159
1160 void
1161 dump_fixed_local (void)
1162 {
1163 int i = 0;
1164
1165 printf ("/* Computer generated file. Please don't edit! */\n\n");
1166 printf ("#define KERNEL_COMPATIBLE_CONFIG\n\n");
1167 printf ("#define SELECTED_SOUND_OPTIONS\t0x%08x\n\n", selected_options);
1168
1169 while (extra_options[i].name != NULL)
1170 {
1171 int n = 0, j;
1172
1173 printf ("#if ");
1174
1175 for (j = 0; j < OPT_LAST; j++)
1176 if (!(DISABLED_OPTIONS & B (j)))
1177 if (extra_options[i].mask & B (j))
1178 {
1179 if (n)
1180 printf (" || ");
1181 if (!(n++ % 2))
1182 printf ("\\\n ");
1183
1184 printf ("defined(CONFIG_%s)", hw_table[j].macro);
1185 }
1186
1187 printf ("\n");
1188 printf ("#\tdefine CONFIG_%s\n", extra_options[i].name);
1189 printf ("#endif\n\n");
1190 i++;
1191 }
1192 }
1193
1194 void
1195 dump_fixed_defines (void)
1196 {
1197 int i = 0;
1198
1199 printf ("# Computer generated file. Please don't edit\n\n");
1200
1201 while (extra_options[i].name != NULL)
1202 {
1203 int j;
1204
1205 for (j = 0; j < OPT_LAST; j++)
1206 if (!(DISABLED_OPTIONS & B (j)))
1207 if (extra_options[i].mask & B (j))
1208 {
1209 printf ("ifdef CONFIG_%s\n", hw_table[j].macro);
1210 printf ("CONFIG_%s=y\n", extra_options[i].name);
1211 printf ("endif\n\n");
1212 }
1213
1214 i++;
1215 }
1216 }
1217
1218 int
1219 main (int argc, char *argv[])
1220 {
1221 int i, full_driver = 1;
1222 char old_config_file[200];
1223
1224 if (getuid () != 0)
1225 {
1226 char *home;
1227
1228 if ((home = getenv ("HOME")) != NULL)
1229 {
1230 sprintf (old_config_file, "%s/.soundconf", home);
1231 oldconf = old_config_file;
1232 }
1233 }
1234
1235 if (argc > 1)
1236 {
1237 if (strcmp (argv[1], "-o") == 0 &&
1238 use_old_config (oldconf))
1239 exit (0);
1240 else if (strcmp (argv[1], "script") == 0)
1241 {
1242 dump_script ();
1243 exit (0);
1244 }
1245 else if (strcmp (argv[1], "fixedlocal") == 0)
1246 {
1247 dump_fixed_local ();
1248 exit (0);
1249 }
1250 else if (strcmp (argv[1], "fixeddefines") == 0)
1251 {
1252 dump_fixed_defines ();
1253 exit (0);
1254 }
1255 }
1256
1257 fprintf (stderr, "\nConfiguring Sound Support\n\n");
1258
1259 if (access (oldconf, R_OK) == 0)
1260 {
1261 char str[255];
1262 sprintf(str, "Old configuration exists in `%s'. Use it", oldconf);
1263 if (think_positively (str, 1,
1264 "Enable this option to load the previously saved configuration file\n"
1265 "for all of the sound driver parameters.\n"))
1266 if (use_old_config (oldconf))
1267 exit (0);
1268 }
1269
1270 printf ("/*\tGenerated by configure. Don't edit!!!!\t*/\n");
1271 printf ("/*\tMaking changes to this file is not as simple as it may look.\t*/\n\n");
1272 printf ("/*\tIf you change the CONFIG_ settings in local.h you\t*/\n");
1273 printf ("/*\t_have_ to edit .defines too.\t*/\n\n");
1274
1275 {
1276
1277
1278
1279
1280 full_driver = 0;
1281
1282 for (i = 0; i <= OPT_LAST; i++)
1283 if (can_select_option (i))
1284 {
1285 if (!(selected_options & B (i)))
1286
1287
1288 if (!hw_table[i].verify)
1289 {
1290 if (hw_table[i].alias)
1291 selected_options |= B (hw_table[i].alias);
1292 else
1293 selected_options |= B (i);
1294 }
1295 else
1296 {
1297 int def_answ = hw_table[i].default_answ;
1298
1299 if (think_positively (questions[i], def_answ, help[i]))
1300 if (hw_table[i].alias)
1301 selected_options |= B (hw_table[i].alias);
1302 else
1303 selected_options |= B (i);
1304 }
1305 }
1306 }
1307
1308 if (selected_options & B (OPT_SB))
1309 {
1310 if (think_positively (
1311 "Support for the SG NX Pro mixer", 0,
1312 "Enable this if you want to support the additional mixer functions\n"
1313 "provided on Sound Galaxy NX Pro sound cards.\n"))
1314 printf ("#define __SGNXPRO__\n");
1315 }
1316
1317 if (selected_options & B (OPT_SB))
1318 {
1319 if (think_positively ("Support for the MV Jazz16 (ProSonic etc.)", 0,
1320 "Enable this if you have an MV Jazz16 or ProSonic sound card.\n"))
1321 {
1322 if (think_positively ("Do you have SoundMan Wave", 0,
1323 "Enable this option of you have the Logitech SoundMan Wave sound card.\n"))
1324 {
1325 printf ("#define SM_WAVE\n");
1326
1327 midi0001_again:
1328 if (think_positively (
1329 "Do you have access to the MIDI0001.BIN file", 1,
1330 "The Logitech SoundMan Wave has a microcontroller which must be\n"
1331 "initialized before MIDI emulation works. This is possible only if the\n"
1332 "microcode file is compiled into the driver.\n"))
1333 {
1334 char path[512];
1335
1336 fprintf (stderr,
1337 "Enter full name of the MIDI0001.BIN file (pwd is sound): ");
1338 scanf ("%s", path);
1339 fprintf (stderr, "including microcode file %s\n", path);
1340
1341 if (!bin2hex (path, "smw-midi0001.h", "smw_ucode"))
1342 {
1343 fprintf (stderr, "Couldn't open file %s\n",
1344 path);
1345 if (think_positively ("Try again with correct path", 1,
1346 "The specified file could not be opened. Enter the correct path to the\n"
1347 "file.\n"))
1348 goto midi0001_again;
1349 }
1350 else
1351 {
1352 printf ("#define SMW_MIDI0001_INCLUDED\n");
1353 printf ("/*build bin2hex %s smw-midi0001.h smw_ucode */\n", path);
1354 }
1355 }
1356 }
1357 }
1358 }
1359
1360 if (selected_options & B (OPT_SB))
1361 {
1362 if (think_positively ("Do you have a Logitech SoundMan Games", 0,
1363 "The Logitech SoundMan Games supports 44 kHz in stereo while the\n"
1364 "standard SB Pro supports just 22 kHz stereo. You have the option of\n"
1365 "enabling SM Games mode. However, enable it only if you are sure that\n"
1366 "your card is an SM Games. Enabling this feature with a plain old SB\n"
1367 "Pro will cause troubles with stereo mode.\n\n"
1368 "DANGER! Read the above once again before answering 'y'\n"
1369 "Answer 'n' if you are unsure what to do!\n"))
1370 printf ("#define SM_GAMES\n");
1371 }
1372
1373 if (selected_options & B (OPT_AEDSP16))
1374 {
1375 int sel1 = 0;
1376
1377 if (selected_options & B (OPT_SB))
1378 {
1379
1380 if (think_positively (
1381 "Do you want support for the Audio Excel SoundBlaster Pro mode",
1382 1,
1383 "Enable this option if you want the Audio Excel sound card to operate\n"
1384 "in SoundBlaster Pro mode.\n"))
1385 {
1386 printf ("#define AEDSP16_SBPRO\n");
1387 sel1 = 1;
1388 }
1389 }
1390
1391 if ((selected_options & B (OPT_MSS)) && (sel1 == 0))
1392 {
1393
1394 if (think_positively (
1395 "Do you want support for the Audio Excel Microsoft Sound System mode",
1396 1,
1397 "Enable this option if you want the Audio Excel sound card to operate\n"
1398 "in Microsoft Sound System mode.\n"))
1399 {
1400 printf ("#define AEDSP16_MSS\n");
1401 sel1 = 1;
1402 }
1403 }
1404
1405 if (sel1 == 0)
1406 {
1407 printf ("invalid_configuration__run_make_config_again\n");
1408 fprintf (stderr, "ERROR!!!!!\nYou must select at least one mode when using Audio Excel!\n");
1409 exit (-1);
1410 }
1411 if (selected_options & B (OPT_MPU401))
1412 printf ("#define AEDSP16_MPU401\n");
1413 }
1414
1415 if (selected_options & B (OPT_PSS))
1416 {
1417 genld_again:
1418 if (think_positively ("Do you wish to include an LD file", 1,
1419 "If you want to emulate the SoundBlaster card and you have a DSPxxx.LD\n"
1420 "file then you must include the LD in the kernel.\n"))
1421 {
1422 char path[512];
1423
1424 fprintf (stderr,
1425 "Enter the path to your LD file (pwd is sound): ");
1426 scanf ("%s", path);
1427 fprintf (stderr, "including LD file %s\n", path);
1428
1429 if (!bin2hex (path, "synth-ld.h", "pss_synth"))
1430 {
1431 fprintf (stderr, "couldn't open `%s' as the LD file\n", path);
1432 if (think_positively ("try again with correct path", 1,
1433 "The given LD file could not opened.\n"))
1434 goto genld_again;
1435 }
1436 else
1437 {
1438 printf ("#define PSS_HAVE_LD\n");
1439 printf ("/*build bin2hex %s synth-ld.h pss_synth */\n", path);
1440 }
1441 }
1442 else
1443 {
1444 FILE *sf = fopen ("synth-ld.h", "w");
1445
1446 fprintf (sf, "/* automaticaly generated by configure */\n");
1447 fprintf (sf, "unsigned char pss_synth[1];\n"
1448 "#define pss_synthLen 0\n");
1449 fclose (sf);
1450 }
1451 }
1452
1453 if (selected_options & B (OPT_TRIX))
1454 {
1455 hex2hex_again:
1456
1457 if (think_positively ("Do you want to include TRXPRO.HEX in your kernel",
1458 1,
1459 "The MediaTriX AudioTrix Pro has an onboard microcontroller which\n"
1460 "needs to be initialized by downloading the code from the file TRXPRO.HEX\n"
1461 "in the DOS driver directory. If you don't have the TRXPRO.HEX file handy\n"
1462 "you may skip this step. However, the SB and MPU-401 modes of AudioTriX\n"
1463 "Pro will not work without this file!\n"))
1464 {
1465 char path[512];
1466
1467 fprintf (stderr,
1468 "Enter the path to your TRXPRO.HEX file (pwd is sound): ");
1469 scanf ("%s", path);
1470 fprintf (stderr, "including HEX file `%s'\n", path);
1471
1472 if (!hex2hex (path, "trix_boot.h", "trix_boot"))
1473 goto hex2hex_again;
1474 printf ("/*build hex2hex %s trix_boot.h trix_boot */\n", path);
1475 printf ("#define INCLUDE_TRIX_BOOT\n");
1476 }
1477 }
1478
1479 if (!(selected_options & ANY_DEVS))
1480 {
1481 printf ("invalid_configuration__run_make_config_again\n");
1482 fprintf (stderr,"\n*** This combination is useless. Sound driver disabled!!! ***\n*** You need to enable support for at least one device ***\n\n");
1483 exit (0);
1484 }
1485
1486 for (i = 0; i <= OPT_LAST; i++)
1487 if (!hw_table[i].alias)
1488 if (selected_options & B (i))
1489 printf ("#define CONFIG_%s\n", hw_table[i].macro);
1490 else
1491 printf ("#undef CONFIG_%s\n", hw_table[i].macro);
1492
1493 printf ("\n");
1494
1495 i = 0;
1496
1497 while (extra_options[i].name != NULL)
1498 {
1499 if (selected_options & extra_options[i].mask)
1500 printf ("#define CONFIG_%s\n", extra_options[i].name);
1501 else
1502 printf ("#undef CONFIG_%s\n", extra_options[i].name);
1503 i++;
1504 }
1505
1506 printf ("\n");
1507
1508 ask_parameters ();
1509
1510 printf ("#define SELECTED_SOUND_OPTIONS\t0x%08lx\n", selected_options);
1511 fprintf (stderr, "\nThe sound driver is now configured.\n");
1512
1513 #if defined(SCO) || defined(ISC) || defined(SYSV)
1514 fprintf (stderr, "Remember to update the System file\n");
1515 #endif
1516
1517 if (!old_config_used)
1518 {
1519 char str[255];
1520 sprintf(str, "Save copy of this configuration to `%s'", oldconf);
1521 if (think_positively (str, 1,
1522 "If you enable this option then the sound driver configuration is\n"
1523 "saved to a file. If you later need to recompile the kernel you have\n"
1524 "the option of using the saved configuration.\n"))
1525 {
1526 char cmd[200];
1527
1528 sprintf (cmd, "cp local.h %s", oldconf);
1529
1530 fclose (stdout);
1531 if (system (cmd) != 0)
1532 perror (cmd);
1533 }
1534 }
1535 exit (0);
1536 }
1537
1538 int
1539 bin2hex (char *path, char *target, char *varname)
1540 {
1541 int fd;
1542 int count;
1543 char c;
1544 int i = 0;
1545
1546 if ((fd = open (path, 0)) > 0)
1547 {
1548 FILE *sf = fopen (target, "w");
1549
1550 fprintf (sf, "/* automatically generated by configure */\n");
1551 fprintf (sf, "static unsigned char %s[] = {\n", varname);
1552 while (1)
1553 {
1554 count = read (fd, &c, 1);
1555 if (count == 0)
1556 break;
1557 if (i != 0 && (i % 10) == 0)
1558 fprintf (sf, "\n");
1559 fprintf (sf, "0x%02lx,", c & 0xFFL);
1560 i++;
1561 }
1562 fprintf (sf, "};\n"
1563 "#define %sLen %d\n", varname, i);
1564 fclose (sf);
1565 close (fd);
1566 return 1;
1567 }
1568
1569 return 0;
1570 }