1 # Autoconf script for oprofile
3 # Copyright 1999 Olaf Titz <olaf@bigred.inka.de>
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.
14 AC_INIT(libop/op_config.h)
15 AM_INIT_AUTOMAKE(oprofile, 0.9.2)
16 AM_CONFIG_HEADER(config.h)
21 DATE="`date '+%a %d %B %Y'`"
24 dnl needed for module build
26 AC_SUBST(OPROFILE_DIR)
28 # this needs to come before --with-gcc so we link with binutil's version
29 # of libiberty ... sigh
31 [ --with-binutils=dir Path to binutils installation to use], BINUTILSDIR=$withval)
33 if test "$BINUTILSDIR" != ""; then
35 if test "$CFLAGS" = ""; then
38 if test "$CXXFLAGS" = ""; then
41 CFLAGS="$CFLAGS -I $BINUTILSDIR/include"
42 CXXFLAGS="$CXXFLAGS -I $BINUTILSDIR/include"
43 LDFLAGS="$LDFLAGS -L $BINUTILSDIR/lib -Xlinker -R -Xlinker $BINUTILSDIR/lib"
47 [ --with-gcc=dir Path to GCC installation to use], GCCDIR=$withval)
49 if test "$GCCDIR" != ""; then
52 LDFLAGS="$LDFLAGS -L $GCCDIR/lib -Xlinker -R -Xlinker $GCCDIR/lib"
58 AC_CHECK_PROG(LD,ld,ld,)
59 test "$LD" || AC_ERROR(ld not found)
63 if test "$OPROFILE_26" = "no"; then
67 AC_ARG_WITH(module-dir,
68 [ --with-module-dir=dir Path to module installation directory], MODINSTALLDIR=$withval)
69 AC_SUBST(MODINSTALLDIR)
74 AC_SUBST(EXTRA_CFLAGS_MODULE)
81 ORIG_SAVE_LIBS="$LIBS"
83 dnl advanced glibc features which we need but may not be present
84 AC_CHECK_FUNCS(sched_setaffinity perfmonctl)
86 AC_CHECK_LIB(popt, poptGetContext,, AC_MSG_ERROR([popt library not found]))
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]))
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)
110 ORIG_X_SAVE_LIBS="$LIBS"
111 LIBS="$X_PRE_LIBS $LIBS $X_LIBS -lX11 $X_EXTRA_LIBS"
115 LIBS="$ORIG_X_SAVE_LIBS"
117 dnl enable pch for c++
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)
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"
132 AC_SUBST(LIBERTY_LIBS)
136 # do NOT put tests here, they will fail in the case X is not installed !
138 AM_CONDITIONAL(have_qt, test -n "$QT_LIB")
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])
149 dnl enable option to use GCC test coverage
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])
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])
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'`
180 AC_SUBST(OP_CXXFLAGS)
182 # fixups for config.h
183 if test "$prefix" = "NONE"; then
184 my_op_prefix="$ac_default_prefix"
186 my_op_prefix="$prefix"
188 my_op_datadir="$my_op_prefix/share"
190 if test "$exec_prefix" = "NONE"; then
191 my_op_exec_prefix="$my_op_prefix"
193 my_op_exec_prefix="$exec_prefix"
195 my_op_bindir="$my_op_exec_prefix/bin"
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/"`
207 libutil/tests/Makefile \
209 libutil++/tests/Makefile \
211 libop/tests/Makefile \
214 libdb/tests/Makefile \
216 libabi/tests/Makefile \
218 libregex/tests/Makefile \
220 libregex/tests/mangled-name \
222 daemon/liblegacy/Makefile \
226 doc/xsl/catalog-1.xml \
235 doc/srcdoc/Doxyfile \
241 module/x86/Makefile \
242 module/ia64/Makefile)
244 AX_COPY_IF_CHANGE(doc/xsl/catalog-1.xml, doc/xsl/catalog.xml)
246 if test -z "$QT_LIB"; then
247 echo "Warning: a working Qt not found; no GUI will be built"