#!/bin/sh # # Kscd - A simple cd player for the KDE Project # # $Id$ # # Copyright (c) 1997 Bernd Johannes Wuebben math.cornell.edu # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # the following is borrowed from configure if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then ac_n= ac_c=' ' ac_t=' ' else ac_n=-n ac_c= ac_t= fi else ac_n= ac_c='\c' ac_t= fi config_file="config.h" ORG_CONFIG="config.h.std" display_main_menu(){ clear echo echo " KSCD -- Configuration" echo "===================================================================" echo echo " Linux ...................... L" echo " FreeBSD/NetBSD ............. F" echo " BSD386 ..................... B" echo " Sun ........................ S" echo " HPUX ....................... H" echo " Irix ....................... I" echo " Sony NEWS .................. N" echo " OSF/1 ...................... O" echo " Ultrix ..................... U" echo " Generic SVR4 (not Sun) ..... V" echo echo " Quit ....................... Q" echo echo echo " Bernd Johannes Wuebben " echo "==================================================================" echo echo $ac_n " Please chose acccording to your platform:$ac_c" read platform } give_instructions(){ echo "Please answer all questions. Simply hit [Enter] to select the default" echo "values which are displayed in square brackets." echo } write_config_header(){ echo "" >> $config_file echo "/* This header file was automatically generated by the kscd" >> $config_file echo " installation script. In case of trouble please edit" >> $config_file echo " $ORG_CONFIG in the source directory of the kscd distribution" >> $config_file echo " and rename it to $config_file .*/" >> $config_file echo "" >> $config_file } linux_conf(){ clear echo "KSCD configuration for Linux systems" echo "------------------------------------" echo give_instructions write_config_header echo "#ifdef linux " >> $config_file echo "" >> $config_file echo $ac_n "Please specify your cdrom device [/dev/cdrom]:$ac_c" read device if [ "$device" = "" ] then device="/dev/cdrom" fi echo "Your choice was: $device" echo "#define DEFAULT_CD_DEVICE \"$device\" " >> $config_file echo echo "I have made modifications to the workman engine which cause kscd to be" echo "a very fast and responsive cd player for an average IDE CDROM drive." echo "Answer NO to the next question unless you have problems getting kscd" echo "to work." echo echo $ac_n "Revert to original Workman behavior? (y/n) [n]:$ac_c" read workman case "$workman" in "yes" | "y" | "Yes" | "Y") echo "#define WORKMAN_ORIGINAL " >> $config_file ;; esac echo echo "I have incorporated modifications from Dirk (milliByte@DeathsDoor.com)" echo "which will make kscd perform better on any drive using the sbpcd or" echo "mcdx drivers. If and only if your kernel uses one of these cd drivers you" echo "should try answering YES to the next question. Please peruse the " echo "documents in the spbcd directory of this distribution for more " echo "information about theses modifications." echo echo $ac_n "Enable SBPCD_HACK? (y/n) [n]:$ac_c" read sbpcd case "$sbpcd" in "yes" | "y" | "Yes" | "Y") echo "#define SBPCD_HACK " >> $config_file ;; esac echo echo "If and only if you have an SCSI cdrom drive you should probably" echo "answer YES to the next question" echo echo $ac_n "Enable LINUX_SCSI_PASSTHROUGH? (y/n) [n]:$ac_c" read scsi case "$scsi" in "yes" | "y" | "Yes" | "Y") echo "#define LINUX_SCSI_PASSTHROUGH " >> $config_file ;; esac echo echo "Most cdrom devices have a volume range from 0 to 255." echo "Feel free to play with the parameters MINVOLUME and MAXVOLUME" echo "until volume adjustment works to your satisfaction." echo "Note: Some CDROM device only support a range from 128 to 255." echo echo $ac_n "MIN_VOLUME [0]:$ac_c" read MINVOLUME if [ "$MINVOLUME" = "" ] then MINVOLUME="0" fi echo "You entered $MINVOLUME " echo "#define MIN_VOLUME $MINVOLUME " >> $config_file echo echo $ac_n "MAX_VOLUME [255]:$ac_c" read MAXVOLUME if [ "$MAXVOLUME" = "" ] then MAXVOLUME="255" fi echo "You entered $MAXVOLUME " echo "#define MAX_VOLUME $MAXVOLUME " >> $config_file echo echo "If you own one a cdrom player whose volume range is 128 to 255," echo "you might want to try answering YES to the next question." echo "Enabling 'Curved Volume' will give you a square root like" echo "volume slider - volume curve." echo echo $ac_n "Enable CURVED_VOLUME? (y/n) [n]:$ac_c" read curved case "$curved" in "yes" | "y" | "Yes" | "Y") echo "#define CURVED_VOLUME " >> $config_file ;; esac echo "" >> $config_file echo "#endif /* linux */" >> $config_file } irix_conf(){ clear echo "KSCD configuration for Irix" echo "---------------------------" echo give_instructions write_config_header echo "" >> $config_file echo "#if defined(sgi)" >> $config_file echo "" >> $config_file echo $ac_n "Please specify your cdrom device [/dev/scsi/sc0d6l0]:$ac_c" read device if [ "$device" = "" ] then device="/dev/scsi/sc0d6l0" fi echo "Your choice was: $device" echo "#define DEFAULT_CD_DEVICE \"$device\" " >> $config_file echo $ac_n "Enable CDDA? (y/n) [y]:$ac_c" read curved case "$curved" in "yes" | "y" | "Yes" | "Y" | "") echo "#define CDDA " >> $config_file ;; esac echo "" echo "That's all for sgi ..." echo "#endif /* sgi */" >> $config_file } hp_conf(){ clear echo "KSCD configuration for HPUX systems" echo "-----------------------------------" echo give_instructions write_config_header echo "" >> $config_file echo "#if defined(hpux) || defined (__hpux)" >> $config_file echo "" >> $config_file echo $ac_n "Please specify your cdrom device [/dev/rscsi]:$ac_c" read device if [ "$device" = "" ] then device="/dev/rcsci" fi echo "Your choice was: $device" echo "#define DEFAULT_CD_DEVICE \"$device\" " >> $config_file echo "" echo "That's all for HPUX ..." echo "#endif /* hpux */" >> $config_file } bsd386_conf(){ clear echo "KSCD configuration for BSD386 systems" echo "-------------------------------------" echo give_instructions write_config_header echo "#ifdef __bsdi__ " >> $config_file echo echo "Please answer YES to the next question if you have a Sound Blaster cdrom." echo echo $ac_n "Define SOUNDBALSTER? (y/n) [n]:$ac_c" read soundblaster case "$soundblaster" in "yes" | "y" | "Yes" | "Y") echo "#define SOUNDBLASTER " >> $config_file ;; esac echo "#endif /* __bsdi__ */" >> $config_file } freebsd_netbsd_conf(){ clear echo "KSCD configuration for FreeBSD/NetBSD systems" echo "---------------------------------------------" echo give_instructions write_config_header echo "" >> $config_file echo "#if defined(__FreeBSD__) || defined(__NetBSD__)" >> $config_file echo "" >> $config_file # get default device if [ `/usr/bin/uname -s` = "NetBSD" ]; then if [ `/usr/bin/uname -m` = "i386" ]; then def_device=/dev/rcd0d else def_device=/dev/rcd0c fi else # FreeBSD def_device=/dev/acd0c fi echo $ac_n "Please specify your cdrom device [$def_device]:$ac_c" read device if [ "$device" = "" ] then device="$def_device" fi echo "Your choice was:$device" echo "#define DEFAULT_CD_DEVICE \"$device\" " >> $config_file echo echo "Some experimental changes to the FreeBSD code were made." echo "Please let me know whether answering yes or no to the next" echo "question will give you a better functioning cd player." echo "Users of NetBSD might want to experiment with this too." echo echo $ac_n "Define NEW_BSD_PLAYCLICKED? (y/n) [y]:$ac_c" read free_play_clicked case "$free_play_clicked" in "yes" | "y" | "Yes" | "Y"| "") echo "#define NEW_BSD_PLAYCLICKED" >> $config_file ;; esac echo "" >> $config_file echo "#endif /* FreeBSD/NetBSD */" >> $config_file } sun_conf(){ clear echo "KSCD configuration for Sun systems" echo "----------------------------------" echo give_instructions write_config_header echo "" >> $config_file echo "#if defined(sun) || defined(__sun__) " >> $config_file echo "" >> $config_file echo $ac_n "Are you compiling on Solaris 2.x? (y/n) [y]:$ac_c" read solaris case "$solaris" in n | N) echo ;; *) echo "#define SYSV" >> $config_file solaris="y" ;; esac echo "" echo "You need to enable the internal audio device if you wish" echo "to get sound from your workstation, as opposed to only from" echo "the head-phone jack of your CDROM." echo "" echo $ac_n "Activate internal audio device (CODEC)? (y/n) [y]:$ac_c" read codec case "$code" in n | N) ;; *) echo "#define CODEC" >> $config_file ;; esac if [ "$solaris" = "y" ] then echo echo "Do you wish to enable digital audio capablilites on drives that" echo $ac_n "support it? (y/n) [y]:$ac_c" read cdda case "$cdda" in n | N) ;; *) echo "#define BUILD_CDDA" >> $config_file ;; esac fi echo echo "Most cdrom devices have a volume range from 0 to 255." echo "Feel free to play with the parameters MINVOLUME and MAXVOLUME" echo "until volume adjustment works to your satisfaction." echo "Note: Some CDROM device only support a range from 128 to 255." echo echo $ac_n "MIN_VOLUME [128]:$ac_c" read MINVOLUME if [ "$MINVOLUME" = "" ] then MINVOLUME="128" fi echo "You entered $MINVOLUME " echo "#define MIN_VOLUME $MINVOLUME " >> $config_file echo echo $ac_n "MAX_VOLUME [255]:$ac_c" read MAXVOLUME if [ "$MAXVOLUME" = "" ] then MAXVOLUME="255" fi echo "You entered $MAXVOLUME " echo "#define MAX_VOLUME $MAXVOLUME " >> $config_file echo echo "If you own one a cdrom player whose volume range is 128 to 255," echo "you might want to try answering YES to the next question." echo "Enabling 'Curved Volume' will give you a square root like" echo "volume slider - volume curve." echo echo $ac_n "Enable CURVED_VOLUME? (y/n) [n]:$ac_c" read curved case "$curved" in "yes" | "y" | "Yes" | "Y") echo "#define CURVED_VOLUME " >> $config_file ;; esac echo "#endif /* Sun*/" >> $config_file } sony_conf(){ clear echo "KSCD configuration for Sony NEWS systems" echo "---------------------------------------------" echo give_instructions write_config_header echo "" >> $config_file echo "#if defined(__sony_news) || defined(sony_news)" >> $config_file echo "" >> $config_file echo "Unfortunately, I have conflicting reports:" echo "You might need a,b or c below." echo "Please let me know what is required on Sony NEWS." echo echo "a) #include " echo echo "b) #include " echo " #include " echo echo "c) both of the above" echo "" echo $ac_n "Please choose a,b or c. [c]:$ac_c" read sony_include case "$sony_include" in "a" | "A" ) echo "Your choice was a" echo "#include " >> $config_file ;; "b" | "B" ) echo "Your choice was b" echo "#include " >> $config_file echo "#include " >> $config_file ;; * ) echo "Your choice was c" echo "#include " >> $config_file echo "#include " >> $config_file echo "#include " >> $config_file ;; esac echo echo $ac_n "Please specify your cdrom device [/dev/rsd/b0i6u0p2\0]:$ac_c" read device if [ "$device" = "" ] then device="/dev/rsd/b0i6u0p2\0" fi echo "Your choice was:$device" echo "#define DEFAULT_CD_DEVICE \"$device\" " >> $config_file echo echo "While most CDROM devices have a volume range from 0 to 255," echo "it appears that 128 to 255 is more appropriate for Sony NEWS." echo "Feel free to play with the parameters MINVOLUME and MAXVOLUME" echo "until volume adjustment works to your satisfaction." echo "Don't forget to let me know the result of your experiments." echo echo $ac_n "MIN_VOLUME [128]:$ac_c" read MINVOLUME if [ "$MINVOLUME" = "" ] then MINVOLUME="128" fi echo "You entered $MINVOLUME " echo "#define MIN_VOLUME $MINVOLUME " >> $config_file echo echo $ac_n "MAX_VOLUME [255]:$ac_c" read MAXVOLUME if [ "$MAXVOLUME" = "" ] then MAXVOLUME="255" fi echo "You entered $MAXVOLUME " echo "#define MAX_VOLUME $MAXVOLUME " >> $config_file echo "" >> $config_file echo "#endif /* sony_news */" >> $config_file } ultrix_conf(){ clear echo "KSCD configuration for Ultrix systems" echo "---------------------------------------------" echo give_instructions write_config_header echo "" >> $config_file echo "#if defined(ultrix) || defined(__ultrix)" >> $config_file echo "" >> $config_file echo "Unfortunately, I have conflicting reports:" echo "You might need a,b or c below." echo "Please let me know what is required on Ultrix." echo echo "a) #include " echo " #include " echo echo "b) #include " echo " #include " echo " #include " echo " #include " echo " #include " echo "" echo "c) both of the above" echo "" echo $ac_n "Please choose a,b or c. [a]:$ac_c" read ultrix_include case "$ultrix_include" in "c" | "C" ) echo "Your choice was c)" echo "" echo "#include " >> $config_file echo "#include ">> $config_file echo "" echo "#include " >> $config_file echo "#include " >> $config_file echo "#include " >> $config_file echo "#include " >> $config_file echo "#include " >> $config_file echo "" >> $config_file ;; "b" | "B" ) echo "Your choice was b" echo "#include " >> $config_file echo "#include " >> $config_file echo "#include " >> $config_file echo "#include " >> $config_file echo "#include " >> $config_file ;; * ) echo "Your choice was a" echo "#include " >> $config_file echo "#include ">> $config_file ;; esac echo echo "While most CDROM devices have a volume range from 0 to 255," echo "it appears that 128 to 255 is more appropriate for Ultrix" echo "Feel free to play with the parameters MINVOLUME and MAXVOLUME" echo "until volume adjustment works to your satisfaction." echo "Don't forget to let me know the result of your experiments." echo echo $ac_n "MIN_VOLUME [128]:$ac_c" read MINVOLUME if [ "$MINVOLUME" = "" ] then MINVOLUME="128" fi echo "You entered $MINVOLUME " echo "#define MIN_VOLUME $MINVOLUME " >> $config_file echo echo $ac_n "MAX_VOLUME [255]:$ac_c" read MAXVOLUME if [ "$MAXVOLUME" = "" ] then MAXVOLUME="255" fi echo "You entered $MAXVOLUME " echo "#define MAX_VOLUME $MAXVOLUME " >> $config_file echo "" >> $config_file echo "#endif /* ultrix */" >> $config_file } osf_conf(){ clear echo "KSCD configuration for OSF systems" echo "----------------------------------" echo give_instructions write_config_header echo "" >> config_file echo "#if defined(__osf__)" >> $config_file echo "Nothing to be done for OSF. The CD device should be automatically detected." echo "If you have trouble look at plat_osf1.c and let me know what needs to be" echo "changed." echo "" echo $ac_n "Press [Enter] to continue.$ac_c" read dummy echo "" >> $config_file echo "#endif /* osf */" >> $config_file echo "" >> $config_file #endif } generic_svr_conf(){ clear echo "KSCD configuration for a generic SVR4 system" echo "--------------------------------------------" echo give_instructions write_config_header echo "" >> $config_file echo "#if defined(SVR4) && !defined(sun) && !defined(__sun__)" >> $config_file echo $ac_n "Please specify your cdrom device [/dev/rcdrom/cd0]:$ac_c" read device if [ "$device" = "" ] then device="/dev/rcdrom/cd0" fi echo "Your choice was:$device" echo "#define DEFAULT_CD_DEVICE \"$device\" " >> $config_file echo "" >> $config_file echo "#endif /* SVR4 */" >> $config_file echo "" >> $config_file } ######################################################################## # # main # ######################################################################## if [ -f $config_file ] then echo "Found old config file. Will clean up first ...." rm $config_file sleep 1 fi display_main_menu if [ "$platform" = "q" ] then clear echo "Good bye!" exit 1 fi case "$platform" in l|L) linux_conf;; f|F) freebsd_netbsd_conf;; b|B) bsd386_conf;; s|S) sun_conf;; h|H) hp_conf;; i|I) irix_conf;; n|N) sony_conf;; o|O) osf_conf;; u|U) ultrix_conf;; v|V) generic_svr_conf;; *) linux_conf;; esac sleep 1 clear echo "" echo "I have written your configuration choices to $config_file." echo "Should you have trouble with the configuration file this" echo "script generates, you can rename $ORG_CONFIG to $config_file" echo "and edit it manually to suit your configuration." echo "" echo "Have fun with kscd!" echo "" echo "Bernd Johannes Wuebben" echo "wuebben@kde.org" echo "wuebben@math.cornell.edu" echo "" echo "Press [Enter] to start the compilation." read key exit