| 1 |
276 |
jeremybenn |
# Process this file with autoconf to produce a configure script, like so:
|
| 2 |
|
|
#
|
| 3 |
|
|
# aclocal -I .. -I ../config && autoconf && autoheader && automake
|
| 4 |
|
|
|
| 5 |
|
|
AC_PREREQ(2.64)
|
| 6 |
|
|
AC_INIT(libssp, 1.0)
|
| 7 |
|
|
AC_CONFIG_SRCDIR(ssp.c)
|
| 8 |
|
|
AC_CANONICAL_SYSTEM
|
| 9 |
|
|
ACX_NONCANONICAL_TARGET
|
| 10 |
|
|
|
| 11 |
|
|
AM_INIT_AUTOMAKE
|
| 12 |
|
|
|
| 13 |
|
|
AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
|
| 14 |
|
|
AC_ARG_ENABLE(version-specific-runtime-libs,
|
| 15 |
|
|
[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
|
| 16 |
|
|
[case "$enableval" in
|
| 17 |
|
|
yes) version_specific_libs=yes ;;
|
| 18 |
|
|
no) version_specific_libs=no ;;
|
| 19 |
|
|
*) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
|
| 20 |
|
|
esac],
|
| 21 |
|
|
[version_specific_libs=no])
|
| 22 |
|
|
AC_MSG_RESULT($version_specific_libs)
|
| 23 |
|
|
|
| 24 |
|
|
AM_MAINTAINER_MODE
|
| 25 |
|
|
|
| 26 |
|
|
GCC_NO_EXECUTABLES
|
| 27 |
|
|
|
| 28 |
|
|
AM_ENABLE_MULTILIB(, ..)
|
| 29 |
|
|
|
| 30 |
|
|
target_alias=${target_alias-$host_alias}
|
| 31 |
|
|
AC_SUBST(target_alias)
|
| 32 |
|
|
|
| 33 |
|
|
AC_CONFIG_HEADERS(config.h)
|
| 34 |
|
|
|
| 35 |
|
|
AC_LANG_C
|
| 36 |
|
|
# The same as in boehm-gc and libstdc++. Have to borrow it from there.
|
| 37 |
|
|
# We must force CC to /not/ be precious variables; otherwise
|
| 38 |
|
|
# the wrong, non-multilib-adjusted value will be used in multilibs.
|
| 39 |
|
|
# As a side effect, we have to subst CFLAGS ourselves.
|
| 40 |
|
|
|
| 41 |
|
|
m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
|
| 42 |
|
|
m4_define([_AC_ARG_VAR_PRECIOUS],[])
|
| 43 |
|
|
AC_PROG_CC
|
| 44 |
|
|
m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
|
| 45 |
|
|
|
| 46 |
|
|
AC_SUBST(CFLAGS)
|
| 47 |
|
|
|
| 48 |
|
|
if test "x$GCC" != "xyes"; then
|
| 49 |
|
|
AC_MSG_ERROR([libssp must be built with GCC])
|
| 50 |
|
|
fi
|
| 51 |
|
|
AC_PROG_CPP
|
| 52 |
|
|
|
| 53 |
|
|
AC_MSG_CHECKING([whether -fstack-protector works])
|
| 54 |
|
|
save_CFLAGS="$CFLAGS"
|
| 55 |
|
|
CFLAGS="$CFLAGS -fstack-protector -Werror"
|
| 56 |
|
|
AC_TRY_COMPILE([
|
| 57 |
|
|
void __attribute__((noinline)) bar (char *x)
|
| 58 |
|
|
{
|
| 59 |
|
|
__builtin_memset (x, 0, 64);
|
| 60 |
|
|
}],[char buf[64]; bar (buf);],
|
| 61 |
|
|
[AC_MSG_RESULT(yes)],
|
| 62 |
|
|
[AC_MSG_RESULT(no)])
|
| 63 |
|
|
CFLAGS="$save_CFLAGS"
|
| 64 |
|
|
|
| 65 |
|
|
AC_MSG_CHECKING([whether hidden visibility is supported])
|
| 66 |
|
|
AC_TRY_COMPILE([
|
| 67 |
|
|
void __attribute__((visibility ("hidden"))) bar (void) {}],,
|
| 68 |
|
|
[ssp_hidden=yes],[ssp_hidden=no])
|
| 69 |
|
|
AC_MSG_RESULT($ssp_hidden)
|
| 70 |
|
|
if test x$ssp_hidden = xyes; then
|
| 71 |
|
|
AC_DEFINE([HAVE_HIDDEN_VISIBILITY],[1],[__attribute__((visibility ("hidden"))) supported])
|
| 72 |
|
|
fi
|
| 73 |
|
|
|
| 74 |
|
|
AC_MSG_CHECKING([whether symbol versioning is supported])
|
| 75 |
|
|
cat > conftest.map <
|
| 76 |
|
|
FOO_1.0 {
|
| 77 |
|
|
global: *foo*; bar; local: *;
|
| 78 |
|
|
};
|
| 79 |
|
|
EOF
|
| 80 |
|
|
save_LDFLAGS="$LDFLAGS"
|
| 81 |
|
|
LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map"
|
| 82 |
|
|
if test x$gcc_no_link = xyes; then
|
| 83 |
|
|
# If we cannot link, we cannot build shared libraries, so do not use
|
| 84 |
|
|
# symbol versioning.
|
| 85 |
|
|
ssp_use_symver=no
|
| 86 |
|
|
else
|
| 87 |
|
|
AC_TRY_LINK([int foo;],[],[ssp_use_symver=yes],[ssp_use_symver=no])
|
| 88 |
|
|
fi
|
| 89 |
|
|
LDFLAGS="$save_LDFLAGS"
|
| 90 |
|
|
AC_MSG_RESULT($ssp_use_symver)
|
| 91 |
|
|
AM_CONDITIONAL(LIBSSP_USE_SYMVER, [test "x$ssp_use_symver" = xyes])
|
| 92 |
|
|
|
| 93 |
|
|
AC_CHECK_HEADERS(alloca.h malloc.h paths.h syslog.h string.h unistd.h fcntl.h stdio.h limits.h)
|
| 94 |
|
|
|
| 95 |
|
|
if test x$gcc_no_link = xyes; then
|
| 96 |
|
|
# Presume the ISO C functions are available; add target-specific
|
| 97 |
|
|
# configuration here if required.
|
| 98 |
|
|
AC_DEFINE(HAVE_STRNCPY)
|
| 99 |
|
|
AC_DEFINE(HAVE_STRNCAT)
|
| 100 |
|
|
else
|
| 101 |
|
|
AC_CHECK_FUNCS(mempcpy strncpy strncat)
|
| 102 |
|
|
fi
|
| 103 |
|
|
|
| 104 |
|
|
AC_MSG_CHECKING([whether vsnprintf is usable])
|
| 105 |
|
|
AC_RUN_IFELSE(AC_LANG_PROGRAM([
|
| 106 |
|
|
#include
|
| 107 |
|
|
#include
|
| 108 |
|
|
#include
|
| 109 |
|
|
int foo (char *buf, size_t n, const char *fmt, ...)
|
| 110 |
|
|
{
|
| 111 |
|
|
va_list ap;
|
| 112 |
|
|
int ret;
|
| 113 |
|
|
va_start (ap, fmt);
|
| 114 |
|
|
ret = vsnprintf (buf, n, fmt, ap);
|
| 115 |
|
|
va_end (ap);
|
| 116 |
|
|
return ret;
|
| 117 |
|
|
}],
|
| 118 |
|
|
[char buf@<:@8@:>@; memset (buf, 'A', sizeof (buf));
|
| 119 |
|
|
if (foo (buf, 4, ".%s.", "CDEFG") != 7)
|
| 120 |
|
|
return 1;
|
| 121 |
|
|
return memcmp (buf, ".CD\0AAAA", sizeof (buf)) != 0;]),
|
| 122 |
|
|
[ssp_have_usable_vsnprintf=define],
|
| 123 |
|
|
[ssp_have_usable_vsnprintf=undef],
|
| 124 |
|
|
[ssp_have_usable_vsnprintf=undef])
|
| 125 |
|
|
if test "x$ssp_have_usable_vsnprintf" = xdefine; then
|
| 126 |
|
|
AC_MSG_RESULT(yes)
|
| 127 |
|
|
AC_DEFINE([HAVE_USABLE_VSNPRINTF],[1],[vsnprintf is present and works])
|
| 128 |
|
|
else
|
| 129 |
|
|
AC_MSG_RESULT(no)
|
| 130 |
|
|
fi
|
| 131 |
|
|
AC_SUBST(ssp_have_usable_vsnprintf)
|
| 132 |
|
|
|
| 133 |
|
|
AM_PROG_LIBTOOL
|
| 134 |
|
|
AC_SUBST(enable_shared)
|
| 135 |
|
|
AC_SUBST(enable_static)
|
| 136 |
|
|
|
| 137 |
|
|
# Calculate toolexeclibdir
|
| 138 |
|
|
# Also toolexecdir, though it's only used in toolexeclibdir
|
| 139 |
|
|
case ${version_specific_libs} in
|
| 140 |
|
|
yes)
|
| 141 |
|
|
# Need the gcc compiler version to know where to install libraries
|
| 142 |
|
|
# and header files if --enable-version-specific-runtime-libs option
|
| 143 |
|
|
# is selected.
|
| 144 |
|
|
toolexecdir='$(libdir)/gcc/$(target_alias)'
|
| 145 |
|
|
toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
|
| 146 |
|
|
;;
|
| 147 |
|
|
no)
|
| 148 |
|
|
if test -n "$with_cross_host" &&
|
| 149 |
|
|
test x"$with_cross_host" != x"no"; then
|
| 150 |
|
|
# Install a library built with a cross compiler in tooldir, not libdir.
|
| 151 |
|
|
toolexecdir='$(exec_prefix)/$(target_alias)'
|
| 152 |
|
|
toolexeclibdir='$(toolexecdir)/lib'
|
| 153 |
|
|
else
|
| 154 |
|
|
toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
|
| 155 |
|
|
toolexeclibdir='$(libdir)'
|
| 156 |
|
|
fi
|
| 157 |
|
|
multi_os_directory=`$CC -print-multi-os-directory`
|
| 158 |
|
|
case $multi_os_directory in
|
| 159 |
|
|
.) ;; # Avoid trailing /.
|
| 160 |
|
|
*) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
|
| 161 |
|
|
esac
|
| 162 |
|
|
;;
|
| 163 |
|
|
esac
|
| 164 |
|
|
AC_SUBST(toolexecdir)
|
| 165 |
|
|
AC_SUBST(toolexeclibdir)
|
| 166 |
|
|
|
| 167 |
|
|
if test ${multilib} = yes; then
|
| 168 |
|
|
multilib_arg="--enable-multilib"
|
| 169 |
|
|
else
|
| 170 |
|
|
multilib_arg=
|
| 171 |
|
|
fi
|
| 172 |
|
|
|
| 173 |
|
|
AC_CONFIG_FILES([Makefile ssp/ssp.h])
|
| 174 |
|
|
AC_OUTPUT
|