configure.ac
author Zhenqiang Chen <zhenqiang.chen@linaro.org>
Mon Dec 30 23:15:02 2013 +0100 (2013-12-30)
changeset 3261 3b61be3d7aa6
parent 3067 3bc371c2881f
child 3280 31d303a49013
permissions -rw-r--r--
kernel/linux: prepare for arch whose kenel name is not the standard name

For some architectures, the kernel architecture name is not the common
name of the architecture for other tools.

For example: ARM 64-bit is commonly referenced as aarch64, but the kernel
calls it arm64.

Signed-off-by: Michael Hope <michael.hope@linaro.org>
Signed-off-by: Zhenqiang Chen <zhenqiang.chen@linaro.org>
[yann.morin.1998@free.fr: split out of the aarch64 patch]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
     1 #                                               -*- Autoconf -*-
     2 # Process this file with autoconf to produce a configure script.
     3 
     4 AC_PREREQ([2.67])
     5 #AC_INIT([crosstool-NG], [hg], [crossgcc@sourceware.org])
     6 AC_INIT([crosstool-NG], [m4_esyscmd_s([cat .version])], [crossgcc@sourceware.org])
     7 AC_CONFIG_AUX_DIR([scripts])
     8 
     9 #--------------------------------------------------------------------
    10 # A few helper macros
    11 
    12 # Check for required tool
    13 AC_DEFUN(
    14     [ACX_CHECK_TOOL_REQ],
    15     [AC_CHECK_TOOLS([$1], [$2])
    16      AS_IF(
    17         [test -z "$$1"],
    18         [AC_MSG_ERROR([missing required tool: $2])])
    19     ])
    20 
    21 # Check for required tool, set variable to full pathname
    22 AC_DEFUN(
    23     [ACX_PATH_TOOL_REQ],
    24     [ACX_CHECK_TOOL_REQ([$1], [$2])
    25      AS_CASE(
    26         [$$1],
    27         [/*],,
    28         [?*],[AC_MSG_CHECKING([for absolute path to $$1])
    29               $1=$(which $$1)
    30               AC_MSG_RESULT([$$1])])])
    31 
    32 # Check for required program
    33 AC_DEFUN(
    34     [ACX_CHECK_PROGS_REQ],
    35     [AC_CHECK_PROGS([$1], [$2])
    36      AS_IF(
    37         [test -z "$$1"],
    38         [AC_MSG_ERROR([missing required tool: $2])])
    39     ])
    40 
    41 # Check for path to required program
    42 AC_DEFUN(
    43     [ACX_PATH_PROGS_REQ],
    44     [AC_PATH_PROGS([$1], [$2])
    45      AS_IF(
    46         [test -z "$$1"],
    47         [AC_MSG_ERROR([missing required tool: $2])])
    48     ])
    49 
    50 # Set the kconfig option
    51 AC_DEFUN(
    52     [ACX_SET_KCONFIG_OPTION],
    53     [AS_IF(
    54         [test -n "$$1"],
    55         [kconfig_options="$kconfig_options has_$1=y"],
    56         [kconfig_options="$kconfig_options has_$1"])
    57     ])
    58 
    59 #--------------------------------------------------------------------
    60 # Allow dummy --{en,dis}able-{static,shared}
    61 AC_ARG_ENABLE(
    62     [local],
    63     [AS_HELP_STRING(
    64         [--enable-local],
    65         [don't install, and use current directory])])
    66 AC_SUBST([enable_local], [${enable_local:-no}])
    67 AC_ARG_ENABLE(
    68     [shared],
    69     [AS_HELP_STRING(
    70         [--enable-shared],
    71         [build shared libraries (default=yes) (ignored)])])
    72 AC_ARG_ENABLE(
    73     [static],
    74     [AS_HELP_STRING(
    75         [--enable-static],
    76         [build static libraries (default=yes) (ignored)])])
    77 
    78 #---------------------------------------------------------------------
    79 # Check for --build and --host...
    80 AC_CANONICAL_BUILD
    81 AC_CANONICAL_HOST
    82 # ... but refuse --target
    83 AS_IF([test -n "$target_alias"],
    84       AC_MSG_ERROR([--target is not allowed]))
    85 
    86 # Allow program name tranformation (--program-{prefix,suffix,transform-name})
    87 AC_ARG_PROGRAM
    88 
    89 #---------------------------------------------------------------------
    90 # Initial checks that are usually done first (I don't know why, that's
    91 # just what I seem to experience...)
    92 #---------------------------------------------------------------------
    93 AC_ARG_WITH([install],
    94     AS_HELP_STRING([--with-install=PATH],
    95                    [Specify the full PATH to a BSD-compatible install]),
    96     [INSTALL=$withval])
    97 AC_PROG_INSTALL
    98 AC_PROG_GREP
    99 AC_PROG_EGREP
   100 AS_IF(
   101     [test ! "$EGREP" = "$GREP -E"],
   102     [AC_MSG_ERROR([egrep is not $GREP -E])])
   103 AC_CACHE_VAL([ac_cv_path_SED],
   104     [AC_ARG_WITH([sed],
   105         AS_HELP_STRING([--with-sed=PATH],
   106                        [Specify the full PATH to GNU sed]),
   107         [ac_cv_path_SED=$withval])])
   108 AC_PROG_SED
   109 AC_MSG_CHECKING([whether sed understands -r -i -e])
   110 touch .ct-ng.sed.test
   111 if ${SED} -r -i -e 's/foo/bar/' .ct-ng.sed.test >/dev/null 2>&1; then
   112     rm -f .ct-ng.sed.test
   113     AC_MSG_RESULT([yes])
   114 else
   115     rm -f .ct-ng.sed.test
   116     AC_MSG_RESULT([no])
   117     AC_MSG_ERROR()
   118 fi
   119 AC_PROG_LN_S
   120 
   121 #--------------------------------------------------------------------
   122 # A bunch of boring tests...
   123 #--------------------------------------------------------------------
   124 AC_PROG_CC
   125 AS_IF([test -z "$CC"],
   126       [AC_MSG_ERROR([no suitable compiler found])])
   127 AC_PROG_CPP
   128 
   129 # But we still need a way to specify the PATH to GNU versions (Damn MacOS)
   130 AC_ARG_WITH([objcopy],
   131     AS_HELP_STRING([--with-objcopy=PATH],
   132                    [Specify the full PATH to GNU objcopy]),
   133     [OBJCOPY=$withval])
   134 AC_ARG_WITH([objdump],
   135     AS_HELP_STRING([--with-objdump=PATH],
   136                    [Specify the full PATH to GNU objdump]),
   137     [OBJDUMP=$withval])
   138 AC_ARG_WITH([ranlib],
   139     AS_HELP_STRING([--with-ranlib=PATH],
   140                    [Specify the full PATH to GNU ranlib]),
   141     [RANLIB=$withval])
   142 AC_ARG_WITH([readelf],
   143     AS_HELP_STRING([--with-readelf=PATH],
   144                    [Specify the full PATH to GNU readelf]),
   145     [READELF=$withval])
   146 AC_ARG_WITH([gperf],
   147     AS_HELP_STRING([--with-gperf=PATH],
   148                    [Specify the full PATH to GNU gperf]),
   149     [GPERF=$withval])
   150 
   151 AC_PROG_RANLIB
   152 ACX_PATH_TOOL_REQ([OBJCOPY], [objcopy])
   153 ACX_PATH_TOOL_REQ([OBJDUMP], [objdump])
   154 ACX_PATH_TOOL_REQ([READELF], [readelf])
   155 ACX_PATH_TOOL_REQ([GPERF], [gperf])
   156 
   157 ACX_CHECK_PROGS_REQ([bison], [bison])
   158 ACX_CHECK_PROGS_REQ([flex], [flex])
   159 ACX_CHECK_PROGS_REQ([makeinfo], [makeinfo])
   160 ACX_CHECK_PROGS_REQ([cut], [cut])
   161 ACX_CHECK_PROGS_REQ([stat], [stat])
   162 ACX_CHECK_PROGS_REQ([readlink], [readlink])
   163 ACX_CHECK_PROGS_REQ([wget], [wget])
   164 ACX_CHECK_PROGS_REQ([tar], [tar])
   165 ACX_CHECK_PROGS_REQ([gzip], [gzip])
   166 ACX_CHECK_PROGS_REQ([bzip2], [bzip2])
   167 
   168 #--------------------------------------------------------------------
   169 # Still boring, but remember the path, now...
   170 #--------------------------------------------------------------------
   171 ACX_PATH_PROGS_REQ([PATCH], [patch])
   172 
   173 #--------------------------------------------------------------------
   174 # And a bunch of less boring tests...
   175 #--------------------------------------------------------------------
   176 # We need a bash that is >= 3.1
   177 AC_CACHE_VAL([ac_cv_path__BASH],
   178     [AC_ARG_WITH([bash],
   179         AS_HELP_STRING([--with-bash=PATH],
   180                        [Specify the full PATH to GNU bash >= 3.1]),
   181         [ac_cv_path__BASH=$withval])])
   182 AC_CACHE_CHECK([for bash >= 3.1], [ac_cv_path__BASH],
   183     [AC_PATH_PROGS_FEATURE_CHECK([_BASH], [bash],
   184         [[_BASH_ver=$($ac_path__BASH --version 2>&1 \
   185                      |$EGREP '^GNU bash, version (3\.[1-9]|4)')
   186           test -n "$_BASH_ver" && ac_cv_path__BASH=$ac_path__BASH ac_path__BASH_found=:]],
   187         [AC_MSG_RESULT([no])
   188          AC_MSG_ERROR([could not find bash >= 3.1])])])
   189 AC_SUBST([_BASH], [$ac_cv_path__BASH])
   190 
   191 # We need a awk that *is* GNU awk
   192 AC_CACHE_VAL([ac_cv_path__AWK],
   193     [AC_ARG_WITH([awk],
   194         AS_HELP_STRING([--with-awk=PATH],
   195                        [Specify the full PATH to GNU awk]),
   196         [ac_cv_path__AWK=$withval])])
   197 AC_CACHE_CHECK([for GNU awk], [ac_cv_path__AWK],
   198     [AC_PATH_PROGS_FEATURE_CHECK([_AWK], [awk gawk],
   199         [[_AWK_ver=$($ac_path__AWK --version 2>&1 \
   200                      |$EGREP '^GNU Awk ')
   201           test -n "$_AWK_ver" && ac_cv_path__AWK=$ac_path__AWK ac_path__AWK_found=:]],
   202         [AC_MSG_RESULT([no])
   203          AC_MSG_ERROR([could not find GNU awk])])])
   204 AC_SUBST([_AWK], [$ac_cv_path__AWK])
   205 
   206 #----------------------------------------
   207 # Check for GNU make 3.80 or above
   208 AC_CACHE_VAL([ac_cv_path_MAKE],
   209     [AC_ARG_WITH([make],
   210         AS_HELP_STRING([--with-make=PATH],
   211                        [Specify the full PATH to GNU make >= 3.80]),
   212         [ac_cv_path_MAKE=$withval])])
   213 AC_CACHE_CHECK([for GNU make >= 3.80], [ac_cv_path_MAKE],
   214     [AC_PATH_PROGS_FEATURE_CHECK([MAKE], [make gmake],
   215         [[MAKE_ver=$($ac_path_MAKE --version 2>&1 \
   216                      |$EGREP '^GNU Make (3.[89][[:digit:]]|[4-9])')
   217           test -n "$MAKE_ver" && ac_cv_path_MAKE=$ac_path_MAKE ac_path_MAKE_found=:]],
   218         [AC_MSG_RESULT([no])
   219          AC_MSG_ERROR([could not find GNU make >= 3.80])])])
   220 AC_SUBST([MAKE], [$ac_cv_path_MAKE])
   221 AC_PROG_MAKE_SET
   222 
   223 #----------------------------------------
   224 # Check for libtool >= 1.5.26
   225 AC_CACHE_VAL([ac_cv_path_LIBTOOL],
   226     [AC_ARG_WITH([libtool],
   227         AS_HELP_STRING([--with-libtool=PATH],
   228                        [Specify the full PATH to GNU libtool >= 1.5.26]),
   229         [ac_cv_path_LIBTOOL=$withval])])
   230 AC_CACHE_CHECK([for GNU libtool >= 1.5.26], [ac_cv_path_LIBTOOL],
   231     [AC_PATH_PROGS_FEATURE_CHECK([LIBTOOL], [libtool],
   232         [[LIBTOOL_ver=$($ac_path_LIBTOOL --version 2>&1 \
   233                         |$EGREP '\(GNU libtool.*\) (2[[:digit:]]*\.|1\.6[[:digit:]]*\.|1\.5\.[2-9][[:digit:]]+)')
   234           test -n "$LIBTOOL_ver" && ac_cv_path_LIBTOOL=$ac_path_LIBTOOL ac_path_LIBTOOL_found=:]],
   235         [AC_MSG_RESULT([no])
   236          AC_MSG_ERROR([could not find GNU libtool >= 1.5.26])])])
   237 AC_SUBST([LIBTOOL], [$ac_cv_path_LIBTOOL])
   238 
   239 #----------------------------------------
   240 # Check for libtoolize >= 1.5.26
   241 AC_CACHE_VAL([ac_cv_path_LIBTOOLIZE],
   242     [AC_ARG_WITH([libtoolize],
   243         AS_HELP_STRING([--with-libtoolize=PATH],
   244                        [Specify the full PATH to GNU libtoolize >= 1.5.26]),
   245         [ac_cv_path_LIBTOOLIZE=$withval])])
   246 AC_CACHE_CHECK([for GNU libtoolize >= 1.5.26], [ac_cv_path_LIBTOOLIZE],
   247     [AC_PATH_PROGS_FEATURE_CHECK([LIBTOOLIZE], [libtoolize],
   248         [[LIBTOOLIZE_ver=$($ac_path_LIBTOOLIZE --version 2>&1 \
   249                         |$EGREP '\(GNU libtool.*\) (2[[:digit:]]*\.|1\.6[[:digit:]]*\.|1\.5\.[2-9][[:digit:]]+)')
   250           test -n "$LIBTOOLIZE_ver" && ac_cv_path_LIBTOOLIZE=$ac_path_LIBTOOLIZE ac_path_LIBTOOLIZE_found=:]],
   251         [AC_MSG_RESULT([no])
   252          AC_MSG_ERROR([could not find GNU libtoolize >= 1.5.26])])])
   253 AC_SUBST([LIBTOOLIZE], [$ac_cv_path_LIBTOOLIZE])
   254 
   255 #----------------------------------------
   256 # Check for automake >= 1.10
   257 AC_CACHE_VAL([ac_cv_path_automake],
   258     [AC_ARG_WITH([automake],
   259         AS_HELP_STRING([--with-automake=PATH],
   260                        [Specify the full PATH to GNU automake >= 1.10]),
   261         [ac_cv_path_automake=$withval])])
   262 AC_CACHE_CHECK([for GNU automake >= 1.10], [ac_cv_path_automake],
   263     [AC_PATH_PROGS_FEATURE_CHECK([automake], [automake],
   264         [[automake_ver=$($ac_path_automake --version 2>&1 \
   265                          |$EGREP '\(GNU automake\) (1\.[[:digit:]]{2,}|[2-9][[:digit:]]*\.)')
   266           test -n "$automake_ver" && ac_cv_path_automake=$ac_path_automake ac_path_automake_found=:]],
   267         [AC_MSG_RESULT([no])
   268          AC_MSG_ERROR([could not find GNU automake >= 1.10])])])
   269 AC_SUBST([automake], [$ac_cv_path_automake])
   270 
   271 #--------------------------------------------------------------------
   272 # Boring again... But still a bit of work to do...
   273 #--------------------------------------------------------------------
   274 AC_SUBST([kconfig_options])
   275 
   276 #----------------------------------------
   277 AC_CHECK_PROGS([xz],   [xz])
   278 ACX_SET_KCONFIG_OPTION([xz])
   279 AS_IF(
   280     [test -z "$xz"],
   281     [AC_CHECK_PROGS([lzma], [lzma])])
   282 ACX_SET_KCONFIG_OPTION([lzma])
   283 
   284 #----------------------------------------
   285 AC_CHECK_PROGS([cvs], [cvs])
   286 ACX_SET_KCONFIG_OPTION([cvs])
   287 
   288 #----------------------------------------
   289 AC_CHECK_PROGS([svn], [svn])
   290 ACX_SET_KCONFIG_OPTION([svn])
   291 
   292 #--------------------------------------------------------------------
   293 # Now, for some fun...
   294 #--------------------------------------------------------------------
   295 AC_C_INLINE
   296 AC_HEADER_STDC
   297 AC_FUNC_MALLOC
   298 AC_FUNC_REALLOC
   299 AC_FUNC_ALLOCA
   300 
   301 #----------------------------------------
   302 # Check for gettext, for the kconfig frontends
   303 AC_SUBST([gettext])
   304 AC_CHECK_HEADERS(
   305     [libintl.h],
   306     [ac_ct_gettext_hdr=$ac_header; break])
   307 AS_IF(
   308     [test -n "$ac_ct_gettext_hdr"],
   309     [AC_CHECK_DECL(
   310         [gettext],
   311         [gettext=y],,
   312         [AC_INCLUDES_DEFAULT()
   313          #include <$ac_ct_gettext_hdr>])])
   314 
   315 #----------------------------------------
   316 # Check for ncurses, for the kconfig frontends
   317 AC_SUBST([ac_ct_curses_hdr])
   318 AC_CHECK_HEADERS(
   319     [ncurses/ncurses.h ncurses/curses.h ncursesw/curses.h ncurses.h curses.h],
   320     [ac_ct_curses_hdr=$ac_header; break])
   321 AS_IF(
   322     [test -z "$ac_ct_curses_hdr"],
   323     [AC_MSG_ERROR([could not find curses header, required for the kconfig frontends])])
   324 AC_SEARCH_LIBS(
   325     [initscr],
   326     [ncursesw ncurses curses],
   327     [ac_ct_curses_lib_found=yes; break])
   328 AS_IF(
   329     [test -z "$ac_ct_curses_lib_found"],
   330     [AC_MSG_ERROR([could not find curses library, required for the kconfig frontends])])
   331 
   332 #--------------------------------------------------------------------
   333 # Lastly, take care of crosstool-NG internal values
   334 #--------------------------------------------------------------------
   335 # Hey! We need the date! :-)
   336 AC_SUBST(
   337     [DATE],
   338     [$(date +%Y%m%d)])
   339 
   340 # Decorate the version string if needed
   341 AS_IF(
   342     [test -f version.sh -a -x version.sh],
   343     [V=$(./version.sh "${PACKAGE_VERSION}")])
   344 AS_IF(
   345     [test -n "${V}"],
   346     [PACKAGE_VERSION="${V}"],
   347     [AS_CASE(
   348         [${PACKAGE_VERSION}],
   349         [hg|*+hg],
   350         [rev_id="$( hg log -r . --template '{branch}-{node|short}\n' \
   351                            2>/dev/null                               \
   352                     || true                                          )"
   353          PACKAGE_VERSION="${PACKAGE_VERSION}+${rev_id:-unknown-$( date +%Y%m%d.%H%M%S )}"
   354         ])])
   355 # Arrange to have no / in the directory name, no need to create an
   356 # arbitrarily deep directory structure
   357 [PACKAGE_VERSION="$( printf "${PACKAGE_VERSION}\n" |"${SED}" -r -e 's:/+:_:g;' )"]
   358 
   359 # Handle the local case
   360 AC_SUBST([sublibdir])
   361 AC_SUBST([subdocdir])
   362 AS_IF(
   363     [test "x$enable_local" = "xyes"],
   364     [AC_MSG_NOTICE([overiding all of --prefix and the likes, because --enable-local was set])
   365      prefix=$(pwd)
   366      exec_prefix="$prefix"
   367      bindir="$prefix"
   368      libdir="$prefix"
   369      sublibdir=""
   370      docdir="$prefix""/docs"
   371      subdocdir=""
   372      datarootdir="$prefix"
   373      mandir="$docdir"],
   374     [sublibdir="/ct-ng.\${VERSION}"
   375      subdocdir="/ct-ng.\${VERSION}"])
   376 
   377 #--------------------------------------------------------------------
   378 # Finally, generate the output file(s)
   379 #--------------------------------------------------------------------
   380 AC_CONFIG_FILES([Makefile])
   381 AC_OUTPUT