1.1 --- a/.hgignore Thu Jan 12 22:41:47 2012 +0100
1.2 +++ b/.hgignore Mon Nov 07 22:28:40 2011 +0100
1.3 @@ -1,6 +1,10 @@
1.4 syntax: glob
1.5
1.6 # Generated files
1.7 +configure
1.8 +autom4te.cache
1.9 +config.log
1.10 +config.status
1.11 Makefile
1.12 *ct-ng*
1.13 docs/*ct-ng*.1
2.1 --- a/Makefile.in Thu Jan 12 22:41:47 2012 +0100
2.2 +++ b/Makefile.in Mon Nov 07 22:28:40 2011 +0100
2.3 @@ -38,39 +38,40 @@
2.4 ###############################################################################
2.5 # Configuration variables
2.6
2.7 -VERSION:= @@VERSION@@
2.8 -BINDIR := @@BINDIR@@
2.9 -LIBDIR := @@LIBDIR@@
2.10 -DOCDIR := @@DOCDIR@@
2.11 -MANDIR := @@MANDIR@@
2.12 -PROG_PFX:=@@PROG_PFX@@
2.13 -PROG_SFX:=@@PROG_SFX@@
2.14 -PROG_SED:=@@PROG_SED@@
2.15 -DATE := @@DATE@@
2.16 -LOCAL := @@LOCAL@@
2.17 -
2.18 -# Paths found by ./configure
2.19 -install := @@install@@
2.20 -bash := @@bash@@
2.21 -grep := @@grep@@
2.22 -make := @@make@@
2.23 -sed := @@sed@@
2.24 -libtool := @@libtool@@
2.25 -libtoolize:= @@libtoolize@@
2.26 -objcopy := @@objcopy@@
2.27 -objdump := @@objdump@@
2.28 -readelf := @@readelf@@
2.29 -patch := @@patch@@
2.30 +# Stuff found by ./configure
2.31 +DATE := @DATE@
2.32 +LOCAL := @enable_local@
2.33 +PROG_SED := @program_transform_name@
2.34 +PACKAGE_TARNAME := @PACKAGE_TARNAME@
2.35 +VERSION := @PACKAGE_VERSION@
2.36 +prefix := @prefix@
2.37 +exec_prefix := @exec_prefix@
2.38 +bindir := @bindir@
2.39 +libdir := @libdir@@sublibdir@
2.40 +docdir := @docdir@@subdocdir@
2.41 +datarootdir := @datarootdir@
2.42 +mandir := @mandir@
2.43 +install := @INSTALL@
2.44 +bash := @_BASH@
2.45 +grep := @EGREP@
2.46 +make := @MAKE@
2.47 +sed := @SED@
2.48 +libtool := @LIBTOOL@
2.49 +libtoolize := @LIBTOOLIZE@
2.50 +objcopy := @OBJCOPY@
2.51 +objdump := @OBJDUMP@
2.52 +readelf := @READELF@
2.53 +patch := @PATCH@
2.54
2.55 # config options to push down to kconfig
2.56 -KCONFIG:= @@KCONFIG@@
2.57 +KCONFIG:= @kconfig_options@
2.58
2.59 ###############################################################################
2.60 # Non-configure variables
2.61 MAN_SECTION := 1
2.62 MAN_SUBDIR := /man$(MAN_SECTION)
2.63
2.64 -PROG_NAME := $(shell echo '$(PROG_PFX)ct-ng$(PROG_SFX)' |sed -e '$(PROG_SED)' )
2.65 +PROG_NAME := $(shell echo 'ct-ng' |$(sed) -r -e '$(PROG_SED)' )
2.66
2.67 ###############################################################################
2.68 # Sanity checks
2.69 @@ -106,7 +107,7 @@
2.70 endif
2.71
2.72 MAKEFLAGS += $(CT_MAKEFLAGS)
2.73 -build install clean distclean uninstall:
2.74 +build install clean distclean mrproper uninstall:
2.75 @$(MAKE) $@
2.76
2.77 else
2.78 @@ -124,6 +125,10 @@
2.79 @echo " RM 'Makefile'"
2.80 @rm -f Makefile
2.81
2.82 +mrproper: distclean
2.83 + @echo " RM 'autostuff'"
2.84 + @ rm -rf autom4te.cache config.log config.status configure
2.85 +
2.86 uninstall: real-uninstall
2.87
2.88 ###############################################################################
2.89 @@ -147,13 +152,10 @@
2.90
2.91 define sed_it
2.92 @echo " SED '$@'"
2.93 - @$(sed) -r -e 's,@@CT_BINDIR@@,$(BINDIR),g;' \
2.94 - -e 's,@@CT_LIBDIR@@,$(LIBDIR),g;' \
2.95 - -e 's,@@CT_DOCDIR@@,$(DOCDIR),g;' \
2.96 - -e 's,@@CT_MANDIR@@,$(MANDIR),g;' \
2.97 - -e 's,@@CT_PROG_PFX@@,$(PROG_PFX),g;' \
2.98 - -e 's,@@CT_PROG_SFX@@,$(PROG_SFX),g;' \
2.99 - -e 's,@@CT_PROG_SED@@,$(PROG_SED),g;' \
2.100 + @$(sed) -r -e 's,@@CT_BINDIR@@,$(bindir),g;' \
2.101 + -e 's,@@CT_LIBDIR@@,$(libdir),g;' \
2.102 + -e 's,@@CT_DOCDIR@@,$(docdir),g;' \
2.103 + -e 's,@@CT_MANDIR@@,$(mandir),g;' \
2.104 -e 's,@@CT_PROG_NAME@@,$(PROG_NAME),g;' \
2.105 -e 's,@@CT_VERSION@@,$(VERSION),g;' \
2.106 -e 's,@@CT_DATE@@,$(DATE),g;' \
2.107 @@ -238,7 +240,7 @@
2.108 #--------------------------------------
2.109 # Check for --local setup
2.110
2.111 -ifeq ($(strip $(LOCAL)),y)
2.112 +ifeq ($(strip $(LOCAL)),yes)
2.113
2.114 real-install:
2.115 @true
2.116 @@ -253,68 +255,68 @@
2.117
2.118 real-install: $(patsubst %,install-%,$(TARGETS)) install-post
2.119
2.120 -install-bin: $(DESTDIR)$(BINDIR)
2.121 +install-bin: $(DESTDIR)$(bindir)
2.122 @echo " INST '$(PROG_NAME)'"
2.123 - @$(install) -m 755 $(PROG_NAME) "$(DESTDIR)$(BINDIR)/$(PROG_NAME)"
2.124 + @$(install) -m 755 $(PROG_NAME) "$(DESTDIR)$(bindir)/$(PROG_NAME)"
2.125
2.126 # If one is hacking crosstool-NG, the patch set might change between any two
2.127 # installations of the same VERSION, thus the patches must be removed prior
2.128 # to being installed. It is simpler to remove the whole lib/ directory, as it
2.129 # is the goal of the install-lib rule to install the lib/ directory...
2.130 -install-lib: uninstall-lib $(DESTDIR)$(LIBDIR) install-lib-main install-lib-samples
2.131 +install-lib: uninstall-lib $(DESTDIR)$(libdir) install-lib-main install-lib-samples
2.132
2.133 LIB_SUB_DIR := config contrib kconfig patches scripts
2.134 -$(patsubst %,install-lib-%-copy,$(LIB_SUB_DIR)): $(DESTDIR)$(LIBDIR)
2.135 +$(patsubst %,install-lib-%-copy,$(LIB_SUB_DIR)): $(DESTDIR)$(libdir)
2.136 @echo " INSTDIR '$(patsubst install-lib-%-copy,%,$(@))/'"
2.137 @tar cf - --exclude='*.sh.in' $(patsubst install-lib-%-copy,%,$(@)) \
2.138 - |(cd "$(DESTDIR)$(LIBDIR)"; tar xf -)
2.139 + |(cd "$(DESTDIR)$(libdir)"; tar xf -)
2.140
2.141 # Huh? It seems we need at least one command to make this rule kick-in.
2.142 install-lib-%: install-lib-%-copy; @true
2.143
2.144 # Huh? that one does not inherit the -opy dependency, above...
2.145 install-lib-scripts: install-lib-scripts-copy
2.146 - @chmod a+x $(DESTDIR)$(LIBDIR)/scripts/crosstool-NG.sh
2.147 - @chmod a+x $(DESTDIR)$(LIBDIR)/scripts/saveSample.sh
2.148 - @rm -f "$(DESTDIR)$(LIBDIR)/scripts/addToolVersion.sh"
2.149 + @chmod a+x $(DESTDIR)$(libdir)/scripts/crosstool-NG.sh
2.150 + @chmod a+x $(DESTDIR)$(libdir)/scripts/saveSample.sh
2.151 + @rm -f "$(DESTDIR)$(libdir)/scripts/addToolVersion.sh"
2.152
2.153 -install-lib-main: $(DESTDIR)$(LIBDIR) $(patsubst %,install-lib-%,$(LIB_SUB_DIR))
2.154 +install-lib-main: $(DESTDIR)$(libdir) $(patsubst %,install-lib-%,$(LIB_SUB_DIR))
2.155 @echo " INST 'steps.mk'"
2.156 - @$(install) -m 644 steps.mk "$(DESTDIR)$(LIBDIR)/steps.mk"
2.157 + @$(install) -m 644 steps.mk "$(DESTDIR)$(libdir)/steps.mk"
2.158 @echo " INST 'paths.mk'"
2.159 - @$(install) -m 644 paths.mk "$(DESTDIR)$(LIBDIR)/paths.mk"
2.160 + @$(install) -m 644 paths.mk "$(DESTDIR)$(libdir)/paths.mk"
2.161
2.162 # Samples need a little love:
2.163 # - change every occurrence of CT_TOP_DIR to CT_LIB_DIR
2.164 -install-lib-samples: $(DESTDIR)$(LIBDIR) install-lib-main
2.165 +install-lib-samples: $(DESTDIR)$(libdir) install-lib-main
2.166 @echo " INSTDIR 'samples/'"
2.167 @for samp_dir in samples/*/; do \
2.168 - mkdir -p "$(DESTDIR)$(LIBDIR)/$${samp_dir}"; \
2.169 + mkdir -p "$(DESTDIR)$(libdir)/$${samp_dir}"; \
2.170 $(sed) -r -e 's:\$$\{CT_TOP_DIR\}:\$$\{CT_LIB_DIR\}:;' \
2.171 -e 's:^(CT_WORK_DIR)=.*:\1="\$${CT_TOP_DIR}/.build":;' \
2.172 $${samp_dir}/crosstool.config \
2.173 - >"$(DESTDIR)$(LIBDIR)/$${samp_dir}/crosstool.config"; \
2.174 + >"$(DESTDIR)$(libdir)/$${samp_dir}/crosstool.config"; \
2.175 $(install) -m 644 "$${samp_dir}/reported.by" \
2.176 - "$(DESTDIR)$(LIBDIR)/$${samp_dir}"; \
2.177 + "$(DESTDIR)$(libdir)/$${samp_dir}"; \
2.178 for libc_cfg in "$${samp_dir}/"*libc*.config; do \
2.179 [ -f "$${libc_cfg}" ] || continue; \
2.180 $(install) -m 644 "$${libc_cfg}" \
2.181 - "$(DESTDIR)$(LIBDIR)/$${samp_dir}"; \
2.182 + "$(DESTDIR)$(libdir)/$${samp_dir}"; \
2.183 done; \
2.184 done
2.185 - @$(install) -m 644 samples/samples.mk "$(DESTDIR)$(LIBDIR)/samples/samples.mk"
2.186 + @$(install) -m 644 samples/samples.mk "$(DESTDIR)$(libdir)/samples/samples.mk"
2.187
2.188 -install-doc: $(DESTDIR)$(DOCDIR)
2.189 +install-doc: $(DESTDIR)$(docdir)
2.190 @echo " INST 'docs/*.txt'"
2.191 @for doc_file in docs/*.txt; do \
2.192 - $(install) -m 644 "$${doc_file}" "$(DESTDIR)$(DOCDIR)"; \
2.193 + $(install) -m 644 "$${doc_file}" "$(DESTDIR)$(docdir)"; \
2.194 done
2.195
2.196 -install-man: $(DESTDIR)$(MANDIR)$(MAN_SUBDIR)
2.197 +install-man: $(DESTDIR)$(mandir)$(MAN_SUBDIR)
2.198 @echo " INST '$(PROG_NAME).1.gz'"
2.199 - @$(install) -m 644 docs/$(PROG_NAME).1.gz "$(DESTDIR)$(MANDIR)$(MAN_SUBDIR)"
2.200 + @$(install) -m 644 docs/$(PROG_NAME).1.gz "$(DESTDIR)$(mandir)$(MAN_SUBDIR)"
2.201
2.202 -$(sort $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(DOCDIR) $(DESTDIR)$(MANDIR)$(MAN_SUBDIR)):
2.203 +$(sort $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(docdir) $(DESTDIR)$(mandir)$(MAN_SUBDIR)):
2.204 @echo " MKDIR '$@/'"
2.205 @$(install) -m 755 -d "$@"
2.206
2.207 @@ -329,20 +331,20 @@
2.208 real-uninstall: $(patsubst %,uninstall-%,$(TARGETS))
2.209
2.210 uninstall-bin:
2.211 - @echo " RM '$(DESTDIR)$(BINDIR)/$(PROG_NAME)'"
2.212 - @rm -f "$(DESTDIR)$(BINDIR)/$(PROG_NAME)"
2.213 + @echo " RM '$(DESTDIR)$(bindir)/$(PROG_NAME)'"
2.214 + @rm -f "$(DESTDIR)$(bindir)/$(PROG_NAME)"
2.215
2.216 uninstall-lib:
2.217 - @echo " RMDIR '$(DESTDIR)$(LIBDIR)/'"
2.218 - @rm -rf "$(DESTDIR)$(LIBDIR)"
2.219 + @echo " RMDIR '$(DESTDIR)$(libdir)/'"
2.220 + @rm -rf "$(DESTDIR)$(libdir)"
2.221
2.222 uninstall-doc:
2.223 - @echo " RMDIR '$(DESTDIR)$(DOCDIR)/'"
2.224 - @rm -rf "$(DESTDIR)$(DOCDIR)"
2.225 + @echo " RMDIR '$(DESTDIR)$(docdir)/'"
2.226 + @rm -rf "$(DESTDIR)$(docdir)"
2.227
2.228 uninstall-man:
2.229 - @echo " RM '$(DESTDIR)$(MANDIR)$(MAN_SUBDIR)/$(PROG_NAME).1.gz'"
2.230 - @rm -f "$(DESTDIR)$(MANDIR)$(MAN_SUBDIR)/$(PROG_NAME).1"{,.gz}
2.231 + @echo " RM '$(DESTDIR)$(mandir)$(MAN_SUBDIR)/$(PROG_NAME).1.gz'"
2.232 + @rm -f "$(DESTDIR)$(mandir)$(MAN_SUBDIR)/$(PROG_NAME).1"{,.gz}
2.233
2.234 endif # Not --local
2.235
3.1 --- a/README Thu Jan 12 22:41:47 2012 +0100
3.2 +++ b/README Mon Nov 07 22:28:40 2011 +0100
3.3 @@ -2,7 +2,11 @@
3.4
3.5 Crosstool-NG follows the autoconf dance. So, to get you
3.6 kick-started, just run:
3.7 - ./configure --help
3.8 + ./configure --help
3.9 +
3.10 +If you are using a development snapshot, you'll have to
3.11 +create the configure script, first. Just run:
3.12 + ./bootstrap
3.13
3.14 You will find the documentation in the directory 'docs'.
3.15 Here is a quick overview of what you'll find there:
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/bootstrap Mon Nov 07 22:28:40 2011 +0100
4.3 @@ -0,0 +1,7 @@
4.4 +#!/bin/sh
4.5 +set -e
4.6 +
4.7 +printf "Running autoconf...\n"
4.8 +autoconf -Wall --force
4.9 +
4.10 +printf "Done. You may now run:\n ./configure\n"
5.1 --- a/configure Thu Jan 12 22:41:47 2012 +0100
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,645 +0,0 @@
5.4 -#!/bin/sh
5.5 -
5.6 -myname="${0##*/}"
5.7 -
5.8 -VERSION=$( cat .version )
5.9 -DATE=$( date +%Y%m%d )
5.10 -
5.11 -PREFIX_DEFAULT=/usr/local
5.12 -
5.13 -BINDIR_set=
5.14 -LIBDIR_set=
5.15 -DOCDIR_set=
5.16 -MANDIR_set=
5.17 -PROG_PFX=
5.18 -PROG_SFX=
5.19 -PROG_SED=
5.20 -LOCAL_set=
5.21 -FORCE=
5.22 -
5.23 -do_quit=
5.24 -
5.25 -# Simply print the error message, and exit. Obvious, he?
5.26 -do_error() {
5.27 - printf "${myname}: ${@}\n"
5.28 - exit 1
5.29 -}
5.30 -
5.31 -# Given an option string and the following argument,
5.32 -# echoes the value of the option.
5.33 -# If --var=val => echoes val and returns 0, meaning second arg was not consumed
5.34 -# If --var val => echoes val and returns non null, meaning second arg was used
5.35 -get_optval(){
5.36 - case "$1" in
5.37 - --*=?*)
5.38 - printf "${1#*=}"
5.39 - return 0
5.40 - ;;
5.41 - *)
5.42 - printf "${2}"
5.43 - return 1
5.44 - ;;
5.45 - esac
5.46 -}
5.47 -
5.48 -# The set_xxx functions will set the corresponding configuration variable
5.49 -# They return 0 if second arg was not consumed, and non-zero if it was consumed.
5.50 -set_prefix() {
5.51 - PREFIX="$( get_optval "$1" "$2" )"
5.52 -}
5.53 -set_bindir() {
5.54 - BINDIR_set=1
5.55 - BINDIR="$( get_optval "$1" "$2" )"
5.56 -}
5.57 -set_libdir() {
5.58 - LIBDIR_set=1
5.59 - LIBDIR="$( get_optval "$1" "$2" )"
5.60 -}
5.61 -set_docdir() {
5.62 - DOCDIR_set=1
5.63 - DOCDIR="$( get_optval "$1" "$2" )"
5.64 -}
5.65 -set_mandir() {
5.66 - MANDIR_set=1
5.67 - MANDIR="$( get_optval "$1" "$2" )"
5.68 -}
5.69 -set_program_prefix() {
5.70 - PROG_PFX="$( get_optval "$1" "$2" )"
5.71 -}
5.72 -set_program_suffix() {
5.73 - PROG_SFX="$( get_optval "$1" "$2" )"
5.74 -}
5.75 -set_program_transform_name() {
5.76 - PROG_SED="$( get_optval "$1" "$2" )"
5.77 -}
5.78 -set_tool() {
5.79 - local var_name="${1%%=*}"
5.80 - var_name="${var_name#--with-}"
5.81 - eval ${var_name}="\$( get_optval "$1" "$2" )"
5.82 -}
5.83 -
5.84 -# var_list is a list of variables, each one holding a path to a
5.85 -# tool, either detected by ./configure, or specified by the user.
5.86 -var_list=""
5.87 -kconfig_list=""
5.88 -
5.89 -# This function adds a variable name to the above list of variable names.
5.90 -# $1: the name of the variable to add to the list
5.91 -add_to_var_list() {
5.92 - local v
5.93 - for v in ${var_list}; do
5.94 - [ "${v}" = "${1}" ] && return 0
5.95 - done
5.96 - var_list="${var_list} ${1}"
5.97 -}
5.98 -add_to_kconfig_list() {
5.99 - local k
5.100 - for k in ${kconfig_list}; do
5.101 - [ "${k}" = "${1}" ] && return 0
5.102 - done
5.103 - kconfig_list="${kconfig_list} ${1}"
5.104 -}
5.105 -
5.106 -# A function to test for required tools/headers/libraries
5.107 -# Return 0 (true) if found, !0 (false) if not found
5.108 -#
5.109 -# $*: [prog|inc|lib]=<name[ name...]>
5.110 -# the name(s) of tool(s) to test for
5.111 -# mandatory
5.112 -# eg: prog=bash prog="curl wget"
5.113 -# $*: var=<var_name>
5.114 -# the name of the variable to test and set
5.115 -# optional
5.116 -# eg: var=bash if ${bash} is set and non-null, use that,
5.117 -# else check for bash and set bash=$(which bash)
5.118 -# $*: ver=<regexp>
5.119 -# for each 'prog', test if $(prog --version) matches 'regexp'
5.120 -# optional
5.121 -# eg: ver='^GNU bash, version [34]\.'
5.122 -# $*: lib_exts=<extension[ extension...]>
5.123 -# the list of allowed library extension
5.124 -# mandatory
5.125 -# eg: lib_exts="so dylib" lib_exts="so dylib a"
5.126 -# $*: err=<error_message>
5.127 -# the error message to print if tool is missing
5.128 -# optional, defaults to: '${prog}: none found'
5.129 -# eg: err="'bash' 3.x or above was not found"
5.130 -# Note: err may be printed by caller, not us
5.131 -# $*: kconfig=<var_name>
5.132 -# the name of a variable to pass down to kconfig if
5.133 -# the prog/inc/lib was found
5.134 -# optional, defaults to none
5.135 -# eg: kconfig=has_libncurses
5.136 -# $*: skip=[y|n|]
5.137 -# if set to 'y', skip the test, but still register the
5.138 -# kconfig and var variables; if 'n' or empty, do the
5.139 -# test.
5.140 -# optional, default to 'n'
5.141 -# eg: skip="${static_link_ko}"
5.142 -check_for() {
5.143 - local lib_exts
5.144 - local skip
5.145 - local val
5.146 - local item
5.147 - local where
5.148 - local status
5.149 - local ext
5.150 -
5.151 - # Note: prog/inc/lib and var/kconfig/ver/err are set here,
5.152 - # but declared by the caller (because it needs it)
5.153 - for item in "${@}"; do
5.154 - case "${item}" in
5.155 - prog=*|inc=*|lib=*|var=*|ver=*|err=*|kconfig=*|lib_exts=*|skip=*)
5.156 - eval ${item%%=*}=\"${item#*=}\"
5.157 - ;;
5.158 - *) do_error "check_for: incorrect parameters: '${item}'";;
5.159 - esac
5.160 - done
5.161 -
5.162 - case "${prog}:${inc}:${lib}" in
5.163 - ?*:?*:|?*::?*|:?*:?*|?*:?*:?*)
5.164 - if [ -n "${var}" ]; then
5.165 - do_error "check_for: the use of var is not compatible with passing several of [prog|inc|lib] at once"
5.166 - fi
5.167 - ;;
5.168 - ::) do_error "check_for: [prog|inc|lib] is mandatory";;
5.169 - esac
5.170 -
5.171 - if [ -n "${var}" ]; then
5.172 - add_to_var_list "${var}"
5.173 - fi
5.174 - if [ -n "${kconfig}" ]; then
5.175 - add_to_kconfig_list "${kconfig}"
5.176 - fi
5.177 -
5.178 - if [ "${skip}" = "y" ]; then
5.179 - return 0
5.180 - fi
5.181 -
5.182 - if [ -n "${prog}" ]; then
5.183 - for item in ${prog}; do
5.184 - printf "Checking for '${item}'... "
5.185 - if [ -n "${var}" ]; then
5.186 - eval val="\${${var}}"
5.187 - if [ -n "${val}" ]; then
5.188 - status="${val} (cached)\n"
5.189 - where="${val}"
5.190 - break
5.191 - fi
5.192 - fi
5.193 - where="$( which "${item}" 2>/dev/null )"
5.194 - if [ -z "${where}" ]; then
5.195 - printf "no\n"
5.196 - continue
5.197 - elif [ -n "${ver}" ]; then
5.198 - str=$( LC_ALL=C "${where}" --version 2>&1 \
5.199 - |grep -E "${ver}" \
5.200 - |head -n 1
5.201 - )
5.202 - if [ -z "${str}" ]; then
5.203 - printf "no\n"
5.204 - unset where
5.205 - continue
5.206 - fi
5.207 - fi
5.208 - status="${where}"
5.209 - break
5.210 - done
5.211 - if [ -z "${status}" ]; then
5.212 - return 1
5.213 - fi
5.214 - printf "${status}\n"
5.215 - unset status
5.216 - fi
5.217 -
5.218 - if [ -n "${inc}" ]; then
5.219 - for item in ${inc}; do
5.220 - printf "Checking for '${item}'... "
5.221 - if printf "#include \"${item}\"" |gcc -x c -c - -o /dev/null >/dev/null 2>&1; then
5.222 - where="${item}"
5.223 - status=yes
5.224 - break;
5.225 - fi
5.226 - printf "no\n"
5.227 - done
5.228 - if [ -z "${status}" ]; then
5.229 - return 1
5.230 - fi
5.231 - printf "${status}\n"
5.232 - unset status
5.233 - fi
5.234 -
5.235 - if [ -n "${lib}" ]; then
5.236 - if [ -z "${lib_exts}" ]; then
5.237 - do_error "check_for: no library extension specified for '${lib}'"
5.238 - fi
5.239 - for item in ${lib}; do
5.240 - for ext in ${lib_exts}; do
5.241 - printf "Checking for '${item}.${ext}'... "
5.242 - where="$( gcc -print-file-name="${item}.${ext}" )"
5.243 - if [ "${where}" != "${item}.${ext}" ]; then
5.244 - where="$( readlink "${where}" )"
5.245 - status=yes
5.246 - break 2;
5.247 - fi
5.248 - printf "no\n"
5.249 - done
5.250 - done
5.251 - if [ -z "${status}" ]; then
5.252 - return 1
5.253 - fi
5.254 - printf "${status}\n"
5.255 - unset status
5.256 - fi
5.257 -
5.258 - if [ -n "${var}" ]; then
5.259 - eval ${var}='"'"${where}"'"'
5.260 - fi
5.261 - if [ -n "${kconfig}" ]; then
5.262 - eval ${kconfig}=y
5.263 - fi
5.264 -}
5.265 -
5.266 -# This function checks for a tool, and aborts if not found
5.267 -# See check_for(), above, for how to call has_or_abort
5.268 -has_or_abort() {
5.269 - # We declare these 6 variables here, although they are
5.270 - # set in check_for(), called below
5.271 - local prog inc lib
5.272 - local var ver err kconfig
5.273 -
5.274 - if ! check_for "$@"; then
5.275 - printf " * A mandatory dependency is missing, or version mis-match:\n"
5.276 - printf " * - ${err:-${prog}${inc}${lib}: none found}\n"
5.277 - if [ -n "${var}" ]; then
5.278 - printf " * --> You can give the path to this tool using: --with-${var}=PATH\n"
5.279 - fi
5.280 - printf "\n"
5.281 - # Bail out if --force is not specified
5.282 - [ -z "${FORCE}" ] && do_error "Bailing out..."
5.283 - printf "<* *>\n"
5.284 - printf "<* FORCE in action: *>\n"
5.285 - printf "<* Continuing despite missing pre-requisite *>\n"
5.286 - printf "<* Prepare for breakage *>\n"
5.287 - printf "<* *>\n"
5.288 - printf "\n"
5.289 - fi
5.290 -}
5.291 -
5.292 -# This function checks for a tool, and warns if not found
5.293 -# See check_for(), above, for how to call has_or_abort
5.294 -# Note: if err is not set, then no error message is printed
5.295 -has_or_warn() {
5.296 - # We declare these 6 variables here, although they are
5.297 - # set in check_for(), called below
5.298 - local prog inc lib
5.299 - local var ver err kconfig
5.300 -
5.301 - if ! check_for "$@"; then
5.302 - printf " * An optional dependency is missing, some features will be disabled"
5.303 - printf "${err:+:\n * - ${err}}\n"
5.304 - if [ -n "${var}" ]; then
5.305 - printf " * --> You can give the path to this tool using: --with-${var}=PATH\n"
5.306 - fi
5.307 - fi
5.308 -}
5.309 -
5.310 -do_help() {
5.311 - cat <<__EOF__
5.312 -\`configure' configures crosstool-NG-${VERSION} to adapt to many kind of systems.
5.313 -
5.314 -USAGE: ./configure [OPTION]...
5.315 -
5.316 -Defaults for the options are specified in brackets.
5.317 -
5.318 -Configuration:
5.319 - -h, --help display this help and exit
5.320 - --force force configure to continue, even in case
5.321 - some pre-requisites are missing
5.322 -
5.323 -Installation directories:
5.324 - --prefix=PREFIX install files in PREFIX [${PREFIX_DEFAULT}]
5.325 - --local don't install, and use current directory
5.326 -
5.327 -By default, \`make install' will install all the files in
5.328 -\`${PREFIX_DEFAULT}/bin', \`${PREFIX_DEFAULT}/lib' etc. You can specify
5.329 -an installation prefix other than \`${PREFIX_DEFAULT}' using \`--prefix',
5.330 -for instance \`--prefix=\${HOME}'.
5.331 -
5.332 -For better control, use the options below.
5.333 -Note: options marked as \`ignored' are recognised, but not acted upon, as
5.334 -they make no sense for crosstool-NG, or they are not implemented yet.
5.335 -
5.336 -Fine tuning of the installation directories:
5.337 - --bindir=DIR user executables [PREFIX/bin]
5.338 - --libdir=DIR object code libraries [PREFIX/lib]
5.339 - --docdir=DIR info documentation [PREFIX/share/doc]
5.340 - --mandir=DIR man documentation [PREFIX/share/man]
5.341 - --infodir=DIR info documentation [DATAROOTDIR/info] (ignored)
5.342 - --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
5.343 - (ignored)
5.344 - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] (ignored)
5.345 - --localstatedir=DIR modifiable single-machine data [PREFIX/var] (ignored)
5.346 -
5.347 -Program names:
5.348 - --program-prefix=PREFIX prepend PREFIX to installed program names
5.349 - --program-suffix=SUFFIX append SUFFIX to installed program names
5.350 - --program-transform-name=PROGRAM run sed PROGRAM on installed program names
5.351 -
5.352 -System types:
5.353 - --build=BUILD configure for building on BUILD [guessed] (ignored)
5.354 - --host=HOST cross-compile to build programs to run on HOST [BUILD]
5.355 - (ignored)
5.356 -
5.357 -Optional Features:
5.358 - --enable-shared[=PKGS] build shared libraries [default=yes] (ignored)
5.359 - --enable-static[=PKGS] build static libraries [default=yes] (ignored)
5.360 -
5.361 -Optional Packages:
5.362 - --with-install=PATH Specify the full PATH to GNU install
5.363 - --with-make=PATH Specify the full PATH to GNU make >= 3.80
5.364 - --with-grep=PATH Specify the full PATH to GNU grep
5.365 - --with-sed=PATH Specify the full PATH to GNU sed
5.366 - --with-bash=PATH Specify the full PATH to bash >= 3.0
5.367 -__EOF__
5.368 -}
5.369 -
5.370 -#---------------------------------------------------------------------
5.371 -# Set user's options
5.372 -
5.373 -while [ $# -ne 0 ]; do
5.374 - case "$1" in
5.375 - --local) LOCAL_set="y"; shift;;
5.376 - --prefix*) set_prefix "$1" "$2" && shift || shift 2;;
5.377 - --bindir*) set_bindir "$1" "$2" && shift || shift 2;;
5.378 - --libdir*) set_libdir "$1" "$2" && shift || shift 2;;
5.379 - --docdir*) set_docdir "$1" "$2" && shift || shift 2;;
5.380 - --mandir*) set_mandir "$1" "$2" && shift || shift 2;;
5.381 - --with-*) set_tool "$1" "$2" && shift || shift 2;;
5.382 - --program-prefix=*|--program-prefix)
5.383 - set_program_prefix "$1" "$2" && shift || shift 2
5.384 - ;;
5.385 - --program-suffix=*|--program-suffix)
5.386 - set_program_suffix "$1" "$2" && shift || shift 2
5.387 - ;;
5.388 - --program-transform-name=*|--program-transform-name)
5.389 - set_program_transform_name "$1" "$2" && shift || shift 2
5.390 - ;;
5.391 - --force) FORCE=1; shift;;
5.392 - --help|-h) do_help; exit 0;;
5.393 - # Skip, auto-stuff compatibility
5.394 - --build=*|--host=*|--infodir=*|--datadir=*|--sysconfdir=*|--localstatedir=*) shift;;
5.395 - --build|--host|--infodir|--datadir|--sysconfdir|--localstatedir) shift 2;;
5.396 - --enable-shared|--disable-shared|--enable-static|--disable-static) shift;;
5.397 - *) printf "Unrecognised option: '${1}'\n"; do_help; exit 1;;
5.398 - esac
5.399 -done
5.400 -
5.401 -# Use defaults
5.402 -[ -z "${PREFIX}" ] && set_prefix "" "${PREFIX_DEFAULT}"
5.403 -
5.404 -# Special case when installing locally
5.405 -if [ "${LOCAL_set}" = "y" ]; then
5.406 - set_prefix "" "$( pwd )"
5.407 - set_bindir "" "$( pwd )"
5.408 - set_libdir "" "$( pwd )"
5.409 - set_docdir "" "$( pwd )/docs"
5.410 - set_mandir "" "$( pwd )/docs"
5.411 - set_program_prefix "" ""
5.412 - set_program_suffix "" ""
5.413 - set_program_transform_name "" ""
5.414 -fi
5.415 -
5.416 -#---------------------------------------------------------------------
5.417 -# Some sanity checks, now
5.418 -
5.419 -# We check for grep and sed manually, because they are used in check_for()
5.420 -printf "Checking for 'grep'... "
5.421 -if [ -n "${grep}" ]; then
5.422 - printf "${grep} (cached)\n"
5.423 -else
5.424 - grep="$( which grep 2>/dev/null )"
5.425 - if [ -z "${grep}" ]; then
5.426 - printf "not found\n"
5.427 - else
5.428 - printf "${grep}\n"
5.429 - printf "Checking whether '${grep}' supports -E... "
5.430 - if echo 'foo' |"${grep}" -E 'foo' >/dev/null 2>&1; then
5.431 - printf "yes\n"
5.432 - else
5.433 - printf "no\n"
5.434 - grep=
5.435 - fi
5.436 - fi
5.437 -fi
5.438 -if [ -z "${grep}" ]; then
5.439 - printf "Either you are missing entirely the needed tool,\n"
5.440 - printf "or the version you have is too old.\n"
5.441 - printf "You can give the path to this tool using: --with-grep=PATH\n"
5.442 - do_error "Bailing out..."
5.443 -fi
5.444 -add_to_var_list grep
5.445 -
5.446 -printf "Checking for 'sed'... "
5.447 -if [ -n "${sed}" ]; then
5.448 - printf "${sed} (cached)\n"
5.449 -else
5.450 - sed="$( which sed 2>/dev/null )"
5.451 - if [ -z "${sed}" ]; then
5.452 - printf "not found\n"
5.453 - else
5.454 - printf "${sed}\n"
5.455 - printf "Checking whether '${sed}' supports -i and -e... "
5.456 - touch .ct-ng.sed.test
5.457 - if "${sed}" -r -i -e 's/foo/bar/' .ct-ng.sed.test >/dev/null 2>&1; then
5.458 - printf "yes\n"
5.459 - else
5.460 - printf "no\n"
5.461 - sed=
5.462 - fi
5.463 - rm -f .ct-ng.sed.test
5.464 - fi
5.465 -fi
5.466 -if [ -z "${sed}" ]; then
5.467 - printf "Either you are missing entirely the needed tool,\n"
5.468 - printf "or the version you have is too old.\n"
5.469 - printf "You can give the path to this tool using: --with-sed=PATH\n"
5.470 - do_error "Bailing out..."
5.471 -fi
5.472 -add_to_var_list sed
5.473 -
5.474 -# The regular list of tools we can now easily check for
5.475 -has_or_abort prog=bash \
5.476 - var=bash \
5.477 - ver='^GNU bash, version (3\.[1-9]|4)' \
5.478 - err="'bash' 3.1 or above was not found"
5.479 -has_or_abort prog=cut
5.480 -has_or_abort prog=install var=install
5.481 -has_or_abort prog=make \
5.482 - var=make \
5.483 - ver='^GNU Make (3.[89][[:digit:]]|[4-9])' \
5.484 - err="GNU 'make' 3.80 or above was not found"
5.485 -has_or_abort prog=gcc
5.486 -has_or_abort prog="awk gawk" ver='^GNU Awk' err="GNU 'awk' was not found"
5.487 -has_or_abort prog=bison
5.488 -has_or_abort prog=flex
5.489 -has_or_abort prog=makeinfo
5.490 -has_or_abort prog=automake \
5.491 - ver='\(GNU automake\) (1\.[[:digit:]]{2,}|[2-9][[:digit:]]*\.)' \
5.492 - err="'automake' 1.10 or above was not found"
5.493 -has_or_abort prog=libtool \
5.494 - var=libtool \
5.495 - ver='\(GNU libtool.*\) (2[[:digit:]]*\.|1\.6[[:digit:]]*\.|1\.5\.[2-9][[:digit:]]+)' \
5.496 - err="'libtool' 1.5.26 or above was not found"
5.497 -has_or_abort prog=libtoolize \
5.498 - var=libtoolize \
5.499 - ver='\(GNU libtool.*\) (2[[:digit:]]*\.|1\.6[[:digit:]]*\.|1\.5\.[2-9][[:digit:]]+)' \
5.500 - err="'libtoolize' 1.5.26 or above was not found"
5.501 -has_or_abort prog=stat
5.502 -has_or_abort prog=wget
5.503 -has_or_abort prog=patch
5.504 -has_or_abort prog=tar
5.505 -has_or_abort prog=gzip
5.506 -has_or_abort prog=bzip2
5.507 -has_or_warn prog=xz \
5.508 - kconfig=has_xzutils \
5.509 - err="xz-compressed tarballs will not be used"
5.510 -has_or_warn prog=lzma \
5.511 - kconfig=has_lzma \
5.512 - skip="${has_xzutils}" \
5.513 - err="lzma-compressed tarballs will not be used"
5.514 -has_or_abort prog=readlink
5.515 -has_or_abort prog=objcopy var=objcopy
5.516 -has_or_abort prog=objdump var=objdump
5.517 -has_or_abort prog=readelf var=readelf
5.518 -has_or_abort prog=patch var=patch
5.519 -has_or_warn prog=cvs \
5.520 - kconfig=has_cvs \
5.521 - err="it will not be possible to use newlib cvs snapshots"
5.522 -has_or_warn prog=svn \
5.523 - kconfig=has_svn \
5.524 - err="subversion is required to download eglibc"
5.525 -
5.526 -# Library checks
5.527 -libs_exts="so dylib a"
5.528 -
5.529 -ncurses_hdrs="ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h"
5.530 -ncurses_libs="libncursesw libncurses libcurses"
5.531 -has_or_abort lib="${ncurses_libs}" \
5.532 - lib_exts="${libs_exts}" \
5.533 - inc="${ncurses_hdrs}" \
5.534 - err="The 'ncurses' library is needed fo the menuconfig frontend"
5.535 -
5.536 -#---------------------------------------------------------------------
5.537 -# Compute the version string
5.538 -
5.539 -# If this version is n hg clone, try to get the revision number
5.540 -# If we can't get the revision number, use date
5.541 -printf "\nComputing version string... "
5.542 -
5.543 -# Pass the version to the version helper script, if present, to compute
5.544 -# a local version string, if needed.
5.545 -if [ -f version.sh -a -x version.sh ]; then
5.546 - V="$( ./version.sh "${VERSION}" 2>/dev/null |head -n 1 )"
5.547 -fi
5.548 -
5.549 -# If the script returns an empty string, revert to using the version
5.550 -# we just computed, above.
5.551 -if [ -n "${V}" ]; then
5.552 - VERSION="${V}"
5.553 -else
5.554 - case "${VERSION}" in
5.555 - *+hg|hg)
5.556 - rev_id="$( hg log -r . --template '{branch}-{node|short}\n' \
5.557 - 2>/dev/null \
5.558 - || true \
5.559 - )"
5.560 - VERSION="${VERSION}+${rev_id:-unknown-$( date +%Y%m%d.%H%M%S )}"
5.561 - ;;
5.562 - esac
5.563 -fi
5.564 -
5.565 -# Arrange to have no / in the directory name, no need to create an
5.566 -# arbitrarily deep directory structure
5.567 -VERSION="$( printf "${VERSION}" |"${sed}" -r -e 's:/+:_:g;' )"
5.568 -
5.569 -printf "${VERSION}\n"
5.570 -
5.571 -#---------------------------------------------------------------------
5.572 -# Compute and check install paths
5.573 -
5.574 -# Now we have the version string, we can build up the paths
5.575 -[ -z "${BINDIR_set}" ] && BINDIR="${PREFIX}/bin"
5.576 -[ -z "${LIBDIR_set}" ] && LIBDIR="${PREFIX}/lib"
5.577 -[ -z "${DOCDIR_set}" ] && DOCDIR="${PREFIX}/share/doc"
5.578 -[ -z "${MANDIR_set}" ] && MANDIR="${PREFIX}/share/man"
5.579 -
5.580 -# Install support files in our own sub-dir, so as not to mangle (system)
5.581 -# files and dirs, but only if not --local
5.582 -if [ -z "${LOCAL_set}" ]; then
5.583 - LIBDIR="${LIBDIR}/ct-ng-${VERSION}"
5.584 - DOCDIR="${DOCDIR}/ct-ng-${VERSION}"
5.585 -fi
5.586 -
5.587 -# Check that install PATHs are absolute
5.588 -for p in BIN LIB DOC MAN; do
5.589 - var="${p}DIR"
5.590 - eval v='"${'"${var}"'}"'
5.591 - case "${v}" in
5.592 - /*) ;;
5.593 - *) do_error "'${var}' is not an absolute path: '${v}'";;
5.594 - esac
5.595 -done
5.596 -case "${PROG_PFX}" in
5.597 - */*) do_error "program prefix '${PROG_PFX}' contains a '/'";;
5.598 -esac
5.599 -case "${PROG_SFX}" in
5.600 - */*) do_error "program suffix '${PROG_SFX}' contains a '/'";;
5.601 -esac
5.602 -
5.603 -#---------------------------------------------------------------------
5.604 -# That's all, folks!
5.605 -
5.606 -printf "Building up Makefile... "
5.607 -var_sed="$( for var_name in ${var_list}; do
5.608 - eval echo 's,@@${var_name}@@,${'"${var_name}"'},g'
5.609 - done
5.610 - )"
5.611 -kconfig_sed="s/@@KCONFIG@@/$( for k_name in ${kconfig_list}; do
5.612 - eval printf \"${k_name}=\${${k_name}} \"
5.613 - done
5.614 - )/"
5.615 -"${sed}" -r -e "s,@@BINDIR@@,${BINDIR},g" \
5.616 - -e "s,@@LIBDIR@@,${LIBDIR},g" \
5.617 - -e "s,@@DOCDIR@@,${DOCDIR},g" \
5.618 - -e "s,@@MANDIR@@,${MANDIR},g" \
5.619 - -e "s,@@PROG_PFX@@,${PROG_PFX},g" \
5.620 - -e "s,@@PROG_SFX@@,${PROG_SFX},g" \
5.621 - -e "s,@@PROG_SED@@,${PROG_SED},g" \
5.622 - -e "s,@@VERSION@@,${VERSION},g" \
5.623 - -e "s,@@DATE@@,${DATE},g" \
5.624 - -e "s,@@LOCAL@@,${LOCAL_set},g" \
5.625 - -e "${var_sed}" \
5.626 - -e "${kconfig_sed}" \
5.627 - Makefile.in \
5.628 - >Makefile
5.629 -echo "done"
5.630 -
5.631 -cat <<__EOF__
5.632 -
5.633 -crosstool-NG configured as follows:
5.634 - PREFIX='${PREFIX}'
5.635 - BINDIR='${BINDIR}'
5.636 - LIBDIR='${LIBDIR}'
5.637 - DOCDIR='${DOCDIR}'
5.638 - MANDIR='${MANDIR}'
5.639 - PROG_PFX='${PROG_PFX}'
5.640 - PROG_SFX='${PROG_SFX}'
5.641 - PROG_SED='${PROG_SED}'
5.642 -
5.643 -Now run:
5.644 - make
5.645 -__EOF__
5.646 -if [ "${LOCAL_set}" != "y" ]; then
5.647 - printf " make install\n"
5.648 -fi
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/configure.ac Mon Nov 07 22:28:40 2011 +0100
6.3 @@ -0,0 +1,346 @@
6.4 +# -*- Autoconf -*-
6.5 +# Process this file with autoconf to produce a configure script.
6.6 +
6.7 +AC_PREREQ([2.67])
6.8 +#AC_INIT([crosstool-NG], [hg], [crossgcc@sourceware.org])
6.9 +AC_INIT([crosstool-NG], [m4_esyscmd_s([cat .version])], [crossgcc@sourceware.org])
6.10 +AC_CONFIG_AUX_DIR([scripts])
6.11 +
6.12 +#--------------------------------------------------------------------
6.13 +# A few helper macros
6.14 +
6.15 +# Check for required tool
6.16 +AC_DEFUN(
6.17 + [ACX_CHECK_TOOL_REQ],
6.18 + [AC_CHECK_TOOLS([$1], [$2])
6.19 + AS_IF(
6.20 + [test -z "$$1"],
6.21 + [AC_MSG_ERROR([missing required tool: $2])])
6.22 + ])
6.23 +
6.24 +# Check for required tool, set variable to full pathname
6.25 +AC_DEFUN(
6.26 + [ACX_PATH_TOOL_REQ],
6.27 + [ACX_CHECK_TOOL_REQ([$1], [$2])
6.28 + AS_CASE(
6.29 + [$$1],
6.30 + [/*],,
6.31 + [?*],[AC_MSG_CHECKING([for absolute path to $$1])
6.32 + $1=$(which $$1)
6.33 + AC_MSG_RESULT([$$1])])])
6.34 +
6.35 +# Check for required program
6.36 +AC_DEFUN(
6.37 + [ACX_CHECK_PROGS_REQ],
6.38 + [AC_CHECK_PROGS([$1], [$2])
6.39 + AS_IF(
6.40 + [test -z "$$1"],
6.41 + [AC_MSG_ERROR([missing required tool: $2])])
6.42 + ])
6.43 +
6.44 +# Check for path to required program
6.45 +AC_DEFUN(
6.46 + [ACX_PATH_PROGS_REQ],
6.47 + [AC_PATH_PROGS([$1], [$2])
6.48 + AS_IF(
6.49 + [test -z "$$1"],
6.50 + [AC_MSG_ERROR([missing required tool: $2])])
6.51 + ])
6.52 +
6.53 +# Set the kconfig option
6.54 +AC_DEFUN(
6.55 + [ACX_SET_KCONFIG_OPTION],
6.56 + [AS_IF(
6.57 + [test -n "$$1"],
6.58 + [kconfig_options="$kconfig_options $1=y"],
6.59 + [kconfig_options="$kconfig_options $1"])
6.60 + ])
6.61 +
6.62 +#--------------------------------------------------------------------
6.63 +# Allow dummy --{en,dis}able-{static,shared}
6.64 +AC_ARG_ENABLE(
6.65 + [local],
6.66 + [AS_HELP_STRING(
6.67 + [--enable-local],
6.68 + [don't install, and use current directory])])
6.69 +AC_SUBST([enable_local], [${enable_local:-no}])
6.70 +AC_ARG_ENABLE(
6.71 + [shared],
6.72 + [AS_HELP_STRING(
6.73 + [--enable-shared],
6.74 + [build shared libraries (default=yes) (ignored)])])
6.75 +AC_ARG_ENABLE(
6.76 + [static],
6.77 + [AS_HELP_STRING(
6.78 + [--enable-static],
6.79 + [build static libraries (default=yes) (ignored)])])
6.80 +
6.81 +#---------------------------------------------------------------------
6.82 +# Check for --build and --host...
6.83 +AC_CANONICAL_BUILD
6.84 +AC_CANONICAL_HOST
6.85 +# ... but refuse --target
6.86 +AS_IF([test -n "$target_alias"],
6.87 + AC_MSG_ERROR([--target is not allowed]))
6.88 +
6.89 +# Allow program name tranformation (--program-{prefix,suffix,transform-name})
6.90 +AC_ARG_PROGRAM
6.91 +
6.92 +#---------------------------------------------------------------------
6.93 +# Initial checks that are usually done first (I don't know why, that's
6.94 +# just what I seem to experience...)
6.95 +#---------------------------------------------------------------------
6.96 +AC_PROG_INSTALL
6.97 +AC_PROG_EGREP
6.98 +AC_CACHE_VAL([ac_cv_path_SED],
6.99 + [AC_ARG_WITH([sed],
6.100 + AS_HELP_STRING([--with-sed=PATH],
6.101 + [Specify the full PATH to sed]),
6.102 + [ac_cv_path_SED=$withval])])
6.103 +AC_PROG_SED
6.104 +AC_MSG_CHECKING([whether sed understands -r -i -e])
6.105 +touch .ct-ng.sed.test
6.106 +if ${SED} -r -i -e 's/foo/bar/' .ct-ng.sed.test >/dev/null 2>&1; then
6.107 + rm -f .ct-ng.sed.test
6.108 + AC_MSG_RESULT([yes])
6.109 +else
6.110 + rm -f .ct-ng.sed.test
6.111 + AC_MSG_RESULT([no])
6.112 + AC_MSG_ERROR()
6.113 +fi
6.114 +AC_PROG_LN_S
6.115 +
6.116 +#--------------------------------------------------------------------
6.117 +# A bunch of boring tests...
6.118 +#--------------------------------------------------------------------
6.119 +AC_PROG_CC
6.120 +AS_IF([test -z "$CC"],
6.121 + [AC_MSG_ERROR([no suitable compiler found])])
6.122 +AC_PROG_CPP
6.123 +AC_PROG_RANLIB
6.124 +ACX_PATH_TOOL_REQ([OBJCOPY], [objcopy])
6.125 +ACX_PATH_TOOL_REQ([OBJDUMP], [objdump])
6.126 +ACX_PATH_TOOL_REQ([READELF], [readelf])
6.127 +
6.128 +ACX_CHECK_PROGS_REQ([bison], [bison])
6.129 +ACX_CHECK_PROGS_REQ([flex], [flex])
6.130 +ACX_CHECK_PROGS_REQ([awk], [gawk mawk nawk awk])
6.131 +ACX_CHECK_PROGS_REQ([makeinfo], [makeinfo])
6.132 +ACX_CHECK_PROGS_REQ([cut], [cut])
6.133 +ACX_CHECK_PROGS_REQ([stat], [stat])
6.134 +ACX_CHECK_PROGS_REQ([readlink], [readlink])
6.135 +ACX_CHECK_PROGS_REQ([curl], [curl])
6.136 +ACX_CHECK_PROGS_REQ([tar], [tar])
6.137 +ACX_CHECK_PROGS_REQ([gzip], [gzip])
6.138 +ACX_CHECK_PROGS_REQ([bzip2], [bzip2])
6.139 +
6.140 +#--------------------------------------------------------------------
6.141 +# Still boring, but remember the path, now...
6.142 +#--------------------------------------------------------------------
6.143 +ACX_PATH_PROGS_REQ([PATCH], [patch])
6.144 +
6.145 +#--------------------------------------------------------------------
6.146 +# And a bunch of less boring tests...
6.147 +#--------------------------------------------------------------------
6.148 +# We need a bash that is >= 3.1
6.149 +AC_CACHE_VAL([ac_cv_path__BASH],
6.150 + [AC_ARG_WITH([bash],
6.151 + AS_HELP_STRING([--with-bash=PATH],
6.152 + [Specify the full PATH to bash >= 3.1]),
6.153 + [ac_cv_path__BASH=$withval])])
6.154 +AC_CACHE_CHECK([for bash >= 3.1], [ac_cv_path__BASH],
6.155 + [AC_PATH_PROGS_FEATURE_CHECK([_BASH], [bash],
6.156 + [[_BASH_ver=$($ac_path__BASH --version 2>&1 \
6.157 + |$EGREP '^GNU bash, version (3\.[1-9]|4)')
6.158 + test -n "$_BASH_ver" && ac_cv_path__BASH=$ac_path__BASH ac_path__BASH_found=:]],
6.159 + [AC_MSG_RESULT([no])
6.160 + AC_MSG_ERROR([could not find bash >= 3.1])])])
6.161 +AC_SUBST([_BASH], [$ac_cv_path__BASH])
6.162 +
6.163 +#----------------------------------------
6.164 +# Check for GNU make 3.80 or above
6.165 +AC_CACHE_VAL([ac_cv_path_MAKE],
6.166 + [AC_ARG_WITH([make],
6.167 + AS_HELP_STRING([--with-make=PATH],
6.168 + [Specify the full PATH to GNU make >= 3.80]),
6.169 + [ac_cv_path_MAKE=$withval])])
6.170 +AC_CACHE_CHECK([for GNU make >= 3.80], [ac_cv_path_MAKE],
6.171 + [AC_PATH_PROGS_FEATURE_CHECK([MAKE], [make gmake],
6.172 + [[MAKE_ver=$($ac_path_MAKE --version 2>&1 \
6.173 + |$EGREP '^GNU Make (3.[89][[:digit:]]|[4-9])')
6.174 + test -n "$MAKE_ver" && ac_cv_path_MAKE=$ac_path_MAKE ac_path_MAKE_found=:]],
6.175 + [AC_MSG_RESULT([no])
6.176 + AC_MSG_ERROR([could not find GNU make >= 3.80])])])
6.177 +AC_SUBST([MAKE], [$ac_cv_path_MAKE])
6.178 +AC_PROG_MAKE_SET
6.179 +
6.180 +#----------------------------------------
6.181 +# Check for libtool >= 1.5.26
6.182 +AC_CACHE_VAL([ac_cv_path_LIBTOOL],
6.183 + [AC_ARG_WITH([libtool],
6.184 + AS_HELP_STRING([--with-libtool=PATH],
6.185 + [Specify the full PATH to GNU libtool >= 1.5.26]),
6.186 + [ac_cv_path_LIBTOOL=$withval])])
6.187 +AC_CACHE_CHECK([for GNU libtool >= 1.5.26], [ac_cv_path_LIBTOOL],
6.188 + [AC_PATH_PROGS_FEATURE_CHECK([LIBTOOL], [libtool],
6.189 + [[LIBTOOL_ver=$($ac_path_LIBTOOL --version 2>&1 \
6.190 + |$EGREP '\(GNU libtool.*\) (2[[:digit:]]*\.|1\.6[[:digit:]]*\.|1\.5\.[2-9][[:digit:]]+)')
6.191 + test -n "$LIBTOOL_ver" && ac_cv_path_LIBTOOL=$ac_path_LIBTOOL ac_path_LIBTOOL_found=:]],
6.192 + [AC_MSG_RESULT([no])
6.193 + AC_MSG_ERROR([could not find GNU libtool >= 1.5.26])])])
6.194 +AC_SUBST([LIBTOOL], [$ac_cv_path_LIBTOOL])
6.195 +
6.196 +#----------------------------------------
6.197 +# Check for libtoolize >= 1.5.26
6.198 +AC_CACHE_VAL([ac_cv_path_LIBTOOLIZE],
6.199 + [AC_ARG_WITH([libtoolize],
6.200 + AS_HELP_STRING([--with-libtoolize=PATH],
6.201 + [Specify the full PATH to GNU libtoolize >= 1.5.26]),
6.202 + [ac_cv_path_LIBTOOLIZE=$withval])])
6.203 +AC_CACHE_CHECK([for GNU libtoolize >= 1.5.26], [ac_cv_path_LIBTOOLIZE],
6.204 + [AC_PATH_PROGS_FEATURE_CHECK([LIBTOOLIZE], [libtool],
6.205 + [[LIBTOOLIZE_ver=$($ac_path_LIBTOOLIZE --version 2>&1 \
6.206 + |$EGREP '\(GNU libtool.*\) (2[[:digit:]]*\.|1\.6[[:digit:]]*\.|1\.5\.[2-9][[:digit:]]+)')
6.207 + test -n "$LIBTOOLIZE_ver" && ac_cv_path_LIBTOOLIZE=$ac_path_LIBTOOLIZE ac_path_LIBTOOLIZE_found=:]],
6.208 + [AC_MSG_RESULT([no])
6.209 + AC_MSG_ERROR([could not find GNU libtoolize >= 1.5.26])])])
6.210 +AC_SUBST([LIBTOOLIZE], [$ac_cv_path_LIBTOOLIZE])
6.211 +
6.212 +#----------------------------------------
6.213 +# Check for automake >= 1.10
6.214 +AC_CACHE_VAL([ac_cv_path_automake],
6.215 + [AC_ARG_WITH([automake],
6.216 + AS_HELP_STRING([--with-automake=PATH],
6.217 + [Specify the full PATH to GNU automake >= 1.10]),
6.218 + [ac_cv_path_automake=$withval])])
6.219 +AC_CACHE_CHECK([for GNU automake >= 1.10], [ac_cv_path_automake],
6.220 + [AC_PATH_PROGS_FEATURE_CHECK([automake], [automake],
6.221 + [[automake_ver=$($ac_path_automake --version 2>&1 \
6.222 + |$EGREP '\(GNU automake\) (1\.[[:digit:]]{2,}|[2-9][[:digit:]]*\.)')
6.223 + test -n "$automake_ver" && ac_cv_path_automake=$ac_path_automake ac_path_automake_found=:]],
6.224 + [AC_MSG_RESULT([no])
6.225 + AC_MSG_ERROR([could not find GNU automake >= 1.10])])])
6.226 +AC_SUBST([automake], [$ac_cv_path_automake])
6.227 +
6.228 +#--------------------------------------------------------------------
6.229 +# Boring again... But still a bit of work to do...
6.230 +#--------------------------------------------------------------------
6.231 +AC_SUBST([kconfig_options])
6.232 +
6.233 +#----------------------------------------
6.234 +AC_CHECK_PROGS([xz], [xz])
6.235 +ACX_SET_KCONFIG_OPTION([xz])
6.236 +AS_IF(
6.237 + [test -z "$xz"],
6.238 + [AC_CHECK_PROGS([lzma], [lzma])])
6.239 +ACX_SET_KCONFIG_OPTION([lzma])
6.240 +
6.241 +#----------------------------------------
6.242 +AC_CHECK_PROGS([cvs], [cvs])
6.243 +ACX_SET_KCONFIG_OPTION([cvs])
6.244 +
6.245 +#----------------------------------------
6.246 +AC_CHECK_PROGS([svn], [svn])
6.247 +ACX_SET_KCONFIG_OPTION([svn])
6.248 +
6.249 +#--------------------------------------------------------------------
6.250 +# Now, for some fun...
6.251 +#--------------------------------------------------------------------
6.252 +AC_C_INLINE
6.253 +AC_HEADER_STDC
6.254 +AC_FUNC_MALLOC
6.255 +AC_FUNC_REALLOC
6.256 +AC_FUNC_ALLOCA
6.257 +AC_CHECK_HEADERS(
6.258 + [ncurses/ncurses.h ncurses/curses.h ncursesw/curses.h ncurses.h curses.h],
6.259 + [ac_ct_curses_hdr_found=yes; break])
6.260 +AS_IF(
6.261 + [test -z "$ac_ct_curses_hdr_found"],
6.262 + [AC_MSG_ERROR([could not find curses header, required for the kconfig frontends])])
6.263 +AC_SEARCH_LIBS(
6.264 + [initscr],
6.265 + [ncursesw ncurses curses],
6.266 + [ac_ct_curses_lib_found=yes; break])
6.267 +AS_IF(
6.268 + [test -z "$ac_ct_curses_lib_found"],
6.269 + [AC_MSG_ERROR([could not find curses library, required for the kconfig frontends])])
6.270 +
6.271 +#--------------------------------------------------------------------
6.272 +# Lastly, take care of crosstool-NG internal values
6.273 +#--------------------------------------------------------------------
6.274 +# Hey! We need the date! :-)
6.275 +AC_SUBST(
6.276 + [DATE],
6.277 + [$(date +%Y%m%d)])
6.278 +
6.279 +# Decorate the version string if needed
6.280 +AS_IF(
6.281 + [test -f version.sh -a -x version.sh],
6.282 + [V=$(./version.sh "${PACKAGE_VERSION}")])
6.283 +AS_IF(
6.284 + [test -n "${V}"],
6.285 + [PACKAGE_VERSION="${V}"],
6.286 + [AS_CASE(
6.287 + [${PACKAGE_VERSION}],
6.288 + [hg|*+hg],
6.289 + [rev_id="$( hg log -r . --template '{branch}-{node|short}\n' \
6.290 + 2>/dev/null \
6.291 + || true )"
6.292 + PACKAGE_VERSION="${PACKAGE_VERSION}@${rev_id:-unknown-$( date +%Y%m%d.%H%M%S )}"
6.293 + ])])
6.294 +# Arrange to have no / in the directory name, no need to create an
6.295 +# arbitrarily deep directory structure
6.296 +[PACKAGE_VERSION="$( printf "${PACKAGE_VERSION}\n" |"${SED}" -r -e 's:/+:_:g;' )"]
6.297 +
6.298 +# Handle the local case
6.299 +AC_SUBST([sublibdir])
6.300 +AC_SUBST([subdocdir])
6.301 +AS_IF(
6.302 + [test "x$enable_local" = "xyes"],
6.303 + [AC_MSG_NOTICE([overiding all of --prefix and the likes, because --enable-local was set])
6.304 + prefix=$(pwd)
6.305 + exec_prefix="$prefix"
6.306 + bindir="$prefix"
6.307 + libdir="$prefix"
6.308 + sublibdir=""
6.309 + docdir="$prefix""/docs"
6.310 + subdocdir=""
6.311 + datarootdir="$prefix"
6.312 + mandir="$docdir"],
6.313 + [sublibdir="/ct-ng.\${VERSION}"
6.314 + subdocdir="/ct-ng.\${VERSION}"])
6.315 +
6.316 +#--------------------------------------------------------------------
6.317 +# Finally, generate the output file(s)
6.318 +#--------------------------------------------------------------------
6.319 +AC_CONFIG_FILES([Makefile])
6.320 +AC_OUTPUT
6.321 +
6.322 +
6.323 +
6.324 +# AC_CONFIG_SRCDIR([kconfig/menu.c])
6.325 +# AC_CONFIG_HEADERS([config.h])
6.326 +#
6.327 +# # Checks for programs.
6.328 +#
6.329 +# # Checks for libraries.
6.330 +#
6.331 +# # Checks for header files.
6.332 +# AC_CHECK_HEADERS([fcntl.h inttypes.h libintl.h limits.h locale.h malloc.h stddef.h stdlib.h string.h sys/time.h unistd.h])
6.333 +#
6.334 +# # Checks for typedefs, structures, and compiler characteristics.
6.335 +# AC_HEADER_STDBOOL
6.336 +# AC_TYPE_INT16_T
6.337 +# AC_TYPE_INT32_T
6.338 +# AC_TYPE_INT8_T
6.339 +# AC_TYPE_SIZE_T
6.340 +# AC_TYPE_UINT16_T
6.341 +# AC_TYPE_UINT32_T
6.342 +# AC_TYPE_UINT8_T
6.343 +#
6.344 +# # Checks for library functions.
6.345 +# AC_FUNC_MALLOC
6.346 +# AC_FUNC_REALLOC
6.347 +# AC_CHECK_FUNCS([bzero gettimeofday memmove memset mkdir regcomp setlocale strcasecmp strchr strcspn strdup strncasecmp strpbrk strrchr strspn strtol uname])
6.348 +#
6.349 +# AC_OUTPUT
7.1 --- a/docs/2 - Installing crosstool-NG.txt Thu Jan 12 22:41:47 2012 +0100
7.2 +++ b/docs/2 - Installing crosstool-NG.txt Mon Nov 07 22:28:40 2011 +0100
7.3 @@ -30,6 +30,8 @@
7.4
7.5 You can then get rid of crosstool-NG source. Next create a directory to serve
7.6 as a working place, cd in there and run:
7.7 + mkdir work-dir
7.8 + cd work-dir
7.9 ct-ng help
7.10
7.11 See below for complete usage.
7.12 @@ -39,8 +41,12 @@
7.13 -----------------+
7.14
7.15 If you go the hacker's way, then the usage is a bit different, although very
7.16 -simple:
7.17 - ./configure --local
7.18 +simple. First, you need to generate the ./configure script from its autoconf
7.19 +template:
7.20 + ./bootstrap
7.21 +
7.22 +Then, you run ./configure for local execution of crosstool-NG:
7.23 + ./configure --enable-local
7.24 make
7.25
7.26 Now, *do not* remove crosstool-NG sources. They are needed to run crosstool-NG!
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/scripts/install-sh Mon Nov 07 22:28:40 2011 +0100
8.3 @@ -0,0 +1,520 @@
8.4 +#!/bin/sh
8.5 +# install - install a program, script, or datafile
8.6 +
8.7 +scriptversion=2009-04-28.21; # UTC
8.8 +
8.9 +# This originates from X11R5 (mit/util/scripts/install.sh), which was
8.10 +# later released in X11R6 (xc/config/util/install.sh) with the
8.11 +# following copyright and license.
8.12 +#
8.13 +# Copyright (C) 1994 X Consortium
8.14 +#
8.15 +# Permission is hereby granted, free of charge, to any person obtaining a copy
8.16 +# of this software and associated documentation files (the "Software"), to
8.17 +# deal in the Software without restriction, including without limitation the
8.18 +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8.19 +# sell copies of the Software, and to permit persons to whom the Software is
8.20 +# furnished to do so, subject to the following conditions:
8.21 +#
8.22 +# The above copyright notice and this permission notice shall be included in
8.23 +# all copies or substantial portions of the Software.
8.24 +#
8.25 +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
8.26 +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
8.27 +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8.28 +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
8.29 +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
8.30 +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8.31 +#
8.32 +# Except as contained in this notice, the name of the X Consortium shall not
8.33 +# be used in advertising or otherwise to promote the sale, use or other deal-
8.34 +# ings in this Software without prior written authorization from the X Consor-
8.35 +# tium.
8.36 +#
8.37 +#
8.38 +# FSF changes to this file are in the public domain.
8.39 +#
8.40 +# Calling this script install-sh is preferred over install.sh, to prevent
8.41 +# `make' implicit rules from creating a file called install from it
8.42 +# when there is no Makefile.
8.43 +#
8.44 +# This script is compatible with the BSD install script, but was written
8.45 +# from scratch.
8.46 +
8.47 +nl='
8.48 +'
8.49 +IFS=" "" $nl"
8.50 +
8.51 +# set DOITPROG to echo to test this script
8.52 +
8.53 +# Don't use :- since 4.3BSD and earlier shells don't like it.
8.54 +doit=${DOITPROG-}
8.55 +if test -z "$doit"; then
8.56 + doit_exec=exec
8.57 +else
8.58 + doit_exec=$doit
8.59 +fi
8.60 +
8.61 +# Put in absolute file names if you don't have them in your path;
8.62 +# or use environment vars.
8.63 +
8.64 +chgrpprog=${CHGRPPROG-chgrp}
8.65 +chmodprog=${CHMODPROG-chmod}
8.66 +chownprog=${CHOWNPROG-chown}
8.67 +cmpprog=${CMPPROG-cmp}
8.68 +cpprog=${CPPROG-cp}
8.69 +mkdirprog=${MKDIRPROG-mkdir}
8.70 +mvprog=${MVPROG-mv}
8.71 +rmprog=${RMPROG-rm}
8.72 +stripprog=${STRIPPROG-strip}
8.73 +
8.74 +posix_glob='?'
8.75 +initialize_posix_glob='
8.76 + test "$posix_glob" != "?" || {
8.77 + if (set -f) 2>/dev/null; then
8.78 + posix_glob=
8.79 + else
8.80 + posix_glob=:
8.81 + fi
8.82 + }
8.83 +'
8.84 +
8.85 +posix_mkdir=
8.86 +
8.87 +# Desired mode of installed file.
8.88 +mode=0755
8.89 +
8.90 +chgrpcmd=
8.91 +chmodcmd=$chmodprog
8.92 +chowncmd=
8.93 +mvcmd=$mvprog
8.94 +rmcmd="$rmprog -f"
8.95 +stripcmd=
8.96 +
8.97 +src=
8.98 +dst=
8.99 +dir_arg=
8.100 +dst_arg=
8.101 +
8.102 +copy_on_change=false
8.103 +no_target_directory=
8.104 +
8.105 +usage="\
8.106 +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
8.107 + or: $0 [OPTION]... SRCFILES... DIRECTORY
8.108 + or: $0 [OPTION]... -t DIRECTORY SRCFILES...
8.109 + or: $0 [OPTION]... -d DIRECTORIES...
8.110 +
8.111 +In the 1st form, copy SRCFILE to DSTFILE.
8.112 +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
8.113 +In the 4th, create DIRECTORIES.
8.114 +
8.115 +Options:
8.116 + --help display this help and exit.
8.117 + --version display version info and exit.
8.118 +
8.119 + -c (ignored)
8.120 + -C install only if different (preserve the last data modification time)
8.121 + -d create directories instead of installing files.
8.122 + -g GROUP $chgrpprog installed files to GROUP.
8.123 + -m MODE $chmodprog installed files to MODE.
8.124 + -o USER $chownprog installed files to USER.
8.125 + -s $stripprog installed files.
8.126 + -t DIRECTORY install into DIRECTORY.
8.127 + -T report an error if DSTFILE is a directory.
8.128 +
8.129 +Environment variables override the default commands:
8.130 + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
8.131 + RMPROG STRIPPROG
8.132 +"
8.133 +
8.134 +while test $# -ne 0; do
8.135 + case $1 in
8.136 + -c) ;;
8.137 +
8.138 + -C) copy_on_change=true;;
8.139 +
8.140 + -d) dir_arg=true;;
8.141 +
8.142 + -g) chgrpcmd="$chgrpprog $2"
8.143 + shift;;
8.144 +
8.145 + --help) echo "$usage"; exit $?;;
8.146 +
8.147 + -m) mode=$2
8.148 + case $mode in
8.149 + *' '* | *' '* | *'
8.150 +'* | *'*'* | *'?'* | *'['*)
8.151 + echo "$0: invalid mode: $mode" >&2
8.152 + exit 1;;
8.153 + esac
8.154 + shift;;
8.155 +
8.156 + -o) chowncmd="$chownprog $2"
8.157 + shift;;
8.158 +
8.159 + -s) stripcmd=$stripprog;;
8.160 +
8.161 + -t) dst_arg=$2
8.162 + shift;;
8.163 +
8.164 + -T) no_target_directory=true;;
8.165 +
8.166 + --version) echo "$0 $scriptversion"; exit $?;;
8.167 +
8.168 + --) shift
8.169 + break;;
8.170 +
8.171 + -*) echo "$0: invalid option: $1" >&2
8.172 + exit 1;;
8.173 +
8.174 + *) break;;
8.175 + esac
8.176 + shift
8.177 +done
8.178 +
8.179 +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
8.180 + # When -d is used, all remaining arguments are directories to create.
8.181 + # When -t is used, the destination is already specified.
8.182 + # Otherwise, the last argument is the destination. Remove it from $@.
8.183 + for arg
8.184 + do
8.185 + if test -n "$dst_arg"; then
8.186 + # $@ is not empty: it contains at least $arg.
8.187 + set fnord "$@" "$dst_arg"
8.188 + shift # fnord
8.189 + fi
8.190 + shift # arg
8.191 + dst_arg=$arg
8.192 + done
8.193 +fi
8.194 +
8.195 +if test $# -eq 0; then
8.196 + if test -z "$dir_arg"; then
8.197 + echo "$0: no input file specified." >&2
8.198 + exit 1
8.199 + fi
8.200 + # It's OK to call `install-sh -d' without argument.
8.201 + # This can happen when creating conditional directories.
8.202 + exit 0
8.203 +fi
8.204 +
8.205 +if test -z "$dir_arg"; then
8.206 + trap '(exit $?); exit' 1 2 13 15
8.207 +
8.208 + # Set umask so as not to create temps with too-generous modes.
8.209 + # However, 'strip' requires both read and write access to temps.
8.210 + case $mode in
8.211 + # Optimize common cases.
8.212 + *644) cp_umask=133;;
8.213 + *755) cp_umask=22;;
8.214 +
8.215 + *[0-7])
8.216 + if test -z "$stripcmd"; then
8.217 + u_plus_rw=
8.218 + else
8.219 + u_plus_rw='% 200'
8.220 + fi
8.221 + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
8.222 + *)
8.223 + if test -z "$stripcmd"; then
8.224 + u_plus_rw=
8.225 + else
8.226 + u_plus_rw=,u+rw
8.227 + fi
8.228 + cp_umask=$mode$u_plus_rw;;
8.229 + esac
8.230 +fi
8.231 +
8.232 +for src
8.233 +do
8.234 + # Protect names starting with `-'.
8.235 + case $src in
8.236 + -*) src=./$src;;
8.237 + esac
8.238 +
8.239 + if test -n "$dir_arg"; then
8.240 + dst=$src
8.241 + dstdir=$dst
8.242 + test -d "$dstdir"
8.243 + dstdir_status=$?
8.244 + else
8.245 +
8.246 + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
8.247 + # might cause directories to be created, which would be especially bad
8.248 + # if $src (and thus $dsttmp) contains '*'.
8.249 + if test ! -f "$src" && test ! -d "$src"; then
8.250 + echo "$0: $src does not exist." >&2
8.251 + exit 1
8.252 + fi
8.253 +
8.254 + if test -z "$dst_arg"; then
8.255 + echo "$0: no destination specified." >&2
8.256 + exit 1
8.257 + fi
8.258 +
8.259 + dst=$dst_arg
8.260 + # Protect names starting with `-'.
8.261 + case $dst in
8.262 + -*) dst=./$dst;;
8.263 + esac
8.264 +
8.265 + # If destination is a directory, append the input filename; won't work
8.266 + # if double slashes aren't ignored.
8.267 + if test -d "$dst"; then
8.268 + if test -n "$no_target_directory"; then
8.269 + echo "$0: $dst_arg: Is a directory" >&2
8.270 + exit 1
8.271 + fi
8.272 + dstdir=$dst
8.273 + dst=$dstdir/`basename "$src"`
8.274 + dstdir_status=0
8.275 + else
8.276 + # Prefer dirname, but fall back on a substitute if dirname fails.
8.277 + dstdir=`
8.278 + (dirname "$dst") 2>/dev/null ||
8.279 + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
8.280 + X"$dst" : 'X\(//\)[^/]' \| \
8.281 + X"$dst" : 'X\(//\)$' \| \
8.282 + X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
8.283 + echo X"$dst" |
8.284 + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
8.285 + s//\1/
8.286 + q
8.287 + }
8.288 + /^X\(\/\/\)[^/].*/{
8.289 + s//\1/
8.290 + q
8.291 + }
8.292 + /^X\(\/\/\)$/{
8.293 + s//\1/
8.294 + q
8.295 + }
8.296 + /^X\(\/\).*/{
8.297 + s//\1/
8.298 + q
8.299 + }
8.300 + s/.*/./; q'
8.301 + `
8.302 +
8.303 + test -d "$dstdir"
8.304 + dstdir_status=$?
8.305 + fi
8.306 + fi
8.307 +
8.308 + obsolete_mkdir_used=false
8.309 +
8.310 + if test $dstdir_status != 0; then
8.311 + case $posix_mkdir in
8.312 + '')
8.313 + # Create intermediate dirs using mode 755 as modified by the umask.
8.314 + # This is like FreeBSD 'install' as of 1997-10-28.
8.315 + umask=`umask`
8.316 + case $stripcmd.$umask in
8.317 + # Optimize common cases.
8.318 + *[2367][2367]) mkdir_umask=$umask;;
8.319 + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
8.320 +
8.321 + *[0-7])
8.322 + mkdir_umask=`expr $umask + 22 \
8.323 + - $umask % 100 % 40 + $umask % 20 \
8.324 + - $umask % 10 % 4 + $umask % 2
8.325 + `;;
8.326 + *) mkdir_umask=$umask,go-w;;
8.327 + esac
8.328 +
8.329 + # With -d, create the new directory with the user-specified mode.
8.330 + # Otherwise, rely on $mkdir_umask.
8.331 + if test -n "$dir_arg"; then
8.332 + mkdir_mode=-m$mode
8.333 + else
8.334 + mkdir_mode=
8.335 + fi
8.336 +
8.337 + posix_mkdir=false
8.338 + case $umask in
8.339 + *[123567][0-7][0-7])
8.340 + # POSIX mkdir -p sets u+wx bits regardless of umask, which
8.341 + # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
8.342 + ;;
8.343 + *)
8.344 + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
8.345 + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
8.346 +
8.347 + if (umask $mkdir_umask &&
8.348 + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
8.349 + then
8.350 + if test -z "$dir_arg" || {
8.351 + # Check for POSIX incompatibilities with -m.
8.352 + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
8.353 + # other-writeable bit of parent directory when it shouldn't.
8.354 + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
8.355 + ls_ld_tmpdir=`ls -ld "$tmpdir"`
8.356 + case $ls_ld_tmpdir in
8.357 + d????-?r-*) different_mode=700;;
8.358 + d????-?--*) different_mode=755;;
8.359 + *) false;;
8.360 + esac &&
8.361 + $mkdirprog -m$different_mode -p -- "$tmpdir" && {
8.362 + ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
8.363 + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
8.364 + }
8.365 + }
8.366 + then posix_mkdir=:
8.367 + fi
8.368 + rmdir "$tmpdir/d" "$tmpdir"
8.369 + else
8.370 + # Remove any dirs left behind by ancient mkdir implementations.
8.371 + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
8.372 + fi
8.373 + trap '' 0;;
8.374 + esac;;
8.375 + esac
8.376 +
8.377 + if
8.378 + $posix_mkdir && (
8.379 + umask $mkdir_umask &&
8.380 + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
8.381 + )
8.382 + then :
8.383 + else
8.384 +
8.385 + # The umask is ridiculous, or mkdir does not conform to POSIX,
8.386 + # or it failed possibly due to a race condition. Create the
8.387 + # directory the slow way, step by step, checking for races as we go.
8.388 +
8.389 + case $dstdir in
8.390 + /*) prefix='/';;
8.391 + -*) prefix='./';;
8.392 + *) prefix='';;
8.393 + esac
8.394 +
8.395 + eval "$initialize_posix_glob"
8.396 +
8.397 + oIFS=$IFS
8.398 + IFS=/
8.399 + $posix_glob set -f
8.400 + set fnord $dstdir
8.401 + shift
8.402 + $posix_glob set +f
8.403 + IFS=$oIFS
8.404 +
8.405 + prefixes=
8.406 +
8.407 + for d
8.408 + do
8.409 + test -z "$d" && continue
8.410 +
8.411 + prefix=$prefix$d
8.412 + if test -d "$prefix"; then
8.413 + prefixes=
8.414 + else
8.415 + if $posix_mkdir; then
8.416 + (umask=$mkdir_umask &&
8.417 + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
8.418 + # Don't fail if two instances are running concurrently.
8.419 + test -d "$prefix" || exit 1
8.420 + else
8.421 + case $prefix in
8.422 + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
8.423 + *) qprefix=$prefix;;
8.424 + esac
8.425 + prefixes="$prefixes '$qprefix'"
8.426 + fi
8.427 + fi
8.428 + prefix=$prefix/
8.429 + done
8.430 +
8.431 + if test -n "$prefixes"; then
8.432 + # Don't fail if two instances are running concurrently.
8.433 + (umask $mkdir_umask &&
8.434 + eval "\$doit_exec \$mkdirprog $prefixes") ||
8.435 + test -d "$dstdir" || exit 1
8.436 + obsolete_mkdir_used=true
8.437 + fi
8.438 + fi
8.439 + fi
8.440 +
8.441 + if test -n "$dir_arg"; then
8.442 + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
8.443 + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
8.444 + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
8.445 + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
8.446 + else
8.447 +
8.448 + # Make a couple of temp file names in the proper directory.
8.449 + dsttmp=$dstdir/_inst.$$_
8.450 + rmtmp=$dstdir/_rm.$$_
8.451 +
8.452 + # Trap to clean up those temp files at exit.
8.453 + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
8.454 +
8.455 + # Copy the file name to the temp name.
8.456 + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
8.457 +
8.458 + # and set any options; do chmod last to preserve setuid bits.
8.459 + #
8.460 + # If any of these fail, we abort the whole thing. If we want to
8.461 + # ignore errors from any of these, just make sure not to ignore
8.462 + # errors from the above "$doit $cpprog $src $dsttmp" command.
8.463 + #
8.464 + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
8.465 + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
8.466 + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
8.467 + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
8.468 +
8.469 + # If -C, don't bother to copy if it wouldn't change the file.
8.470 + if $copy_on_change &&
8.471 + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
8.472 + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
8.473 +
8.474 + eval "$initialize_posix_glob" &&
8.475 + $posix_glob set -f &&
8.476 + set X $old && old=:$2:$4:$5:$6 &&
8.477 + set X $new && new=:$2:$4:$5:$6 &&
8.478 + $posix_glob set +f &&
8.479 +
8.480 + test "$old" = "$new" &&
8.481 + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
8.482 + then
8.483 + rm -f "$dsttmp"
8.484 + else
8.485 + # Rename the file to the real destination.
8.486 + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
8.487 +
8.488 + # The rename failed, perhaps because mv can't rename something else
8.489 + # to itself, or perhaps because mv is so ancient that it does not
8.490 + # support -f.
8.491 + {
8.492 + # Now remove or move aside any old file at destination location.
8.493 + # We try this two ways since rm can't unlink itself on some
8.494 + # systems and the destination file might be busy for other
8.495 + # reasons. In this case, the final cleanup might fail but the new
8.496 + # file should still install successfully.
8.497 + {
8.498 + test ! -f "$dst" ||
8.499 + $doit $rmcmd -f "$dst" 2>/dev/null ||
8.500 + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
8.501 + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
8.502 + } ||
8.503 + { echo "$0: cannot unlink or rename $dst" >&2
8.504 + (exit 1); exit 1
8.505 + }
8.506 + } &&
8.507 +
8.508 + # Now rename the file to the real destination.
8.509 + $doit $mvcmd "$dsttmp" "$dst"
8.510 + }
8.511 + fi || exit 1
8.512 +
8.513 + trap '' 0
8.514 + fi
8.515 +done
8.516 +
8.517 +# Local variables:
8.518 +# eval: (add-hook 'write-file-hooks 'time-stamp)
8.519 +# time-stamp-start: "scriptversion="
8.520 +# time-stamp-format: "%:y-%02m-%02d.%02H"
8.521 +# time-stamp-time-zone: "UTC"
8.522 +# time-stamp-end: "; # UTC"
8.523 +# End: