-AC_CHECK_HEADER(portab.h,,AC_MSG_ERROR([Alex \"portability headers\" (portab.h an friends) not found!]))
-AC_CHECK_HEADER(imp.h,,AC_MSG_ERROR([Alex \"portability headers\" (portab.h an friends) not found!]))
-AC_CHECK_HEADER(exp.h,,AC_MSG_ERROR([Alex \"portability headers\" (portab.h an friends) not found!]))
-
-AC_CHECK_HEADERS([netinet/in.h sys/socket.h],,[required C headers missing!])
-
-AC_CHECK_HEADERS([stdint.h])
+AC_HEADER_TIME
+
+AC_ARG_WITH(portab,
+ [ --with-portab=DIR search the "portab headers" in DIR],
+ [ if test "x$withval" != "xno"; then
+ CFLAGS="$CFLAGS -I${withval}"
+ if test -f ${withval}/portab.h; then
+ AC_MSG_RESULT([searching "portab headers" in ${withval}...])
+ else
+ AC_MSG_ERROR([${withval}/portab.h not found!])
+ fi
+ else
+ AC_MSG_ERROR([Can't disable Alex \"portability headers\"!])
+ fi
+ ],
+ [ AC_CHECK_HEADER(portab.h,[
+ AC_CHECK_HEADER(imp.h,,AC_MSG_ERROR([Alex \"portability headers\" (portab.h an friends) not found!]))
+ AC_CHECK_HEADER(exp.h,,AC_MSG_ERROR([Alex \"portability headers\" (portab.h an friends) not found!]))
+ ],[
+ AC_CHECK_HEADER(/usr/local/include/portab.h,,AC_MSG_ERROR([Alex \"portability headers\" (portab.h an friends) not found!]))
+ AC_CHECK_HEADER(/usr/local/include/imp.h,,AC_MSG_ERROR([Alex \"portability headers\" (portab.h an friends) not found!]))
+ AC_CHECK_HEADER(/usr/local/include/exp.h,,AC_MSG_ERROR([Alex \"portability headers\" (portab.h an friends) not found!]))
+ CFLAGS="$CFLAGS -I/usr/local/include"
+ ])
+ ]
+)
+
+AC_CHECK_HEADERS([ \
+ arpa/inet.h errno.h fcntl.h netinet/in.h string.h \
+ sys/socket.h sys/time.h unistd.h \
+ ],,AC_MSG_ERROR([required C header missing!]))