Makefile.ksplice: Rewrite ksplice-cow-check as a wrapper function.
[ksplice.git] / configure.ac
blobd7a5f6fcbedd1a465d0352c9dfae10c4f961e94a
1 AC_INIT([Ksplice], [0.9.8], [devel@ksplice.com])
2 AC_SUBST([KSPLICE_API_VERSION], [2])
4 AC_ARG_WITH([libbfd],
5   [  --with-libbfd=FILE      path to libbfd.a],
6   [ac_libbfd=$withval],
7   [ac_libbfd=NONE])
9 AC_ARG_WITH([libiberty],
10   [  --with-libiberty=FILE   path to libiberty.a],
11   [ac_libiberty=$withval],
12   [ac_libiberty=NONE])
14 AC_ARG_WITH([libz],
15   [  --with-libz=FILE        path to libz.a],
16   [ac_libz=$withval],
17   [ac_libz=NONE])
19 AC_ARG_WITH([bfd-include-dir],
20   [  --with-bfd-include-dir=DIR
21                           path to directory containing bfd.h],
22   [ac_bfd_include_dir=$withval],
23   [ac_bfd_include_dir=NONE])
25 AC_PROG_CC
27 if test "$ac_libz" = "NONE"; then
28   AC_CHECK_LIB([z], [zlibVersion])
29 else
30   LIBS="$ac_libz $LIBS"
32 if test "$ac_libiberty" = "NONE"; then
33   AC_CHECK_LIB([iberty], [objalloc_create])
34 else
35   LIBS="$ac_libiberty $LIBS"
37 if test "$ac_libbfd" = "NONE"; then
38   ac_libbfd=auto
39   AC_CHECK_LIB([bfd], [bfd_openr], , [ac_libbfd=NONE])
40 else
41   LIBS="$ac_libbfd $LIBS"
44 if test "$ac_bfd_include_dir" != "NONE"; then
45   CPPFLAGS="$CPPFLAGS -I$ac_bfd_include_dir"
48 AC_CHECK_HEADERS([bfd.h], , [BFD_H="no"])
50 AC_CHECK_MEMBER([struct bfd_hash_table.entsize],
51   [CPPFLAGS="$CPPFLAGS -DBFD_HASH_TABLE_HAS_ENTSIZE"],
52   [],
53   [[#include <bfd.h>]])
55 if ! test -e "objmanip-static"; then
56   if test "$ac_libbfd" = "NONE"; then
57     echo
58     echo "Ksplice could not locate libbfd.a and/or libiberty.a on your system."
59     echo "You can obtain these libraries from the GNU binutils collection."
60     echo "These libraries are available on many Linux distributions as a"
61     echo "package called 'binutils-dev' or 'binutils-devel'."
62     echo "If your distribution does not provide GNU binutils, you can install"
63     echo "GNU binutils from source -- see http://www.gnu.org/software/binutils/."
64     echo
65     echo "If these libraries are already installed on your system, then you need"
66     echo "to tell Ksplice where to find them by running configure again:"
67     echo
68     echo "  ./configure --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>"
69     echo
70     echo "Depending on the host system you may also need to provide zlib:"
71     echo
72     echo "  ./configure ... --with-libz=<libz.a>"
73     echo
74     exit 1
75   fi
77   if test "$BFD_H" = "no"; then
78     echo
79     echo "Ksplice could not locate bfd.h on your system."
80     echo "If this header file is already installed on your system, then you need"
81     echo "to tell Ksplice where to find it by running configure again:"
82     echo
83     echo "  ./configure --with-bfd-include-dir=<directory-containing-bfd.h>"
84     echo
85     exit 1
86   fi
89 AC_PATH_PROG([PATCH], [patch])
90 AC_PATH_PROG([POD2MAN], [pod2man])
91 if test "$PATCH" = ""; then
92   echo
93   echo "Ksplice could not locate patch on your system."
94   echo
95   exit 1
97 if test "$POD2MAN" = ""; then
98   echo
99   echo "Ksplice could not locate pod2man on your system."
100   echo
101   exit 1
104 AC_PROG_PERL_MODULES([Cwd Getopt::Long File::Basename File::Copy File::Path File::Spec::Functions File::Temp Fatal IPC::Open2 IPC::Open3 Pod::Usage Text::ParseWords], ,
105   [AC_MSG_ERROR([Missing some required perl modules])])
107 AC_CONFIG_FILES([Makefile kmodsrc/Makefile])
108 AC_OUTPUT