Blame configure.ac

Packit 7e09eb
Packit 7e09eb
AC_PREREQ([2.69])
Packit 7e09eb
AC_INIT([ledmon], [0.94])
Packit 7e09eb
AC_CONFIG_MACRO_DIR([m4])
Packit 7e09eb
AC_SUBST([PACKAGE_DATE], "February 2020")
Packit 7e09eb
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
Packit 7e09eb
Packit 7e09eb
# Checks for programs.
Packit 7e09eb
AM_PROG_CC_C_O
Packit 7e09eb
AC_PROG_CC_C99
Packit 7e09eb
AC_PROG_INSTALL
Packit 7e09eb
AC_CONFIG_HEADERS([config_ac.h])
Packit 7e09eb
Packit 7e09eb
AM_CFLAGS='-Wall -I../config'
Packit 7e09eb
AM_CPPFLAGS='-D_DEBUG -D_GNU_SOURCE -D_DEFAULT_SOURCE -DDMALLOC_DISABLE -DBUILD_LABEL=\""$(BUILD_LABEL)"\"'
Packit 7e09eb
Packit 7e09eb
Packit 7e09eb
AC_DEFUN([AX_AM_CFLAGS_ADD],[AX_CHECK_COMPILE_FLAG($1, AM_CFLAGS="$AM_CFLAGS $1")])
Packit 7e09eb
AX_AM_CFLAGS_ADD([-Wformat -Werror=format-security])
Packit 7e09eb
AX_AM_CFLAGS_ADD([-Werror=format-overflow=2])
Packit 7e09eb
AX_AM_CFLAGS_ADD([-Werror=format-truncation=1])
Packit 7e09eb
AX_AM_CFLAGS_ADD([-Werror=shift-negative-value])
Packit 7e09eb
AX_AM_CFLAGS_ADD([-Werror=alloca])
Packit 7e09eb
AX_AM_CFLAGS_ADD([-Werror=missing-field-initializers])
Packit 7e09eb
AX_AM_CFLAGS_ADD([-Werror=format-signedness])
Packit 7e09eb
Packit 7e09eb
AC_SUBST([AM_CFLAGS])
Packit 7e09eb
AC_SUBST([AM_CPPFLAGS])
Packit 7e09eb
Packit 7e09eb
# Automake 1.11 - silent build rules
Packit 7e09eb
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Packit 7e09eb
Packit 7e09eb
PKG_PROG_PKG_CONFIG
Packit 7e09eb
Packit 7e09eb
# Checks for libraries.
Packit 7e09eb
AC_CHECK_LIB([rt], [shm_unlink], [], [AC_MSG_ERROR(librt not found)])
Packit 7e09eb
AC_CHECK_LIB([sgutils2], [sg_ll_send_diag], [], [AC_MSG_ERROR(libsgutils not found)])
Packit 7e09eb
PKG_CHECK_MODULES([LIBUDEV], [libudev])
Packit 7e09eb
PKG_CHECK_MODULES([LIBPCI], [libpci])
Packit 7e09eb
Packit 7e09eb
# Checks for header files.
Packit 7e09eb
AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h stdint.h stdlib.h string.h sys/file.h sys/ioctl.h sys/param.h sys/time.h syslog.h unistd.h])
Packit 7e09eb
Packit 7e09eb
# Checks for typedefs, structures, and compiler characteristics.
Packit 7e09eb
AC_CHECK_HEADER_STDBOOL
Packit 7e09eb
AC_C_INLINE
Packit 7e09eb
AC_TYPE_PID_T
Packit 7e09eb
AC_TYPE_SIZE_T
Packit 7e09eb
AC_CHECK_MEMBERS([struct stat.st_blksize])
Packit 7e09eb
AC_CHECK_MEMBERS([struct stat.st_rdev])
Packit 7e09eb
AC_TYPE_UINT16_T
Packit 7e09eb
AC_TYPE_UINT32_T
Packit 7e09eb
AC_TYPE_UINT64_T
Packit 7e09eb
AC_TYPE_UINT8_T
Packit 7e09eb
Packit 7e09eb
# Checks for library functions.
Packit 7e09eb
AC_FUNC_FORK
Packit 7e09eb
AC_FUNC_MALLOC
Packit 7e09eb
AC_FUNC_MMAP
Packit 7e09eb
AC_CHECK_FUNCS([ftruncate memset munmap realpath regcomp select strcasecmp strchr strdup strerror strrchr strstr strtol strtoul])
Packit 7e09eb
Packit 7e09eb
# configure options
Packit 7e09eb
AC_ARG_ENABLE(systemd, AS_HELP_STRING([--enable-systemd], [install ledmon systemd service]))
Packit 7e09eb
AC_ARG_ENABLE(testconfig, AS_HELP_STRING([--enable-testconfig], [build test_config tool]))
Packit 7e09eb
Packit 7e09eb
AS_IF([test "x$enable_systemd" = xyes], [SYSTEMD_STR=yes], [SYSTEMD_STR=no])
Packit 7e09eb
AS_IF([test "x$enable_testconfig" = xyes], [TESTCONFIG_STR=yes], [TESTCONFIG_STR=no])
Packit 7e09eb
Packit 7e09eb
AM_CONDITIONAL([SYSTEMD_CONDITION], [test "$SYSTEMD_STR" = yes])
Packit 7e09eb
AM_CONDITIONAL([TESTCONFIG_CONDITION], [test "$TESTCONFIG_STR" = yes])
Packit 7e09eb
Packit 7e09eb
# target directory for ledmon service file
Packit 7e09eb
AC_SUBST([SYSTEMD_PATH], "$(pkg-config systemd --variable=systemdsystemunitdir)")
Packit 7e09eb
Packit 7e09eb
AC_CONFIG_FILES([Makefile
Packit 7e09eb
                 doc/Makefile
Packit 7e09eb
                 src/Makefile
Packit 7e09eb
                 systemd/Makefile])
Packit 7e09eb
AC_OUTPUT
Packit 7e09eb
AC_MSG_RESULT([
Packit 7e09eb
$PACKAGE_NAME $VERSION configuration:
Packit 7e09eb
Packit 7e09eb
  Source code location:    ${srcdir}
Packit 7e09eb
  Preprocessor flags:      ${AM_CPPFLAGS} ${CPPFLAGS}
Packit 7e09eb
  C compiler flags:        ${AM_CFLAGS} ${CFLAGS}
Packit 7e09eb
  Common install location: ${prefix}
Packit 7e09eb
  configure parameters:    --enable-systemd=${SYSTEMD_STR}
Packit 7e09eb
                           --enable-testconfig=${TESTCONFIG_STR}
Packit 7e09eb
])