No empty .Rs/.Re
[netbsd-mini2440.git] / crypto / dist / heimdal / cf / check-x.m4
blob0e0c3ad18d75584753228c5f2cd6401bdc0ccfa0
1 dnl 
2 dnl See if there is any X11 present
3 dnl
4 dnl $Heimdal: check-x.m4 15435 2005-06-16 19:45:52Z lha $
5 dnl $NetBSD$
7 AC_DEFUN([KRB_CHECK_X],[
8 AC_PATH_XTRA
10 # try to figure out if we need any additional ld flags, like -R
11 # and yes, the autoconf X test is utterly broken
12 if test "$no_x" != yes; then
13         AC_CACHE_CHECK(for special X linker flags,krb_cv_sys_x_libs_rpath,[
14         ac_save_libs="$LIBS"
15         ac_save_cflags="$CFLAGS"
16         CFLAGS="$CFLAGS $X_CFLAGS"
17         krb_cv_sys_x_libs_rpath=""
18         krb_cv_sys_x_libs=""
19         for rflag in "" "-R" "-R " "-rpath "; do
20                 if test "$rflag" = ""; then
21                         foo="$X_LIBS"
22                 else
23                         foo=""
24                         for flag in $X_LIBS; do
25                         case $flag in
26                         -L*)
27                                 foo="$foo $flag `echo $flag | sed \"s/-L/$rflag/\"`"
28                                 ;;
29                         *)
30                                 foo="$foo $flag"
31                                 ;;
32                         esac
33                         done
34                 fi
35                 LIBS="$ac_save_libs $foo $X_PRE_LIBS -lX11 $X_EXTRA_LIBS"
36                 AC_RUN_IFELSE([
37                 #include <X11/Xlib.h>
38                 foo(void)
39                 {
40                 XOpenDisplay(NULL);
41                 }
42                 main(int argc, char **argv)
43                 {
44                 return 0;
45                 }
46                 ],krb_cv_sys_x_libs_rpath="$rflag"; krb_cv_sys_x_libs="$foo"; break,:,
47                 krb_cv_sys_x_libs_rpath="" ; krb_cv_sys_x_libs="" ; break)
48         done
49         LIBS="$ac_save_libs"
50         CFLAGS="$ac_save_cflags"
51         ])
52         X_LIBS="$krb_cv_sys_x_libs"