DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(autocf21.info.gz) Multiple Cases

Info Catalog (autocf21.info.gz) Testing Values and Files (autocf21.info.gz) Writing Tests (autocf21.info.gz) Language Choice
 
 5.7 Multiple Cases
 ==================
 
 Some operations are accomplished in several possible ways, depending on
 the UNIX variant.  Checking for them essentially requires a "case
 statement".  Autoconf does not directly provide one; however, it is
 easy to simulate by using a shell variable to keep track of whether a
 way to perform the operation has been found yet.
 
    Here is an example that uses the shell variable `fstype' to keep
 track of whether the remaining cases need to be checked.
 
      AC_MSG_CHECKING(how to get filesystem type)
      fstype=no
      # The order of these tests is important.
      AC_TRY_CPP([#include <sys/statvfs.h>
      #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4)
      if test $fstype = no; then
      AC_TRY_CPP([#include <sys/statfs.h>
      #include <sys/fstyp.h>], AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3)
      fi
      if test $fstype = no; then
      AC_TRY_CPP([#include <sys/statfs.h>
      #include <sys/vmount.h>], AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX)
      fi
      # (more cases omitted here)
      AC_MSG_RESULT($fstype)
 
Info Catalog (autocf21.info.gz) Testing Values and Files (autocf21.info.gz) Writing Tests (autocf21.info.gz) Language Choice
automatically generated byinfo2html