+2005-11-03 Soren Sandmann <sandmann@redhat.com>
[platform/upstream/sysprof.git] / configure.ac
1 AC_PREREQ(2.54)
2
3 AC_INIT([sysprof], [1.1.0])
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 AC_ARG_ENABLE(kernel-module,
48      AC_HELP_STRING(--disable-kernel-module, disable building kernel module))
49
50 kernel_module="yes"
51 if test "x$enableval" = "xno"; then
52         kernel_module="no"
53 fi
54
55 if test $kernel_module = "yes"; then
56   # Activate build in module/ subdir
57   MODULE_SUBDIR=module
58   
59   # Kernel version
60   KMAJOR=`uname -r | cut -d"." -f 1`
61   KMINOR=`uname -r | cut -d"." -f 2`
62   KMICRO=`uname -r | cut -d"." -f 3 | cut -d"-" -f 1`
63
64   if [[ $KMICRO -lt 11 ]] ; then
65      echo *
66      echo * Linux \>= 2.6.11 is required
67      echo *
68      exit 1
69   fi
70
71   if [ ! test -f /lib/modules/`uname -r`/build/Makefile ] ; then
72      case `uname -r` in
73      *smp) pkg=kernel-smp-devel ;;
74      *) pkg=kernel-devel ;;
75      esac
76      echo \*
77      echo \* Sysprof requires the kernel source code to be installed.
78      echo \* On a Fedora Core system the relevant package is $pkg
79      echo \*
80      exit 1
81   fi
82 fi
83
84 # Pkgconfig dependencies
85
86 core_dep="glib-2.0"
87 gui_dep="gtk+-2.0 > 2.6.0 gdk-pixbuf-2.0 pangoft2 libglade-2.0"
88
89 PKG_CHECK_MODULES(CORE_DEP, $core_dep, [],
90                   AC_MSG_ERROR([sysprof dependencies not satisfied]))
91
92 PKG_CHECK_MODULES(GUI_DEP, $gui_dep, [],
93                   AC_MSG_ERROR([sysprof dependencies not satisfied]))
94
95 # libiberty and libbfd
96
97 AC_CHECK_LIB(iberty, cplus_demangle,:, 
98   AC_CHECK_LIB(iberty, cplus_demangle_opname, [],
99     AC_MSG_ERROR([libiberty is required to compile sysprof]), -ldl))
100
101 AC_CHECK_LIB(bfd, bfd_get_error,,
102   AC_MSG_ERROR([libbfd is required to compile sysprof]),
103   -liberty)
104
105 CORE_DEP_LIBS="$CORE_DEP_LIBS -lbfd -liberty"
106 GUI_DEP_LIBS="$GUI_DEP_LIBS -lbfd -liberty"
107
108 # emit files
109
110 AC_SUBST(CORE_DEP_LIBS)
111 AC_SUBST(GUI_DEP_LIBS)
112 AC_SUBST(MODULE_SUBDIR)
113
114 AC_CONFIG_FILES([
115 Makefile
116 ])
117
118 AC_OUTPUT
119
120 echo
121 echo "%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%"
122 echo "@"
123 echo "%      This is cvs HEAD of sysprof. "
124 echo "@"
125 echo "%      The kernel module in this version has bugs that"
126 echo "@      cause hangs with some kernels, notably the Fedora"
127 echo "%      Rawhide ones."
128 echo "@"
129 echo "%      If you need a stable version of sysprof, either"
130 echo "@      get version 1.0 from"
131 echo "%"
132 echo "@          http://www.daimi.au.dk/~sandmann/sysprof"
133 echo "%      "
134 echo "@      or do"
135 echo "%"
136 echo "@          cvs -z3 upd -r sysprof-1-0"
137 echo "%"
138 echo "@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@%@"
139 echo