1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ([2.64])
5AC_INIT(package-unused, version-unused, libsanitizer)
6AC_CONFIG_SRCDIR([include/sanitizer/common_interface_defs.h])
7
8AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
9AC_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])
17AC_MSG_RESULT($version_specific_libs)
18
19# Do not delete or change the following two lines.  For why, see
20# http://gcc.gnu.org/ml/libstdc++/2003-07/msg00451.html
21AC_CANONICAL_SYSTEM
22target_alias=${target_alias-$host_alias}
23AC_SUBST(target_alias)
24GCC_LIBSTDCXX_RAW_CXX_FLAGS
25
26AM_INIT_AUTOMAKE(foreign no-dist)
27AM_ENABLE_MULTILIB(, ..)
28AM_MAINTAINER_MODE
29
30# Calculate toolexeclibdir
31# Also toolexecdir, though it's only used in toolexeclibdir
32case ${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    ;;
56esac
57AC_SUBST(toolexecdir)
58AC_SUBST(toolexeclibdir)
59
60# Checks for programs.
61AC_PROG_CC
62AC_PROG_CXX
63AM_PROG_AS
64
65AC_LIBTOOL_DLOPEN
66AM_PROG_LIBTOOL
67
68AC_SUBST(enable_shared)
69AC_SUBST(enable_static)
70
71AC_CHECK_SIZEOF([void *])
72
73if test "${multilib}" = "yes"; then
74  multilib_arg="--enable-multilib"
75else
76  multilib_arg=
77fi
78
79# Get target configury.
80unset TSAN_SUPPORTED
81. ${srcdir}/configure.tgt
82AM_CONDITIONAL(TSAN_SUPPORTED, [test "x$TSAN_SUPPORTED" = "xyes"])
83
84case "$host" in
85  *-*-darwin*) MAC_INTERPOSE=true ; enable_static=no ;;
86  *) MAC_INTERPOSE=false ;;
87esac
88AM_CONDITIONAL(USING_MAC_INTERPOSE, $MAC_INTERPOSE)
89
90AC_CONFIG_FILES([Makefile])
91
92AC_CONFIG_FILES(AC_FOREACH([DIR], [interception sanitizer_common asan], [DIR/Makefile ]),
93  [cat > vpsed$$ << \_EOF
94s!`test -f '$<' || echo '$(srcdir)/'`!!
95_EOF
96   sed -f vpsed$$ $ac_file > tmp$$
97   mv tmp$$ $ac_file
98   rm vpsed$$
99   echo 'MULTISUBDIR =' >> $ac_file
100   ml_norecursion=yes
101   . ${multi_basedir}/config-ml.in
102   AS_UNSET([ml_norecursion])
103])
104
105if test "x$TSAN_SUPPORTED" = "xyes"; then
106  AC_CONFIG_FILES(AC_FOREACH([DIR], [tsan], [DIR/Makefile ]),
107    [cat > vpsed$$ << \_EOF
108s!`test -f '$<' || echo '$(srcdir)/'`!!
109_EOF
110    sed -f vpsed$$ $ac_file > tmp$$
111    mv tmp$$ $ac_file
112    rm vpsed$$
113    echo 'MULTISUBDIR =' >> $ac_file
114    ml_norecursion=yes
115    . ${multi_basedir}/config-ml.in
116    AS_UNSET([ml_norecursion])
117])
118fi
119
120AC_OUTPUT
121