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