~cbehrens/openstack-guest-agents/lp764221

« back to all changes in this revision

Viewing changes to src/unix/configure.ac

  • Committer: Chris Behrens
  • Date: 2011-04-13 20:03:06 UTC
  • mfrom: (2.1.61 unix-agent-dev)
  • Revision ID: cbehrens@codestud.com-20110413200306-tbd1fdrjdy0yjy2c
MergedĀ lp:~rackspace-ozone/openstack-guest-agents/unix-agent-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
AC_PREREQ([2.59])
 
2
AC_INIT([nova-agent], [0.0.1.2], [chris.behrens@rackspace.com])
 
3
AC_CONFIG_SRCDIR([src/nova-agent.c])
 
4
AC_CONFIG_HEADERS([include/config.h])
 
5
 
 
6
AM_INIT_AUTOMAKE([foreign -Wall -Werror tar-ustar])
 
7
 
 
8
AC_PREFIX_DEFAULT([/usr])
 
9
 
 
10
AC_ARG_ENABLE([coverage],
 
11
  [AS_HELP_STRING([--enable-coverage],
 
12
    [Toggle coverage @<:@default=off@:>@])],
 
13
  [ac_coverage="$enableval"],
 
14
  [ac_coverage="no"])
 
15
 
 
16
AS_IF([test "$ac_coverage" = "yes"],
 
17
  [
 
18
    GCOV_CFLAGS="-fprofile-arcs -ftest-coverage -lgcov -O0"
 
19
  ])
 
20
 
 
21
 
 
22
AC_PROG_CC
 
23
AM_PROG_CC_C_O
 
24
AC_PROG_LIBTOOL
 
25
AC_CONFIG_MACRO_DIR([m4])
 
26
 
 
27
missing() {
 
28
    what="$1"
 
29
    echo ""
 
30
    echo "The $what is missing and is required for building"
 
31
    echo ""
 
32
}
 
33
 
 
34
if test "$PYTHON_CFLAGS" = "" -a "$PYTHON_LIB" = ""; then
 
35
    AC_MSG_CHECKING([for python build requisites])
 
36
 
 
37
    for python in "python2.7" "python2.6" "python2.5" "python2.4" ; do
 
38
        for dir in $prefix "/usr/local" "/usr"; do
 
39
            if test -f ${dir}/include/${python}/Python.h ; then
 
40
                if test -f ${dir}/lib/lib${python}.so ; then
 
41
                    # We're done.  Found header and library
 
42
                    PYTHON_VER=${python}
 
43
                    PYTHON_CFLAGS="-I${dir}/include/${python}"
 
44
                    PYTHON_LIB="-l${python}"
 
45
                    break
 
46
                fi
 
47
            fi
 
48
        done
 
49
    done
 
50
 
 
51
    if test "x${PYTHON_CFLAGS}" = "x" ; then
 
52
        AC_MSG_RESULT([not found])
 
53
    else
 
54
        AC_MSG_RESULT([adding ${PYTHON_CFLAGS} and ${PYTHON_LIB}])
 
55
    fi
 
56
fi
 
57
 
 
58
AC_MSG_CHECKING([that the python library can be linked])
 
59
 
 
60
SAVE_CFLAGS=$CFLAGS
 
61
SAVE_LIBS=$LIBS
 
62
 
 
63
CFLAGS="$CFLAGS $PYTHON_CFLAGS"
 
64
LIBS="$LIBS $PYTHON_LIB"
 
65
 
 
66
AC_TRY_LINK([#include <Python.h>], [
 
67
int main(int argc, char **argv)
 
68
{
 
69
    Py_Main(argc, argv);
 
70
}
 
71
], [AC_MSG_RESULT([yes])], [
 
72
 
 
73
    AC_MSG_RESULT([no])
 
74
    AC_MSG_RESULT([])
 
75
    AC_MSG_RESULT([A working python header and/or library could not be found])
 
76
    AC_MSG_RESULT([Re-run configure specifying PYTHON_CFLAGS and PYTHON_LIB])
 
77
    AC_MSG_RESULT([and/or CFLAGS and LDFLAGS correctly])
 
78
 
 
79
    exit 1
 
80
 
 
81
    ])
 
82
 
 
83
LIBS=$SAVE_LIBS
 
84
CFLAGS=$SAVE_CFLAGS
 
85
 
 
86
AC_CHECK_PROG([PATCHELF], [patchelf], [yes])
 
87
if test "$PATCHELF" != "yes"; then
 
88
    missing "patchelf"
 
89
    exit 1
 
90
fi
 
91
 
 
92
AC_CHECK_LIB([pthread], [pthread_create], [], [
 
93
    missing "the pthread library"
 
94
    exit 1
 
95
])
 
96
 
 
97
DESTDIR="/"
 
98
 
 
99
AC_SUBST([GCOV_CFLAGS])
 
100
AC_SUBST([PYTHON_VER])
 
101
AC_SUBST([PYTHON_CFLAGS])
 
102
AC_SUBST([PYTHON_LIB])
 
103
AC_SUBST([DESTDIR])
 
104
 
 
105
AC_CONFIG_FILES([Makefile
 
106
                 src/Makefile
 
107
                 lib/Makefile
 
108
                 plugins/Makefile
 
109
                 commands/Makefile
 
110
                 tests/Makefile
 
111
                 scripts/installer.sh
 
112
                 ])
 
113
 
 
114
AC_OUTPUT
 
115