PageRenderTime 16ms CodeModel.GetById 10ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/config/ac_mqshell.m4

https://code.google.com/
m4 | 116 lines | 76 code | 15 blank | 25 comment | 0 complexity | cbfaa372b3d59b1d393329088770976b MD5 | raw file
  1##*****************************************************************************
  2## $Id$
  3##*****************************************************************************
  4#  AUTHOR:
  5#    Albert Chu <chu11@llnl.gov>
  6#
  7#  SYNOPSIS:
  8#    AC_MQSHELL
  9#
 10#  DESCRIPTION:
 11#    Checks for mqshell option and checks for things mqshd requires
 12#
 13#  WARNINGS:
 14#    This macro must be called after AC_QSHELL and AC_MRSH
 15#    This macro must be placed after AC_PROG_CC or equivalent.
 16##*****************************************************************************
 17
 18# Found online, original author not known
 19AC_DEFUN([AC_STRUCT_SA_LEN],
 20[
 21  AC_CACHE_CHECK([for sa_len in struct sockaddr], ac_cv_struct_sa_len,
 22        AC_TRY_COMPILE([#include <sys/types.h> #include <sys/socket.h>], 
 23                        [struct sockaddr s; s.sa_len;],
 24                        ac_cv_struct_sa_len=yes, 
 25                        ac_cv_struct_sa_len=no))
 26
 27  if test $ac_cv_struct_sa_len = yes; then
 28     AC_DEFINE(HAVE_SA_LEN, [1], [do we have sa_len in struct sockaddr])  
 29  fi
 30])
 31
 32AC_DEFUN([AC_MQSHELL],
 33[
 34  #
 35  # Check for whether to include mqshell module
 36  # Assumes this is AFTER --with-qshell and --with-mrsh checks
 37  #
 38  AC_MSG_CHECKING([for whether to build mqshell module and mqshd daemon])
 39  AC_ARG_WITH([mqshell],
 40    AC_HELP_STRING([--with-mqshell], [Build mqshell module and mqshd daemon]),
 41    [ case "$withval" in
 42        no)  ac_with_mqshell=no ;;
 43        yes) ac_with_mqshell=yes ;;
 44        *)   AC_MSG_RESULT([doh!])
 45             AC_MSG_ERROR([bad value "$withval" for --with-mqshell]) ;;
 46      esac
 47    ]
 48  )
 49  AC_MSG_RESULT([${ac_with_mqshell=no}])
 50   
 51  if test "$ac_with_mqshell" = "yes"; then
 52       
 53     AC_ELAN
 54       
 55     if test "$ac_have_elan" != "yes"; then 
 56       ac_have_mqshell=no
 57     else
 58        
 59       if test "$ac_with_pam" = "yes" ; then
 60          AC_CHECK_LIB([pam], [pam_start], [ac_mqshell_have_pam=yes])
 61          if test "$ac_mqshell_have_pam" != "yes" ; then
 62             AC_MSG_NOTICE([Cannot support mqshell without libpam])
 63             AC_MSG_NOTICE([Consider turning off PAM with --without-pam])
 64	         AC_MSG_ERROR([Error configuring mqshell.])
 65           else
 66             QSHELL_LIBS="-lpam -lpam_misc"
 67             AC_DEFINE_UNQUOTED(USE_PAM, [1])
 68             ac_mqshell_qshell=yes
 69           fi
 70       else
 71          ac_mqshell_have_pam=no
 72          ac_mqshell_qshell=yes
 73       fi
 74
 75       AC_SUBST(QSHELL_LIBS)
 76
 77       # check for munge libs if --with-mrsh was not specified
 78       if test "$ac_have_libmunge" = "yes"; then 
 79          ac_mqshell_munge=yes
 80       else
 81          AC_CHECK_LIB([munge], [munge_encode], [ac_mqshell_have_munge=yes])
 82
 83          if test "$ac_mqshell_have_munge" != "yes" ; then
 84             AC_MSG_NOTICE([Cannot support mqshell without libmunge])
 85             ac_mqshell_munge=no
 86          else
 87             ac_mqshell_munge=yes
 88             MRSH_LIBS="-lmunge" 
 89             AC_SUBST(MRSH_LIBS)
 90          fi
 91       fi
 92
 93       # do we have everything we want?
 94       if test "$ac_mqshell_qshell" = "yes" &&
 95          test "$ac_mqshell_munge" = "yes" ; then
 96          ac_have_mqshell=yes
 97          AC_ADD_STATIC_MODULE("mqcmd")
 98          AC_DEFINE_UNQUOTED([HAVE_MQSHELL], [1], [Define if you have mqshell.])
 99          PROG_MQSHD=in.mqshd   
100
101          # check for IPv6, IEEE standard says it should be in sys/socket.h 
102          AC_CHECK_DECL([AF_INET6], 
103                        AC_DEFINE(HAVE_IPV6,1,[have IPv6]),,
104                        [#include <sys/socket.h>])  
105
106          AC_STRUCT_SA_LEN
107
108          # compile libqsw
109          ac_have_qsw=yes
110       fi
111     fi      
112   fi
113
114   AC_SUBST(PROG_MQSHD)
115   AC_SUBST(HAVE_MQSHELL)
116])