~ubuntu-branches/ubuntu/maverick/cluster-agents/maverick-proposed

« back to all changes in this revision

Viewing changes to configure.in

  • Committer: Bazaar Package Importer
  • Author(s): Ante Karamatic
  • Date: 2010-02-17 21:46:00 UTC
  • Revision ID: james.westby@ubuntu.com-20100217214600-g44grvtkw7jbpciz
Tags: upstream-1.0.2
ImportĀ upstreamĀ versionĀ 1.0.2

Show diffs side-by-side

added added

removed removed

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