Merge pull request #9 from lha/master
[heimdal.git] / cf / check-xau.m4
blobf66e2d193285e497244201b8de3c5e8a8ca1086d
1 dnl $Id$
2 dnl
3 dnl check for Xau{Read,Write}Auth and XauFileName
4 dnl
5 AC_DEFUN([AC_CHECK_XAU],[
6 save_CFLAGS="$CFLAGS"
7 CFLAGS="$X_CFLAGS $CFLAGS"
8 save_LIBS="$LIBS"
9 dnl LIBS="$X_LIBS $X_PRE_LIBS $X_EXTRA_LIBS $LIBS"
10 LIBS="$X_PRE_LIBS $X_EXTRA_LIBS $LIBS"
11 save_LDFLAGS="$LDFLAGS"
12 LDFLAGS="$LDFLAGS $X_LIBS"
14 ## check for XauWriteAuth first, so we detect the case where
15 ## XauReadAuth is in -lX11, but XauWriteAuth is only in -lXau this
16 ## could be done by checking for XauReadAuth in -lXau first, but this
17 ## breaks in IRIX 6.5
19 AC_FIND_FUNC_NO_LIBS(XauWriteAuth, X11 Xau,[#include <X11/Xauth.h>],[0,0])
20 ac_xxx="$LIBS"
21 LIBS="$LIB_XauWriteAuth $LIBS"
22 AC_FIND_FUNC_NO_LIBS(XauReadAuth, X11 Xau,[#include <X11/Xauth.h>],[0])
23 LIBS="$LIB_XauReadAauth $LIBS"
24 AC_FIND_FUNC_NO_LIBS(XauFileName, X11 Xau,[#include <X11/Xauth.h>])
25 LIBS="$ac_xxx"
27 ## set LIB_XauReadAuth to union of these tests, since this is what the
28 ## Makefiles are using
29 case "$ac_cv_funclib_XauWriteAuth" in
30 yes)    ;;
31 no)     ;;
32 *)      if test "$ac_cv_funclib_XauReadAuth" = yes; then
33                 if test "$ac_cv_funclib_XauFileName" = yes; then
34                         LIB_XauReadAuth="$LIB_XauWriteAuth"
35                 else
36                         LIB_XauReadAuth="$LIB_XauWriteAuth $LIB_XauFileName"
37                 fi
38         else
39                 if test "$ac_cv_funclib_XauFileName" = yes; then
40                         LIB_XauReadAuth="$LIB_XauReadAuth $LIB_XauWriteAuth"
41                 else
42                         LIB_XauReadAuth="$LIB_XauReadAuth $LIB_XauWriteAuth $LIB_XauFileName"
43                 fi
44         fi
45         ;;
46 esac
48 if test "$AUTOMAKE" != ""; then
49         AM_CONDITIONAL(NEED_WRITEAUTH, test "$ac_cv_func_XauWriteAuth" != "yes")
50 else
51         AC_SUBST(NEED_WRITEAUTH_TRUE)
52         AC_SUBST(NEED_WRITEAUTH_FALSE)
53         if test "$ac_cv_func_XauWriteAuth" != "yes"; then
54                 NEED_WRITEAUTH_TRUE=
55                 NEED_WRITEAUTH_FALSE='#'
56         else
57                 NEED_WRITEAUTH_TRUE='#'
58                 NEED_WRITEAUTH_FALSE=
59         fi
61 CFLAGS=$save_CFLAGS
62 LIBS=$save_LIBS
63 LDFLAGS=$save_LDFLAGS