3 # Configuration shell script
8 VERSION
=`cut -f2 -d\" VERSION`
10 # default installation prefix
13 # installation directory for documents
17 while [ $# -gt 0 ] ; do
20 --without-win32) WITHOUT_WIN32
=1 ;;
21 --without-unix-glob) WITHOUT_UNIX_GLOB
=1 ;;
22 --with-included-regex) WITH_INCLUDED_REGEX
=1 ;;
23 --with-pcre) WITH_PCRE
=1 ;;
24 --without-gettext) WITHOUT_GETTEXT
=1 ;;
25 --without-iconv) WITHOUT_ICONV
=1 ;;
26 --without-wcwidth) WITHOUT_WCWIDTH
=1 ;;
27 --help) CONFIG_HELP
=1 ;;
29 --prefix) PREFIX
=$2 ; shift ;;
30 --prefix=*) PREFIX
=`echo $1 | sed -e 's/--prefix=//'` ;;
32 --docdir) DOCDIR
=$2 ; shift ;;
33 --docdir=*) DOCDIR
=`echo $1 | sed -e 's/--docdir=//'` ;;
40 if [ "$CONFIG_HELP" = "1" ] ; then
42 echo "Available options:"
43 echo "--prefix=PREFIX Installation prefix ($PREFIX)."
44 echo "--docdir=DOCDIR Instalation directory for documentation."
45 echo "--without-win32 Disable win32 interface detection."
46 echo "--without-unix-glob Disable glob.h usage (use workaround)."
47 echo "--with-included-regex Use included regex code (gnu_regex.c)."
48 echo "--with-pcre Enable PCRE library detection."
49 echo "--without-gettext Disable gettext usage."
50 echo "--without-iconv Disable iconv usage."
51 echo "--without-wcwidth Disable system wcwidth() (use workaround)."
54 echo "Environment variables:"
56 echo "AR Library Archiver."
62 if [ "$DOCDIR" = "" ] ; then
63 DOCDIR
=$PREFIX/share
/doc
/mpsl
66 echo "Configuring MPSL..."
68 echo "/* automatically created by config.sh - do not modify */" > config.h
69 echo "# automatically created by config.sh - do not modify" > makefile.opts
75 if [ "$CC" = "" ] ; then
77 # if CC is unset, try if gcc is available
85 echo "CC=$CC" >> makefile.opts
88 if [ "$CFLAGS" = "" -a "$CC" = "gcc" ] ; then
92 echo "CFLAGS=$CFLAGS" >> makefile.opts
98 if [ "$AR" = "" ] ; then
102 echo "AR=$AR" >> makefile.opts
105 if [ "$YACC" = "" ] ; then
109 echo "YACC=$YACC" >> makefile.opts
112 cat VERSION
>> config.h
114 # add installation prefix
115 echo "#define CONFOPT_PREFIX \"$PREFIX\"" >> config.h
117 #########################################################
119 # configuration directives
122 echo -n "Looking for MPDM... "
124 for MPDM
in .
/mpdm ..
/mpdm NOTFOUND
; do
125 if [ -d $MPDM ] && [ -f $MPDM/mpdm.h
] ; then
130 if [ "$MPDM" != "NOTFOUND" ] ; then
131 echo "-I$MPDM" >> config.cflags
132 echo "-L$MPDM -lmpdm" >> config.ldflags
139 # If MPDM is not configured, do it
140 if [ ! -f $MPDM/Makefile
] ; then
141 CONF_ARGS
="--prefix=$PREFIX"
142 [ "$WITHOUT_WIN32" = 1 ] && CONF_ARGS
="$CONF_ARGS --without-win32"
143 [ "$WITHOUT_UNIX_GLOB" = 1 ] && CONF_ARGS
="$CONF_ARGS --without-unix-glob"
144 [ "$WITH_INCLUDED_REGEX" = 1 ] && CONF_ARGS
="$CONF_ARGS --with-included-regex"
145 [ "$WITH_PCRE" = 1 ] && CONF_ARGS
="$CONF_ARGS --with-pcre"
146 [ "$WITHOUT_GETTEXT" = 1 ] && CONF_ARGS
="$CONF_ARGS --without-gettext"
147 [ "$WITHOUT_ICONV" = 1 ] && CONF_ARGS
="$CONF_ARGS --without-iconv"
148 [ "$WITHOUT_WCWIDTH" = 1 ] && CONF_ARGS
="$CONF_ARGS --without-wcwidth"
149 ( echo ; cd $MPDM ; .
/config.sh
$CONF_ARGS ; echo )
152 cat $MPDM/config.ldflags
>> config.ldflags
154 # if win32, the interpreter is called mpsl.exe
155 grep CONFOPT_WIN32
${MPDM}/config.h
>/dev
/null
&& TARGET
=mpsl.exe
157 #########################################################
161 echo "MPDM=$MPDM" >> makefile.opts
162 echo "VERSION=$VERSION" >> makefile.opts
163 echo "PREFIX=\$(DESTDIR)$PREFIX" >> makefile.opts
164 echo "DOCDIR=\$(DESTDIR)$DOCDIR" >> makefile.opts
165 echo "TARGET=$TARGET" >> makefile.opts
166 echo >> makefile.opts
168 cat makefile.opts makefile.
in makefile.depend
> Makefile
170 #########################################################