configure.ac
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jan 15 01:04:26 2012 +0100 (2012-01-15)
changeset 2836 1c4f3be68a6d
parent 2835 0a2fa748727e
child 2839 8e8313e40f8a
permissions -rw-r--r--
kconfig: add missing files

The real sources for a few files are the lex/yacc/gperf
files, and the C files are only generated...

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