1 # Process this file with autoconf to produce a configure script, like so:
2 # aclocal && autoconf && autoheader && automake
6 AC_CONFIG_SRCDIR(ssp.c)
11 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
12 AC_ARG_ENABLE(version-specific-runtime-libs,
13 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
15 yes) version_specific_libs=yes ;;
16 no) version_specific_libs=no ;;
17 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
19 [version_specific_libs=no])
20 AC_MSG_RESULT($version_specific_libs)
25 AM_ENABLE_MULTILIB(, ..)
27 target_alias=${target_alias-$host_alias}
28 AC_SUBST(target_alias)
30 AC_CONFIG_HEADERS(config.h)
33 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
34 # We must force CC to /not/ be precious variables; otherwise
35 # the wrong, non-multilib-adjusted value will be used in multilibs.
36 # As a side effect, we have to subst CFLAGS ourselves.
38 m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
39 m4_define([_AC_ARG_VAR_PRECIOUS],[])
41 m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
45 if test "x$GCC" != "xyes"; then
46 AC_MSG_ERROR([libssp must be built with GCC])
50 AC_MSG_CHECKING([whether -fstack-protector works])
52 CFLAGS="$CFLAGS -fstack-protector -Werror"
54 void __attribute__((noinline)) bar (char *x)
56 __builtin_memset (x, 0, 64);
57 }],[char buf[64]; bar (buf);],
62 AC_MSG_CHECKING([whether hidden visibility is supported])
64 void __attribute__((visibility ("hidden"))) bar (void) {}],,
65 [ssp_hidden=yes],[ssp_hidden=no])
66 AC_MSG_RESULT($ssp_hidden)
67 if test x$ssp_hidden = xyes; then
68 AC_DEFINE([HAVE_HIDDEN_VISIBILITY],[1],[__attribute__((visibility ("hidden"))) supported])
71 AC_MSG_CHECKING([whether symbol versioning is supported])
72 cat > conftest.map <<EOF
74 global: *foo*; bar; local: *;
77 save_LDFLAGS="$LDFLAGS"
78 LDFLAGS="$LDFLAGS -shared -Wl,--version-script,./conftest.map"
79 AC_TRY_LINK([int foo;],[],[ssp_use_symver=yes],[ssp_use_symver=no])
80 LDFLAGS="$save_LDFLAGS"
81 AC_MSG_RESULT($ssp_use_symver)
82 AM_CONDITIONAL(LIBSSP_USE_SYMVER, [test "x$ssp_use_symver" = xyes])
84 AC_CHECK_HEADERS(alloca.h paths.h syslog.h string.h unistd.h fcntl.h stdio.h limits.h)
86 AC_CHECK_FUNCS(mempcpy strncpy strncat)
88 AC_MSG_CHECKING([whether vsnprintf is usable])
89 AC_RUN_IFELSE(AC_LANG_PROGRAM([
93 int foo (char *buf, size_t n, const char *fmt, ...)
98 ret = vsnprintf (buf, n, fmt, ap);
102 [char buf@<:@8@:>@; memset (buf, 'A', sizeof (buf));
103 if (foo (buf, 4, ".%s.", "CDEFG") != 7)
105 return memcmp (buf, ".CD\0AAAA", sizeof (buf)) != 0;]),
106 [ssp_have_usable_vsnprintf=define],
107 [ssp_have_usable_vsnprintf=undef],
108 [ssp_have_usable_vsnprintf=undef])
109 if test "x$ssp_have_usable_vsnprintf" = xdefine; then
111 AC_DEFINE([HAVE_USABLE_VSNPRINTF],[1],[vsnprintf is present and works])
115 AC_SUBST(ssp_have_usable_vsnprintf)
118 AC_SUBST(enable_shared)
119 AC_SUBST(enable_static)
121 # Calculate toolexeclibdir
122 # Also toolexecdir, though it's only used in toolexeclibdir
123 case ${version_specific_libs} in
125 # Need the gcc compiler version to know where to install libraries
126 # and header files if --enable-version-specific-runtime-libs option
128 toolexecdir='$(libdir)/gcc/$(target_alias)'
129 toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
132 if test -n "$with_cross_host" &&
133 test x"$with_cross_host" != x"no"; then
134 # Install a library built with a cross compiler in tooldir, not libdir.
135 toolexecdir='$(exec_prefix)/$(target_alias)'
136 toolexeclibdir='$(toolexecdir)/lib'
138 toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
139 toolexeclibdir='$(libdir)'
141 multi_os_directory=`$CC -print-multi-os-directory`
142 case $multi_os_directory in
143 .) ;; # Avoid trailing /.
144 *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
148 AC_SUBST(toolexecdir)
149 AC_SUBST(toolexeclibdir)
151 if test ${multilib} = yes; then
152 multilib_arg="--enable-multilib"
157 AC_CONFIG_FILES([Makefile ssp/ssp.h])