#!/bin/sh

rm -f config.h

echo "/* auto-generated config.h for AScd. */" >  config.h
echo "/* do not edit. Run ./configure!       */" >> config.h
echo "" >> config.h

echo "/* internal defines, do not change! */" >> config.h
echo "#define PACKAGE \"ascd\"" >> config.h
cat version.h >> config.h
echo "" >> config.h
echo "/* user choices */" >> config.h
echo "#define DEFAULT_COLOR \"#2FAFAF\"" >> config.h
echo "#define DEFAULT_BGCOLOR \"#000000\"" >> config.h

clear

#################################################################

echo
echo "-------------------------------------------------------------------"
echo "Please select a default CD device. This can be overriden at run"
echo "time with the -d option. Default is /dev/cdrom. You can also type"
echo "'NO' if you don't want to specify a default device (in case you're"
echo "using Volume Manager for example."
echo
printf "Default device or NO (or return to accept the default): "
read CDD

case $CDD in
   "")	echo "#define DEFAULTDEVICE \"/dev/cdrom\"" >> config.h
	echo "Ok, the default device will be /dev/cdrom"
	;;
   NO)	echo "#define DEFAULTDEVICE \"/dev/cdrom\"" >> config.h
	echo "#define NO_D_DEVICE" >> config.h
	echo "Ok, no device option enabled."
	;;
   *)	echo "#define DEFAULTDEVICE \"$CDD\"" >> config.h
	echo "Ok, the default device will be $CDD"
	;;
esac

#################################################################

echo
echo "-------------------------------------------------------------------"
echo "If you're using WindowMaker window manager, AScd can be compiled"
echo "with a configuration window using WINGs toolkit. Please note that"
echo "it's work in progress and you may have to change a few things in"
echo "ascd/Imakefile."
echo
echo "1) compile with WINGs support"
echo "2) no WINGs support (DEFAULT)"
echo
printf "Type 1 or 2: "
read WINGS

case $WINGS in 
    1)  echo "#define WMK" >> config.h
    	echo "Compiling with WINGs support."
	;;
    *)	echo "No WINGs support."
	;;
esac

#################################################################

echo "-------------------------------------------------------------------"
echo "Configuration is done. Running xmkmf to generate the Makefiles."
echo

xmkmf -a

echo
echo "-------------------------------------------------------------------"
echo "You are now ready to compile AScd. type:"
echo
echo "make                ... to compile the software"
echo "make install        ... to install it"
echo "make install.man    ... to install the man page"
echo "-------------------------------------------------------------------"
echo
