blob: 66036de433d3c306b6b453714c6c00a2648ff05d [file] [log] [blame]
Nick Lewycky18f99072009-03-05 08:20:21 +00001#
2# Determine if the system can handle the -R option being passed to the linker.
3#
4# This macro is specific to LLVM.
5#
6AC_DEFUN([AC_LINK_USE_R],
7[AC_CACHE_CHECK([for compiler -Wl,-R<path> option],[llvm_cv_link_use_r],
8[ AC_LANG_PUSH([C])
9 oldcflags="$CFLAGS"
10 CFLAGS="$CFLAGS -Wl,-R."
11 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[int main() { return 0; }]])],
12 [llvm_cv_link_use_r=yes],[llvm_cv_link_use_r=no])
13 CFLAGS="$oldcflags"
14 AC_LANG_POP([C])
15])
16if 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.])
18 fi
19])
20
21#
22# Determine if the system can handle the -R option being passed to the linker.
23#
24# This macro is specific to LLVM.
25#
26AC_DEFUN([AC_LINK_EXPORT_DYNAMIC],
27[AC_CACHE_CHECK([for compiler -Wl,-export-dynamic option],
28 [llvm_cv_link_use_export_dynamic],
29[ AC_LANG_PUSH([C])
30 oldcflags="$CFLAGS"
31 CFLAGS="$CFLAGS -Wl,-export-dynamic"
32 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[int main() { return 0; }]])],
33 [llvm_cv_link_use_export_dynamic=yes],[llvm_cv_link_use_export_dynamic=no])
34 CFLAGS="$oldcflags"
35 AC_LANG_POP([C])
36])
37if 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.])
39 fi
40])
41