Complain if we can't find /lib/modules/`uname -r`/build/Makefile.
[platform/upstream/sysprof.git] / configure.ac
1 AC_PREREQ(2.54)
2
3 AC_INIT([sysprof], [0.91])
4 AC_CONFIG_SRCDIR(sysprof.glade)
5
6 AM_INIT_AUTOMAKE(no-define)
7
8 AM_CONFIG_HEADER(config.h)
9
10 AC_PROG_CC
11 AC_PROG_INSTALL
12
13 changequote(,)dnl
14 if test "x$GCC" = "xyes"; then
15   case " $CFLAGS " in
16   *[\ \ ]-Wall[\ \      ]*) ;;
17   *) CFLAGS="$CFLAGS -Wall" ;;
18   esac
19 fi
20 changequote([,])dnl
21
22 debugdir=${libdir}/debug
23
24 # Separate debug dir
25          
26 dnl written by Guido Draheim <guidod@gmx.de>, original by Alexandre Oliva 
27 dnl Version 1.3 (2001/03/02)
28 dnl source http://www.gnu.org/software/ac-archive/Miscellaneous/ac_define_dir.html
29
30 AC_DEFUN([AC_DEFINE_DIR], [
31   test "x$prefix" = xNONE && prefix="$ac_default_prefix"
32   test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
33   ac_define_dir=`eval echo [$]$2`
34   ac_define_dir=`eval echo [$]ac_define_dir`
35   ifelse($3, ,
36     AC_DEFINE_UNQUOTED($1, "$ac_define_dir"),
37     AC_DEFINE_UNQUOTED($1, "$ac_define_dir", $3))
38 ])
39
40 AC_ARG_WITH(separate-debug-dir,
41 [  --with-separate-debug-dir=path   Look for global separate debug info in this path [LIBDIR/debug]],
42 [debugdir="${withval}"])
43         
44 AC_DEFINE_DIR(DEBUGDIR, debugdir,
45               [Look for global separate debug info in this path])
46
47 # Pkgconfig dependencies
48         
49 dep_modules="gtk+-2.0 > 2.6.0 gthread-2.0 gdk-pixbuf-2.0 pangoft2 libglade-2.0"
50
51 PKG_CHECK_MODULES(DEP, $dep_modules, [],
52                   AC_MSG_ERROR([sysprof dependencies not satisfied]))
53
54 # libiberty and libbfd
55
56 AC_CHECK_LIB(iberty, cplus_demangle,:, 
57   AC_CHECK_LIB(iberty, cplus_demangle_opname, [],
58     AC_MSG_ERROR([libiberty is required to compile sysprof]), -ldl))
59
60 AC_CHECK_LIB(bfd, bfd_get_error, [DEP_LIBS="$DEP_LIBS -lbfd -liberty"],
61   AC_MSG_ERROR([libbfd is required to compile sysprof]),
62   -liberty)
63
64
65 # emit files
66
67 AC_SUBST(DEP_LIBS)
68
69 AC_CONFIG_FILES([
70 Makefile
71 ])
72
73 # Kernel version
74
75 KMAJOR=`uname -r | cut -d"." -f 1`
76 KMINOR=`uname -r | cut -d"." -f 2`
77 KMICRO=`uname -r | cut -d"." -f 3 | cut -d"-" -f 1`
78
79 if [[ $KMICRO -lt 11 ]] ; then
80    echo *
81    echo * Linux \>= 2.6.11 is required
82    echo *
83    exit 1
84 fi
85
86 if [ ! test -f /lib/modules/`uname -r`/build/Makefile ] ; then
87    echo \*
88    echo \* Sysprof requires the kernel source code to be installed.
89    echo \* On a Fedora Core system the relevant package is kernel-devel
90    echo \*
91    exit 1
92 fi
93
94 AC_OUTPUT