Enable using contributed code: add a new ./configure option to select which contributions should be applied.
/trunk/configure | 44 43 1 0 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 43 insertions(+), 1 deletion(-)
3 VERSION=$(cat .version)
6 PREFIX_DEFAULT=/usr/local
21 echo "${1}" |cut -d '=' -f 2-
33 PREFIX=$(get_optval "$1" "$2")
39 BINDIR=$(get_optval "$1" "$2")
45 LIBDIR=$(get_optval "$1" "$2")
51 DOCDIR=$(get_optval "$1" "$2")
57 MANDIR=$(get_optval "$1" "$2")
62 opt_val=$(get_optval "$1" "$2")
66 CONTRIB_list=$(LC_ALL=C ls -1 contrib/*.patch.lzma |sed -r -e 's|.*/||; s|\.patch\.lzma||;')
70 echo "Available contributions:"
71 LC_ALL=C ls -1 contrib/*.patch.lzma |sed -r -e 's|.*/||; s|\.patch\.lzma||; s|^| |;'
73 *) CONTRIB_list="${CONTRIB_list},${opt_val}";;
80 \`configure' configures crosstool-NG ${VERSION} to adapt to many kind of systems.
82 USAGE: ./configure [OPTION]...
84 Defaults for the options are specified in brackets.
87 -h, --help display this help and exit
88 --prefix=PREFIX install files in PREFIX [${PREFIX_DEFAULT}]
89 --local don't install, and use current directory
91 By default, \`make install' will install all the files in
92 \`${PREFIX_DEFAULT}/bin', \`${PREFIX_DEFAULT}/lib' etc. You can specify
93 an installation prefix other than \`${PREFIX_DEFAULT}' using \`--prefix',
94 for instance \`--prefix=\${HOME}'.
96 For better control, use the options below.
98 Fine tuning of the installation directories:
99 --bindir=DIR user executables [PREFIX/bin]
100 --libdir=DIR object code libraries [PREFIX/lib]
101 --docdir=DIR info documentation [PREFIX/share/doc]
102 --mandir=DIR man documentation [PREFIX/share/man]
105 --with-contrib=XXX Include externally contributed features found in the
106 contrib/ sub-directory. Set to a comma-separated list
107 of features. Use 'all' to use all contributions, and
108 'list' to see which are available.
117 #---------------------------------------------------------------------
120 while [ $# -ne 0 ]; do
122 --prefix*) set_prefix "$1" "$2" && shift || shift 2;;
123 --bindir*) set_bindir "$1" "$2" && shift || shift 2;;
124 --libdir*) set_libdir "$1" "$2" && shift || shift 2;;
125 --docdir*) set_docdir "$1" "$2" && shift || shift 2;;
126 --mandir*) set_mandir "$1" "$2" && shift || shift 2;;
127 --local) LOCAL_set=1; shift;;
129 set_contrib "$1" "$2" && shift || shift 2
130 [ "${do_quit}" = "1" ] && exit 0
132 --help|-h) do_help; exit 0;;
137 [ -z "${PREFIX}" ] && set_prefix "" "${PREFIX_DEFAULT}"
138 if [ "${LOCAL_set}" = "1" ]; then
142 set_docdir "" $(pwd)/docs
143 set_mandir "" $(pwd)/docs
146 #---------------------------------------------------------------------
147 # Some sanity checks, now
149 # If this version is a svn snapshot, try to get the revision number
150 # If we can't get the revision number, use date
151 echo -n "Computing version string... "
154 REVISION=$(LC_ALL=C svnversion)
155 case "${REVISION}" in
157 VERSION="${VERSION}unknown@$(date +%Y%m%d.%H%M%S)";;
159 URL=$(LC_ALL=C svn info 2>/dev/null |egrep 'URL: ' |cut -d ' ' -f 2-)
160 ROOT=$(LC_ALL=C svn info 2>/dev/null |egrep 'Repository Root: ' |cut -d ' ' -f 3-)
161 VERSION="${VERSION}${URL#${ROOT}}@${REVISION}"
164 VERSION="${VERSION/\//_}"
169 # Now we have the version string, we can build up the paths
170 [ -z "${BINDIR_set}" ] && BINDIR="${PREFIX}/bin"
171 [ -z "${LIBDIR_set}" ] && LIBDIR="${PREFIX}/lib/ct-ng-${VERSION}"
172 [ -z "${DOCDIR_set}" ] && DOCDIR="${PREFIX}/share/doc/ct-ng-${VERSION}"
173 [ -z "${MANDIR_set}" ] && MANDIR="${PREFIX}/share/man/man1"
175 # Check bash is present, and at least version 3.0
176 echo -n "Checking bash is at least bash-3.0... "
177 [ -x /bin/bash ] || do_error "bash 3.0 or above was not found in /bin/bash"
178 bash_version=$(/bin/bash -c 'echo ${BASH_VERSION}')
179 bash_major=$(/bin/bash -c 'echo ${BASH_VERSINFO[0]}')
180 [ ${bash_major} -ge 3 ] || do_error "bash 3.0 or above is needed (/bin/bash is ${bash_version})"
181 echo "ok (${bash_version})"
183 echo -n "Applying contributed code: "
184 for c in ${CONTRIB_list//,/ }; do
186 if [ ! -f "contrib/${c}.patch.lzma" ]; then
187 do_error "Contribution '${c}' does not exist"
189 lzcat "contrib/${c}.patch.lzma" |patch -p1 >/dev/null 2>&1
193 echo -n "Building up Makefile... "
194 sed -r -e "s,@@BINDIR@@,${BINDIR},g;" \
195 -e "s,@@LIBDIR@@,${LIBDIR},g;" \
196 -e "s,@@DOCDIR@@,${DOCDIR},g;" \
197 -e "s,@@MANDIR@@,${MANDIR},g;" \
198 -e "s,@@VERSION@@,${VERSION},g;" \
199 -e "s,@@DATE@@,${DATE},g;" \
200 -e "s,@@LOCAL@@,${LOCAL_set},g;" \
201 Makefile.in >Makefile
205 crosstool-NG configured as follows:
211 CONTRIB='${CONTRIB_list//