configure: handle --program-prefix
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Wed Aug 17 23:05:01 2011 +0200 (2011-08-17)
changeset 262100853d565edf
parent 2620 d9c5b3b75864
child 2622 bc9f7c29311e
configure: handle --program-prefix

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
.hgignore
Makefile.in
configure
ct-ng.in
docs/ct-ng.1.in
     1.1 --- a/.hgignore	Fri Aug 19 22:53:48 2011 +0200
     1.2 +++ b/.hgignore	Wed Aug 17 23:05:01 2011 +0200
     1.3 @@ -2,9 +2,9 @@
     1.4  
     1.5  # Generated files
     1.6  Makefile
     1.7 -ct-ng
     1.8 -docs/ct-ng.1
     1.9 -docs/ct-ng.1.gz
    1.10 +*ct-ng
    1.11 +docs/*ct-ng.1
    1.12 +docs/*ct-ng.1.gz
    1.13  paths.mk
    1.14  scripts/crosstool-NG.sh
    1.15  scripts/saveSample.sh
     2.1 --- a/Makefile.in	Fri Aug 19 22:53:48 2011 +0200
     2.2 +++ b/Makefile.in	Wed Aug 17 23:05:01 2011 +0200
     2.3 @@ -43,6 +43,7 @@
     2.4  LIBDIR := @@LIBDIR@@
     2.5  DOCDIR := @@DOCDIR@@
     2.6  MANDIR := @@MANDIR@@
     2.7 +PROG_PFX:=@@PROG_PFX@@
     2.8  DATE   := @@DATE@@
     2.9  LOCAL  := @@LOCAL@@
    2.10  
    2.11 @@ -66,7 +67,7 @@
    2.12  MAN_SECTION := 1
    2.13  MAN_SUBDIR := /man$(MAN_SECTION)
    2.14  
    2.15 -PROG_NAME := ct-ng
    2.16 +PROG_NAME := $(PROG_PFX)ct-ng
    2.17  
    2.18  ###############################################################################
    2.19  # Sanity checks
    2.20 @@ -141,17 +142,26 @@
    2.21  	@echo "  GZIP   '$@'"
    2.22  	@gzip -c9 $< >$@
    2.23  
    2.24 +define sed_it
    2.25 +	@echo "  SED    '$@'"
    2.26 +	@$(sed) -r -e 's,@@CT_BINDIR@@,$(BINDIR),g;'        \
    2.27 +	           -e 's,@@CT_LIBDIR@@,$(LIBDIR),g;'        \
    2.28 +	           -e 's,@@CT_DOCDIR@@,$(DOCDIR),g;'        \
    2.29 +	           -e 's,@@CT_MANDIR@@,$(MANDIR),g;'        \
    2.30 +	           -e 's,@@CT_PROG_PFX@@,$(PROG_PFX),g;'    \
    2.31 +	           -e 's,@@CT_PROG_NAME@@,$(PROG_NAME),g;'  \
    2.32 +	           -e 's,@@CT_VERSION@@,$(VERSION),g;'	    \
    2.33 +	           -e 's,@@CT_DATE@@,$(DATE),g;'            \
    2.34 +	           -e 's,@@CT_make@@,$(make),g;'            \
    2.35 +	           -e 's,@@CT_bash@@,$(bash),g;'            \
    2.36 +	           $< >$@
    2.37 +endef
    2.38 +
    2.39 +$(PROG_PFX)%: %.in Makefile
    2.40 +	$(call sed_it)
    2.41 +
    2.42  %: %.in Makefile
    2.43 -	@echo "  SED    '$@'"
    2.44 -	@$(sed) -r -e 's,@@CT_BINDIR@@,$(BINDIR),g;'    \
    2.45 -	           -e 's,@@CT_LIBDIR@@,$(LIBDIR),g;'    \
    2.46 -	           -e 's,@@CT_DOCDIR@@,$(DOCDIR),g;'    \
    2.47 -	           -e 's,@@CT_MANDIR@@,$(MANDIR),g;'    \
    2.48 -	           -e 's,@@CT_VERSION@@,$(VERSION),g;'	\
    2.49 -	           -e 's,@@CT_DATE@@,$(DATE),g;'        \
    2.50 -	           -e 's,@@CT_make@@,$(make),g;'        \
    2.51 -	           -e 's,@@CT_bash@@,$(bash),g;'        \
    2.52 -	           $@.in >$@
    2.53 +	$(call sed_it)
    2.54  
    2.55  # We create a script fragment that is parseable from inside a Makefile,
    2.56  # but also from inside a shell script, hence the reason why we don't
     3.1 --- a/configure	Fri Aug 19 22:53:48 2011 +0200
     3.2 +++ b/configure	Wed Aug 17 23:05:01 2011 +0200
     3.3 @@ -11,6 +11,7 @@
     3.4  LIBDIR_set=
     3.5  DOCDIR_set=
     3.6  MANDIR_set=
     3.7 +PROG_PFX=
     3.8  LOCAL_set=
     3.9  FORCE=
    3.10  
    3.11 @@ -60,6 +61,9 @@
    3.12      MANDIR_set=1
    3.13      MANDIR="$( get_optval "$1" "$2" )"
    3.14  }
    3.15 +set_program_prefix() {
    3.16 +    PROG_PFX="$( get_optval "$1" "$2" )"
    3.17 +}
    3.18  set_tool() {
    3.19      local var_name="${1%%=*}"
    3.20      var_name="${var_name#--with-}"
    3.21 @@ -330,7 +334,6 @@
    3.22  
    3.23  Program names:
    3.24    --program-prefix=PREFIX            prepend PREFIX to installed program names
    3.25 -                                     (ignored)
    3.26  
    3.27  System types:
    3.28    --build=BUILD     configure for building on BUILD [guessed] (ignored)
    3.29 @@ -362,14 +365,15 @@
    3.30          --docdir*)  set_docdir "$1" "$2" && shift || shift 2;;
    3.31          --mandir*)  set_mandir "$1" "$2" && shift || shift 2;;
    3.32          --with-*)   set_tool   "$1" "$2" && shift || shift 2;;
    3.33 +        --program-prefix=*|--program-prefix)
    3.34 +                    set_program_prefix "$1" "$2" && shift || shift 2
    3.35 +                    ;;
    3.36          --force)    FORCE=1; shift;;
    3.37          --help|-h)  do_help; exit 0;;
    3.38          # Skip, auto-stuff compatibility
    3.39          --build=*|--host=*|--infodir=*|--datadir=*|--sysconfdir=*|--localstatedir=*) shift;;
    3.40          --build|--host|--infodir|--datadir|--sysconfdir|--localstatedir)             shift 2;;
    3.41          --enable-shared|--disable-shared|--enable-static|--disable-static)           shift;;
    3.42 -        --program-prefix=*)                                                          shift;;
    3.43 -        --program-prefix)                                                            shift 2;;
    3.44          *)          printf "Unrecognised option: '${1}'\n"; do_help; exit 1;;
    3.45      esac
    3.46  done
    3.47 @@ -384,6 +388,7 @@
    3.48      set_libdir "" "$( pwd )"
    3.49      set_docdir "" "$( pwd )/docs"
    3.50      set_mandir "" "$( pwd )/docs"
    3.51 +    set_program_prefix "" ""
    3.52  fi
    3.53  
    3.54  #---------------------------------------------------------------------
    3.55 @@ -624,9 +629,12 @@
    3.56      eval v='"${'"${var}"'}"'
    3.57      case "${v}" in
    3.58          /*) ;;
    3.59 -        *)  do_error "'${var}' is not an absolute path: '${v}'"
    3.60 +        *)  do_error "'${var}' is not an absolute path: '${v}'";;
    3.61      esac
    3.62  done
    3.63 +case "${PROG_PFX}" in
    3.64 +    */*)    do_error "program prefix '${PROG_PFX}' contains a '/'";;
    3.65 +esac
    3.66  
    3.67  #---------------------------------------------------------------------
    3.68  # That's all, folks!
    3.69 @@ -644,6 +652,7 @@
    3.70              -e "s,@@LIBDIR@@,${LIBDIR},g"       \
    3.71              -e "s,@@DOCDIR@@,${DOCDIR},g"       \
    3.72              -e "s,@@MANDIR@@,${MANDIR},g"       \
    3.73 +            -e "s,@@PROG_PFX@@,${PROG_PFX},g"   \
    3.74              -e "s,@@VERSION@@,${VERSION},g"     \
    3.75              -e "s,@@DATE@@,${DATE},g"           \
    3.76              -e "s,@@LOCAL@@,${LOCAL_set},g"     \
    3.77 @@ -661,6 +670,7 @@
    3.78    LIBDIR='${LIBDIR}'
    3.79    DOCDIR='${DOCDIR}'
    3.80    MANDIR='${MANDIR}'
    3.81 +  PROG_PFX='${PROG_PFX}'
    3.82  
    3.83  Now run:
    3.84    make
     4.1 --- a/ct-ng.in	Fri Aug 19 22:53:48 2011 +0200
     4.2 +++ b/ct-ng.in	Wed Aug 17 23:05:01 2011 +0200
     4.3 @@ -101,7 +101,7 @@
     4.4  	@echo  'Use action "menuconfig" to configure your toolchain'
     4.5  	@echo  'Use action "build" to build your toolchain'
     4.6  	@echo  'Use action "version" to see the version'
     4.7 -	@echo  'See "man 1 ct-ng" for some help as well'
     4.8 +	@echo  'See "man 1 $(notdir $(CT_NG))" for some help as well'
     4.9  
    4.10  help-build::
    4.11  	@echo  '  build[.#]          - Build the currently configured toolchain'
     5.1 --- a/docs/ct-ng.1.in	Fri Aug 19 22:53:48 2011 +0200
     5.2 +++ b/docs/ct-ng.1.in	Wed Aug 17 23:05:01 2011 +0200
     5.3 @@ -9,11 +9,11 @@
     5.4  ."
     5.5  ."
     5.6  .SH NAME
     5.7 -ct-ng, crosstool-NG \- Build cross-toolchains
     5.8 +@@CT_PROG_NAME@@, crosstool-NG \- Build cross-toolchains
     5.9  ."
    5.10  ."
    5.11  .SH SYNOPSIS
    5.12 -.B ct-ng ACTION
    5.13 +.B @@CT_PROG_NAME@@ ACTION
    5.14  ."
    5.15  ."
    5.16  .SH DESCRIPTION
    5.17 @@ -56,7 +56,7 @@
    5.18  .I `pwd`/samples/${CT_TARGET}/
    5.19  
    5.20  Samples can be later recalled by calling
    5.21 -.B ct-ng
    5.22 +.B @@CT_PROG_NAME@@
    5.23  with the target tuple they represent.
    5.24  ."
    5.25  .TP
    5.26 @@ -112,7 +112,7 @@
    5.27  ."
    5.28  .SH EXIT VALUE
    5.29  The
    5.30 -.B ct-ng
    5.31 +.B @@CT_PROG_NAME@@
    5.32  frontend is in fact a
    5.33  .BR make (1)
    5.34  script. See the man page for