2 # Determine if the system can handle the -R option being passed to the linker.
4 # This macro is specific to LLVM.
6 AC_DEFUN([AC_LINK_USE_R],
7 [AC_CACHE_CHECK([for compiler -Wl,-R<path> option],[llvm_cv_link_use_r],
10 CFLAGS="$CFLAGS -Wl,-R."
11 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
12 [llvm_cv_link_use_r=yes],[llvm_cv_link_use_r=no])
16 if test "$llvm_cv_link_use_r" = yes ; then
17 AC_DEFINE([HAVE_LINK_R],[1],[Define if you can use -Wl,-R. to pass -R. to the linker, in order to add the current directory to the dynamic linker search path.])
22 # Determine if the system can handle the -R option being passed to the linker.
24 # This macro is specific to LLVM.
26 AC_DEFUN([AC_LINK_EXPORT_DYNAMIC],
27 [AC_CACHE_CHECK([for compiler -Wl,-export-dynamic option],
28 [llvm_cv_link_use_export_dynamic],
31 CFLAGS="$CFLAGS -Wl,-export-dynamic"
32 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
33 [llvm_cv_link_use_export_dynamic=yes],[llvm_cv_link_use_export_dynamic=no])
37 if test "$llvm_cv_link_use_export_dynamic" = yes ; then
38 AC_DEFINE([HAVE_LINK_EXPORT_DYNAMIC],[1],[Define if you can use -Wl,-export-dynamic.])
43 # Determine if the system can handle the -retain-symbols-file option being
44 # passed to the linker.
46 # This macro is specific to LLVM.
48 AC_DEFUN([AC_LINK_RETAIN_SYMBOLS_FILE],
49 [AC_CACHE_CHECK([for compiler -Wl,-retain-symbols-file option],
50 [llvm_cv_link_use_retain_symbols_file],
54 # The following code is from the autoconf manual,
55 # "11.13: Limitations of Usual Tools".
56 # Create a temporary directory $tmp in $TMPDIR (default /tmp).
57 # Use mktemp if possible; otherwise fall back on mkdir,
58 # with $RANDOM to make collisions less likely.
62 (umask 077 && mktemp -d "$TMPDIR/fooXXXXXX") 2>/dev/null
64 test -n "$tmp" && test -d "$tmp"
66 tmp=$TMPDIR/foo$$-$RANDOM
67 (umask 077 && mkdir "$tmp")
70 echo "main" > "$tmp/exports"
72 CFLAGS="$CFLAGS -Wl,-retain-symbols-file=$tmp/exports"
73 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],
74 [llvm_cv_link_use_retain_symbols_file=yes],[llvm_cv_link_use_retain_symbols_file=no])
80 if test "$llvm_cv_link_use_retain_symbols_file" = yes ; then
81 AC_SUBST(HAVE_LINK_RETAIN_SYMBOLS_FILE,1)