Ksplice 0.9.0
[ksplice.git] / configure.ac
blobb7a1fcedadbe63ed1c4d317af836ba4248165738
1 AC_INIT(Ksplice, 0.9.0, ksplice@mit.edu)
3 dnl The author of Ksplice learned how to configure libbfd by looking at
4 dnl elf2flt, which is available under the GNU General Public License.
6 AC_ARG_WITH(libbfd,
7   [  --with-libbfd=FILE      path to libbfd.a ],
8   [ ac_libbfd=$withval ],
9   [ ac_libbfd=NONE ]
12 AC_ARG_WITH(libiberty,
13   [  --with-libiberty=FILE   path to libiberty.a ],
14   [ ac_libiberty=$withval ],
15   [ ac_libiberty=NONE ]
18 AC_ARG_WITH(bfd-include-dir,
19   [  --with-bfd-include-dir=DIR
20                           path to directory containing bfd.h ],
21   [ ac_bfd_include_dir=$withval ],
22   [ ac_bfd_include_dir=NONE ]
25 AC_PROG_CC
26 AC_CHECK_HEADERS(bfd.h,, BFD_H="no")
28 if test "$ac_libiberty" = "NONE"; then
29   AC_CHECK_LIB(iberty, objalloc_create)
30   ac_libiberty=auto
31 else
32   LIBS="$ac_libiberty $LIBS"
34 if test "$ac_libbfd" = "NONE"; then
35   AC_CHECK_LIB(bfd, bfd_openr)
36   ac_libbfd=auto
37 else
38   LIBS="$ac_libbfd $LIBS"
41 if test "$ac_bfd_include_dir" != "NONE"; then
42   CPPFLAGS="$CPPFLAGS -I$ac_bfd_include_dir"
45 AC_CHECK_MEMBER(struct bfd_hash_table.entsize,
46   [CPPFLAGS="$CPPFLAGS -DBFD_HASH_TABLE_HAS_ENTSIZE"],
47   [],
48   [[#include <bfd.h>]]
51 if ! test -e "objdiff-static" || ! test -e "objmanip-static"; then
52   if test "$ac_libbfd" = "NONE" || test "$ac_libiberty" = "NONE"; then
53     echo
54     echo "Ksplice could not locate libbfd.a and/or libiberty.a on your system."
55     echo "You can obtain these libraries from the GNU binutils collection."
56     echo "These libraries are available on many Linux distributions as a"
57     echo "package called 'binutils-dev' or 'binutils-devel'."
58     echo "If your distribution does not provide GNU binutils, you can install"
59     echo "GNU binutils from source -- see http://www.gnu.org/software/binutils/."
60     echo
61     echo "If these libraries are already installed on your system, then you need"
62     echo "to tell Ksplice where to find them by running configure again:"
63     echo
64     echo "  ./configure --with-libbfd=<libbfd.a> --with-libiberty=<libiberty.a>"
65     echo
66     exit 1
67   fi
69   if test "$BFD_H" = "no"; then
70     echo
71     echo "Ksplice could not locate bfd.h on your system."
72     echo "If this header file is already installed on your system, then you need"
73     echo "to tell Ksplice where to find it by running configure again:"
74     echo
75     echo "  ./configure --with-bfd-include-dir=<directory-containing-bfd.h>"
76     echo
77     exit 1
78   fi
81 AC_PATH_PROG(PATCH, patch)
82 AC_PATH_PROG(POD2MAN, pod2man)
83 if test "$PATCH" = ""; then
84   echo
85   echo "Ksplice could not locate patch on your system."
86   echo
87   exit 1
89 if test "$POD2MAN" = ""; then
90   echo
91   echo "Ksplice could not locate pod2man on your system."
92   echo
93   exit 1
96 AC_PROG_PERL_MODULES(Cwd,,AC_MSG_ERROR(Required perl module Cwd not found))
97 AC_PROG_PERL_MODULES(Pod::Usage,,AC_MSG_ERROR(Required perl module Pod::Usage not found))
98 AC_PROG_PERL_MODULES(File::Temp,,AC_MSG_ERROR(Required perl module File::Temp not found))
100 AC_CONFIG_FILES([Makefile kmodsrc/Makefile])
101 AC_OUTPUT