--- a/genconfig.sh +++ b/genconfig.sh @@ -23,14 +23,18 @@ RM="rm -f" CONFIGFILE="config.h" CONFIGMACRO="__CONFIG_H__" +PREFIX="${PREFIX:-/usr}" +ICONV_PREFIX="${ICONV_PREFIX:-$PREFIX}" +INTL_PREFIX="${INTL_PREFIX:-$PREFIX}" + # Database path -DB_PATH="/tmp/minidlna" +DB_PATH="${DB_PATH:-/tmp/minidlna}" # Log path -LOG_PATH="${DB_PATH}" +LOG_PATH="${LOG_PATH:-$DB_PATH}" # detecting the OS name and version -OS_NAME=`uname -s` -OS_VERSION=`uname -r` +OS_NAME="${OS_NAME:-$(uname -s)}" +OS_VERSION="${OS_VERSION:-$(uname -r)}" TIVO="/*#define TIVO_SUPPORT*/" NETGEAR="/*#define NETGEAR*/" READYNAS="/*#define READYNAS*/" @@ -40,22 +44,22 @@ ${RM} ${CONFIGFILE} # Detect if there are missing headers # NOTE: This check only works with a normal distro -[ ! -e "/usr/include/sqlite3.h" ] && MISSING="libsqlite3 $MISSING" -[ ! -e "/usr/include/jpeglib.h" ] && MISSING="libjpeg $MISSING" -[ ! -e "/usr/include/libexif/exif-loader.h" ] && MISSING="libexif $MISSING" -[ ! -e "/usr/include/id3tag.h" ] && MISSING="libid3tag $MISSING" -[ ! -e "/usr/include/ogg/ogg.h" ] && MISSING="libogg $MISSING" -[ ! -e "/usr/include/vorbis/codec.h" ] && MISSING="libvorbis $MISSING" -[ ! -e "/usr/include/FLAC/metadata.h" ] && MISSING="libflac $MISSING" -[ ! -e "/usr/include/ffmpeg/avutil.h" -a \ - ! -e "/usr/include/libavutil/avutil.h" -a \ - ! -e "/usr/include/ffmpeg/libavutil/avutil.h" ] && MISSING="libavutil $MISSING" -[ ! -e "/usr/include/ffmpeg/avformat.h" -a \ - ! -e "/usr/include/libavformat/avformat.h" -a \ - ! -e "/usr/include/ffmpeg/libavformat/avformat.h" ] && MISSING="libavformat $MISSING" -[ ! -e "/usr/include/ffmpeg/avcodec.h" -a \ - ! -e "/usr/include/libavcodec/avcodec.h" -a \ - ! -e "/usr/include/ffmpeg/libavcodec/avcodec.h" ] && MISSING="libavcodec $MISSING" +[ ! -e "${PREFIX}/include/sqlite3.h" ] && MISSING="libsqlite3 $MISSING" +[ ! -e "${PREFIX}/include/jpeglib.h" ] && MISSING="libjpeg $MISSING" +[ ! -e "${PREFIX}/include/libexif/exif-loader.h" ] && MISSING="libexif $MISSING" +[ ! -e "${PREFIX}/include/id3tag.h" ] && MISSING="libid3tag $MISSING" +[ ! -e "${PREFIX}/include/ogg/ogg.h" ] && MISSING="libogg $MISSING" +[ ! -e "${PREFIX}/include/vorbis/codec.h" ] && MISSING="libvorbis $MISSING" +[ ! -e "${PREFIX}/include/FLAC/metadata.h" ] && MISSING="libflac $MISSING" +[ ! -e "${PREFIX}/include/ffmpeg/avutil.h" -a \ + ! -e "${PREFIX}/include/libavutil/avutil.h" -a \ + ! -e "${PREFIX}/include/ffmpeg/libavutil/avutil.h" ] && MISSING="libavutil $MISSING" +[ ! -e "${PREFIX}/include/ffmpeg/avformat.h" -a \ + ! -e "${PREFIX}/include/libavformat/avformat.h" -a \ + ! -e "${PREFIX}/include/ffmpeg/libavformat/avformat.h" ] && MISSING="libavformat $MISSING" +[ ! -e "${PREFIX}/include/ffmpeg/avcodec.h" -a \ + ! -e "${PREFIX}/include/libavcodec/avcodec.h" -a \ + ! -e "${PREFIX}/include/ffmpeg/libavcodec/avcodec.h" ] && MISSING="libavcodec $MISSING" if [ -n "$MISSING" ]; then echo -e "\nERROR! Cannot continue." echo -e "The following required libraries are either missing, or are missing development headers:\n" @@ -151,8 +155,7 @@ case $OS_NAME in fi ;; *) - echo "Unknown OS : $OS_NAME" - exit 1 + echo "WARNING: Unknown OS : $OS_NAME" 1>&2 ;; esac @@ -183,7 +186,7 @@ fi echo "" >> ${CONFIGFILE} echo "/* Enable if the system iconv.h exists. ID3 tag reading in various character sets will not work properly otherwise. */" >> ${CONFIGFILE} -if [ -f /usr/include/iconv.h ]; then +if [ -f ${ICONV_PREFIX}/include/iconv.h ]; then echo "#define HAVE_ICONV_H" >> ${CONFIGFILE} else echo -e "\nWARNING!! Iconv support not found. ID3 tag reading may not work." @@ -192,7 +195,7 @@ fi echo "" >> ${CONFIGFILE} echo "/* Enable if the system libintl.h exists for NLS support. */" >> ${CONFIGFILE} -if [ -f /usr/include/libintl.h ]; then +if [ -f ${INTL_PREFIX}/include/libintl.h ]; then echo "#define ENABLE_NLS" >> ${CONFIGFILE} else echo "/*#define ENABLE_NLS*/" >> ${CONFIGFILE}