OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / user / oprofile / configure.in
1 #   Autoconf script for oprofile
2 #
3 #   Copyright 1999 Olaf Titz <olaf@bigred.inka.de>
4 #   Adapted for oprofile
5 #
6 #   This program is free software; you can redistribute it and/or
7 #   modify it under the terms of the GNU General Public License
8 #   as published by the Free Software Foundation; either version
9 #   2 of the License, or (at your option) any later version.
10 #
11
12 AC_PREREQ(2.13)
13
14 AC_INIT(libop/op_config.h)
15 AM_INIT_AUTOMAKE(oprofile, 0.9.2)
16 AM_CONFIG_HEADER(config.h)
17
18 AC_PROG_RANLIB
19
20 dnl for the man page
21 DATE="`date '+%a %d %B %Y'`"
22 AC_SUBST(DATE)
23
24 dnl needed for module build
25 OPROFILE_DIR=`pwd`
26 AC_SUBST(OPROFILE_DIR)
27  
28 # this needs to come before --with-gcc so we link with binutil's version
29 # of libiberty ... sigh
30 AC_ARG_WITH(binutils,
31 [  --with-binutils=dir          Path to binutils installation to use], BINUTILSDIR=$withval)
32
33 if test "$BINUTILSDIR" != ""; then
34         LD="$BINUTILSDIR/ld"
35         if test "$CFLAGS" = ""; then
36                 CFLAGS="-g -O2"
37         fi
38         if test "$CXXFLAGS" = ""; then
39                 CXXFLAGS="-g -O2"
40         fi
41         CFLAGS="$CFLAGS -I $BINUTILSDIR/include"
42         CXXFLAGS="$CXXFLAGS -I $BINUTILSDIR/include"
43         LDFLAGS="$LDFLAGS -L $BINUTILSDIR/lib -Xlinker -R -Xlinker $BINUTILSDIR/lib"
44 fi
45
46 AC_ARG_WITH(gcc,
47 [  --with-gcc=dir               Path to GCC installation to use], GCCDIR=$withval)
48
49 if test "$GCCDIR" != ""; then
50         CC="$GCCDIR/bin/gcc"
51         CXX="$GCCDIR/bin/g++"
52         LDFLAGS="$LDFLAGS -L $GCCDIR/lib -Xlinker -R -Xlinker $GCCDIR/lib"
53 fi
54
55 AC_PROG_CC
56 AC_PROG_CPP
57 AC_PROG_CXX
58 AC_CHECK_PROG(LD,ld,ld,)
59 test "$LD" || AC_ERROR(ld not found)
60
61 AX_FIND_KERNEL
62
63 if test "$OPROFILE_26" = "no"; then
64         AX_CONFIG_MODULE
65 fi
66
67 AC_ARG_WITH(module-dir,
68 [  --with-module-dir=dir        Path to module installation directory], MODINSTALLDIR=$withval)
69 AC_SUBST(MODINSTALLDIR)
70
71 AX_MALLOC_ATTRIBUTE
72 AX_BUILTIN_EXPECT
73
74 AC_SUBST(EXTRA_CFLAGS_MODULE)
75
76 topdir=`pwd`
77 AC_SUBST(topdir)
78  
79 AX_EXTRA_DIRS
80
81 ORIG_SAVE_LIBS="$LIBS"
82
83 dnl advanced glibc features which we need but may not be present
84 AC_CHECK_FUNCS(sched_setaffinity perfmonctl)
85
86 AC_CHECK_LIB(popt, poptGetContext,, AC_MSG_ERROR([popt library not found]))
87
88 AX_BINUTILS
89
90 # C++ tests
91  
92 AC_LANG_CPLUSPLUS
93
94 AX_POPT_CONST
95 AX_CHECK_SSTREAM
96
97 dnl bfd.h pre 1998 check only for gnu 2.xx series, so gcc 3.0 can't compile it
98 AC_MSG_CHECKING([whether bfd defines bool])
99 AC_TRY_COMPILE([#include <bfd.h>], [], 
100 AC_MSG_RESULT([no]);,
101 AC_MSG_RESULT([yes]); AC_DEFINE(TRUE_FALSE_ALREADY_DEFINED, 1, [whether bfd.h defines bool values]))
102
103 dnl smart demangler need to know what are the underlined type for some typedef
104 AX_TYPEDEFED_NAME(size_t, "unsigned" "unsigned long", SIZE_T_TYPE)
105 AC_SUBST(SIZE_T_TYPE)
106 AX_TYPEDEFED_NAME(ptrdiff_t, "int" "long", PTRDIFF_T_TYPE)
107 AC_SUBST(PTRDIFF_T_TYPE)
108
109 AC_PATH_XTRA
110 ORIG_X_SAVE_LIBS="$LIBS"
111 LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
112 X_LIBS="$LIBS"
113 AC_SUBST(X_LIBS)
114 QT_DO_IT_ALL
115 LIBS="$ORIG_X_SAVE_LIBS"
116
117 dnl enable pch for c++
118 AC_ARG_ENABLE(pch,
119         [  --enable-pch                 enable precompiled header (default is disabled)],
120         enable_pch=$enableval, enable_pch=no)
121 if test "$enable_pch" = yes; then
122         AX_CHECK_PRECOMPILED_HEADER(OP_CXXFLAGS)
123 fi
124
125 AX_CHECK_DOCBOOK
126
127 dnl finally restore the original libs setting
128 LIBS="$ORIG_SAVE_LIBS"
129 LIBERTY_LIBS="-liberty $DL_LIB $INTL_LIB"
130 BFD_LIBS="-lbfd -liberty $DL_LIB $INTL_LIB"
131 POPT_LIBS="-lpopt"
132 AC_SUBST(LIBERTY_LIBS)
133 AC_SUBST(BFD_LIBS)
134 AC_SUBST(POPT_LIBS)
135
136 # do NOT put tests here, they will fail in the case X is not installed !
137  
138 AM_CONDITIONAL(have_qt, test -n "$QT_LIB")
139
140 AX_CFLAGS_OPTION(OP_CFLAGS,[-W])
141 AX_CXXFLAGS_OPTION(OP_CXXFLAGS,[-W])
142 AX_CFLAGS_OPTION(OP_CFLAGS,[-Wall])
143 AX_CXXFLAGS_OPTION(OP_CXXFLAGS,[-Wall])
144 AX_CFLAGS_OPTION(OP_CFLAGS,[-fno-common])
145 AX_CXXFLAGS_OPTION(OP_CXXFLAGS,[-fno-common])
146 AX_CXXFLAGS_OPTION(OP_CXXFLAGS,[-ftemplate-depth-50])
147 AX_CFLAGS_OPTION(OP_CFLAGS,[-Wdeclaration-after-statement])
148
149 dnl enable option to use GCC test coverage
150 AC_ARG_ENABLE(gcov,
151         [  --enable-gcov                enable option for gcov coverage testing (default is disabled)],
152         enable_gcov=$enableval, enable_gcov=no)
153 if test "$enable_gcov" = yes; then
154         AX_CFLAGS_OPTION(OP_CFLAGS,[-fprofile-arcs])
155         AX_CXXFLAGS_OPTION(OP_CXXFLAGS,[-fprofile-arcs])
156         AX_CFLAGS_OPTION(OP_CFLAGS,[-ftest-coverage])
157         AX_CXXFLAGS_OPTION(OP_CXXFLAGS,[-ftest-coverage])
158 fi
159
160 AC_ARG_ENABLE(werror,
161         [  --disable-werror            disable -Werror flag (default is enabled for non-release)],
162         enable_werror=$enableval, enable_werror=yes)
163 if test "$enable_werror" = yes; then
164         # enable -Werror for non-release versions.
165         if echo "$VERSION" | grep cvs >/dev/null; then
166                 AX_CFLAGS_OPTION(OP_CFLAGS,[-Werror])
167                 AX_CXXFLAGS_OPTION(OP_CXXFLAGS,[-Werror])
168         fi
169 fi
170
171 AC_ARG_ENABLE(optimization,
172         [  --disable-optimization      disable optimization flags (default is enabled)],
173         enable_optimization=$enableval, enable_optimisation=yes)
174 if test "$enable_optimization" = "no"; then
175         CFLAGS=`echo $CFLAGS | sed 's/-O2//g'`
176         CXXFLAGS=`echo $CXXFLAGS | sed 's/-O2//g'`
177 fi
178
179 AC_SUBST(OP_CFLAGS)
180 AC_SUBST(OP_CXXFLAGS)
181
182 # fixups for config.h
183 if test "$prefix" = "NONE"; then
184         my_op_prefix="$ac_default_prefix"
185 else
186         my_op_prefix="$prefix"
187 fi
188 my_op_datadir="$my_op_prefix/share"
189
190 if test "$exec_prefix" = "NONE"; then
191         my_op_exec_prefix="$my_op_prefix"
192 else
193         my_op_exec_prefix="$exec_prefix"
194 fi
195 my_op_bindir="$my_op_exec_prefix/bin"
196
197 OP_DATADIR=`eval echo "$my_op_datadir/$PACKAGE/"`
198 AC_DEFINE_UNQUOTED(OP_DATADIR, "$OP_DATADIR", [package data directory])
199 OP_BINDIR=`eval echo "$my_op_bindir/"`
200 AC_DEFINE_UNQUOTED(OP_BINDIR, "$OP_BINDIR", [package binary directory])
201 OP_DOCDIR=`eval echo "${my_op_prefix}/share/doc/$PACKAGE/"`
202 AC_SUBST(OP_DOCDIR)
203
204 AC_OUTPUT(Makefile \
205         m4/Makefile \
206         libutil/Makefile \
207         libutil/tests/Makefile \
208         libutil++/Makefile \
209         libutil++/tests/Makefile \
210         libop/Makefile \
211         libop/tests/Makefile \
212         libopt++/Makefile \
213         libdb/Makefile \
214         libdb/tests/Makefile \
215         libabi/Makefile \
216         libabi/tests/Makefile \
217         libregex/Makefile \
218         libregex/tests/Makefile \
219         libregex/stl.pat \
220         libregex/tests/mangled-name \
221         daemon/Makefile \
222         daemon/liblegacy/Makefile \
223         events/Makefile \
224         utils/Makefile \
225         doc/Makefile \
226         doc/xsl/catalog-1.xml \
227         doc/oprofile.1 \
228         doc/opcontrol.1 \
229         doc/ophelp.1 \
230         doc/opreport.1 \
231         doc/opannotate.1 \
232         doc/opgprof.1 \
233         doc/oparchive.1 \
234         doc/opimport.1 \
235         doc/srcdoc/Doxyfile \
236         libpp/Makefile \
237         pp/Makefile \
238         gui/Makefile \
239         gui/ui/Makefile \
240         module/Makefile \
241         module/x86/Makefile \
242         module/ia64/Makefile)
243
244 AX_COPY_IF_CHANGE(doc/xsl/catalog-1.xml, doc/xsl/catalog.xml)
245
246 if test -z "$QT_LIB"; then
247         echo "Warning: a working Qt not found; no GUI will be built"
248 fi