{
        int res;
        struct dahdi_spaninfo zi;
-#if defined(HAVE_DAHDI) || defined(HAVE_ZAPTEL_CHANALARMS)
+#if !defined(HAVE_ZAPTEL) || defined(HAVE_ZAPTEL_CHANALARMS)
        /*
         * The conditional compilation is needed only in asterisk-1.4 for
         * backward compatibility with old zaptel drivers that don't have
        }
        if (zi.alarms != DAHDI_ALARM_NONE)
                return zi.alarms;
-#if defined(HAVE_DAHDI) || defined(HAVE_ZAPTEL_CHANALARMS)
+#if !defined(HAVE_ZAPTEL) || defined(HAVE_ZAPTEL_CHANALARMS)
        /* No alarms on the span. Check for channel alarms. */
        if ((res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_GET_PARAMS, ¶ms)) >= 0)
                return params.chan_alarms;
 
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <stdio.h>
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
 int
 main ()
 {
-return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
   ;
   return 0;
 }
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #define _LARGEFILE_SOURCE 1
-#include <stdio.h>
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
 int
 main ()
 {
-return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
   ;
   return 0;
 }
 
 cat >>confdefs.h <<\_ACEOF
 #define HAVE_ZAPTEL_CHANALARMS 1
-_ACEOF
-
-       else
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ZAPTEL_CHANALARMS 0
 _ACEOF
 
        fi
 
        CPPFLAGS="${saved_cppflags}"
        if test "${ac_cv_member_ZT_PARAMS_chan_alarms}" = "yes"; then
             AC_DEFINE([HAVE_ZAPTEL_CHANALARMS], 1, [Define if your Zaptel drivers have chan_alarms.])
-       else
-            AC_DEFINE([HAVE_ZAPTEL_CHANALARMS], 0, [Define if your Zaptel drivers have chan_alarms.])
        fi
    elif test -n "${ZAPTEL_MANDATORY}"; 
    then