Blame aclocal.m4

Packit 6c4009
dnl We require that everyone use exactly the same Autoconf version so that
Packit 6c4009
dnl the internal functions defined and used by the main configure script
Packit 6c4009
dnl match those expected by the fragments.  When changing this version,
Packit 6c4009
dnl install.texi also needs to be updated.
Packit 6c4009
m4_define([GLIBC_AUTOCONF_VERSION], [2.69])
Packit 6c4009
m4_if(m4_defn([AC_AUTOCONF_VERSION]), GLIBC_AUTOCONF_VERSION, [],
Packit 6c4009
      [m4_fatal(m4_flatten(
Packit 6c4009
Exactly version GLIBC_AUTOCONF_VERSION of Autoconf is required but you have
Packit 6c4009
m4_defn([AC_AUTOCONF_VERSION])
Packit 6c4009
), [63])])dnl
Packit 6c4009
dnl
Packit 6c4009
dnl We define the macro GLIBC_PROVIDES to do an AC_PROVIDE for each macro
Packit 6c4009
dnl which appears in configure.ac before the sysdep configure scripts are run.
Packit 6c4009
dnl Each sysdep configure.ac does GLIBC_PROVIDES first, to avoid any
Packit 6c4009
dnl AC_REQUIREs or AC_BEFOREs duplicating their code.
Packit 6c4009
dnl
Packit 6c4009
define([GLIBC_PROVIDES], [dnl
Packit 6c4009
AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
Packit 6c4009
AC_PROVIDE([AC_CONFIG_SUBDIRS])dnl
Packit 6c4009
AC_PROVIDE([_AS_ECHO_N_PREPARE])dnl
Packit 6c4009
AC_PROVIDE([_AS_ECHO_PREPARE])dnl
Packit 6c4009
AC_PROVIDE([_AS_CR_PREPARE])dnl
Packit 6c4009
AC_PROVIDE([_AS_TR_SH_PREPARE])dnl
Packit 6c4009
AC_PROVIDE([_AS_VAR_ARITH_PREPARE])dnl
Packit 6c4009
AC_PROVIDE([AC_PROG_INSTALL])dnl
Packit 6c4009
AC_PROVIDE([AC_PROG_CC])dnl
Packit 6c4009
AC_PROVIDE([AC_PROG_CPP])dnl
Packit 6c4009
AC_PROVIDE([_AS_PATH_SEPARATOR_PREPARE])dnl
Packit 6c4009
AC_PROVIDE([_AS_TEST_PREPARE])dnl
Packit 6c4009
AC_PROVIDE([_AS_BASENAME_PREPARE])dnl
Packit 6c4009
AC_PROVIDE([_AS_ME_PREPARE])dnl
Packit 6c4009
AC_PROVIDE([_AS_LINENO_PREPARE])dnl
Packit 6c4009
AC_PROVIDE([AS_SHELL_FN_as_fn_set_status])dnl
Packit 6c4009
AC_PROVIDE([AS_SHELL_FN_as_fn_exit])dnl
Packit 6c4009
AC_PROVIDE([AS_SHELL_FN_as_fn_arith])dnl
Packit 6c4009
AC_PROVIDE([AS_SHELL_FN_ac_fn_c_try_compile])dnl
Packit 6c4009
define([AS_MESSAGE_LOG_FD],5)dnl
Packit 6c4009
define([AS_MESSAGE_FD],6)dnl
Packit 6c4009
dnl Ripped out of AS_INIT, which does more cruft we do not want.
Packit 6c4009
m4_wrap([m4_divert_pop([BODY])[]])
Packit 6c4009
m4_divert_push([BODY])[]dnl
Packit 6c4009
dnl End of ripped out of AS_INIT.
Packit 6c4009
# This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
Packit 6c4009
define([_AC_LANG], [C])dnl
Packit 6c4009
])dnl
Packit 6c4009
dnl
Packit 6c4009
dnl Check for a symbol
Packit 6c4009
dnl
Packit 6c4009
AC_DEFUN([AC_CHECK_SYMBOL], [dnl
Packit 6c4009
AC_MSG_CHECKING(for $1)
Packit 6c4009
AC_CACHE_VAL(ac_cv_check_symbol_$1, [dnl
Packit 6c4009
AC_TRY_LINK(,
Packit 6c4009
changequote(,)dnl
Packit 6c4009
extern char *$1[]; puts(*$1);,
Packit 6c4009
changequote([,])dnl
Packit 6c4009
	    ac_cv_check_symbol_$1=yes, ac_cv_check_symbol_$1=no)])
Packit 6c4009
if test "$ac_cv_check_symbol_$1" = yes; then
Packit 6c4009
changequote(,)dnl
Packit 6c4009
  ac_tr_symbol=`echo $1 | tr '[a-z]' '[A-Z]'`
Packit 6c4009
changequote([,])dnl
Packit 6c4009
  AC_DEFINE_UNQUOTED(HAVE_${ac_tr_symbol})
Packit 6c4009
fi
Packit 6c4009
AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl
Packit 6c4009
dnl
Packit 6c4009
Packit 6c4009
dnl Locate a program and check that its version is acceptable.
Packit 6c4009
dnl AC_PROG_CHECK_VER(var, namelist, version-switch,
Packit 6c4009
dnl 		      [version-extract-regexp], version-glob [, do-if-fail])
Packit 6c4009
AC_DEFUN([AC_CHECK_PROG_VER],
Packit 6c4009
[AC_CHECK_PROGS([$1], [$2])
Packit 6c4009
if test -z "[$]$1"; then
Packit 6c4009
  ac_verc_fail=yes
Packit 6c4009
else
Packit 6c4009
  # Found it, now check the version.
Packit 6c4009
  AC_MSG_CHECKING([version of [$]$1])
Packit 6c4009
changequote(<<,>>)dnl
Packit 6c4009
  ac_prog_version=`<<$>>$1 $3 2>&1 ifelse(<<$4>>,,,
Packit 6c4009
		   <<| sed -n 's/^.*patsubst(<<$4>>,/,\/).*$/\1/p'>>)`
Packit 6c4009
  case $ac_prog_version in
Packit 6c4009
    '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
Packit 6c4009
    <<$5>>)
Packit 6c4009
changequote([,])dnl
Packit 6c4009
       ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
Packit 6c4009
    *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
Packit 6c4009
Packit 6c4009
  esac
Packit 6c4009
  AC_MSG_RESULT([$ac_prog_version])
Packit 6c4009
fi
Packit 6c4009
ifelse([$6],,,
Packit 6c4009
[if test $ac_verc_fail = yes; then
Packit 6c4009
  $6
Packit 6c4009
fi])
Packit 6c4009
])
Packit 6c4009
Packit 6c4009
dnl These modifications are to allow for an empty cross compiler tree.
Packit 6c4009
define([_AC_COMPILER_EXEEXT], [EXEEXT=
Packit 6c4009
])
Packit 6c4009
Packit 6c4009
AC_DEFUN([LIBC_PROG_FOO_GNU],
Packit 6c4009
[# Most GNU programs take a -v and spit out some text including
Packit 6c4009
# the word 'GNU'.  Some try to read stdin, so give them /dev/null.
Packit 6c4009
if $1 -o conftest -v </dev/null 2>&1 | grep GNU > /dev/null 2>&1; then
Packit 6c4009
  $2
Packit 6c4009
else
Packit 6c4009
  $3
Packit 6c4009
fi
Packit 6c4009
rm -fr contest*])
Packit 6c4009
Packit 6c4009
AC_DEFUN([LIBC_PROG_BINUTILS],
Packit 6c4009
[# Was a --with-binutils option given?
Packit 6c4009
if test -n "$path_binutils"; then
Packit 6c4009
    # Make absolute; ensure a single trailing slash.
Packit 6c4009
    path_binutils=`(cd $path_binutils; pwd) | sed 's%/*$%/%'`
Packit 6c4009
    CC="$CC -B$path_binutils"
Packit 6c4009
fi
Packit 6c4009
AS=`$CC -print-prog-name=as`
Packit 6c4009
LD=`$CC -print-prog-name=ld`
Packit 6c4009
AR=`$CC -print-prog-name=ar`
Packit 6c4009
AC_SUBST(AR)
Packit 6c4009
OBJDUMP=`$CC -print-prog-name=objdump`
Packit 6c4009
AC_SUBST(OBJDUMP)
Packit 6c4009
OBJCOPY=`$CC -print-prog-name=objcopy`
Packit 6c4009
AC_SUBST(OBJCOPY)
Packit 6c4009
GPROF=`$CC -print-prog-name=gprof`
Packit 6c4009
AC_SUBST(GPROF)
Packit 6c4009
Packit 6c4009
# Determine whether we are using GNU binutils.
Packit 6c4009
AC_CACHE_CHECK(whether $AS is GNU as, libc_cv_prog_as_gnu,
Packit 6c4009
[LIBC_PROG_FOO_GNU($AS, libc_cv_prog_as_gnu=yes, libc_cv_prog_as_gnu=no)])
Packit 6c4009
rm -f a.out
Packit 6c4009
gnu_as=$libc_cv_prog_as_gnu
Packit 6c4009
Packit 6c4009
AC_CACHE_CHECK(whether $LD is GNU ld, libc_cv_prog_ld_gnu,
Packit 6c4009
[LIBC_PROG_FOO_GNU($LD, libc_cv_prog_ld_gnu=yes, libc_cv_prog_ld_gnu=no)])
Packit 6c4009
gnu_ld=$libc_cv_prog_ld_gnu
Packit 6c4009
])
Packit 6c4009
Packit 6c4009
dnl Run a static link test with -nostdlib -nostartfiles.
Packit 6c4009
dnl LIBC_TRY_LINK_STATIC([code], [action-if-true], [action-if-false])
Packit 6c4009
AC_DEFUN([LIBC_TRY_LINK_STATIC],
Packit 6c4009
[cat > conftest.c <
Packit 6c4009
int _start (void) { return 0; }
Packit 6c4009
int __start (void) { return 0; }
Packit 6c4009
$1
Packit 6c4009
EOF
Packit 6c4009
AS_IF([AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp -o conftest
Packit 6c4009
		       conftest.c -static -nostartfiles -nostdlib
Packit 6c4009
		       1>&AS_MESSAGE_LOG_FD])],
Packit 6c4009
      [$2], [$3])
Packit 6c4009
rm -f conftest*])
Packit 6c4009
Packit 6c4009
dnl Test a compiler option or options with an empty input file.
Packit 6c4009
dnl LIBC_TRY_CC_OPTION([options], [action-if-true], [action-if-false])
Packit 6c4009
AC_DEFUN([LIBC_TRY_CC_OPTION],
Packit 6c4009
[AS_IF([AC_TRY_COMMAND([${CC-cc} $1 -xc /dev/null -S -o /dev/null])],
Packit 6c4009
	[$2], [$3])])
Packit 6c4009
Packit 6c4009
dnl Find and source sysdeps/*/preconfigure.
Packit 6c4009
dnl LIBC_PRECONFIGURE([$srcdir], [for])
Packit 6c4009
AC_DEFUN([LIBC_PRECONFIGURE], [dnl
Packit 6c4009
if frags=`ls -d $1/sysdeps/*/preconfigure 2> /dev/null`
Packit 6c4009
then
Packit 6c4009
  AC_MSG_CHECKING($2 preconfigure fragments)
Packit 6c4009
  for frag in $frags; do
Packit 6c4009
    name=`echo "$frag" | sed 's@/[[^/]]*[$]@@;s@^.*/@@'`
Packit 6c4009
    echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
Packit 6c4009
    . "$frag"
Packit 6c4009
  done
Packit 6c4009
  AC_MSG_RESULT()
Packit 6c4009
fi])
Packit 6c4009
Packit 6c4009
# These two macros are taken from GCC's config/acx.m4.
Packit 6c4009
dnl Support the --with-pkgversion configure option.
Packit 6c4009
dnl ACX_PKGVERSION(default-pkgversion)
Packit 6c4009
AC_DEFUN([ACX_PKGVERSION],[
Packit 6c4009
  AC_ARG_WITH(pkgversion,
Packit 6c4009
    AS_HELP_STRING([--with-pkgversion=PKG],
Packit 6c4009
                   [Use PKG in the version string in place of "$1"]),
Packit 6c4009
    [case "$withval" in
Packit 6c4009
      yes) AC_MSG_ERROR([package version not specified]) ;;
Packit 6c4009
      no)  PKGVERSION= ;;
Packit 6c4009
      *)   PKGVERSION="($withval) " ;;
Packit 6c4009
     esac],
Packit 6c4009
    PKGVERSION="($1) "
Packit 6c4009
  )
Packit 6c4009
  PKGVERSION_TEXI=`echo "$PKGVERSION" | sed 's/@/@@/g'`
Packit 6c4009
  AC_SUBST(PKGVERSION)
Packit 6c4009
  AC_SUBST(PKGVERSION_TEXI)
Packit 6c4009
])
Packit 6c4009
Packit 6c4009
dnl Support the --with-bugurl configure option.
Packit 6c4009
dnl ACX_BUGURL(default-bugurl)
Packit 6c4009
AC_DEFUN([ACX_BUGURL],[
Packit 6c4009
  AC_ARG_WITH(bugurl,
Packit 6c4009
    AS_HELP_STRING([--with-bugurl=URL],
Packit 6c4009
                   [Direct users to URL to report a bug]),
Packit 6c4009
    [case "$withval" in
Packit 6c4009
      yes) AC_MSG_ERROR([bug URL not specified]) ;;
Packit 6c4009
      no)  BUGURL=
Packit 6c4009
	   ;;
Packit 6c4009
      *)   BUGURL="$withval"
Packit 6c4009
	   ;;
Packit 6c4009
     esac],
Packit 6c4009
     BUGURL="$1"
Packit 6c4009
  )
Packit 6c4009
  case ${BUGURL} in
Packit 6c4009
  "")
Packit 6c4009
    REPORT_BUGS_TO=
Packit 6c4009
    REPORT_BUGS_TEXI=
Packit 6c4009
    ;;
Packit 6c4009
  *)
Packit 6c4009
    REPORT_BUGS_TO="<$BUGURL>"
Packit 6c4009
    REPORT_BUGS_TEXI=@uref{`echo "$BUGURL" | sed 's/@/@@/g'`}
Packit 6c4009
    ;;
Packit 6c4009
  esac;
Packit 6c4009
  AC_SUBST(REPORT_BUGS_TO)
Packit 6c4009
  AC_SUBST(REPORT_BUGS_TEXI)
Packit 6c4009
])
Packit 6c4009
Packit 6c4009
dnl Check linker option support.
Packit 6c4009
dnl LIBC_LINKER_FEATURE([ld_option], [cc_option], [action-if-true], [action-if-false])
Packit 6c4009
AC_DEFUN([LIBC_LINKER_FEATURE],
Packit 6c4009
[AC_MSG_CHECKING([for linker that supports $1])
Packit 6c4009
libc_linker_feature=no
Packit 6c4009
if test x"$gnu_ld" = x"yes"; then
Packit 6c4009
  libc_linker_check=`$LD -v --help 2>/dev/null | grep "\$1"`
Packit 6c4009
  if test -n "$libc_linker_check"; then
Packit 6c4009
    cat > conftest.c <
Packit 6c4009
int _start (void) { return 42; }
Packit 6c4009
EOF
Packit 6c4009
    if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
Packit 6c4009
				$2 -nostdlib -nostartfiles
Packit 6c4009
				-fPIC -shared -o conftest.so conftest.c
Packit 6c4009
				1>&AS_MESSAGE_LOG_FD])
Packit 6c4009
    then
Packit 6c4009
      libc_linker_feature=yes
Packit 6c4009
    fi
Packit 6c4009
    rm -f conftest*
Packit 6c4009
  fi
Packit 6c4009
fi
Packit 6c4009
if test $libc_linker_feature = yes; then
Packit 6c4009
  $3
Packit 6c4009
else
Packit 6c4009
  $4
Packit 6c4009
fi
Packit 6c4009
AC_MSG_RESULT($libc_linker_feature)])
Packit 6c4009
Packit 6c4009
dnl Add a makefile variable, with value set from a shell string
Packit 6c4009
dnl (expanded by the shell inside double quotes), to config.make.
Packit 6c4009
dnl LIBC_CONFIG_VAR(make-variable, shell-value)
Packit 6c4009
AC_DEFUN([LIBC_CONFIG_VAR],
Packit 6c4009
[config_vars="$config_vars
Packit 6c4009
$1 = $2"])
Packit 6c4009
Packit 6c4009
dnl Check that function FUNC was inlined as a builtin.  The code fragment
Packit 6c4009
dnl CODE is compiled with additional options CC_OPTION.  If FUNC is
Packit 6c4009
dnl not found in the assembly then it is assumed the compiler has support
Packit 6c4009
dnl for this builtin and has inlined the call.  If the compiler has the
Packit 6c4009
dnl feature then ACTION-IF-TRUE is called, otherwise ACTION-IF-FALSE.
Packit 6c4009
dnl It is up to the caller to provide a CC_OPTION that ensures the
Packit 6c4009
dnl builtin is inlined if present.
Packit 6c4009
dnl Warning: This may not work for some machines. For example on ARM the
Packit 6c4009
dnl ABI dictates that some functions should not be inlined and instead
Packit 6c4009
dnl should be provided by a compiler helper library e.g. __aeabi_memcpy.
Packit 6c4009
dnl This is done to reduce code size.
Packit 6c4009
dnl LIBC_COMPILER_BUILTIN([func], [code], [cc_option], [action-if-true], [action-if-false])
Packit 6c4009
AC_DEFUN([LIBC_COMPILER_BUILTIN_INLINED],
Packit 6c4009
[AC_MSG_CHECKING([for compiler support of inlined builtin function $1])
Packit 6c4009
libc_compiler_builtin_inlined=no
Packit 6c4009
cat > conftest.c <
Packit 6c4009
int _start (void) { $2 return 0; }
Packit 6c4009
EOF
Packit 6c4009
if ! AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
Packit 6c4009
		     $3 -nostdlib -nostartfiles
Packit 6c4009
		     -S conftest.c -o - | fgrep "$1"
Packit 6c4009
		     1>&AS_MESSAGE_LOG_FD])
Packit 6c4009
then
Packit 6c4009
  libc_compiler_builtin_inlined=yes
Packit 6c4009
fi
Packit 6c4009
rm -f conftest*
Packit 6c4009
if test $libc_compiler_builtin_inlined = yes; then
Packit 6c4009
  $4
Packit 6c4009
else
Packit 6c4009
  $5
Packit 6c4009
fi
Packit 6c4009
AC_MSG_RESULT($libc_compiler_builtin_inlined)])
Packit 6c4009
Packit 6c4009
dnl Default to slibdir named SLIBDIR instead of "lib", and rtlddir
Packit 6c4009
dnl named RTLDDIR instead of "lib".  This is used to put 64-bit
Packit 6c4009
dnl libraries in /lib64.
Packit 6c4009
dnl LIBC_SLIBDIR_RTLDDIR([slibdir], [rtlddir])
Packit 6c4009
AC_DEFUN([LIBC_SLIBDIR_RTLDDIR],
Packit 6c4009
[test -n "$libc_cv_slibdir" ||
Packit 6c4009
case "$prefix" in
Packit 6c4009
/usr | /usr/)
Packit 6c4009
  libc_cv_slibdir='/$1'
Packit 6c4009
  libc_cv_rtlddir='/$2'
Packit 6c4009
  if test "$libdir" = '${exec_prefix}/lib'; then
Packit 6c4009
    libdir='${exec_prefix}/$1';
Packit 6c4009
    # Locale data can be shared between 32-bit and 64-bit libraries.
Packit 6c4009
    libc_cv_complocaledir='${exec_prefix}/lib/locale'
Packit 6c4009
  fi
Packit 6c4009
  ;;
Packit 6c4009
esac])