blob: 30c964e25971ac031466a11c36c1b38694bca982 [file] [log] [blame]
Reid Spencer491f6812004-09-07 06:56:14 +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],
Reid Spencer1ac1d402004-11-25 04:44:46 +00007[AC_CACHE_CHECK([for compiler -Wl,-R<path> option],[llvm_cv_link_use_r],
8[ AC_LANG_PUSH([C])
Reid Spencer491f6812004-09-07 06:56:14 +00009 oldcflags="$CFLAGS"
10 CFLAGS="$CFLAGS -Wl,-R."
Reid Spencer1ac1d402004-11-25 04:44:46 +000011 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[int main() { return 0; }]])],
12 [llvm_cv_link_use_r=yes],[llvm_cv_link_use_r=no])
Reid Spencer491f6812004-09-07 06:56:14 +000013 CFLAGS="$oldcflags"
Reid Spencer12de17d2004-09-19 22:31:49 +000014 AC_LANG_POP([C])
Reid Spencer1ac1d402004-11-25 04:44:46 +000015])
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.])
Reid Spencer491f6812004-09-07 06:56:14 +000018 fi
19])