dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.13) AC_INIT(CHANGES) dnl VERSION needs to be updated such that 'make dist' uses the correct dnl filename for the directory name and tarball. VERSION=`sed -n 's/.*version.*"\(.*\)".*/\1/p' $srcdir/include/version.h.in|tr -d ' '` PACKAGE=`sed -n 's/.*package.*"\(.*\)".*/\1/p' $srcdir/include/version.h.in|tr -d ' '` AC_SUBST(VERSION) AC_SUBST(PACKAGE) AM_INIT_AUTOMAKE($PACKAGE, $VERSION, rancid@shrubbery.net) dnl default install location AC_PREFIX_DEFAULT(/usr/local/rancid) dnl AM_MAINTAINER_MODE() dnl AC_CONFIG_SUBDIRS(util) # make sure MAKE sets ${MAKE} AC_PATH_PROG(MAKE,gmake,no) if test $MAKE = no; then unset ac_cv_path_MAKE AC_PATH_PROG(MAKE,make,no) if test $MAKE = no; then AC_MSG_ERROR([can't locate a make.]) exit 1 fi fi AC_PROG_MAKE_SET() # compiler specifics AC_PROG_CC AM_C_PROTOTYPES AC_PROG_CPP AC_C_CONST AC_C_INLINE AC_C_STRINGIZE # check includes/headers AC_HEADER_STDC AC_CHECK_HEADERS(limits.h memory.h siginfo.h string.h strings.h unistd.h) AC_CHECK_HEADERS(errno.h fcntl.h sys/types.h sys/wait.h) dnl AC_CHECK_HEADERS(errno.h stdlib.h sys/types.h sys/wait.h) dnl AC_CHECK_HEADERS(malloc.h) AC_CHECK_HEADERS(sysexits.h) # check functions AC_CHECK_FUNCS(memcpy memmove memset bcopy bzero strerror strchr strrchr \ strstr strtok strrtok index rindex) dnl AC_FUNC_VPRINTF # type checks AC_TYPE_SIGNAL AC_TYPE_SIZE_T # Package-specific options/knobs # # Check if user wants us to create LOCALSTATEDIR. If it's a package-system, # they might create it themselves for book-keeping sake; eg: NetBSD AC_MSG_CHECKING([whether to create the local state directory at install time]) AC_ARG_ENABLE(mk-localstatedir, AS_HELP_STRING([--enable-mk-localstatedir], [enable creation of the local state directory at install time (default: yes)]), [if test "$enable_mk_localstatedir" = yes; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi], [AC_MSG_RESULT(yes) enable_mk_localstatedir="yes" ]) AM_CONDITIONAL([MK_LCLSTATEDIR], [test "${enable_mk_localstatedir}" = yes]) # Check if user wants us to install sample configurations into the sysconfdir. AC_MSG_CHECKING([whether to install sample .conf files in sysconfdir]) AC_ARG_ENABLE(conf-install, AS_HELP_STRING([--enable-conf-install], [enable install of sample .conf files in sysconfdir (default: yes)]), [if test "$enable_conf_install" = yes; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi], [AC_MSG_RESULT(yes) enable_conf_install="yes" ]) AM_CONDITIONAL([CONF_INSTALL], [test "${enable_conf_install}" = yes]) # Configure for subversion revision control system instead of CVS. AC_MSG_CHECKING([whether subversion]) AC_ARG_ENABLE(svn, AS_HELP_STRING([--enable-svn], [enable use of subversion instead of cvs]), [if test "$enable_svn" = yes; then AC_MSG_RESULT(yes) RCSSYS="svn" else AC_MSG_RESULT(no) RCSSYS="cvs" fi], [AC_MSG_RESULT(no) RCSSYS="cvs" ]) AC_SUBST(RCSSYS) rd_cv_RCSSYS=$RCSSYS # Check for a preference for using mail addresses like rancid+group # instead of the standard rancid-group AC_MSG_CHECKING([whether mail addresses should be in the rancid+ form]) AC_ARG_ENABLE(mail-plus, AS_HELP_STRING([--enable-mail-plus], [enable mail to rancid+ addresses, instead of rancid-]), [if test "$enable_mail_plus" = yes; then AC_MSG_RESULT(yes) MAILPLUS="rancid+" AC_SUBST(MAILPLUS) else AC_MSG_RESULT(no) MAILPLUS="rancid-" AC_SUBST(MAILPLUS) fi], [AC_MSG_RESULT(no) MAILPLUS="rancid-" AC_SUBST(MAILPLUS) ]) rd_cv_MAILPLUS=$MAILPLUS # Check for a preference for using mail addresses like rancid+admin-group # instead of the standard rancid-admin-group AC_MSG_CHECKING([whether admin mail addresses should be in the rancid-admin+ form]) AC_ARG_ENABLE(adminmail-plus, AS_HELP_STRING([--enable-adminmail-plus], [enable mail to rancid-admin+ addresses, instead of rancid-admin-]), [if test "$enable_adminmail_plus" = yes; then AC_MSG_RESULT([rancid-admin+]) ADMINMAILPLUS="rancid-admin+" AC_SUBST(ADMINMAILPLUS) else AC_MSG_RESULT([${MAILPLUS}admin-]) ADMINMAILPLUS="${MAILPLUS}admin-" AC_SUBST(ADMINMAILPLUS) fi], [AC_MSG_RESULT([${MAILPLUS}admin-]) ADMINMAILPLUS="${MAILPLUS}admin-" AC_SUBST(ADMINMAILPLUS) ]) rd_cv_ADMINMAILPLUS=$ADMINMAILPLUS AC_PATH_PROG(DIRNAME,dirname,no) # locate GNU diff (one supporting the -u option) AC_MSG_CHECKING([for a diff(1) that supports -u]) _DIFF_PATH=`echo $PATH:${prefix}/bin:/usr/bin:/usr/pkg/bin:/usr/local/bin:/usr/gnu/bin:/usr/contrib/bin | sed -e 's/:/ /g'` for _diff in ${_DIFF_PATH} ; do if test -e ${_diff}/diff ; then ${_diff}/diff -u -4 /dev/null /dev/null > /dev/null 2>&1 if test $? -ne 0; then # linux/gnu shit has to change options that have been around # since organized religion; see if -U 4 works. ${_diff}/diff -U 4 /dev/null /dev/null > /dev/null 2>&1 if test $? -ne 0; then if test "${ADIFF}" == "" ; then ADIFF="${_diff}/diff" ADIFF_CMD="diff -c -4" fi else DIFF="${_diff}/diff" DIFF_CMD="diff -U 4" break fi else DIFF="${_diff}/diff" DIFF_CMD="diff -u -4" break fi fi done if test "$DIFF" = "" ; then DIFF=$ADIFF DIFF_CMD=$ADIFF_CMD fi if test "$DIFF" = "" ; then AC_MSG_ERROR([can't locate diff.]) fi AC_MSG_RESULT([${DIFF_CMD}]) rd_cv_DIFF=$DIFF AC_SUBST(DIFF) rd_cv_DIFF_CMD=$DIFF_CMD AC_SUBST(DIFF_CMD) AC_PATH_PROG(SENDMAIL,sendmail,no, /usr/sbin:/usr/bin:/usr/lib) # Find an appropriate tar for use in "dist" targets. A "best guess" # is good enough -- if we can't find GNU tar, we don't really care. AC_CHECK_PROGS(TAR, gnutar gtar tar) AC_CHECK_PROGS(AUTOMAKE, automake) dnl locate perl 5 and expect. AC_PROG_INSTALL AC_PATH_PROG(PERLV_PATH,perl5,no) if test $PERLV_PATH = no; then unset ac_cv_path_PERLV_PATH AC_PATH_PROG(PERLV_PATH,perl,no) if test $PERLV_PATH = no; then AC_MSG_ERROR([can't locate a suitable perl5.]) exit 1 else $PERLV_PATH -e 'require 5;' if test $? -ne 0 ; then AC_MSG_ERROR([can't locate a suitable perl5.]) exit 1 fi fi fi AC_SUBST(PERLV_PATH) PERLV=`basename $PERLV_PATH` AC_SUBST(PERLV) AC_PATH_PROG(EXPECT_PATH,expect,no) if test $EXPECT_PATH = no; then AC_MSG_ERROR([can't locate expect.]) fi AC_SUBST(EXPECT_PATH) # locate ping and it's syntax AC_PATH_PROG(PING_PATH,ping,no) if test $PING_PATH = no; then AC_MSG_ERROR([can't locate ping.]) exit 1 fi # ping seems to take one of two formats for count (N) # BSD: ping -c N host # SVR: ping host N $PING_PATH -c 1 -v 127.0.0.1 > /dev/null 2>&1 if test $? -ne 0 ; then $PING_PATH 127.0.0.1 56 1 > /dev/null 2>&1 if test $? -ne 0 ; then AC_MSG_ERROR([can't figure out how to pass count == 1 to $PING_PATH.]) exit 1 else LG_PING_CMD="$PING_PATH" AC_SUBST(LG_PING_CMD) fi else LG_PING_CMD="$PING_PATH -c 1" AC_SUBST(LG_PING_CMD) fi rd_cv_lg_ping_cmd=$LG_PING_CMD # locate tools to build $PATH for rancid.conf. order is significant. want # to be sure that we pick up the the proper diff and ucbmail in # etc/rancid.conf. ENV_PATH="`dirname $PERLV_PATH`:`dirname $EXPECT_PATH`:`dirname $SENDMAIL`" ENV_PATH="$ENV_PATH:`dirname $DIRNAME`:`dirname $DIFF`" if test $RCSSYS = "cvs" ; then AC_PATH_PROG(CVS,cvs,no) ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_CVS`" else AC_PATH_PROG(SVN,svn,no) ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_SVN`" fi AC_PATH_PROG(COMM,comm,no) ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_COMM`" AC_PATH_PROG(FIND,find,no) ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_FIND`" AC_PATH_PROG(GREP,grep,no) ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_GREP`" AC_PATH_PROG(ID,id,no) ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_ID`" AC_PATH_PROG(MKDIR,mkdir,no) ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_MKDIR`" AC_PATH_PROG(RSH,rsh,no) ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_RSH`" AC_PATH_PROG(SORT,sort,no) ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_SORT`" AC_PATH_PROG(SSH,ssh,no) ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_SSH`" AC_PATH_PROG(TELNET,telnet,no) ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_TELNET`" AC_PATH_PROG(TOUCH,touch,no) ENV_PATH="$ENV_PATH:`dirname $ac_cv_path_TOUCH`" ENV_PATH="$ENV_PATH:/usr/local/bin:/usr/bin" AC_SUBST(ENV_PATH) ENV_PATH=`echo $ENV_PATH | $PERLV_PATH -e 'foreach $x(split(":",<>)){next unless (length($x));push(@F, $x),$seen{$x}=1 unless (defined $seen{$x});}print join(":",@F);'` ac_cv_env_path=$ENV_PATH AC_SUBST(ENV_PATH) AC_CONFIG_FILES(Makefile) AC_CONFIG_FILES(bin/Makefile) AC_CONFIG_FILES(etc/Makefile) AC_CONFIG_FILES(include/Makefile) AC_CONFIG_FILES(man/Makefile) AC_CONFIG_FILES(share/Makefile) AC_CONFIG_FILES(include/version.h) # this is not a header in the sense of # AC_CONFIG_HEADERS will cause # autoheader to overwrite it, while all # want is simple variable replacement AC_CONFIG_HEADERS(include/config.h) AC_CONFIG_FILES(bin/control_rancid bin/par bin/rancid-fe, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/alogin bin/arancid, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/blogin bin/brancid, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/cat5rancid bin/clogin bin/rancid, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/cssrancid, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/elogin bin/erancid, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/f10rancid, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/flogin bin/francid, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/fnrancid, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/jlogin bin/jrancid bin/jerancid, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/hlogin bin/hrancid, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/htlogin bin/htrancid, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/mrancid, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/nlogin bin/nrancid, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/nslogin bin/nsrancid, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/prancid, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/rivlogin bin/rivrancid, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/rrancid, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/tntlogin bin/tntrancid, [chmod a+x $ac_file]) AC_CONFIG_FILES(bin/xrancid bin/zrancid, [chmod a+x $ac_file]) AC_CONFIG_FILES(share/rtrfilter, [chmod a+x $ac_file]) AC_OUTPUT()