dnl Process this file with autoconf to produce a configure script. AC_INIT(rpsl/rpsl.y) AC_CONFIG_HEADER(config.h) AC_CANONICAL_HOST AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging], if eval "test x$enable_debug = xyes"; then OPTFLAG="-gstabs+ -DDEBUG -fno-inline" else OPTFLAG="-O3 -gstabs+" fi , OPTFLAG="-O3 -gstabs+" ) case "${host_os}" in solaris* ) EXTRA_INCLUDE_DIRS="-I/opt/sfw/${ac_cv_host}/include" EXTRA_LIBS="-lsocket -lnsl" ;; bsdi* ) dnl Commented out by wlee@isi.edu dnl EXTRA_INCLUDE_DIRS="-I/usr/include/g++ -I/usr/include/g++/stdc++" EXTRA_LIBS="-lipc" ;; esac : ${CFLAGS="$OPTFLAG"} : ${CXXFLAGS="$OPTFLAG -frtti"} all_INCDIRS='-I$(top_srcdir)/../Core' AC_SUBST(all_INCDIRS) AC_SUBST(EXTRA_INCLUDE_DIRS) AC_SUBST(EXTRA_LIBS) AC_DEFINE_UNQUOTED(EXTRA_INCLUDE_DIRS, ${EXTRA_INCLUDE_DIRS}) AC_DEFINE_UNQUOTED(EXTRA_LIBS, ${EXTRA_LIBS}) dnl Checks for programs. AC_PROG_MAKE_SET AC_PROG_CC AC_PROG_CPP AC_PROG_CXX AC_PROG_CXXCPP AC_PROG_MAKE_SET(MAKE=make) AC_ARG_PROGRAM AC_PROG_LN_S AC_C_CONST AC_C_BIGENDIAN : ${LD=$CXX} AC_SUBST(LD) : ${LEX="flex"} AC_SUBST(LEX) : ${YACC="bison -y"} AC_SUBST(YACC) AC_PROG_RANLIB dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(regex.h limits.h sys/time.h unistd.h) AC_CHECK_HEADERS(strings.h string.h memory.h malloc.h) AC_CHECK_HEADERS(sys/sockio.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_TYPE_SIZE_T AC_HEADER_TIME AC_MSG_CHECKING(for struct timeval) AC_TRY_COMPILE([#ifdef TIME_WITH_SYS_TIME #include #include #else #ifdef HAVE_SYS_TIME_H #include #else #include #endif #endif], [static struct timeval x; x.tv_sec = x.tv_usec;], [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_TIMEVAL)], AC_MSG_RESULT(no)) AC_MSG_CHECKING(for whether rusage uses timeval) AC_EGREP_CPP([timeval[[ \t]]*ru_utime], [#include #if HAVE_SYS_RUSAGE_H #include #endif ], [AC_MSG_RESULT(yes) AC_DEFINE(RUSAGE_USES_TIMEVAL)], AC_MSG_RESULT(no)) AC_MSG_CHECKING(for memalign definition) AC_EGREP_HEADER(memalign, malloc.h, [AC_DEFINE(HAVE_MEMALIGN_DEFINITION) AC_MSG_RESULT(yes)], AC_MSG_RESULT(no)) AC_MSG_CHECKING(for strcasecmp definition) AC_EGREP_HEADER(strcasecmp, string.h, [AC_DEFINE(HAVE_STRCASECMP_DEFINITION) AC_MSG_RESULT(yes)], AC_MSG_RESULT(no)) dnl Check if socklen_t is defined AC_MSG_CHECKING(for whether accept uses type (socklen_t *) as parameter) AC_TRY_COMPILE([ #include #include ], [ int sock; struct sockaddr socknew; int addrlen = 5; int newsock = accept (sock, &socknew, (socklen_t *) &addrlen); ], [AC_DEFINE(ACCEPT_USES_SOCKLEN_T) AC_MSG_RESULT(yes)], AC_MSG_RESULT(no)) dnl Checks for library functions. AC_CHECK_FUNCS(gettimeofday timegm socket strstr memcpy vsnprintf) AC_LANG_SAVE AC_LANG_CPLUSPLUS AC_MSG_CHECKING(if we need to declare sys_errlist) AC_EGREP_CPP(sys_errlist, [ #include #include ], [AC_MSG_RESULT(no)], [ AC_DEFINE(NEED_TO_DECLARE_SYS_ERRLIST) AC_MSG_RESULT(yes) ]) AC_MSG_CHECKING(if struct ip contains ip_vhl instead of ip_v and ip_hl) AC_EGREP_CPP(ip_vhl, [ extern "C" { #include } ], [ AC_DEFINE(STRUCT_IP_USES_VHL) AC_MSG_RESULT(yes) ], [AC_MSG_RESULT(no)]) AC_MSG_CHECKING(if struct udphdr contains uh_ulen or len) AC_TRY_COMPILE([ #include #include ], [ struct udphdr u; u.uh_ulen = 1; ], [AC_DEFINE(HAVE_BSD_STYLE_UDPHDR) AC_MSG_RESULT(uh_ulen)], AC_MSG_RESULT(len)) ########################## htons ################################## AC_MSG_CHECKING(if a declaration for htons is needed) htons=notneeded AC_TRY_COMPILE([ extern "C" { #include #include #include #include #include } ], [ int port = 5; struct sockaddr_in server_sockaddr; server_sockaddr.sin_port = htons((u_short) port); ], [AC_MSG_RESULT(no)], [htons=needed]) if test $htons = needed; then AC_TRY_COMPILE([ extern "C" { #include #include #include #include #include extern u_short htons(...); } ], [ int port = 5; struct sockaddr_in server_sockaddr; server_sockaddr.sin_port = htons((u_short) port); ], [AC_DEFINE(DEFINE_HTONS_WITH_ELLIPSIS) AC_MSG_RESULT(with ellipsis)], [ AC_DEFINE(DEFINE_HTONS_WITH_USHORT) AC_MSG_RESULT(with ushort)]) fi AC_LANG_RESTORE ############################ prefix ################################ AC_SUBST(prefix) AC_SUBST(exec_prefix) AC_SUBST(bindir) AC_SUBST(mandir) # Remove any trailing slashes in these variables. changequote(, )dnl test "${prefix}" != NONE && prefix=`echo "${prefix}" | sed 's,\([^/]\)/*$,\1,'` test "${exec_prefix}" != NONE && exec_prefix=`echo "${exec_prefix}" | sed 's,\([^/]\)/*$,\1,'` changequote([, ])dnl ############################ OUTPUT ################################ AC_OUTPUT(Makefile gnu/Makefile rpsl/Makefile )