Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
4.5KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_afs.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_AFS
  8. #
  9. # DESCRIPTION
  10. #
  11. # This sets up the proper includes and libs needed for building programs
  12. # that link with AFS. It adds a --with-afsdir option that lets you specify
  13. # where the AFS includes and libs are (defaulting to /usr/afsws).
  14. #
  15. # It also adds the -I and -L options to CPPFLAGS and LDFLAGS
  16. #
  17. # It creates an AC_SUBST(AFSWS) that contains the directory being used.
  18. #
  19. # It checks for -lBSD, -lsocket and -lnsl since AFS needs those if they
  20. # exist. It also adds -R/usr/ucblib -L/usr/ucblib -lucb if on Solaris.
  21. #
  22. # It sets VICE_ETC_PATH to be the directory where /usr/vice/etc lives,
  23. # since AFS 3.4 uses a different define than AFS 3.5 does for that path.
  24. #
  25. # Finally, it defines AFS_int32 to be the in32 type needed. In older
  26. # versions of afs it was 'int32', and in newer versions it's 'afs_int32'.
  27. #
  28. # LICENSE
  29. #
  30. # Copyright (c) 2008 Scott Grosch <Scott.Grosch@intel.com>
  31. #
  32. # Copying and distribution of this file, with or without modification, are
  33. # permitted in any medium without royalty provided the copyright notice
  34. # and this notice are preserved. This file is offered as-is, without any
  35. # warranty.
  36. #serial 7
  37. AU_ALIAS([SG_AFS], [AX_AFS])
  38. AC_DEFUN([AX_AFS],
  39. [AC_ARG_WITH(afsdir, AS_HELP_STRING([--with-afsdir=DIR],
  40. [Directory holding AFS includes/libs]),
  41. ax_cv_with_afsdir=$withval)
  42. AC_CACHE_CHECK([for location of AFS directory],
  43. ax_cv_with_afsdir, ax_cv_with_afsdir=/usr/afsws)
  44. CPPFLAGS="-I${ax_cv_with_afsdir}/include $CPPFLAGS"
  45. LDFLAGS="-L${ax_cv_with_afsdir}/lib -L${ax_cv_with_afsdir}/lib/afs $LDFLAGS"
  46. dnl Once we specify a directory, we try to link a test program. If the link
  47. dnl works, we store the value of the directory in a cache variable. If not,
  48. dnl we put _FAILED_ in the cache value. In this way we don't try to link
  49. dnl the test program if our afsdir value was cached, as we know it works.
  50. AC_MAX_CHECKING([whether the specified AFS dir looks valid])
  51. if test "x${ax_cv_afsdir_link_works:-set}" != "x$ax_cv_with_afsdir"; then
  52. save_LIBS="$LIBS"
  53. LIBS="$save_LIBS -lcmd"
  54. AC_TRY_LINK([#include <afs/cmd.h>],
  55. [cmd_CreateAlias((struct cmd_syndesc *)0, "foo")],
  56. ax_cv_afsdir_link_works=$ax_cv_with_afsdir,
  57. ax_cv_afsdir_link_works=_FAILED_)
  58. LIBS="$save_LIBS"
  59. wasCached=""
  60. else
  61. wasCached="(cached)"
  62. fi
  63. if test "x$ax_cv_afsdir_link_works" = "x$ax_cv_with_afsdir"; then
  64. AC_MAX_RESULT([${wasCached} yes])
  65. else
  66. AC_MAX_RESULT([no])
  67. AC_MAX_ERROR([Unable to link test program....bad AFS dir specified?])
  68. fi
  69. dnl Much easier to use in XXX.in files
  70. AFSWS=$ax_cv_with_afsdir
  71. AC_SUBST(AFSWS)
  72. dnl Linking against AFS always needs these
  73. AC_CHECK_LIB(BSD, signal)
  74. AC_CHECK_LIB(socket, getservbyname)
  75. AC_CHECK_LIB(nsl, gethostbyname)
  76. dnl On Solaris is just always needs the -lucb library from the compatibility
  77. dnl area. I can't think of any other way to do this than just hardcode it.
  78. AC_CANONICAL_HOST
  79. case "$host" in
  80. *-*-solaris*)
  81. LDFLAGS="-L/usr/ucblib -R/usr/ucblib $LDFLAGS"
  82. LIBS="-lucb $LIBS"
  83. ;;
  84. esac
  85. dnl And it always needs these libs added
  86. LIBS="$LIBS -lacl -lvolser -lvldb -lprot -lkauth -lauth -lrxkad -lubik ${ax_cv_with_afsdir}/lib/afs/vlib.a -ldir ${ax_cv_with_afsdir}/lib/afs/util.a -lsys -lafsint -lrx -lsys -ldes -lcom_err -llwp -lcmd -laudit"
  87. dnl This really should be AC_CHECK_LIB() but that always fails for some reason
  88. if test -f "${ax_cv_with_afsdir}/lib/afs/libaudit.a"; then
  89. LIBS="$LIBS -laudit"
  90. fi
  91. dnl If dirpath.h exists and has the value, use that. Otherwise don't
  92. AC_CHECK_HEADERS(afs/dirpath.h,
  93. [AC_DEFINE(VICE_ETC_PATH, AFSDIR_CLIENT_ETC_DIRPATH)],
  94. [AC_DEFINE(VICE_ETC_PATH, AFSCONF_CLIENTNAME)])
  95. dnl Find out if we should use afs_int32 or int32. They changed the
  96. dnl type across AFS versions.
  97. AC_CACHE_CHECK([for AFS int32 type], ac_cv_type_int32,
  98. [AC_EGREP_CPP(dnl
  99. changequote(<<,>>)dnl
  100. <<(^|[^a-zA-Z_0-9])afs_int32[^a-zA-Z_0-9]>>dnl
  101. changequote([,]), [#include <afs/stds.h>
  102. ], ac_cv_type_int32=afs_int32, ac_cv_type_int32=int32)])
  103. AC_DEFINE_UNQUOTED(AFS_int32, $ac_cv_type_int32)
  104. AH_TEMPLATE([VICE_ETC_PATH],
  105. [Define this to be the define used in the AFS header for /usr/vice/etc])
  106. AH_TEMPLATE([AFS_int32], [Define this to be the type AFS uses for int32])
  107. ])dnl