forked from intel/ledmon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
90 lines (70 loc) · 2.7 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
AC_PREREQ([2.69])
AC_INIT([ledmon], [0.97])
AC_CONFIG_MACRO_DIR([m4])
AC_SUBST([PACKAGE_DATE], "May 2023")
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
# Checks for programs.
AX_CHECK_PROG([gcc])
AX_CHECK_PROG([make])
AM_PROG_CC_C_O
AC_PROG_CC_C99
AC_PROG_INSTALL
AC_CONFIG_HEADERS([config_ac.h])
AM_CFLAGS='-Wall -I../config'
AM_CPPFLAGS='-D_DEBUG -D_GNU_SOURCE -D_DEFAULT_SOURCE -DDMALLOC_DISABLE -DBUILD_LABEL=\""$(BUILD_LABEL)"\"'
AC_DEFUN([AX_AM_CFLAGS_ADD],[AX_CHECK_COMPILE_FLAG($1, AM_CFLAGS="$AM_CFLAGS $1")])
AX_AM_CFLAGS_ADD([-Wformat -Werror=format-security])
AX_AM_CFLAGS_ADD([-Werror=format-overflow=2])
AX_AM_CFLAGS_ADD([-Werror=format-truncation=1])
AX_AM_CFLAGS_ADD([-Werror=shift-negative-value])
AX_AM_CFLAGS_ADD([-Werror=alloca])
AX_AM_CFLAGS_ADD([-Werror=missing-field-initializers])
AX_AM_CFLAGS_ADD([-Werror=format-signedness])
AC_SUBST([AM_CFLAGS])
AC_SUBST([AM_CPPFLAGS])
AC_PREFIX_DEFAULT(/usr)
# Automake 1.11 - silent build rules
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
PKG_PROG_PKG_CONFIG
# Checks for libraries.
AC_CHECK_LIB([rt], [shm_unlink], [], [AC_MSG_ERROR(librt not found)])
AC_CHECK_LIB([sgutils2], [sg_ll_send_diag], [], [AC_MSG_ERROR(libsgutils not found)])
PKG_CHECK_MODULES([LIBUDEV], [libudev])
PKG_CHECK_MODULES([LIBPCI], [libpci])
# Checks for header files.
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])
# Checks for typedefs, structures, and compiler characteristics.
AC_CHECK_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_CHECK_MEMBERS([struct stat.st_blksize])
AC_CHECK_MEMBERS([struct stat.st_rdev])
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_MMAP
AC_CHECK_FUNCS([ftruncate memset munmap realpath regcomp select strcasecmp strchr strdup strerror strrchr strstr strtol strtoul])
# configure options
AC_ARG_ENABLE(systemd, AS_HELP_STRING([--enable-systemd], [install ledmon systemd service]))
AS_IF([test "x$enable_systemd" = xyes], [SYSTEMD_STR=yes], [SYSTEMD_STR=no])
AM_CONDITIONAL([SYSTEMD_CONDITION], [test "$SYSTEMD_STR" = yes])
# target directory for ledmon service file
AC_SUBST([SYSTEMD_PATH], "$(pkg-config systemd --variable=systemdsystemunitdir)")
AC_CONFIG_FILES([Makefile
doc/Makefile
src/Makefile
systemd/Makefile])
AC_OUTPUT
AC_MSG_RESULT([
$PACKAGE_NAME $VERSION configuration:
Source code location: ${srcdir}
Preprocessor flags: ${AM_CPPFLAGS} ${CPPFLAGS}
C compiler flags: ${AM_CFLAGS} ${CFLAGS}
Common install location: ${prefix}
configure parameters: --enable-systemd=${SYSTEMD_STR}
])