Forgot to add a changelog entry for previous commit. Added here.
[official-gcc.git] / libsanitizer / configure.ac
blob3c87984b2da9d07c19b6bacadc92b2596f1e7888
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ([2.64])
5 AC_INIT(package-unused, version-unused, libsanitizer)
6 AC_CONFIG_SRCDIR([include/sanitizer/common_interface_defs.h])
8 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
9 AC_ARG_ENABLE(version-specific-runtime-libs,
10 [  --enable-version-specific-runtime-libs    Specify that runtime libraries should be installed in a compiler-specific directory ],
11 [case "$enableval" in
12  yes) version_specific_libs=yes ;;
13  no)  version_specific_libs=no ;;
14  *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
15  esac],
16 [version_specific_libs=no])
17 AC_MSG_RESULT($version_specific_libs)
19 # Do not delete or change the following two lines.  For why, see
20 # http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
21 AC_CANONICAL_SYSTEM
22 target_alias=${target_alias-$host_alias}
23 AC_SUBST(target_alias)
24 GCC_LIBSTDCXX_RAW_CXX_FLAGS
26 AM_INIT_AUTOMAKE(foreign no-dist)
27 AM_ENABLE_MULTILIB(, ..)
28 AM_MAINTAINER_MODE
30 # Calculate toolexeclibdir
31 # Also toolexecdir, though it's only used in toolexeclibdir
32 case ${version_specific_libs} in
33   yes)
34     # Need the gcc compiler version to know where to install libraries
35     # and header files if --enable-version-specific-runtime-libs option
36     # is selected.
37     toolexecdir='$(libdir)/gcc/$(target_alias)'
38     toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
39     ;;
40   no)
41     if test -n "$with_cross_host" &&
42        test x"$with_cross_host" != x"no"; then
43       # Install a library built with a cross compiler in tooldir, not libdir.
44       toolexecdir='$(exec_prefix)/$(target_alias)'
45       toolexeclibdir='$(toolexecdir)/lib'
46     else
47       toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
48       toolexeclibdir='$(libdir)'
49     fi
50     multi_os_directory=`$CC -print-multi-os-directory`
51     case $multi_os_directory in
52       .) ;; # Avoid trailing /.
53       *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;;
54     esac
55     ;;
56 esac
57 AC_SUBST(toolexecdir)
58 AC_SUBST(toolexeclibdir)
60 # Checks for programs.
61 AC_PROG_CC
62 AC_PROG_CXX
63 AM_PROG_AS
65 AC_LIBTOOL_DLOPEN
66 AM_PROG_LIBTOOL
68 AC_SUBST(enable_shared)
69 AC_SUBST(enable_static)
71 AC_CHECK_SIZEOF([void *])
73 if test "${multilib}" = "yes"; then
74   multilib_arg="--enable-multilib"
75 else
76   multilib_arg=
79 # Get target configury.
80 unset TSAN_SUPPORTED
81 unset LSAN_SUPPORTED
82 . ${srcdir}/configure.tgt
83 AM_CONDITIONAL(TSAN_SUPPORTED, [test "x$TSAN_SUPPORTED" = "xyes"])
84 AM_CONDITIONAL(LSAN_SUPPORTED, [test "x$LSAN_SUPPORTED" = "xyes"])
86 # Check for functions needed.
87 AC_CHECK_FUNCS(clock_getres clock_gettime clock_settime)
89 # Common libraries that we need to link against for all sanitizer libs.
90 link_sanitizer_common='-lpthread -ldl -lm'
92 # Set up the set of additional libraries that we need to link against for libasan.
93 link_libasan=$link_sanitizer_common
94 AC_SUBST(link_libasan)
96 # Set up the set of additional libraries that we need to link against for libtsan.
97 link_libtsan=$link_sanitizer_common
98 AC_SUBST(link_libtsan)
100 # Set up the set of additional libraries that we need to link against for libubsan.
101 link_libubsan=$link_sanitizer_common
102 AC_SUBST(link_libubsan)
104 # Set up the set of additional libraries that we need to link against for liblsan.
105 link_liblsan=$link_sanitizer_common
106 AC_SUBST(link_liblsan)
108 # At least for glibc, clock_gettime is in librt.  But don't pull that
109 # in if it still doesn't give us the function we want.  This
110 # test is copied from libgomp.
111 if test $ac_cv_func_clock_gettime = no; then
112   AC_CHECK_LIB(rt, clock_gettime,
113     [link_libasan="-lrt $link_libasan"
114 link_libtsan="-lrt $link_libtsan"
115 # Other sanitizers do not override clock_* API
119 case "$host" in
120   *-*-darwin*) MAC_INTERPOSE=true ; enable_static=no ;;
121   *) MAC_INTERPOSE=false ;;
122 esac
123 AM_CONDITIONAL(USING_MAC_INTERPOSE, $MAC_INTERPOSE)
125 AC_CONFIG_FILES([Makefile libsanitizer.spec])
127 AC_CONFIG_FILES(AC_FOREACH([DIR], [interception sanitizer_common lsan asan ubsan], [DIR/Makefile ]),
128   [cat > vpsed$$ << \_EOF
129 s!`test -f '$<' || echo '$(srcdir)/'`!!
130 _EOF
131    sed -f vpsed$$ $ac_file > tmp$$
132    mv tmp$$ $ac_file
133    rm vpsed$$
134    echo 'MULTISUBDIR =' >> $ac_file
135    ml_norecursion=yes
136    . ${multi_basedir}/config-ml.in
137    AS_UNSET([ml_norecursion])
140 if test "x$TSAN_SUPPORTED" = "xyes"; then
141   AC_CONFIG_FILES(AC_FOREACH([DIR], [tsan], [DIR/Makefile ]), 
142     [cat > vpsed$$ << \_EOF
143 s!`test -f '$<' || echo '$(srcdir)/'`!!
144 _EOF
145     sed -f vpsed$$ $ac_file > tmp$$
146     mv tmp$$ $ac_file
147     rm vpsed$$
148     echo 'MULTISUBDIR =' >> $ac_file
149     ml_norecursion=yes
150     . ${multi_basedir}/config-ml.in
151     AS_UNSET([ml_norecursion])
155 AC_OUTPUT