Final polisihing for KDE4:
[kdemultimedia.git] / kscd / kscd-script
blob89146f7c8e74749076505d443d405b67c6b1f355
1 #!/bin/sh
3 # Kscd - A simple cd player for the KDE Project
5 # $Id$
6 #
7 # Copyright (c) 1997 Bernd Johannes Wuebben math.cornell.edu
8 #
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2, or (at your option)
12 # any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 # the following is borrowed from configure
25 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
26 # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
27 if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
28 ac_n= ac_c='
29 ' ac_t=' '
30 else
31 ac_n=-n ac_c= ac_t=
33 else
34 ac_n= ac_c='\c' ac_t=
37 config_file="config.h"
38 ORG_CONFIG="config.h.std"
40 display_main_menu(){
42 clear
43 echo
44 echo " KSCD -- Configuration"
45 echo "==================================================================="
46 echo
47 echo " Linux ...................... L"
48 echo " FreeBSD/NetBSD ............. F"
49 echo " BSD386 ..................... B"
50 echo " Sun ........................ S"
51 echo " HPUX ....................... H"
52 echo " Irix ....................... I"
53 echo " Sony NEWS .................. N"
54 echo " OSF/1 ...................... O"
55 echo " Ultrix ..................... U"
56 echo " Generic SVR4 (not Sun) ..... V"
57 echo
58 echo " Quit ....................... Q"
59 echo
60 echo
61 echo " Bernd Johannes Wuebben <wuebben@kde.org>"
62 echo "=================================================================="
63 echo
64 echo $ac_n " Please chose acccording to your platform:$ac_c"
66 read platform
70 give_instructions(){
72 echo "Please answer all questions. Simply hit [Enter] to select the default"
73 echo "values which are displayed in square brackets."
74 echo
78 write_config_header(){
80 echo "" >> $config_file
81 echo "/* This header file was automatically generated by the kscd" >> $config_file
82 echo " installation script. In case of trouble please edit" >> $config_file
83 echo " $ORG_CONFIG in the source directory of the kscd distribution" >> $config_file
84 echo " and rename it to $config_file .*/" >> $config_file
85 echo "" >> $config_file
89 linux_conf(){
91 clear
92 echo "KSCD configuration for Linux systems"
93 echo "------------------------------------"
94 echo
96 give_instructions
97 write_config_header
99 echo "#ifdef linux " >> $config_file
100 echo "" >> $config_file
102 echo $ac_n "Please specify your cdrom device [/dev/cdrom]:$ac_c"
104 read device
105 if [ "$device" = "" ]
106 then
107 device="/dev/cdrom"
110 echo "Your choice was: $device"
111 echo "#define DEFAULT_CD_DEVICE \"$device\" " >> $config_file
115 echo
116 echo "I have made modifications to the workman engine which cause kscd to be"
117 echo "a very fast and responsive cd player for an average IDE CDROM drive."
118 echo "Answer NO to the next question unless you have problems getting kscd"
119 echo "to work."
120 echo
121 echo $ac_n "Revert to original Workman behavior? (y/n) [n]:$ac_c"
123 read workman
125 case "$workman" in
126 "yes" | "y" | "Yes" | "Y") echo "#define WORKMAN_ORIGINAL " >> $config_file ;;
127 esac
130 echo
131 echo "I have incorporated modifications from Dirk (milliByte@DeathsDoor.com)"
132 echo "which will make kscd perform better on any drive using the sbpcd or"
133 echo "mcdx drivers. If and only if your kernel uses one of these cd drivers you"
134 echo "should try answering YES to the next question. Please peruse the "
135 echo "documents in the spbcd directory of this distribution for more "
136 echo "information about theses modifications."
137 echo
138 echo $ac_n "Enable SBPCD_HACK? (y/n) [n]:$ac_c"
140 read sbpcd
142 case "$sbpcd" in
143 "yes" | "y" | "Yes" | "Y") echo "#define SBPCD_HACK " >> $config_file ;;
144 esac
147 echo
148 echo "If and only if you have an SCSI cdrom drive you should probably"
149 echo "answer YES to the next question"
150 echo
151 echo $ac_n "Enable LINUX_SCSI_PASSTHROUGH? (y/n) [n]:$ac_c"
153 read scsi
155 case "$scsi" in
156 "yes" | "y" | "Yes" | "Y") echo "#define LINUX_SCSI_PASSTHROUGH " >> $config_file ;;
157 esac
159 echo
160 echo "Most cdrom devices have a volume range from 0 to 255."
161 echo "Feel free to play with the parameters MINVOLUME and MAXVOLUME"
162 echo "until volume adjustment works to your satisfaction."
163 echo "Note: Some CDROM device only support a range from 128 to 255."
164 echo
165 echo $ac_n "MIN_VOLUME [0]:$ac_c"
167 read MINVOLUME
168 if [ "$MINVOLUME" = "" ]
169 then
170 MINVOLUME="0"
173 echo "You entered $MINVOLUME "
174 echo "#define MIN_VOLUME $MINVOLUME " >> $config_file
176 echo
177 echo $ac_n "MAX_VOLUME [255]:$ac_c"
179 read MAXVOLUME
180 if [ "$MAXVOLUME" = "" ]
181 then
182 MAXVOLUME="255"
185 echo "You entered $MAXVOLUME "
186 echo "#define MAX_VOLUME $MAXVOLUME " >> $config_file
188 echo
189 echo "If you own one a cdrom player whose volume range is 128 to 255,"
190 echo "you might want to try answering YES to the next question."
191 echo "Enabling 'Curved Volume' will give you a square root like"
192 echo "volume slider - volume curve."
193 echo
194 echo $ac_n "Enable CURVED_VOLUME? (y/n) [n]:$ac_c"
196 read curved
198 case "$curved" in
199 "yes" | "y" | "Yes" | "Y") echo "#define CURVED_VOLUME " >> $config_file ;;
200 esac
202 echo "" >> $config_file
203 echo "#endif /* linux */" >> $config_file
207 irix_conf(){
209 clear
210 echo "KSCD configuration for Irix"
211 echo "---------------------------"
212 echo
214 give_instructions
215 write_config_header
217 echo "" >> $config_file
218 echo "#if defined(sgi)" >> $config_file
219 echo "" >> $config_file
221 echo $ac_n "Please specify your cdrom device [/dev/scsi/sc0d6l0]:$ac_c"
223 read device
224 if [ "$device" = "" ]
225 then
226 device="/dev/scsi/sc0d6l0"
229 echo "Your choice was: $device"
230 echo "#define DEFAULT_CD_DEVICE \"$device\" " >> $config_file
232 echo $ac_n "Enable CDDA? (y/n) [y]:$ac_c"
234 read curved
236 case "$curved" in
237 "yes" | "y" | "Yes" | "Y" | "") echo "#define CDDA " >> $config_file ;;
238 esac
239 echo ""
240 echo "That's all for sgi ..."
242 echo "#endif /* sgi */" >> $config_file
246 hp_conf(){
248 clear
249 echo "KSCD configuration for HPUX systems"
250 echo "-----------------------------------"
251 echo
253 give_instructions
254 write_config_header
256 echo "" >> $config_file
257 echo "#if defined(hpux) || defined (__hpux)" >> $config_file
258 echo "" >> $config_file
260 echo $ac_n "Please specify your cdrom device [/dev/rscsi]:$ac_c"
262 read device
263 if [ "$device" = "" ]
264 then
265 device="/dev/rcsci"
268 echo "Your choice was: $device"
269 echo "#define DEFAULT_CD_DEVICE \"$device\" " >> $config_file
270 echo ""
271 echo "That's all for HPUX ..."
273 echo "#endif /* hpux */" >> $config_file
278 bsd386_conf(){
280 clear
281 echo "KSCD configuration for BSD386 systems"
282 echo "-------------------------------------"
283 echo
285 give_instructions
286 write_config_header
288 echo "#ifdef __bsdi__ " >> $config_file
290 echo
291 echo "Please answer YES to the next question if you have a Sound Blaster cdrom."
292 echo
293 echo $ac_n "Define SOUNDBALSTER? (y/n) [n]:$ac_c"
295 read soundblaster
297 case "$soundblaster" in
298 "yes" | "y" | "Yes" | "Y") echo "#define SOUNDBLASTER " >> $config_file ;;
299 esac
301 echo "#endif /* __bsdi__ */" >> $config_file
305 freebsd_netbsd_conf(){
307 clear
308 echo "KSCD configuration for FreeBSD/NetBSD systems"
309 echo "---------------------------------------------"
310 echo
312 give_instructions
313 write_config_header
315 echo "" >> $config_file
316 echo "#if defined(__FreeBSD__) || defined(__NetBSD__)" >> $config_file
317 echo "" >> $config_file
319 # get default device
320 if [ `/usr/bin/uname -s` = "NetBSD" ]; then
321 if [ `/usr/bin/uname -m` = "i386" ]; then
322 def_device=/dev/rcd0d
323 else
324 def_device=/dev/rcd0c
326 else
327 # FreeBSD
328 def_device=/dev/acd0c
331 echo $ac_n "Please specify your cdrom device [$def_device]:$ac_c"
333 read device
334 if [ "$device" = "" ]
335 then
336 device="$def_device"
339 echo "Your choice was:$device"
340 echo "#define DEFAULT_CD_DEVICE \"$device\" " >> $config_file
342 echo
343 echo "Some experimental changes to the FreeBSD code were made."
344 echo "Please let me know whether answering yes or no to the next"
345 echo "question will give you a better functioning cd player."
346 echo "Users of NetBSD might want to experiment with this too."
347 echo
348 echo $ac_n "Define NEW_BSD_PLAYCLICKED? (y/n) [y]:$ac_c"
350 read free_play_clicked
352 case "$free_play_clicked" in
353 "yes" | "y" | "Yes" | "Y"| "") echo "#define NEW_BSD_PLAYCLICKED" >> $config_file ;;
354 esac
356 echo "" >> $config_file
357 echo "#endif /* FreeBSD/NetBSD */" >> $config_file
361 sun_conf(){
363 clear
364 echo "KSCD configuration for Sun systems"
365 echo "----------------------------------"
366 echo
368 give_instructions
369 write_config_header
371 echo "" >> $config_file
372 echo "#if defined(sun) || defined(__sun__) " >> $config_file
373 echo "" >> $config_file
375 echo $ac_n "Are you compiling on Solaris 2.x? (y/n) [y]:$ac_c"
376 read solaris
378 case "$solaris" in
380 n | N)
381 echo
384 echo "#define SYSV" >> $config_file
385 solaris="y"
387 esac
389 echo ""
390 echo "You need to enable the internal audio device if you wish"
391 echo "to get sound from your workstation, as opposed to only from"
392 echo "the head-phone jack of your CDROM."
393 echo ""
394 echo $ac_n "Activate internal audio device (CODEC)? (y/n) [y]:$ac_c"
396 read codec
398 case "$code" in
400 n | N)
403 echo "#define CODEC" >> $config_file
405 esac
407 if [ "$solaris" = "y" ]
408 then
409 echo
410 echo "Do you wish to enable digital audio capablilites on drives that"
411 echo $ac_n "support it? (y/n) [y]:$ac_c"
412 read cdda
414 case "$cdda" in
416 n | N)
419 echo "#define BUILD_CDDA" >> $config_file
421 esac
425 echo
426 echo "Most cdrom devices have a volume range from 0 to 255."
427 echo "Feel free to play with the parameters MINVOLUME and MAXVOLUME"
428 echo "until volume adjustment works to your satisfaction."
429 echo "Note: Some CDROM device only support a range from 128 to 255."
430 echo
431 echo $ac_n "MIN_VOLUME [128]:$ac_c"
433 read MINVOLUME
434 if [ "$MINVOLUME" = "" ]
435 then
436 MINVOLUME="128"
439 echo "You entered $MINVOLUME "
440 echo "#define MIN_VOLUME $MINVOLUME " >> $config_file
442 echo
443 echo $ac_n "MAX_VOLUME [255]:$ac_c"
445 read MAXVOLUME
446 if [ "$MAXVOLUME" = "" ]
447 then
448 MAXVOLUME="255"
451 echo "You entered $MAXVOLUME "
452 echo "#define MAX_VOLUME $MAXVOLUME " >> $config_file
454 echo
455 echo "If you own one a cdrom player whose volume range is 128 to 255,"
456 echo "you might want to try answering YES to the next question."
457 echo "Enabling 'Curved Volume' will give you a square root like"
458 echo "volume slider - volume curve."
459 echo
460 echo $ac_n "Enable CURVED_VOLUME? (y/n) [n]:$ac_c"
462 read curved
464 case "$curved" in
465 "yes" | "y" | "Yes" | "Y") echo "#define CURVED_VOLUME " >> $config_file ;;
466 esac
468 echo "#endif /* Sun*/" >> $config_file
472 sony_conf(){
474 clear
475 echo "KSCD configuration for Sony NEWS systems"
476 echo "---------------------------------------------"
477 echo
479 give_instructions
480 write_config_header
482 echo "" >> $config_file
483 echo "#if defined(__sony_news) || defined(sony_news)" >> $config_file
484 echo "" >> $config_file
486 echo "Unfortunately, I have conflicting reports:"
487 echo "You might need a,b or c below."
488 echo "Please let me know what is required on Sony NEWS."
489 echo
490 echo "a) #include <CD.h> "
491 echo
492 echo "b) #include <newsiodev/scu.h>"
493 echo " #include <newsiodev/scsireg.h>"
494 echo
495 echo "c) both of the above"
496 echo ""
497 echo $ac_n "Please choose a,b or c. [c]:$ac_c"
499 read sony_include
501 case "$sony_include" in
502 "a" | "A" )
503 echo "Your choice was a"
504 echo "#include <CD.h>" >> $config_file
506 "b" | "B" )
507 echo "Your choice was b"
508 echo "#include <newsiodev/scu.h>" >> $config_file
509 echo "#include <newsiodev/scsireg.h>" >> $config_file
512 echo "Your choice was c"
513 echo "#include <CD.h>" >> $config_file
514 echo "#include <newsiodev/scu.h>" >> $config_file
515 echo "#include <newsiodev/scsireg.h>" >> $config_file
517 esac
519 echo
520 echo $ac_n "Please specify your cdrom device [/dev/rsd/b0i6u0p2\0]:$ac_c"
522 read device
523 if [ "$device" = "" ]
524 then
525 device="/dev/rsd/b0i6u0p2\0"
528 echo "Your choice was:$device"
529 echo "#define DEFAULT_CD_DEVICE \"$device\" " >> $config_file
531 echo
532 echo "While most CDROM devices have a volume range from 0 to 255,"
533 echo "it appears that 128 to 255 is more appropriate for Sony NEWS."
534 echo "Feel free to play with the parameters MINVOLUME and MAXVOLUME"
535 echo "until volume adjustment works to your satisfaction."
536 echo "Don't forget to let me know the result of your experiments."
537 echo
538 echo $ac_n "MIN_VOLUME [128]:$ac_c"
540 read MINVOLUME
541 if [ "$MINVOLUME" = "" ]
542 then
543 MINVOLUME="128"
546 echo "You entered $MINVOLUME "
547 echo "#define MIN_VOLUME $MINVOLUME " >> $config_file
549 echo
550 echo $ac_n "MAX_VOLUME [255]:$ac_c"
552 read MAXVOLUME
553 if [ "$MAXVOLUME" = "" ]
554 then
555 MAXVOLUME="255"
558 echo "You entered $MAXVOLUME "
559 echo "#define MAX_VOLUME $MAXVOLUME " >> $config_file
561 echo "" >> $config_file
562 echo "#endif /* sony_news */" >> $config_file
566 ultrix_conf(){
568 clear
569 echo "KSCD configuration for Ultrix systems"
570 echo "---------------------------------------------"
571 echo
573 give_instructions
574 write_config_header
576 echo "" >> $config_file
577 echo "#if defined(ultrix) || defined(__ultrix)" >> $config_file
578 echo "" >> $config_file
580 echo "Unfortunately, I have conflicting reports:"
581 echo "You might need a,b or c below."
582 echo "Please let me know what is required on Ultrix."
583 echo
584 echo "a) #include <sys/rzdisk.h>"
585 echo " #include <sys/cdrom.h>"
586 echo
587 echo "b) #include <sys/devio.h>"
588 echo " #include <io/cam/cam.h>"
589 echo " #include <io/cam/uagt.h>"
590 echo " #include <io/cam/dec_cam.h>"
591 echo " #include <io/cam/scsi_all.h>"
592 echo ""
593 echo "c) both of the above"
594 echo ""
595 echo $ac_n "Please choose a,b or c. [a]:$ac_c"
597 read ultrix_include
599 case "$ultrix_include" in
600 "c" | "C" )
601 echo "Your choice was c)"
602 echo ""
603 echo "#include <sys/rzdisk.h>" >> $config_file
604 echo "#include <sys/cdrom.h>">> $config_file
605 echo ""
606 echo "#include <sys/devio.h>" >> $config_file
607 echo "#include <io/cam/cam.h>" >> $config_file
608 echo "#include <io/cam/uagt.h>" >> $config_file
609 echo "#include <io/cam/dec_cam.h>" >> $config_file
610 echo "#include <io/cam/scsi_all.h>" >> $config_file
611 echo "" >> $config_file
614 "b" | "B" )
615 echo "Your choice was b"
616 echo "#include <sys/devio.h>" >> $config_file
617 echo "#include <io/cam/cam.h>" >> $config_file
618 echo "#include <io/cam/uagt.h>" >> $config_file
619 echo "#include <io/cam/dec_cam.h>" >> $config_file
620 echo "#include <io/cam/scsi_all.h>" >> $config_file
623 echo "Your choice was a"
624 echo "#include <sys/rzdisk.h>" >> $config_file
625 echo "#include <sys/cdrom.h>">> $config_file
627 esac
629 echo
630 echo "While most CDROM devices have a volume range from 0 to 255,"
631 echo "it appears that 128 to 255 is more appropriate for Ultrix"
632 echo "Feel free to play with the parameters MINVOLUME and MAXVOLUME"
633 echo "until volume adjustment works to your satisfaction."
634 echo "Don't forget to let me know the result of your experiments."
635 echo
636 echo $ac_n "MIN_VOLUME [128]:$ac_c"
638 read MINVOLUME
639 if [ "$MINVOLUME" = "" ]
640 then
641 MINVOLUME="128"
644 echo "You entered $MINVOLUME "
645 echo "#define MIN_VOLUME $MINVOLUME " >> $config_file
647 echo
648 echo $ac_n "MAX_VOLUME [255]:$ac_c"
650 read MAXVOLUME
651 if [ "$MAXVOLUME" = "" ]
652 then
653 MAXVOLUME="255"
656 echo "You entered $MAXVOLUME "
657 echo "#define MAX_VOLUME $MAXVOLUME " >> $config_file
659 echo "" >> $config_file
660 echo "#endif /* ultrix */" >> $config_file
664 osf_conf(){
666 clear
667 echo "KSCD configuration for OSF systems"
668 echo "----------------------------------"
669 echo
671 give_instructions
672 write_config_header
674 echo "" >> config_file
675 echo "#if defined(__osf__)" >> $config_file
677 echo "Nothing to be done for OSF. The CD device should be automatically detected."
678 echo "If you have trouble look at plat_osf1.c and let me know what needs to be"
679 echo "changed."
681 echo ""
682 echo $ac_n "Press [Enter] to continue.$ac_c"
683 read dummy
685 echo "" >> $config_file
686 echo "#endif /* osf */" >> $config_file
687 echo "" >> $config_file
689 #endif
694 generic_svr_conf(){
696 clear
697 echo "KSCD configuration for a generic SVR4 system"
698 echo "--------------------------------------------"
699 echo
701 give_instructions
702 write_config_header
704 echo "" >> $config_file
705 echo "#if defined(SVR4) && !defined(sun) && !defined(__sun__)" >> $config_file
707 echo $ac_n "Please specify your cdrom device [/dev/rcdrom/cd0]:$ac_c"
709 read device
710 if [ "$device" = "" ]
711 then
712 device="/dev/rcdrom/cd0"
715 echo "Your choice was:$device"
716 echo "#define DEFAULT_CD_DEVICE \"$device\" " >> $config_file
718 echo "" >> $config_file
719 echo "#endif /* SVR4 */" >> $config_file
720 echo "" >> $config_file
724 ########################################################################
726 # main
728 ########################################################################
730 if [ -f $config_file ]
731 then
732 echo "Found old config file. Will clean up first ...."
733 rm $config_file
734 sleep 1
737 display_main_menu
739 if [ "$platform" = "q" ]
740 then
741 clear
742 echo "Good bye!"
743 exit 1
746 case "$platform" in
747 l|L) linux_conf;;
748 f|F) freebsd_netbsd_conf;;
749 b|B) bsd386_conf;;
750 s|S) sun_conf;;
751 h|H) hp_conf;;
752 i|I) irix_conf;;
753 n|N) sony_conf;;
754 o|O) osf_conf;;
755 u|U) ultrix_conf;;
756 v|V) generic_svr_conf;;
757 *) linux_conf;;
758 esac
760 sleep 1
761 clear
762 echo ""
763 echo "I have written your configuration choices to $config_file."
764 echo "Should you have trouble with the configuration file this"
765 echo "script generates, you can rename $ORG_CONFIG to $config_file"
766 echo "and edit it manually to suit your configuration."
767 echo ""
768 echo "Have fun with kscd!"
769 echo ""
770 echo "Bernd Johannes Wuebben"
771 echo "wuebben@kde.org"
772 echo "wuebben@math.cornell.edu"
773 echo ""
774 echo "Press [Enter] to start the compilation."
775 read key
776 exit