Replace copyreloc-main.c with copyreloc-main.S
[platform/upstream/binutils.git] / gdb / acx_configure_dir.m4
1 # Copyright (C) 1992-2014 Free Software Foundation, Inc.
2 #
3 # This file is free software; the Free Software Foundation gives
4 # unlimited permission to copy and/or distribute it, with or without
5 # modifications, as long as this notice is preserved.
6
7 # ACX_CONFIGURE_DIR(SRC-DIR-NAME, BUILD-DIR-NAME)
8 # ---------------------------
9 #
10 # Configure a subdirectory.  This is an alternative to
11 # AC_CONFIG_SUBDIRS that allows pointing the source directory
12 # somewhere else.  The build directory is always a subdirectory of the
13 # top build directory.  This is heavilly based on Autoconf 2.64's
14 # _AC_OUTPUT_SUBDIRS.
15 #
16 # Inputs:
17 #   - SRC-DIR-NAME is the source directory, relative to $srcdir.
18 #   - BUILD-DIR-NAME is `top-build -> build'
19
20 AC_DEFUN([ACX_CONFIGURE_DIR],
21 [
22   in_src=$1
23   in_build=$2
24
25   # Remove --cache-file, --srcdir, and --disable-option-checking arguments
26   # so they do not pile up.
27   ac_sub_configure_args=
28   ac_prev=
29   eval "set x $ac_configure_args"
30   shift
31   for ac_arg
32   do
33     if test -n "$ac_prev"; then
34       ac_prev=
35       continue
36     fi
37     case $ac_arg in
38     -cache-file | --cache-file | --cache-fil | --cache-fi \
39     | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
40       ac_prev=cache_file ;;
41     -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
42     | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* \
43     | --c=*)
44       ;;
45     --config-cache | -C)
46       ;;
47     -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
48       ac_prev=srcdir ;;
49     -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
50       ;;
51     -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
52       ac_prev=prefix ;;
53     -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
54       ;;
55     --disable-option-checking)
56       ;;
57     *)
58       case $ac_arg in
59       *\'*) ac_arg=`AS_ECHO(["$ac_arg"]) | sed "s/'/'\\\\\\\\''/g"` ;;
60       esac
61       AS_VAR_APPEND([ac_sub_configure_args], [" '$ac_arg'"]) ;;
62     esac
63   done
64
65   # Always prepend --prefix to ensure using the same prefix
66   # in subdir configurations.
67   ac_arg="--prefix=$prefix"
68   case $ac_arg in
69   *\'*) ac_arg=`AS_ECHO(["$ac_arg"]) | sed "s/'/'\\\\\\\\''/g"` ;;
70   esac
71   ac_sub_configure_args="'$ac_arg' $ac_sub_configure_args"
72
73   # Pass --silent
74   if test "$silent" = yes; then
75     ac_sub_configure_args="--silent $ac_sub_configure_args"
76   fi
77
78   # Always prepend --disable-option-checking to silence warnings, since
79   # different subdirs can have different --enable and --with options.
80   ac_sub_configure_args="--disable-option-checking $ac_sub_configure_args"
81
82   ac_popdir=`pwd`
83   ac_dir=$in_build
84
85   ac_msg="=== configuring in $ac_dir (`pwd`/$ac_dir)"
86   _AS_ECHO_LOG([$ac_msg])
87   _AS_ECHO([$ac_msg])
88   AS_MKDIR_P(["$ac_dir"])
89
90   case $srcdir in
91   [[\\/]]* | ?:[[\\/]]* )
92     ac_srcdir=$srcdir/$in_src ;;
93   *) # Relative name.
94     ac_srcdir=../$srcdir/$in_src ;;
95   esac
96
97   cd "$ac_dir"
98
99   ac_sub_configure=$ac_srcdir/configure
100
101   # Make the cache file name correct relative to the subdirectory.
102   case $cache_file in
103   [[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;;
104   *) # Relative name.
105     ac_sub_cache_file=$ac_top_build_prefix$cache_file ;;
106   esac
107
108   AC_MSG_NOTICE([running $SHELL $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_srcdir])
109   # The eval makes quoting arguments work.
110   eval "\$SHELL \"\$ac_sub_configure\" $ac_sub_configure_args \
111        --cache-file=\"\$ac_sub_cache_file\" --srcdir=\"\$ac_srcdir\"" ||
112     AC_MSG_ERROR([$ac_sub_configure failed for $ac_dir])
113
114   cd "$ac_popdir"
115 ])# ACX_CONFIGURE_DIR