configure.in   [plain text]


dnl Process this file with autoconf to produce a configure script.

AC_PREREQ(2.12)

AC_INIT(src/gsint.h)
AM_INIT_AUTOMAKE(enscript, 1.6.1)
AM_CONFIG_HEADER(config.h)

AC_REVISION($Revision: 1.1.1.1 $)

AM_PROG_INSTALL

AC_ARG_WITH(cc,
[  --with-cc(=CC)	  use system's native compiler (or compiler CC)],
  if test "X$withval" != "Xno"; then
    if test "X$withval" = "Xyes"; then
      CC='cc'
    else
      CC=$withval
    fi
    CFLAGS="$CFLAGS -I/usr/local/include"
    LDFLAGS="$LDFLAGS -L/usr/local/lib"
    echo "using compiler CC=$CC"
  fi
)

if test "X$CC" = "X"; then
  AC_PROG_CC
fi

AC_ISC_POSIX
AM_C_PROTOTYPES

AC_C_CONST
AC_FUNC_ALLOCA

AC_STDC_HEADERS
AC_HAVE_HEADERS(string.h stdlib.h unistd.h stdarg.h math.h pwd.h)

dnl Check some functions.
AC_CHECK_FUNCS(strchr)
AC_CHECK_FUNC(strerror, AC_DEFINE(HAVE_STRERROR), [
  LIBOBJS="$LIBOBJS strerror.o"
])
AC_CHECK_FUNC(memmove, AC_DEFINE(HAVE_MEMMOVE), [
  LIBOBJS="$LIBOBJS memmove.o"
])
AC_CHECK_FUNC(memcpy, AC_DEFINE(HAVE_MEMCPY), [
  LIBOBJS="$LIBOBJS memcpy.o"
])
AC_CHECK_FUNC(strtoul, AC_DEFINE(HAVE_STRTOUL), [
  LIBOBJS="$LIBOBJS strtoul.o"
])

AC_CHECK_FUNC(getcwd, AC_DEFINE(HAVE_GETCWD), [
  AC_CHECK_FUNC(getwd, AC_DEFINE(HAVE_GETWD))
])

AC_FUNC_VPRINTF

dnl -lsun is needed on IRIX-4.0 to get the user passwd entry through
dnl the yellow pages / NIS.
AC_CHECK_LIB(sun, main)

dnl Find out where the gethostname() is.
AC_CHECK_FUNC(gethostname, , AC_CHECK_LIB(nsl, main))

AC_PROG_RANLIB
AC_PROG_YACC
AM_PROG_LEX

AC_ARG_ENABLE(debug,
[  --enable-debug	  enable debugging], [
  echo enabling debugging
  if test -n "$GCC"; then
    CFLAGS="$CFLAGS -Wall"
  fi
])

dnl Define the default output media.

AC_ARG_WITH(media,
[  --with-media(=MEDIA)	  use output media Letter (MEDIA), default is A4],
  if test "X$withval" != "Xno"; then
    if test "X$withval" = "Xyes"; then
      ac_cv_value_media='Letter'
    else
      ac_cv_value_media=$withval
    fi
  else
    ac_cv_value_media=${MEDIA-A4}
  fi,
  ac_cv_value_media=${MEDIA-A4}
)
MEDIA=$ac_cv_value_media
AC_SUBST(MEDIA)

dnl Find the printer spooler command.

AC_CHECK_PROG(SPOOLER, lpr, lpr)
AC_CHECK_PROG(SPOOLER, lp, lp)

dnl user can overwrite this
AC_ARG_WITH(spooler,
[  --with-spooler=SPOOLER  set the printer spooler command],
  if test "X$withval" != "Xno"; then
    SPOOLER=$withval
  fi
)

dnl If SPOOLER is still empty, set it to `lpr'.  After this, we should
dnl be able to compile enscript on HURD.
if test "X$SPOOLER" = "X"; then
  SPOOLER=lpr
fi

dnl The PostScript language level.
PSLEVEL="2"
AC_ARG_WITH(ps-level,
[  --with-ps-level=LEVEL   set the PostScript language level to LEVEL],
  if test "X$withval" != "Xno"; then
    PSLEVEL=$withval
  fi
)
AC_SUBST(PSLEVEL)

dnl Internationalization.
ALL_LINGUAS="de es fi fr nl sl"
AM_GNU_GETTEXT
AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl)

dnl Path separator character.
AC_DEFINE_UNQUOTED(PATH_SEPARATOR, ':')

dnl
dnl Scripts
dnl

dnl diffpp

AC_PATH_PROG(PERL, perl)

dnl substitutions

AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
AC_SUBST(LIBOBJS)

AC_OUTPUT([Makefile enscript.1 compat/Makefile afm/Makefile afmlib/Makefile src/Makefile lib/Makefile scripts/Makefile intl/Makefile po/Makefile.in states/Makefile states/states.1 states/tests/Makefile tests/Makefile], [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in >po/Makefile])

echo ""

echo "Enscript is now configured to your system with the following"
echo "user-definable options.  Please, check that they are correct and"
echo "match to your system's properties."
echo ""
echo "Option     Change with configure's option   Current value"
echo "---------------------------------------------------------"
echo "Media      --with-media=MEDIA               $MEDIA"
echo "Spooler    --with-spooler=SPOOLER           $SPOOLER"
echo "PS level   --with-ps-level=LEVEL            $PSLEVEL"
echo ""