configure.ac
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Jan 14 18:22:06 2012 +0100 (2012-01-14)
changeset 2835 0a2fa748727e
parent 2834 0a0410dd0cb0
child 2836 1c4f3be68a6d
permissions -rw-r--r--
kconfig: install compiled frontends

The kconfig frontends are currently instaleld as source files. This is
a remnant of the early times, when I wanted a single installation of
crosstool-NG to be shared across multiple machines, potentially of
different architectures.

This does not really make sense, and it's been a long time since it
was las tpossible in practice.

So, just build the kconfig frontends at make-time, and install them
as we do for all other crosstool-NG dependent files.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.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 $1=y"],
    56         [kconfig_options="$kconfig_options $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_PROG_INSTALL
    94 AC_PROG_EGREP
    95 AC_CACHE_VAL([ac_cv_path_SED],
    96     [AC_ARG_WITH([sed],
    97         AS_HELP_STRING([--with-sed=PATH],
    98                        [Specify the full PATH to sed]),
    99         [ac_cv_path_SED=$withval])])
   100 AC_PROG_SED
   101 AC_MSG_CHECKING([whether sed understands -r -i -e])
   102 touch .ct-ng.sed.test
   103 if ${SED} -r -i -e 's/foo/bar/' .ct-ng.sed.test >/dev/null 2>&1; then
   104     rm -f .ct-ng.sed.test
   105     AC_MSG_RESULT([yes])
   106 else
   107     rm -f .ct-ng.sed.test
   108     AC_MSG_RESULT([no])
   109     AC_MSG_ERROR()
   110 fi
   111 AC_PROG_LN_S
   112 
   113 #--------------------------------------------------------------------
   114 # A bunch of boring tests...
   115 #--------------------------------------------------------------------
   116 AC_PROG_CC
   117 AS_IF([test -z "$CC"],
   118       [AC_MSG_ERROR([no suitable compiler found])])
   119 AC_PROG_CPP
   120 AC_PROG_RANLIB
   121 ACX_PATH_TOOL_REQ([OBJCOPY], [objcopy])
   122 ACX_PATH_TOOL_REQ([OBJDUMP], [objdump])
   123 ACX_PATH_TOOL_REQ([READELF], [readelf])
   124 
   125 ACX_CHECK_PROGS_REQ([bison], [bison])
   126 ACX_CHECK_PROGS_REQ([flex], [flex])
   127 ACX_CHECK_PROGS_REQ([awk], [gawk mawk nawk awk])
   128 ACX_CHECK_PROGS_REQ([makeinfo], [makeinfo])
   129 ACX_CHECK_PROGS_REQ([cut], [cut])
   130 ACX_CHECK_PROGS_REQ([stat], [stat])
   131 ACX_CHECK_PROGS_REQ([readlink], [readlink])
   132 ACX_CHECK_PROGS_REQ([curl], [curl])
   133 ACX_CHECK_PROGS_REQ([tar], [tar])
   134 ACX_CHECK_PROGS_REQ([gzip], [gzip])
   135 ACX_CHECK_PROGS_REQ([bzip2], [bzip2])
   136 
   137 #--------------------------------------------------------------------
   138 # Still boring, but remember the path, now...
   139 #--------------------------------------------------------------------
   140 ACX_PATH_PROGS_REQ([PATCH], [patch])
   141 
   142 #--------------------------------------------------------------------
   143 # And a bunch of less boring tests...
   144 #--------------------------------------------------------------------
   145 # We need a bash that is >= 3.1
   146 AC_CACHE_VAL([ac_cv_path__BASH],
   147     [AC_ARG_WITH([bash],
   148         AS_HELP_STRING([--with-bash=PATH],
   149                        [Specify the full PATH to bash >= 3.1]),
   150         [ac_cv_path__BASH=$withval])])
   151 AC_CACHE_CHECK([for bash >= 3.1], [ac_cv_path__BASH],
   152     [AC_PATH_PROGS_FEATURE_CHECK([_BASH], [bash],
   153         [[_BASH_ver=$($ac_path__BASH --version 2>&1 \
   154                      |$EGREP '^GNU bash, version (3\.[1-9]|4)')
   155           test -n "$_BASH_ver" && ac_cv_path__BASH=$ac_path__BASH ac_path__BASH_found=:]],
   156         [AC_MSG_RESULT([no])
   157          AC_MSG_ERROR([could not find bash >= 3.1])])])
   158 AC_SUBST([_BASH], [$ac_cv_path__BASH])
   159 
   160 #----------------------------------------
   161 # Check for GNU make 3.80 or above
   162 AC_CACHE_VAL([ac_cv_path_MAKE],
   163     [AC_ARG_WITH([make],
   164         AS_HELP_STRING([--with-make=PATH],
   165                        [Specify the full PATH to GNU make >= 3.80]),
   166         [ac_cv_path_MAKE=$withval])])
   167 AC_CACHE_CHECK([for GNU make >= 3.80], [ac_cv_path_MAKE],
   168     [AC_PATH_PROGS_FEATURE_CHECK([MAKE], [make gmake],
   169         [[MAKE_ver=$($ac_path_MAKE --version 2>&1 \
   170                      |$EGREP '^GNU Make (3.[89][[:digit:]]|[4-9])')
   171           test -n "$MAKE_ver" && ac_cv_path_MAKE=$ac_path_MAKE ac_path_MAKE_found=:]],
   172         [AC_MSG_RESULT([no])
   173          AC_MSG_ERROR([could not find GNU make >= 3.80])])])
   174 AC_SUBST([MAKE], [$ac_cv_path_MAKE])
   175 AC_PROG_MAKE_SET
   176 
   177 #----------------------------------------
   178 # Check for libtool >= 1.5.26
   179 AC_CACHE_VAL([ac_cv_path_LIBTOOL],
   180     [AC_ARG_WITH([libtool],
   181         AS_HELP_STRING([--with-libtool=PATH],
   182                        [Specify the full PATH to GNU libtool >= 1.5.26]),
   183         [ac_cv_path_LIBTOOL=$withval])])
   184 AC_CACHE_CHECK([for GNU libtool >= 1.5.26], [ac_cv_path_LIBTOOL],
   185     [AC_PATH_PROGS_FEATURE_CHECK([LIBTOOL], [libtool],
   186         [[LIBTOOL_ver=$($ac_path_LIBTOOL --version 2>&1 \
   187                         |$EGREP '\(GNU libtool.*\) (2[[:digit:]]*\.|1\.6[[:digit:]]*\.|1\.5\.[2-9][[:digit:]]+)')
   188           test -n "$LIBTOOL_ver" && ac_cv_path_LIBTOOL=$ac_path_LIBTOOL ac_path_LIBTOOL_found=:]],
   189         [AC_MSG_RESULT([no])
   190          AC_MSG_ERROR([could not find GNU libtool >= 1.5.26])])])
   191 AC_SUBST([LIBTOOL], [$ac_cv_path_LIBTOOL])
   192 
   193 #----------------------------------------
   194 # Check for libtoolize >= 1.5.26
   195 AC_CACHE_VAL([ac_cv_path_LIBTOOLIZE],
   196     [AC_ARG_WITH([libtoolize],
   197         AS_HELP_STRING([--with-libtoolize=PATH],
   198                        [Specify the full PATH to GNU libtoolize >= 1.5.26]),
   199         [ac_cv_path_LIBTOOLIZE=$withval])])
   200 AC_CACHE_CHECK([for GNU libtoolize >= 1.5.26], [ac_cv_path_LIBTOOLIZE],
   201     [AC_PATH_PROGS_FEATURE_CHECK([LIBTOOLIZE], [libtool],
   202         [[LIBTOOLIZE_ver=$($ac_path_LIBTOOLIZE --version 2>&1 \
   203                         |$EGREP '\(GNU libtool.*\) (2[[:digit:]]*\.|1\.6[[:digit:]]*\.|1\.5\.[2-9][[:digit:]]+)')
   204           test -n "$LIBTOOLIZE_ver" && ac_cv_path_LIBTOOLIZE=$ac_path_LIBTOOLIZE ac_path_LIBTOOLIZE_found=:]],
   205         [AC_MSG_RESULT([no])
   206          AC_MSG_ERROR([could not find GNU libtoolize >= 1.5.26])])])
   207 AC_SUBST([LIBTOOLIZE], [$ac_cv_path_LIBTOOLIZE])
   208 
   209 #----------------------------------------
   210 # Check for automake >= 1.10
   211 AC_CACHE_VAL([ac_cv_path_automake],
   212     [AC_ARG_WITH([automake],
   213         AS_HELP_STRING([--with-automake=PATH],
   214                        [Specify the full PATH to GNU automake >= 1.10]),
   215         [ac_cv_path_automake=$withval])])
   216 AC_CACHE_CHECK([for GNU automake >= 1.10], [ac_cv_path_automake],
   217     [AC_PATH_PROGS_FEATURE_CHECK([automake], [automake],
   218         [[automake_ver=$($ac_path_automake --version 2>&1 \
   219                          |$EGREP '\(GNU automake\) (1\.[[:digit:]]{2,}|[2-9][[:digit:]]*\.)')
   220           test -n "$automake_ver" && ac_cv_path_automake=$ac_path_automake ac_path_automake_found=:]],
   221         [AC_MSG_RESULT([no])
   222          AC_MSG_ERROR([could not find GNU automake >= 1.10])])])
   223 AC_SUBST([automake], [$ac_cv_path_automake])
   224 
   225 #--------------------------------------------------------------------
   226 # Boring again... But still a bit of work to do...
   227 #--------------------------------------------------------------------
   228 AC_SUBST([kconfig_options])
   229 
   230 #----------------------------------------
   231 AC_CHECK_PROGS([xz],   [xz])
   232 ACX_SET_KCONFIG_OPTION([xz])
   233 AS_IF(
   234     [test -z "$xz"],
   235     [AC_CHECK_PROGS([lzma], [lzma])])
   236 ACX_SET_KCONFIG_OPTION([lzma])
   237 
   238 #----------------------------------------
   239 AC_CHECK_PROGS([cvs], [cvs])
   240 ACX_SET_KCONFIG_OPTION([cvs])
   241 
   242 #----------------------------------------
   243 AC_CHECK_PROGS([svn], [svn])
   244 ACX_SET_KCONFIG_OPTION([svn])
   245 
   246 #--------------------------------------------------------------------
   247 # Now, for some fun...
   248 #--------------------------------------------------------------------
   249 AC_C_INLINE
   250 AC_HEADER_STDC
   251 AC_FUNC_MALLOC
   252 AC_FUNC_REALLOC
   253 AC_FUNC_ALLOCA
   254 
   255 #----------------------------------------
   256 # Check for gettext, for the kconfig frontends
   257 AC_SUBST([gettext])
   258 AC_CHECK_HEADERS(
   259     [libintl.h],
   260     [ac_ct_gettext_hdr=$ac_header; break])
   261 AS_IF(
   262     [test -n "$ac_ct_gettext_hdr"],
   263     [AC_CHECK_DECL(
   264         [gettext],gettext=y,,
   265         [#include <$ac_ct_gettext_hdr>])])
   266 
   267 #----------------------------------------
   268 # Check for ncurses, for the kconfig frontends
   269 AC_SUBST([ac_ct_curses_hdr])
   270 AC_CHECK_HEADERS(
   271     [ncurses/ncurses.h ncurses/curses.h ncursesw/curses.h ncurses.h curses.h],
   272     [ac_ct_curses_hdr=$ac_header; break])
   273 AS_IF(
   274     [test -z "$ac_ct_curses_hdr"],
   275     [AC_MSG_ERROR([could not find curses header, required for the kconfig frontends])])
   276 AC_SEARCH_LIBS(
   277     [initscr],
   278     [ncursesw ncurses curses],
   279     [ac_ct_curses_lib_found=yes; break])
   280 AS_IF(
   281     [test -z "$ac_ct_curses_lib_found"],
   282     [AC_MSG_ERROR([could not find curses library, required for the kconfig frontends])])
   283 
   284 #--------------------------------------------------------------------
   285 # Lastly, take care of crosstool-NG internal values
   286 #--------------------------------------------------------------------
   287 # Hey! We need the date! :-)
   288 AC_SUBST(
   289     [DATE],
   290     [$(date +%Y%m%d)])
   291 
   292 # Decorate the version string if needed
   293 AS_IF(
   294     [test -f version.sh -a -x version.sh],
   295     [V=$(./version.sh "${PACKAGE_VERSION}")])
   296 AS_IF(
   297     [test -n "${V}"],
   298     [PACKAGE_VERSION="${V}"],
   299     [AS_CASE(
   300         [${PACKAGE_VERSION}],
   301         [hg|*+hg],
   302         [rev_id="$( hg log -r . --template '{branch}-{node|short}\n' \
   303                            2>/dev/null                               \
   304                     || true                                          )"
   305          PACKAGE_VERSION="${PACKAGE_VERSION}@${rev_id:-unknown-$( date +%Y%m%d.%H%M%S )}"
   306         ])])
   307 # Arrange to have no / in the directory name, no need to create an
   308 # arbitrarily deep directory structure
   309 [PACKAGE_VERSION="$( printf "${PACKAGE_VERSION}\n" |"${SED}" -r -e 's:/+:_:g;' )"]
   310 
   311 # Handle the local case
   312 AC_SUBST([sublibdir])
   313 AC_SUBST([subdocdir])
   314 AS_IF(
   315     [test "x$enable_local" = "xyes"],
   316     [AC_MSG_NOTICE([overiding all of --prefix and the likes, because --enable-local was set])
   317      prefix=$(pwd)
   318      exec_prefix="$prefix"
   319      bindir="$prefix"
   320      libdir="$prefix"
   321      sublibdir=""
   322      docdir="$prefix""/docs"
   323      subdocdir=""
   324      datarootdir="$prefix"
   325      mandir="$docdir"],
   326     [sublibdir="/ct-ng.\${VERSION}"
   327      subdocdir="/ct-ng.\${VERSION}"])
   328 
   329 #--------------------------------------------------------------------
   330 # Finally, generate the output file(s)
   331 #--------------------------------------------------------------------
   332 AC_CONFIG_FILES([Makefile])
   333 AC_OUTPUT
   334 
   335 
   336 
   337 # AC_CONFIG_SRCDIR([kconfig/menu.c])
   338 # AC_CONFIG_HEADERS([config.h])
   339 # 
   340 # # Checks for programs.
   341 # 
   342 # # Checks for libraries.
   343 # 
   344 # # Checks for header files.
   345 # 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])
   346 # 
   347 # # Checks for typedefs, structures, and compiler characteristics.
   348 # AC_HEADER_STDBOOL
   349 # AC_TYPE_INT16_T
   350 # AC_TYPE_INT32_T
   351 # AC_TYPE_INT8_T
   352 # AC_TYPE_SIZE_T
   353 # AC_TYPE_UINT16_T
   354 # AC_TYPE_UINT32_T
   355 # AC_TYPE_UINT8_T
   356 # 
   357 # # Checks for library functions.
   358 # AC_FUNC_MALLOC
   359 # AC_FUNC_REALLOC
   360 # AC_CHECK_FUNCS([bzero gettimeofday memmove memset mkdir regcomp setlocale strcasecmp strchr strcspn strdup strncasecmp strpbrk strrchr strspn strtol uname])
   361 # 
   362 # AC_OUTPUT