AC_INIT(QOTD Quote Daemon, 1.0, bobf@mrp3.com, quoted) AC_CONFIG_SRCDIR(quoted.c) AM_INIT_AUTOMAKE AC_PROG_CC AC_PROG_GCC_TRADITIONAL # check libraries before checking functions AC_CHECK_LIB([m],[floor]) AC_HEADER_STDC AC_HEADER_TIME AC_HEADER_SYS_WAIT # recommended by autoscan AC_CHECK_HEADERS([stdio.h]) AC_CHECK_HEADERS([fcntl.h]) AC_CHECK_HEADERS([limits.h]) AC_CHECK_HEADERS([math.h]) AC_CHECK_HEADERS([netinet/in.h]) AC_CHECK_HEADERS([sys/ioctl.h]) AC_CHECK_HEADERS([sys/socket.h]) AC_CHECK_HEADERS([sys/time.h]) AC_CHECK_FUNCS([printf bzero munmap select socket]) AC_CHECK_FUNCS([floor]) AC_FUNC_FORK AC_FUNC_MALLOC AC_FUNC_MMAP AC_FUNC_SELECT_ARGTYPES AC_TYPE_PID_T AC_C_CONST # define the host name information 'host' from config.guess AC_CANONICAL_HOST # check for ln, assign as LN_S AC_PROG_LN_S # additional arguments AC_ARG_ENABLE(usedaemon, [ --use-daemon Install as daemon], [ case "$(enableval)" in yes) usedaemon=true ;; no) usedaemon=false ;; *) AC_MSG_ERROR(bad value $(enableval) for --use-daemon) ;; esac],[usedaemon=true]) AM_CONDITIONAL(USE_DAEMON,test x$usedaemon = xtrue) AC_TYPE_SIGNAL # optional things for Interix vs Linux vs FreeBSD vs the rest of the world # specific check for interix, man page assignment case $host in i*86-pc-interix*) MAN_PAGES="quoted.interix" is_interix=true ;; *) MAN_PAGES="quoted.1" is_interix=false ;; esac # disposition of 'init' files echo "$as_me:$LINENO: checking operating system type for daemon install" >&5 echo $ECHO_N "checking operating system type for daemon install... $ECHO_C" >&6 case $host in i*86-pc-interix*) RC_LN_DIR="/etc/rc2.d" RC_COPY_DIR="/etc/init.d" RC_FILE_SRC="quoted.rc.interix" RC_FILE="quoted" update_rc=false echo "$as_me:$LINENO: result: Interix (init.d, create link)" >&5 echo "${ECHO_T}Interix (init.d, create link)" >&6 ;; *-*-linux-gnu) RC_LN_DIR="" RC_COPY_DIR="/etc/init.d" RC_FILE_SRC="quoted.rc.linux" RC_FILE="quoted" update_rc=true echo "$as_me:$LINENO: result: GNU Linux (invoke update-rc.d)" >&5 echo "${ECHO_T}GNU Linux (invoke update-rc.d)" >&6 ;; *-*-freebsd*) RC_LN_DIR="" RC_COPY_DIR="$sysconfdir/rc.d" RC_FILE_SRC="quoted.sh.rc.freebsd" RC_FILE="quoted.sh" update_rc=false echo "$as_me:$LINENO: result: FreeBSD (/usr/local/etc/rc.d)" >&5 echo "${ECHO_T}FreeBSD (/usr/local/etc/rc.d)" >&6 ;; *) RC_LN_DIR="" RC_COPY_DIR="" RC_FILE_SRC="" RC_FILE="" update_rc=false echo "$as_me:$LINENO: result: Unknown (none) host=$host" >&5 echo "${ECHO_T}Unknown (none) host=$host" >&6 ;; esac # create a conditional that specifies how to handle RC # use 'x' to avoid using quotes... AM_CONDITIONAL(IS_INTERIX, test x$is_interix = xtrue) AM_CONDITIONAL(UPDATE_RC, test x$update_rc = xtrue) AM_CONDITIONAL(CREATE_RC_LINK, test x$RC_LN_DIR != x) AM_CONDITIONAL(COPY_RC_FILE, test x$RC_COPY_DIR != x) AC_SUBST([MAN_PAGES]) AC_SUBST([RC_LN_DIR]) AC_SUBST([RC_COPY_DIR]) AC_SUBST([RC_FILE_SRC]) AC_SUBST([RC_FILE]) # handling the 'NORMAL_UNINSTALL' make variable properly # first, see if I'm installing as a daemon if test x$usedaemon = xtrue ; then # next, see if I'm copying the RC file (if I'm not I can't tell how to stop the daemon!) if test x$RC_COPY_DIR != x ; then # this means I am a daemon, so sub 'NORMAL_UNINSTALL' to stop the daemon first NORMAL_UNINSTALL='$(MAKE) $(AM_MAKEFLAGS) custom-stop-daemon' else NORMAL_UNINSTALL=":" fi else NORMAL_UNINSTALL=":" fi AC_SUBST([NORMAL_UNINSTALL]) # the end AC_CONFIG_FILES([Makefile]) AC_OUTPUT