-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
164 lines (132 loc) · 4.2 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.53)
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AM_INIT_AUTOMAKE(openhpi-subagent, 2.3.4)
AC_CONFIG_SRCDIR([include/hpiB0101.h])
AM_CONFIG_HEADER([config.h])
# Checks for programs.
AC_PROG_CC
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
# Checks for library functions.
AC_FUNC_MALLOC
AC_HEADER_STDC
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([memset strncasecmp])
# check for helper progs
AC_PATH_PROGS(RPM, rpmbuild)
# set up some vars
HPI_PKG=openhpi-subagent
AC_SUBST(HPI_PKG)
# Checks for header files.
AC_CHECK_HEADERS([netinet/in.h])
have_openhpi=no
AC_CHECK_PROG([found_pkg_config],[pkg-config],[yes])
if test "x$found_pkg_config" != "xyes"; then
OH_CHECK_FAIL(pkg-config,pkg-config)
fi
# TODO: need to add checks for glib2.0
GLIB_CFLAGS=`pkg-config --cflags glib-2.0 gthread-2.0`
GLIB_LIBS=`pkg-config --libs glib-2.0 gthread-2.0`
AC_ARG_ENABLE([client-library],
[[ --enable-client-library build with thin client library [default=no]]],
[if test "x$enableval" = "xyes"; then
OPENHPILIB="openhpiclient"
else
OPENHPILIB="openhpi"
fi
],
[OPENHPILIB="openhpi"])
HPI_LIBS=`PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig" pkg-config --libs $OPENHPILIB`
if test "x$HPI_LIBS" = "x"; then
AC_MSG_ERROR([
*** OpenHPI pkgconfig file wasn't found
*** we can't determine proper build flags without it
*** please check your installation
])
fi
# uncomment the section below when libopenhpiutils
# has its own pkgconfig file 'openhpiutils.pc'
# HPIUTILS_LIBS=`pkg-config --libs openhpiutils`
# if test "x$HPIUTILS_LIBS" = "x"; then
# AC_MSG_ERROR([
# *** OpenHpiUtils pkgconfig file wasn't found
# *** we can't determine proper build flags without it
# *** please check your installation
# ])
# fi
LIBS=$HPI_LIBS
# Checks for libraries
# FIXME: Replace `main' with a function in `-lopenhpi':
AC_CHECK_LIB([$OPENHPILIB], [saHpiSessionOpen],
[
have_hpi=yes
HPI_FLAGS=`PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig" pkg-config --cflags $OPENHPILIB`
HPI_LIBS=`PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig" pkg-config --libs $OPENHPILIB`
],
[OH_CHECK_FAIL(lib$OPENHPILIB,openhpi-devel)])
AC_CHECK_LIB([openhpiutils], [oh_lookup_error],
[
have_hpiutils=yes
# uncomment the 2 lines below when openhpiutils
# has its own pkgconfig file 'openhpiutils.pc'
# HPIUTILS_FLAGS=`pkg-config --cflags openhpiutils`
# HPIUTILS_LIBS=`pkg-config --libs openhpiutils`
],
[OH_CHECK_FAIL(libopenhpiutils,openhpiutils-devel)])
OH_CHECK_NETSNMP
AC_SUBST(SNMPCONFDIR)
dnl
dnl This code was borrowed from linux-ha configure.in file
dnl and is used for creating the proper substitutions
dnl in the spec file. Without it, the spec file will
dnl have ${exec_prefix}, etc. instead of the actual
dnl directory.
dnl
dnl
prefix=`eval echo "$prefix"`
case $prefix in
NONE) prefix=/usr/local;;
esac
var() {
case $1 in
*'${'*) res=`eval echo "$1"`;;
*) res="$1";;
esac
case "$res" in
""|NONE) echo "$2";;
*) echo "$res";;
esac
}
exec_prefix=`var "$exec_prefix" "$prefix"`
bindir=`var "$bindir" "$exec_prefix/bin"`
sbindir=`var "$sbindir" "$exec_prefix/sbin"`
libdir=`var "$libdir" "$exec_prefix/lib"`
includedir=`var "$includedir" "$exec_prefix/include"`
base_includedir="${includedir}"
AC_SUBST(base_includedir)
AC_C_STRINGIZE
CC_WARNINGS="-Wall -Wmissing-prototypes \
-Wmissing-declarations \
-Wstrict-prototypes \
-Wpointer-arith \
-Werror \
# -fprofile-arcs -ftest-coverage \
-Wcast-qual -Wcast-align "
CFLAGS="$CFLAGS $GLIB_CFLAGS $SNMPFLAGS $HPI_FLAGS $HPIUTILS_FLAGS $CC_WARNINGS"
if test "x$THREAD_SAFE" = "xyes" ; then
CFLAGS="$CFLAGS -D_GNU_SOURCE -D_REENTRANT -fexceptions"
fi
LIBS="$LIBS $GLIB_LIBS $SNMPALIBS $HPI_LIBS $HPIUTILS_LIBS -lm"
if test "x$THREAD_SAFE" = "xyes" ; then
LIBS="$LIBS -lpthread"
fi
# pass this down to the spec file
AC_SUBST(ac_configure_args)
AC_CONFIG_FILES([Makefile
src/Makefile
docs/Makefile
openhpi-subagent.spec])
AC_OUTPUT