Files
hamlogger/configure.ac
Олег Бородин 1cc8b577cd wip
2024-07-03 00:28:42 +02:00

266 lines
6.9 KiB
Plaintext

AC_INIT([hamlogger],[1.0.0])
AM_INIT_AUTOMAKE([foreign])
AC_PREFIX_DEFAULT(/usr/local)
PACKAGE=hamlogger
AC_CHECK_PROG(HAVE_GO, go, true, false)
if test "x$HAVE_GO" = "xfalse"; then
AC_MSG_ERROR([Requested program go not found])
fi
AC_PATH_PROG([go],[go])
AC_PATH_PROG([GO],[go])
AC_PATH_PROGS([CP],[gcp cp])
if test -z "$CP"; then
AC_MSG_ERROR([Requested program cp not found])
fi
AC_PATH_PROGS([YARN],[yarn npm])
if test -z "$YARN"; then
AC_MSG_ERROR([Requested program yarn not found])
fi
AC_PATH_PROGS([NODE],[node])
if test -z "$NODE"; then
AC_MSG_ERROR([Requested program node not found])
fi
AC_PROG_INSTALL
AC_PROG_MKDIR_P
AC_CANONICAL_HOST
AC_PROG_INSTALL
AC_CANONICAL_HOST
case $host_os in
*freebsd* )
AC_SUBST(ROOT_GROUP, "wheel")
AM_CONDITIONAL(FREEBSD_OS, true)
AM_CONDITIONAL(LINUX_OS, false)
OSNAME=freebsd
ROOT_GROUP=wheel
;;
*linux* )
AC_SUBST(ROOT_GROUP, "root")
AM_CONDITIONAL(FREEBSD_OS, false)
AM_CONDITIONAL(LINUX_OS, true)
OSNAME=linux
ROOT_GROUP=root
;;
esac
AM_CONDITIONAL(SYSTEMD, false)
if test -d /lib/systemd/system; then
AM_CONDITIONAL(SYSTEMD, true)
fi
test "x$prefix" == "xNONE" && prefix=$ac_default_prefix
test "x$libexecdir" == "xNONE" && libexecdir=${prefix}/lib
dnl --------------------------------------------------------------------------------------
AC_ARG_ENABLE([devel-mode],
AS_HELP_STRING([--enable-devel-mode], [Enable developmend mode]))
AC_DEFINE_UNQUOTED(srv_devel_mode, "false", [developmend mode])
AC_SUBST(srv_devel_mode, "false")
AS_IF([test "x$enable_devel_mode" = "xyes"], [
SRCDIR=`pwd`
enable_devel_mode=yes
])
dnl --------------------------------------------------------------------------------------
SRV_CONFDIR="${prefix}/etc/${PACKAGE}"
AC_ARG_WITH(confdir,
AS_HELP_STRING([--with-confdir=PATH],[set configuration dir to PATH (default: $SRV_CONFDIR)]),
[ if test ! -z "$withval" ; then
case $withval in
/*)
SRV_CONFDIR="$withval"
;;
*)
AC_MSG_ERROR(You must specify an absolute path to --with-confdir=PATH)
;;
esac
fi ])
AS_IF([test "x$enable_devel_mode" = "xyes"], [
SRV_CONFDIR="${SRCDIR}/etc/${PACKAGE}"
sysconfdir="${SRCDIR}/etc/${PACKAGE}"
], [
test "x$SRV_CONFDIR" == "x/usr/etc/${PACKAGE}" && SRV_CONFDIR="/etc/${PACKAGE}"
test "x$prefix" == "x/usr" && sysconfdir="/etc"
])
AC_DEFINE_UNQUOTED(SRV_CONFDIR, "$SRV_CONFDIR", [location of configuration files for ${PACKAGE}])
AC_SUBST(srv_confdir, "$SRV_CONFDIR")
AC_MSG_NOTICE(srv_confdir set as ${SRV_CONFDIR})
dnl --------------------------------------------------------------------------------------
SRV_LOGDIR="/var/log/${PACKAGE}"
AC_ARG_WITH(logdir,
AS_HELP_STRING([--with-logdir=PATH],[set path for logdir (default: $SRV_LOGDIR)]),
[ if test ! -z "$withval" ; then
case $withval in
/*)
SRV_LOGDIR="$withval"
;;
*)
AC_MSG_ERROR(You must specify an absolute path to --with-logdir=PATH)
;;
esac
fi])
AS_IF([test "x$enable_devel_mode" = "xyes"], [
SRV_LOGDIR="${SRCDIR}/tmp.log"
])
AC_DEFINE_UNQUOTED(SRV_LOGDIR, "$SRV_LOGDIR", [location of ${PACKAGE} logdir])
AC_SUBST(srv_logdir, "$SRV_LOGDIR")
AC_MSG_NOTICE(srv_logdir set as ${SRV_LOGDIR})
dnl --------------------------------------------------------------------------------------
SRV_RUNDIR="/var/run/${PACKAGE}"
AC_ARG_WITH(rundir,
AS_HELP_STRING([--with-rundir=PATH],[set path for rundir (default: $SRV_RUNDIR)]),
[ if test ! -z "$withval" ; then
case $withval in
/*)
SRV_RUNDIR="$withval"
;;
*)
AC_MSG_ERROR(You must specify an absolute path to --with-rundir=PATH)
;;
esac
fi ])
AS_IF([test "x$enable_devel_mode" = "xyes"], [
SRV_RUNDIR="${SRCDIR}/tmp.run"
])
AC_DEFINE_UNQUOTED(SRV_RUNDIR, "$SRV_RUNDIR", [location of rundir])
AC_SUBST(srv_rundir, "$SRV_RUNDIR")
AC_MSG_NOTICE(srv_rundir set as ${SRV_RUNDIR})
dnl --------------------------------------------------------------------------------------
SRV_SHAREDIR="${prefix}/share/$PACKAGE"
AC_ARG_WITH(sharedir,
AS_HELP_STRING([--with-sharedir=PATH],[set share directory (default: $SRV_SHAREDIR)]),
[ if test ! -z "$with_sharedir" ; then
case $with_sharedir in
/*)
SRV_SHAREDIR="$withval"
;;
*)
AC_MSG_ERROR(You must specify an absolute path to --with-sharedir=PATH)
;;
esac
fi ])
AS_IF([test "x$enable_devel_mode" = "xyes"], [
SRV_SHAREDIR="${SRCDIR}/share"
])
AC_DEFINE_UNQUOTED(SRV_SHAREDIR, "$SRV_SHAREDIR", [location of share dir])
AC_SUBST(srv_sharedir, "$SRV_SHAREDIR")
AC_MSG_NOTICE(srv_sharedir set as ${SRV_SHAREDIR})
dnl --------------------------------------------------------------------------------------
SRV_LIBDIR="${prefix}/lib/$PACKAGE"
AC_ARG_WITH(libdir,
AS_HELP_STRING([--with-libdir=PATH],[set lib directory (default: $SRV_LIBDIR)]),
[ if test ! -z "$withval" ; then
case $withval in
/*)
SRV_LIBDIR="$withval"
;;
*)
AC_MSG_ERROR(You must specify an absolute path to --with-libdir=PATH)
;;
esac
fi ])
AS_IF([test "x$enable_devel_mode" = "xyes"], [
SRV_LIBDIR="${SRCDIR}/sysagent"
])
AC_DEFINE_UNQUOTED(SRV_LIBDIR, "$SRV_LIBDIR", [location of lib dir])
AC_SUBST(srv_libdir, "$SRV_LIBDIR")
AC_MSG_NOTICE(srv_libdir set as ${SRV_LIBDIR})
dnl --------------------------------------------------------------------------------------
SRV_DATADIR="/var/data/${PACKAGE}"
AC_ARG_WITH(datadir,
AS_HELP_STRING([--with-datadir=PATH],[set path for datadir (default: $SRV_DATADIR)]),
[ if test ! -z "$withval" ; then
case $withval in
/*)
SRV_DATADIR="$withval"
;;
*)
AC_MSG_ERROR(You must specify an absolute path to --with-datadir=PATH)
;;
esac
fi])
AS_IF([test "x$enable_devel_mode" = "xyes"], [
SRV_DATADIR="${SRCDIR}/tmp.data"
])
AC_DEFINE_UNQUOTED(SRV_DATADIR, "$SRV_DATADIR", [location of ${PACKAGE} datadir])
AC_SUBST(srv_datadir, "$SRV_DATADIR")
AC_MSG_NOTICE(srv_datadir set as ${SRV_DATADIR})
dnl --------------------------------------------------------------------------------------
AM_CONDITIONAL(DEV_MODE, false)
AS_IF([test "x$enable_devel_mode" = "xyes"], [
AM_CONDITIONAL(DEV_MODE, true)
sbindir="./"
AC_MSG_NOTICE(devel mode enabled)
])
dnl --------------------------------------------------------------------------------------
AC_SUBST(srv_name, "$PACKAGE")
AC_CONFIG_FILES([
Makefile
internal/config/path.go
initrc/hamloggerd.service
initrc/hamloggerd
front/Makefile
])
AC_OUTPUT