Getting error in shell scripts

Hi,
I have a shell script confug-msys.sh which callls config-common.sh. When run from command prompt,these work fine but give the below error when i try to run from code-blocks
line 7: --without-contrib: command not found

...Also I am unable to understand what the second script does...
Please help

Configure-msys.sh

#!/bin/sh
root=$(echo $0|sed 's#extras/package/win32/configure-msys.sh##')./
if [ -n "$1" ]
then
CONTRIBS="$1"
else
CONTRIBS="/usr/win32"
fi
export CONTRIBS
PATH="$CONTRIBS/bin:$PATH" \
PKG_CONFIG_LIBDIR=$CONTRIBS/lib/pkgconfig \
CPPFLAGS="-I$CONTRIBS/include -I$CONTRIBS/include/ebml" \
LDFLAGS="-L$CONTRIBS/lib" \
CC=gcc CXX=g++ \
CONFIG="${root}configure --host=i586-mingw32msvc --build=i386-linux
--disable-mkv --disable-taglib --disable-nls --disable-dirac --enable-debug" \
sh ${root}extras/package/win32/configure-common.sh

configure-common.sh

if [ -z $CONTRIBS ]
then
CONTRIBS=/usr/win32
fi
$CONFIG \
--without-contrib \
--enable-update-check \
--enable-lua \
--enable-faad \
--enable-flac \
--enable-theora \
--enable-twolame \
--enable-quicktime \
--enable-real \
--enable-avcodec --enable-merge-ffmpeg \
--enable-dca \
--enable-mpc \
--enable-libass \
--enable-x264 \
--enable-schroedinger \
--enable-realrtsp \
--enable-live555 --with-live555-tree=$CONTRIBS/live.com \
--enable-dvdread --with-dvdnav-config-path=$CONTRIBS/bin \
--enable-shout \
--enable-goom \
--enable-caca \
--enable-portaudio \
--enable-sdl --with-sdl-config-path=$CONTRIBS/bin \
--enable-qt4 \
--enable-mozilla --with-mozilla-sdk-path=$CONTRIBS/gecko-sdk \
--enable-activex \
--enable-sse --enable-mmx \
--enable-libcddb \
--enable-zvbi --disable-telx \
--disable-dvb \
--disable-sqlite \
--enable-peflags

This is a script that configures some software package right before compiling. The common used configure options are outsourced into a second script.
--without-contrib is just the 1st parameter in the option list for the configure.

I do not understand what this sentence means, but you should check out the documentation of this software and read it carefully. If nothing special is needed, you can often get around with a

./configure
./make
./make install

But as said, you should try to know what you downloaded, if it is for your OS and version and if you are starting to configure/compile it, when you are currently in it's base directory.

To run from code-blocks i simply need to put the sh command in pre/post build steps ...which I have for config-msys.sh

But why the error:

line 7: --without-contrib: command not found

With sh you start a new shell that does not know what $CONFIG is. $CONFIG contains your command to configure in the former shell where the parent script is started.
So starting the 2nd script on it's own will have an empty $CONFIG and it will run into

line 7: --without-contrib: command not found

because this is taken out of relationship from the former shell script. This is no command for a shell. It makes only sense in a context which you removed by adding the sh in front of the substitution of that

${root}extras/package/win32/configure-common.sh

If you want to run just the configure with the options, check what the $CONFIG contains or should contain and add it into the 2nd script when trying to call it alone, if that makes sense. Also exporting things to the second script would be a way but not very pretty and maybe not necessary.

1 Like

Thanks...But this script works perfectly ok when ran from command prompt..
then what cld be missing from code blocks?