Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 918 lines (769 sloc) 26.026 kB
23ef67a @fabbione Merge build systems
fabbione authored
1 dnl
2 dnl autoconf for Agents
3 dnl
4 dnl License: GNU General Public License (GPL)
9a3ad47 @fabbione build: convert to autoconf/automake/libtool
fabbione authored
5
23ef67a @fabbione Merge build systems
fabbione authored
6 dnl ===============================================
7 dnl Bootstrap
8 dnl ===============================================
9 AC_PREREQ(2.63)
9a3ad47 @fabbione build: convert to autoconf/automake/libtool
fabbione authored
10
23ef67a @fabbione Merge build systems
fabbione authored
11 dnl Suggested structure:
12 dnl information on the package
13 dnl checks for programs
14 dnl checks for libraries
15 dnl checks for header files
16 dnl checks for types
17 dnl checks for structures
18 dnl checks for compiler characteristics
19 dnl checks for library functions
20 dnl checks for system services
03bc681 @fabbione build: add automatic versioning and release script
fabbione authored
21
22 AC_INIT([resource-agents],
23 m4_esyscmd([make/git-version-gen .tarball-version]),
23ef67a @fabbione Merge build systems
fabbione authored
24 [to_be_defined@foobar.org])
03bc681 @fabbione build: add automatic versioning and release script
fabbione authored
25
23ef67a @fabbione Merge build systems
fabbione authored
26 AC_USE_SYSTEM_EXTENSIONS
9a3ad47 @fabbione build: convert to autoconf/automake/libtool
fabbione authored
27
23ef67a @fabbione Merge build systems
fabbione authored
28 CRM_DTD_VERSION="1.0"
9a3ad47 @fabbione build: convert to autoconf/automake/libtool
fabbione authored
29
23ef67a @fabbione Merge build systems
fabbione authored
30 PKG_FEATURES=""
9a3ad47 @fabbione build: convert to autoconf/automake/libtool
fabbione authored
31
23ef67a @fabbione Merge build systems
fabbione authored
32 AC_CONFIG_AUX_DIR(.)
33 AC_CANONICAL_HOST
9a3ad47 @fabbione build: convert to autoconf/automake/libtool
fabbione authored
34
23ef67a @fabbione Merge build systems
fabbione authored
35 dnl Where #defines go (e.g. `AC_CHECK_HEADERS' below)
36 dnl
37 dnl Internal header: include/config.h
38 dnl - Contains ALL defines
39 dnl - include/config.h.in is generated automatically by autoheader
40 dnl - NOT to be included in any header files except lha_internal.h
41 dnl (which is also not to be included in any other header files)
42 dnl
43 dnl External header: include/agent_config.h
44 dnl - Contains a subset of defines checked here
45 dnl - Manually edit include/agent_config.h.in to have configure include new defines
46 dnl - Should not include HAVE_* defines
47 dnl - Safe to include anywhere
48 AM_CONFIG_HEADER(include/config.h include/agent_config.h)
49 ALL_LINGUAS="en fr"
50
51 AC_ARG_WITH(version,
52 [ --with-version=version Override package version (if you're a packager needing to pretend) ],
53 [ PACKAGE_VERSION="$withval" ])
54
55 AC_ARG_WITH(pkg-name,
56 [ --with-pkg-name=name Override package name (if you're a packager needing to pretend) ],
57 [ PACKAGE_NAME="$withval" ])
58
00b4e19 @fabbione build: relax automake requirements and drop dist-xz
fabbione authored
59 dnl
60 dnl AM_INIT_AUTOMAKE([1.11.1 foreign dist-bzip2 dist-xz])
61 dnl
62
63 AM_INIT_AUTOMAKE([1.10.1 foreign dist-bzip2])
413922b @fabbione build: fix automake version check and options
fabbione authored
64
23ef67a @fabbione Merge build systems
fabbione authored
65 AC_DEFINE_UNQUOTED(AGENTS_VERSION, "$PACKAGE_VERSION", Current agents version)
66
67 CC_IN_CONFIGURE=yes
68 export CC_IN_CONFIGURE
9a3ad47 @fabbione build: convert to autoconf/automake/libtool
fabbione authored
69
23ef67a @fabbione Merge build systems
fabbione authored
70 LDD=ldd
71
72 dnl ========================================================================
73 dnl Compiler characteristics
74 dnl ========================================================================
9a3ad47 @fabbione build: convert to autoconf/automake/libtool
fabbione authored
75
76 # check stolen from gnulib/m4/gnu-make.m4
77 if ! ${MAKE-make} --version /cannot/make/this >/dev/null 2>&1; then
78 AC_MSG_ERROR([you don't seem to have GNU make; it is required])
79 fi
80
23ef67a @fabbione Merge build systems
fabbione authored
81 AC_PROG_CC dnl Can force other with environment variable "CC".
82 AM_PROG_CC_C_O
83 AC_PROG_CC_STDC
9a3ad47 @fabbione build: convert to autoconf/automake/libtool
fabbione authored
84 AC_PROG_AWK
85 AC_PROG_LN_S
86 AC_PROG_INSTALL
87 AC_PROG_MAKE_SET
88
23ef67a @fabbione Merge build systems
fabbione authored
89 AC_C_STRINGIZE
90 AC_C_INLINE
91
92 AC_TYPE_SIZE_T
93 AC_TYPE_SSIZE_T
94 AC_TYPE_UID_T
95 AC_TYPE_UINT16_T
96 AC_TYPE_UINT8_T
97 AC_TYPE_UINT32_T
98
99 AC_CHECK_SIZEOF(char)
100 AC_CHECK_SIZEOF(short)
101 AC_CHECK_SIZEOF(int)
102 AC_CHECK_SIZEOF(long)
103 AC_CHECK_SIZEOF(long long)
104 AC_STRUCT_TIMEZONE
105
106 dnl ===============================================
107 dnl Helpers
108 dnl ===============================================
109 cc_supports_flag() {
110 local CFLAGS="$@"
111 AC_MSG_CHECKING(whether $CC supports "$@")
112 AC_COMPILE_IFELSE([int main(){return 0;}] ,[RC=0; AC_MSG_RESULT(yes)],[RC=1; AC_MSG_RESULT(no)])
113 return $RC
114 }
115
116 extract_header_define() {
117 AC_MSG_CHECKING(for $2 in $1)
4e2eb4c build: enable building with noexec /tmp (lf#2487)
Lorand Kelemen authored
118 Cfile=$srcdir/extract_define.$2.${$}
23ef67a @fabbione Merge build systems
fabbione authored
119 printf "#include <stdio.h>\n" > ${Cfile}.c
120 printf "#include <%s>\n" $1 >> ${Cfile}.c
121 printf "int main(int argc, char **argv) { printf(\"%%s\", %s); return 0; }\n" $2 >> ${Cfile}.c
122 $CC $CFLAGS ${Cfile}.c -o ${Cfile}
123 value=`${Cfile}`
124 AC_MSG_RESULT($value)
125 printf $value
126 rm -f ${Cfile}.c ${Cfile}
127 }
128
129 dnl ===============================================
130 dnl Configure Options
131 dnl ===============================================
132
133 dnl Some systems, like Solaris require a custom package name
134 AC_ARG_WITH(pkgname,
135 [ --with-pkgname=name name for pkg (typically for Solaris) ],
136 [ PKGNAME="$withval" ],
137 [ PKGNAME="LXHAhb" ],
138 )
139 AC_SUBST(PKGNAME)
140
141 AC_ARG_ENABLE([ansi],
142 [ --enable-ansi force GCC to compile to ANSI/ANSI standard for older compilers.
143 [default=yes]])
144
145 AC_ARG_ENABLE([fatal-warnings],
146 [ --enable-fatal-warnings very pedantic and fatal warnings for gcc
147 [default=yes]])
148
149 INITDIR=""
150 AC_ARG_WITH(initdir,
151 [ --with-initdir=DIR directory for init (rc) scripts [${INITDIR}]],
152 [ INITDIR="$withval" ])
153
154 OCF_ROOT_DIR="/usr/lib/ocf"
155 AC_ARG_WITH(ocf-root,
156 [ --with-ocf-root=DIR directory for OCF scripts [${OCF_ROOT_DIR}]],
157 [ if test x"$withval" = xprefix; then OCF_ROOT_DIR=${prefix}; else
158 OCF_ROOT_DIR="$withval"; fi ])
159 HA_RSCTMPDIR=${localstatedir}/run/resource-agents
160 AC_ARG_WITH(rsctmpdir,
161 [ --with-rsctmpdir=DIR directory for resource agents state files [${HA_RSCTMPDIR}]],
162 [ if test x"$withval" = xprefix; then HA_RSCTMPDIR=${prefix}; else
163 HA_RSCTMPDIR="$withval"; fi ])
164
165 AC_ARG_ENABLE([libnet],
166 [ --enable-libnet Use libnet for ARP based funcationality, [default=try]],
167 [enable_libnet="$enableval"], [enable_libnet=try])
168
2136d6e @fabbione add --with-ras-set option to exclude/include rgmanager/linux-ha agents
fabbione authored
169 BUILD_RGMANAGER=0
170 BUILD_LINUX_HA=0
171
172 RASSET=all
173 AC_ARG_WITH(ras-set,
174 [ --with-ras-set=SET build/install only linux-ha or rgmanager resource-agents [default: all]],
175 [ RASSET="$withval" ])
176
177 if test x$RASSET = xyes || test x$RASSET = xall ; then
178 BUILD_RGMANAGER=1
179 BUILD_LINUX_HA=1
180 fi
181
182 if test x$RASSET = xlinux-ha; then
183 BUILD_LINUX_HA=1
184 fi
185
186 if test x$RASSET = xrgmanager; then
187 BUILD_RGMANAGER=1
188 fi
189
190 if test $BUILD_LINUX_HA -eq 0 && test $BUILD_RGMANAGER -eq 0; then
191 AC_MSG_ERROR([Are you really sure you want this package?])
192 exit 1
193 fi
194
195 AM_CONDITIONAL(BUILD_LINUX_HA, test $BUILD_LINUX_HA -eq 1)
196 AM_CONDITIONAL(BUILD_RGMANAGER, test $BUILD_RGMANAGER -eq 1)
197
23ef67a @fabbione Merge build systems
fabbione authored
198 dnl ===============================================
199 dnl General Processing
200 dnl ===============================================
201
202 INIT_EXT=""
203 echo Our Host OS: $host_os/$host
204
205 AC_MSG_NOTICE(Sanitizing prefix: ${prefix})
206 case $prefix in
207 NONE) prefix=/usr;;
208 esac
209
210 AC_MSG_NOTICE(Sanitizing exec_prefix: ${exec_prefix})
211 case $exec_prefix in
212 dnl For consistency with Heartbeat, map NONE->$prefix
213 NONE) exec_prefix=$prefix;;
214 prefix) exec_prefix=$prefix;;
215 esac
216
217 AC_MSG_NOTICE(Sanitizing INITDIR: ${INITDIR})
218 case $INITDIR in
219 prefix) INITDIR=$prefix;;
220 "")
221 AC_MSG_CHECKING(which init (rc) directory to use)
222 for initdir in /etc/init.d /etc/rc.d/init.d /sbin/init.d \
223 /usr/local/etc/rc.d /etc/rc.d
224 do
225 if
226 test -d $initdir
227 then
228 INITDIR=$initdir
229 break
230 fi
231 done
232 if
233 test -z $INITDIR
234 then
235 INITDIR=${sysconfdir}/init.d
236 fi
237 AC_MSG_RESULT($INITDIR);;
238 esac
239 AC_SUBST(INITDIR)
240
241 if test "${prefix}" = "/usr"; then
242 INITDIRPREFIX="$INITDIR"
243 else
244 INITDIRPREFIX="${prefix}/$INITDIR"
245 fi
246
247 AC_SUBST(INITDIRPREFIX)
248
249 AC_MSG_NOTICE(Sanitizing libdir: ${libdir})
250 case $libdir in
251 dnl For consistency with Heartbeat, map NONE->$prefix
252 *prefix*|NONE)
253 AC_MSG_CHECKING(which lib directory to use)
254 for aDir in lib64 lib
255 do
256 trydir="${exec_prefix}/${aDir}"
257 if
258 test -d ${trydir}
259 then
260 libdir=${trydir}
261 break
262 fi
263 done
264 AC_MSG_RESULT($libdir);
265 ;;
266 esac
267
268 dnl Expand autoconf variables so that we dont end up with '${prefix}'
269 dnl in #defines and python scripts
270 dnl NOTE: Autoconf deliberately leaves them unexpanded to allow
271 dnl make exec_prefix=/foo install
272 dnl No longer being able to do this seems like no great loss to me...
273
274 eval prefix="`eval echo ${prefix}`"
275 eval exec_prefix="`eval echo ${exec_prefix}`"
276 eval bindir="`eval echo ${bindir}`"
277 eval sbindir="`eval echo ${sbindir}`"
278 eval libexecdir="`eval echo ${libexecdir}`"
279 eval datadir="`eval echo ${datadir}`"
280 eval sysconfdir="`eval echo ${sysconfdir}`"
281 eval sharedstatedir="`eval echo ${sharedstatedir}`"
282 eval localstatedir="`eval echo ${localstatedir}`"
283 eval libdir="`eval echo ${libdir}`"
284 eval includedir="`eval echo ${includedir}`"
285 eval oldincludedir="`eval echo ${oldincludedir}`"
286 eval infodir="`eval echo ${infodir}`"
287 eval mandir="`eval echo ${mandir}`"
288
289 dnl docdir is a recent addition to autotools
290 eval docdir="`eval echo ${docdir}`"
291 if test "x$docdir" = "x"; then
292 docdir="`eval echo ${datadir}/doc`"
293 fi
294 AC_SUBST(docdir)
295
296 dnl Home-grown variables
297 eval INITDIR="${INITDIR}"
298
299 for j in prefix exec_prefix bindir sbindir libexecdir datadir sysconfdir \
300 sharedstatedir localstatedir libdir includedir oldincludedir infodir \
301 mandir INITDIR docdir
302 do
303 dirname=`eval echo '${'${j}'}'`
304 if
305 test ! -d "$dirname"
306 then
307 AC_MSG_WARN([$j directory ($dirname) does not exist!])
308 fi
309 done
310
311 dnl This OS-based decision-making is poor autotools practice;
312 dnl feature-based mechanisms are strongly preferred.
313 dnl
314 dnl So keep this section to a bare minimum; regard as a "necessary evil".
315
316 REBOOT_OPTIONS="-f"
317 POWEROFF_OPTIONS="-f"
318
319 case "$host_os" in
320 *bsd*) LIBS="-L/usr/local/lib"
321 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
322 INIT_EXT=".sh"
323 ;;
324 *solaris*)
325 REBOOT_OPTIONS="-n"
326 POWEROFF_OPTIONS="-n"
327 ;;
328 *linux*)
329 AC_DEFINE_UNQUOTED(ON_LINUX, 1, Compiling for Linux platform)
330 POWEROFF_OPTIONS="-nf"
331 REBOOT_OPTIONS="-nf"
332 ;;
333 darwin*)
334 AC_DEFINE_UNQUOTED(ON_DARWIN, 1, Compiling for Darwin platform)
335 LIBS="$LIBS -L${prefix}/lib"
336 CFLAGS="$CFLAGS -I${prefix}/include"
337 ;;
338 esac
339
340 AC_SUBST(INIT_EXT)
341 AC_DEFINE_UNQUOTED(HA_LOG_FACILITY, LOG_DAEMON, Default logging facility)
342
343 AC_MSG_NOTICE(Host CPU: $host_cpu)
344
345 case "$host_cpu" in
346 ppc64|powerpc64)
347 case $CFLAGS in
348 *powerpc64*) ;;
349 *) if test "$GCC" = yes; then
350 CFLAGS="$CFLAGS -m64"
351 fi ;;
352 esac
353 esac
354
355 AC_MSG_CHECKING(which format is needed to print uint64_t)
356 case "$host_cpu" in
357 s390x)U64T="%lu";;
358 *64*) U64T="%lu";;
359 *) U64T="%llu";;
360 esac
361 AC_MSG_RESULT($U64T)
362 AC_DEFINE_UNQUOTED(U64T, "$U64T", Correct printf format for logging uint64_t)
363
364
365 dnl Variables needed for substitution
366
367 AC_CHECK_HEADERS(heartbeat/glue_config.h)
368
369 if test "$ac_cv_header_heartbeat_glue_config_h" = "yes"; then
370 OCF_ROOT_DIR=`extract_header_define heartbeat/glue_config.h OCF_ROOT_DIR`
371 else
372 enable_libnet=no
373 fi
374
375 AC_DEFINE_UNQUOTED(OCF_ROOT_DIR,"$OCF_ROOT_DIR", OCF root directory - specified by the OCF standard)
376 AC_SUBST(OCF_ROOT_DIR)
377
378 GLUE_STATE_DIR=${localstatedir}/run
379 AC_DEFINE_UNQUOTED(GLUE_STATE_DIR,"$GLUE_STATE_DIR", Where to keep state files and sockets)
380 AC_SUBST(GLUE_STATE_DIR)
381
382 AC_DEFINE_UNQUOTED(HA_VARRUNDIR,"$GLUE_STATE_DIR", Where Heartbeat keeps state files and sockets - old name)
383 HA_VARRUNDIR="$GLUE_STATE_DIR"
384 AC_SUBST(HA_VARRUNDIR)
9a3ad47 @fabbione build: convert to autoconf/automake/libtool
fabbione authored
385
23ef67a @fabbione Merge build systems
fabbione authored
386 # Expand $prefix
387 eval HA_RSCTMPDIR="`eval echo ${HA_RSCTMPDIR}`"
388 AC_DEFINE_UNQUOTED(HA_RSCTMPDIR,"$HA_RSCTMPDIR", Where Resouce agents keep state files)
389 AC_SUBST(HA_RSCTMPDIR)
390
391 dnl Eventually move out of the heartbeat dir tree and create symlinks when needed
392 HA_VARLIBHBDIR=${localstatedir}/lib/heartbeat
393 AC_DEFINE_UNQUOTED(HA_VARLIBHBDIR,"$HA_VARLIBHBDIR", Whatever this used to mean)
394 AC_SUBST(HA_VARLIBHBDIR)
395
396 OCF_RA_DIR="${OCF_ROOT_DIR}/resource.d/"
397 AC_DEFINE_UNQUOTED(OCF_RA_DIR,"$OCF_RA_DIR", Location for OCF RAs)
398 AC_SUBST(OCF_RA_DIR)
399
400 if test "${prefix}" = "/usr"; then
401 OCF_RA_DIR_PREFIX="$OCF_RA_DIR"
402 else
403 OCF_RA_DIR_PREFIX="${prefix}/$OCF_RA_DIR"
404 fi
405 AC_SUBST(OCF_RA_DIR_PREFIX)
406
322b7fc @dmuhamedagic Dev: add OCF_ROOT/lib/heartbeat directory
dmuhamedagic authored
407 OCF_LIB_DIR="${OCF_ROOT_DIR}/lib/"
408 AC_DEFINE_UNQUOTED(OCF_LIB_DIR,"$OCF_LIB_DIR", Location for shared code for OCF RAs)
409 AC_SUBST(OCF_LIB_DIR)
410
1e73ac3 @fabbione Fix make distcheck again after merge
fabbione authored
411 if test "${prefix}" = "/usr"; then
412 OCF_LIB_DIR_PREFIX="$OCF_LIB_DIR"
413 else
414 OCF_LIB_DIR_PREFIX="${prefix}/$OCF_LIB_DIR"
415 fi
416 AC_SUBST(OCF_LIB_DIR_PREFIX)
417
23ef67a @fabbione Merge build systems
fabbione authored
418 dnl ===============================================
419 dnl rgmanager ras bits
420 dnl ===============================================
9a3ad47 @fabbione build: convert to autoconf/automake/libtool
fabbione authored
421
422 LOGDIR=${localstatedir}/log/cluster
423 CLUSTERDATA=${datadir}/cluster
424
425 AC_SUBST([LOGDIR])
426 AC_SUBST([CLUSTERDATA])
427
23ef67a @fabbione Merge build systems
fabbione authored
428 dnl ===============================================
429 dnl Program Paths
430 dnl ===============================================
431
432 PATH="$PATH:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin"
433 export PATH
434
435 AM_PATH_PYTHON
436 AC_CHECK_PROGS(MAKE, gmake make)
437 AC_PATH_PROGS(SSH, ssh, /usr/bin/ssh)
438 AC_PATH_PROGS(SCP, scp, /usr/bin/scp)
439 AC_PATH_PROGS(TAR, tar)
440 AC_PATH_PROGS(MD5, md5)
441 AC_PATH_PROGS(TEST, test)
442 AC_PATH_PROGS(PING, ping, /bin/ping)
443 AC_PATH_PROGS(IFCONFIG, ifconfig, /sbin/ifconfig)
444 AC_PATH_PROGS(MAILCMD, mailx mail, mail)
445 AC_PATH_PROGS(EGREP, egrep)
446 AC_PATH_PROGS(PKGCONFIG, pkg-config)
447
448 AC_SUBST(MAILCMD)
449 AC_SUBST(EGREP)
450 AC_SUBST(SHELL)
451 AC_SUBST(PING)
452 AC_SUBST(TEST)
453
454 AC_PATH_PROGS(ROUTE, route)
455 AC_DEFINE_UNQUOTED(ROUTE, "$ROUTE", path to route command)
456
457 AC_MSG_CHECKING(ifconfig option to list interfaces)
458 for IFCONFIG_A_OPT in "-A" "-a" ""
459 do
460 $IFCONFIG $IFCONFIG_A_OPT > /dev/null 2>&1
461 if
462 test "$?" = 0
463 then
464 AC_DEFINE_UNQUOTED(IFCONFIG_A_OPT, "$IFCONFIG_A_OPT", option for ifconfig command)
465 AC_MSG_RESULT($IFCONFIG_A_OPT)
466 break
467 fi
468 done
469
470 AC_SUBST(IFCONFIG_A_OPT)
471
472 if test x"${MAKE}" = x""; then
473 AC_MSG_ERROR(You need (g)make installed in order to build ${PACKAGE})
474 fi
475
476 dnl ===============================================
477 dnl Libraries
478 dnl ===============================================
479 AC_CHECK_LIB(socket, socket)
480 AC_CHECK_LIB(gnugetopt, getopt_long) dnl if available
481
482 if test x"${PKGCONFIG}" = x""; then
483 AC_MSG_ERROR(You need pkgconfig installed in order to build ${PACKAGE})
484 fi
485
486 if test "x${enable_thread_safe}" = "xyes"; then
487 GPKGNAME="gthread-2.0"
488 else
489 GPKGNAME="glib-2.0"
490 fi
491
492 if
493 $PKGCONFIG --exists $GPKGNAME
494 then
495 GLIBCONFIG="$PKGCONFIG $GPKGNAME"
496 else
497 set -x
498 echo PKG_CONFIG_PATH=$PKG_CONFIG_PATH
499 $PKGCONFIG --exists $GPKGNAME; echo $?
500 $PKGCONFIG --cflags $GPKGNAME; echo $?
501 $PKGCONFIG $GPKGNAME; echo $?
502 set +x
503
504 AC_MSG_ERROR(You need glib2-devel installed in order to build ${PACKAGE})
505 fi
506 AC_MSG_RESULT(using $GLIBCONFIG)
507
508 if test "X$GLIBCONFIG" != X; then
509 AC_MSG_CHECKING(for special glib includes: )
510 GLIBHEAD=`$GLIBCONFIG --cflags`
511 AC_MSG_RESULT($GLIBHEAD)
512 CPPFLAGS="$CPPFLAGS $GLIBHEAD"
513
514 AC_MSG_CHECKING(for glib library flags)
515 GLIBLIB=`$GLIBCONFIG --libs`
516 AC_MSG_RESULT($GLIBLIB)
517 LIBS="$LIBS $GLIBLIB"
518 fi
519
520 dnl ========================================================================
521 dnl Headers
522 dnl ========================================================================
523
524 AC_HEADER_STDC
525 AC_CHECK_HEADERS(sys/socket.h)
526 AC_CHECK_HEADERS(sys/sockio.h)
527 AC_CHECK_HEADERS([arpa/inet.h])
528 AC_CHECK_HEADERS([fcntl.h])
529 AC_CHECK_HEADERS([limits.h])
530 AC_CHECK_HEADERS([malloc.h])
531 AC_CHECK_HEADERS([netdb.h])
532 AC_CHECK_HEADERS([netinet/in.h])
533 AC_CHECK_HEADERS([sys/file.h])
534 AC_CHECK_HEADERS([sys/ioctl.h])
535 AC_CHECK_HEADERS([sys/param.h])
536 AC_CHECK_HEADERS([sys/time.h])
537 AC_CHECK_HEADERS([syslog.h])
538
539 dnl ========================================================================
540 dnl Functions
541 dnl ========================================================================
542
543 AC_FUNC_FORK
544 AC_FUNC_STRNLEN
545 AC_CHECK_FUNCS([alarm gettimeofday inet_ntoa memset mkdir socket uname])
546 AC_CHECK_FUNCS([strcasecmp strchr strdup strerror strrchr strspn strstr strtol strtoul])
547
548 dnl 'reboot()' system call: one argument (e.g. Linux) or two (e.g. Solaris)?
549 dnl
550 AC_CACHE_CHECK([number of arguments in reboot system call],
551 ac_cv_REBOOT_ARGS,[
552 AC_TRY_COMPILE(
553 [#include <sys/reboot.h>],
554 [(void)reboot(0);],
555 ac_cv_REBOOT_ARGS=1,
556 [AC_TRY_COMPILE(
557 [#include <sys/reboot.h>],
558 [(void)reboot(0,(void *)0);],
559 ac_cv_REBOOT_ARGS=2,
560 ac_cv_REBOOT_ARGS=0
561 )],
562 ac_cv_REBOOT_ARGS=0
563 )
564 ]
565 )
566 dnl Argument count of 0 suggests no known 'reboot()' call.
567 if test "$ac_cv_REBOOT_ARGS" -ge "1"; then
568 AC_DEFINE_UNQUOTED(REBOOT_ARGS,$ac_cv_REBOOT_ARGS,[number of arguments for reboot system call])
569 fi
570
571 AC_PATH_PROGS(REBOOT, reboot, /sbin/reboot)
572 AC_SUBST(REBOOT)
573 AC_SUBST(REBOOT_OPTIONS)
574 AC_DEFINE_UNQUOTED(REBOOT, "$REBOOT", path to the reboot command)
575 AC_DEFINE_UNQUOTED(REBOOT_OPTIONS, "$REBOOT_OPTIONS", reboot options)
576
577 AC_PATH_PROGS(POWEROFF_CMD, poweroff, /sbin/poweroff)
578 AC_SUBST(POWEROFF_CMD)
579 AC_SUBST(POWEROFF_OPTIONS)
580 AC_DEFINE_UNQUOTED(POWEROFF_CMD, "$POWEROFF_CMD", path to the poweroff command)
581 AC_DEFINE_UNQUOTED(POWEROFF_OPTIONS, "$POWEROFF_OPTIONS", poweroff options)
582
583 AC_PATH_PROGS(XSLTPROC, xsltproc)
584 AM_CONDITIONAL(BUILD_DOC, test "x$XSLTPROC" != "x" )
585 if test "x$XSLTPROC" = "x"; then
586 AC_MSG_WARN([xsltproc not installed, unable to (re-)build manual pages])
587 fi
588 AC_SUBST(XSLTPROC)
589
590 AC_PATH_PROGS(POD2MAN, pod2man)
591 AM_CONDITIONAL(BUILD_POD_DOC, test "x$POD2MAN" != "x" )
592 if test "x$POD2MAN" = "x"; then
593 AC_MSG_WARN([pod2man not installed, unable to (re-)build ldirector manual page])
594 fi
595 AC_SUBST(POD2MAN)
596
597 dnl ========================================================================
598 dnl Functions
599 dnl ========================================================================
600
601 AC_CHECK_FUNCS(getopt, AC_DEFINE(HAVE_DECL_GETOPT, 1, [Have getopt function]))
602
603 dnl ========================================================================
604 dnl sfex
605 dnl ========================================================================
606
607 build_sfex=no
608 case $host_os in
609 *Linux*|*linux*)
610 if test "$ac_cv_header_heartbeat_glue_config_h" = "yes"; then
611 build_sfex=yes
612 fi
613 ;;
614 esac
615
616 AM_CONDITIONAL(BUILD_SFEX, test "$build_sfex" = "yes" )
617
618
619 dnl ========================================================================
620 dnl tickle (needs port to BSD platforms)
621 dnl ========================================================================
622
623 AC_CHECK_MEMBERS([struct iphdr.saddr],,,[[#include <netinet/ip.h>]])
624 AM_CONDITIONAL(BUILD_TICKLE, test "$ac_cv_member_struct_iphdr_saddr" = "yes" )
625
626 dnl ========================================================================
627 dnl libnet
628 dnl ========================================================================
629
630 libnet=""
631 libnet_version="none"
632 LIBNETLIBS=""
633 LIBNETDEFINES=""
634
635 AC_MSG_CHECKING(if libnet is required)
636 libnet_fatal=$enable_libnet
637 case $enable_libnet in
638 no) ;;
639 yes|libnet10|libnet11|10|11) libnet_fatal=yes;;
640 try)
641 case $host_os in
642 *Linux*|*linux*) libnet_fatal=no;;
643 *) libnet_fatal=yes;; dnl legacy behavior
644 esac
645 ;;
646 *) libnet_fatal=yes; enable_libnet=try;;
647 esac
648 AC_MSG_RESULT($libnet_fatal)
649
650 if test "x$enable_libnet" != "xno"; then
651 AC_PATH_PROGS(LIBNETCONFIG, libnet-config)
652
653 AC_CHECK_LIB(nsl, t_open) dnl -lnsl
654 AC_CHECK_LIB(socket, socket) dnl -lsocket
655 AC_CHECK_LIB(net, libnet_get_hwaddr, LIBNETLIBS=" -lnet", [])
656 fi
657
658 AC_MSG_CHECKING(for libnet)
659 if test "x$LIBNETLIBS" != "x" -o "x$enable_libnet" = "xlibnet11"; then
660 LIBNETDEFINES=""
661 if test "$ac_cv_lib_nsl_t_open" = yes; then
662 LIBNETLIBS="-lnsl $LIBNETLIBS"
663 fi
664 if test "$ac_cv_lib_socket_socket" = yes; then
665 LIBNETLIBS="-lsocket $LIBNETLIBS"
666 fi
667
668 libnet=net
669 libnet_version="libnet1.1"
670 fi
671
672 if test "x$enable_libnet" = "xtry" -o "x$enable_libnet" = "xlibnet10"; then
673 if test "x$LIBNETLIBS" = x -a "x${LIBNETCONFIG}" != "x" ; then
674 LIBNETDEFINES="`$LIBNETCONFIG --defines` `$LIBNETCONFIG --cflags`";
675 LIBNETLIBS="`$LIBNETCONFIG --libs`";
676 libnet_version="libnet1.0 (old)"
677 case $LIBNETLIBS in
678 *-l*) libnet=`echo $LIBNETLIBS | sed 's%.*-l%%'`;;
679 *) libnet_version=none;;
680 esac
681
682 CPPFLAGS="$CPPFLAGS $LIBNETDEFINES"
683
684 AC_CHECK_HEADERS(libnet.h)
685 if test "$ac_cv_header_libnet_h" = no; then
686 libnet_version=none
687 fi
688 fi
689 fi
690 AC_MSG_RESULT(found $libnet_version)
691
692 if test "$libnet_version" = none; then
693 LIBNETLIBS=""
694 LIBNETDEFINES=""
695 if test $libnet_fatal = yes; then
696 AC_MSG_ERROR(libnet not found)
697 fi
698
699 else
700 AC_CHECK_LIB($libnet,libnet_init,
701 [new_libnet=yes; AC_DEFINE(HAVE_LIBNET_1_1_API, 1, Libnet 1.1 API)],
702 [new_libnet=no; AC_DEFINE(HAVE_LIBNET_1_0_API, 1, Libnet 1.0 API)],$LIBNETLIBS)
703 AC_SUBST(LIBNETLIBS)
704 fi
705
706 if test "$new_libnet" = yes; then
707 AC_MSG_CHECKING(for libnet API 1.1.4: )
708 save_CFLAGS="$CFLAGS"
709 CFLAGS="$CFLAGS -fgnu89-inline -Wall -Werror"
710 AC_COMPILE_IFELSE([#include <libnet.h>
711 int main(){libnet_t *l=NULL; libnet_pblock_record_ip_offset(l, l->total_size); return(0); }],
712 [AC_MSG_RESULT(no)],
713 [AC_DEFINE(HAVE_LIBNET_1_1_4_API, 1, Libnet 1.1.4 API) AC_MSG_RESULT(yes)])
714 CFLAGS="$save_CFLAGS"
715 fi
716
717 sendarp_linux=0
718 case $host_os in
719 *Linux*|*linux*) sendarp_linux=1;;
720 esac
721
722 AC_SUBST(LIBNETLIBS)
723 AC_SUBST(LIBNETDEFINES)
724
725 AM_CONDITIONAL(SENDARP_LINUX, test $sendarp_linux = 1 )
726 AM_CONDITIONAL(USE_LIBNET, test "x$libnet_version" != "xnone" )
727
728 dnl ************************************************************************
729 dnl * Check for netinet/icmp6.h to enable the IPv6addr resource agent
730 AC_CHECK_HEADERS(netinet/icmp6.h,[],[],[#include <sys/types.h>])
731 AM_CONDITIONAL(USE_IPV6ADDR, test "$ac_cv_header_netinet_icmp6_h" = yes )
732
733 dnl ========================================================================
734 dnl Compiler flags
735 dnl ========================================================================
736
737 dnl Make sure that CFLAGS is not exported. If the user did
738 dnl not have CFLAGS in their environment then this should have
739 dnl no effect. However if CFLAGS was exported from the user's
740 dnl environment, then the new CFLAGS will also be exported
741 dnl to sub processes.
742
743 CC_ERRORS=""
744 CC_EXTRAS=""
745
746 if export | fgrep " CFLAGS=" > /dev/null; then
747 export -n CFLAGS || true # We don't want to bomb out if this fails
748 SAVED_CFLAGS="$CFLAGS"
749 unset CFLAGS
750 CFLAGS="$SAVED_CFLAGS"
751 unset SAVED_CFLAGS
752 fi
753
754 if test "$GCC" != yes; then
755 CFLAGS="$CFLAGS -g"
756 enable_fatal_warnings=no
757 else
6dad11c @fabbione build: drop -O0 in default CFLAGS
fabbione authored
758 CFLAGS="$CFLAGS -ggdb3"
23ef67a @fabbione Merge build systems
fabbione authored
759
760 # We had to eliminate -Wnested-externs because of libtool changes
761 # Also remove -Waggregate-return because we use one libnet
762 # call which returns a struct
763 EXTRA_FLAGS="-fgnu89-inline
764 -fstack-protector-all
765 -Wall
766 -Wbad-function-cast
767 -Wcast-qual
768 -Wcast-align
769 -Wdeclaration-after-statement
770 -Wendif-labels
771 -Wfloat-equal
772 -Wformat=2
773 -Wformat-security
774 -Wformat-nonliteral
775 -Winline
776 -Wmissing-prototypes
777 -Wmissing-declarations
778 -Wmissing-format-attribute
779 -Wnested-externs
780 -Wno-long-long
781 -Wno-strict-aliasing
782 -Wpointer-arith
783 -Wstrict-prototypes
784 -Wunsigned-char
785 -Wwrite-strings"
786
787 # Additional warnings it might be nice to enable one day
788 # -Wshadow
789 # -Wunreachable-code
790
791 for j in $EXTRA_FLAGS
792 do
793 if
794 cc_supports_flag $j
795 then
796 CC_EXTRAS="$CC_EXTRAS $j"
797 fi
798 done
799
800 dnl In lib/ais/Makefile.am there's a gcc option available as of v4.x
801
802 GCC_MAJOR=`gcc -v 2>&1 | awk 'END{print $3}' | sed 's/[.].*//'`
803 AM_CONDITIONAL(GCC_4, test "${GCC_MAJOR}" = 4)
804
805 dnl System specific options
806
807 case "$host_os" in
808 *linux*|*bsd*)
809 if test "${enable_fatal_warnings}" = "unknown"; then
810 enable_fatal_warnings=yes
811 fi
812 ;;
813 esac
814
815 if test "x${enable_fatal_warnings}" != xno && cc_supports_flag -Werror ; then
816 enable_fatal_warnings=yes
817 else
818 enable_fatal_warnings=no
819 fi
820
821 if test "x${enable_ansi}" != xno && cc_supports_flag -std=iso9899:199409 ; then
822 AC_MSG_NOTICE(Enabling ANSI Compatibility)
823 CC_EXTRAS="$CC_EXTRAS -ansi -D_GNU_SOURCE -DANSI_ONLY"
824 fi
825
826 AC_MSG_NOTICE(Activated additional gcc flags: ${CC_EXTRAS})
827 fi
828
829 CFLAGS="$CFLAGS $CC_EXTRAS"
830
831 NON_FATAL_CFLAGS="$CFLAGS"
832 AC_SUBST(NON_FATAL_CFLAGS)
833
834 dnl
835 dnl We reset CFLAGS to include our warnings *after* all function
836 dnl checking goes on, so that our warning flags don't keep the
837 dnl AC_*FUNCS() calls above from working. In particular, -Werror will
838 dnl *always* cause us troubles if we set it before here.
839 dnl
840 dnl
841 if test "x${enable_fatal_warnings}" = xyes ; then
842 AC_MSG_NOTICE(Enabling Fatal Warnings)
843 CFLAGS="$CFLAGS -Werror"
844 fi
845 AC_SUBST(CFLAGS)
846
847 dnl This is useful for use in Makefiles that need to remove one specific flag
848 CFLAGS_COPY="$CFLAGS"
849 AC_SUBST(CFLAGS_COPY)
850
851 AC_SUBST(LOCALE)
852
853 AC_SUBST(CC)
854 AC_SUBST(MAKE)
855
856 dnl The Makefiles and shell scripts we output
857 AC_CONFIG_FILES(Makefile \
858 include/Makefile \
859 heartbeat/Makefile \
322b7fc @dmuhamedagic Dev: add OCF_ROOT/lib/heartbeat directory
dmuhamedagic authored
860 heartbeat/ocf-binaries \
861 heartbeat/ocf-directories \
23ef67a @fabbione Merge build systems
fabbione authored
862 heartbeat/ocf-shellfuncs \
863 heartbeat/shellfuncs \
864 tools/Makefile \
865 tools/ocf-tester \
866 tools/ocft/Makefile \
867 tools/ocft/ocft \
868 tools/ocft/caselib \
869 tools/ocft/README \
870 tools/ocft/README.zh_CN \
871 ldirectord/Makefile \
872 ldirectord/ldirectord \
873 ldirectord/init.d/Makefile \
874 ldirectord/init.d/ldirectord \
875 ldirectord/init.d/ldirectord.debian \
876 ldirectord/init.d/ldirectord.debian.default \
877 ldirectord/logrotate.d/Makefile \
878 ldirectord/OCF/Makefile \
879 ldirectord/OCF/ldirectord \
880 doc/Makefile \
361fec2 @fghaas doc: move man page generation to doc/man
fghaas authored
881 doc/man/Makefile \
23ef67a @fabbione Merge build systems
fabbione authored
882 rgmanager/Makefile \
883 rgmanager/src/Makefile \
884 rgmanager/src/resources/Makefile \
885 rgmanager/src/resources/utils/Makefile \
886 )
887
888 dnl Now process the entire list of files added by previous
889 dnl calls to AC_CONFIG_FILES()
890 AC_OUTPUT()
891
892 dnl *****************
893 dnl Configure summary
894 dnl *****************
895
896 AC_MSG_RESULT([])
897 AC_MSG_RESULT([$PACKAGE configuration:])
24cc10d @fabbione build: drop concept of BUILD_VERSION
fabbione authored
898 AC_MSG_RESULT([ Version = ${VERSION}])
2136d6e @fabbione add --with-ras-set option to exclude/include rgmanager/linux-ha agents
fabbione authored
899 AC_MSG_RESULT([ Build Version = $Format:%H$])
23ef67a @fabbione Merge build systems
fabbione authored
900 AC_MSG_RESULT([ Features =${PKG_FEATURES}])
901 AC_MSG_RESULT([])
902 AC_MSG_RESULT([ Prefix = ${prefix}])
903 AC_MSG_RESULT([ Executables = ${sbindir}])
904 AC_MSG_RESULT([ Man pages = ${mandir}])
905 AC_MSG_RESULT([ Libraries = ${libdir}])
906 AC_MSG_RESULT([ Header files = ${includedir}])
907 AC_MSG_RESULT([ Arch-independent files = ${datadir}])
908 AC_MSG_RESULT([ Documentation = ${docdir}])
909 AC_MSG_RESULT([ State information = ${localstatedir}])
910 AC_MSG_RESULT([ System configuration = ${sysconfdir}])
911 AC_MSG_RESULT([ RA state files = ${HA_RSCTMPDIR}])
912 AC_MSG_RESULT([ AIS Plugins = ${LCRSODIR}])
913 AC_MSG_RESULT([])
914 AC_MSG_RESULT([ CFLAGS = ${CFLAGS}])
915 AC_MSG_RESULT([ Libraries = ${LIBS}])
916 AC_MSG_RESULT([ Stack Libraries = ${CLUSTERLIBS}])
9a3ad47 @fabbione build: convert to autoconf/automake/libtool
fabbione authored
917
Something went wrong with that request. Please try again.