Updated translations for bfd, gold and opcodes
[binutils-gdb.git] / gprofng / configure.ac
blobcfca82e36518e1be8d879a8c497886ac4431cc8a
1 dnl Process this file with autoconf to produce a configure script.
2 dnl
3 dnl   Copyright (C) 2021-2023 Free Software Foundation, Inc.
4 dnl
5 dnl This file is free software; you can redistribute it and/or modify
6 dnl it under the terms of the GNU General Public License as published by
7 dnl the Free Software Foundation; either version 3 of the License, or
8 dnl (at your option) any later version.
9 dnl
10 dnl This program is distributed in the hope that it will be useful,
11 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 dnl GNU General Public License for more details.
14 dnl
15 dnl You should have received a copy of the GNU General Public License
16 dnl along with this program; see the file COPYING3.  If not see
17 dnl <http://www.gnu.org/licenses/>.
19 m4_include([../bfd/version.m4])
20 m4_include([../config/zlib.m4])
21 AC_INIT([gprofng], BFD_VERSION)
22 AC_CANONICAL_TARGET
23 AM_INIT_AUTOMAKE([subdir-objects])
24 AM_MAINTAINER_MODE
26 AC_USE_SYSTEM_EXTENSIONS
27 AC_PROG_CC
28 AC_PROG_CXX
29 AC_PROG_INSTALL
30 AC_PROG_RANLIB
31 AM_PROG_AR
32 gl_PROG_BISON([BISON],[3.0.4])
33 if test x$BISON = "x:"; then
34   AC_MSG_ERROR([Building gprofng requires bison 3.0.4 or later.])
37 AC_DISABLE_SHARED
38 LT_INIT
40 GPROFNG_LIBADD="-L../../libiberty -liberty"
41 if test "$enable_shared" = "yes"; then
42   GPROFNG_LIBADD="-L../../libiberty/pic -liberty"
44 AC_SUBST(GPROFNG_LIBADD)
46 # Figure out what compiler warnings we can enable.
47 # See config/warnings.m4 for details.
49 ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
50 ACX_PROG_CC_WARNING_OPTS([-Wall], [gprofng_cflags])
51 ACX_PROG_CC_WARNING_OPTS([-Wno-switch], [GPROFNG_NO_SWITCH_CFLAGS])
52 gprofng_cppflags="-U_ASM"
53 build_collector=
54 build_src=
56   case "${host}" in
57     x86_64-*-linux*)
58       build_src=true
59       build_collector=true
60       ;;
61     i?86-*-linux*)
62       build_src=true
63       build_collector=true
64       ;;
65     aarch64-*-linux*)
66       build_src=true
67       build_collector=true
68       ;;
69   esac
70   AC_ARG_ENABLE(gprofng-tools,
71     AS_HELP_STRING([--disable-gprofng-tools], [do not build gprofng/src directory]),
72     build_src=$enableval)
74 AM_CONDITIONAL([BUILD_COLLECTOR], [test x$build_collector = xtrue])
75 AM_CONDITIONAL([BUILD_SRC], [test x$build_src = xtrue])
77 if test x$build_collector = xtrue; then
78   AC_CONFIG_SUBDIRS([libcollector])
80 AX_PTHREAD
82 # Specify a location for JDK
83 enable_gprofng_jp=
84 jdk_inc=
85 AC_ARG_WITH(jdk,
86 [AS_HELP_STRING([--with-jdk=PATH],
87                 [specify prefix directory for installed JDK.])])
89 if test "x$with_jdk" != x; then
90   jdk_inc="-I$with_jdk/include -I$with_jdk/include/linux"
91   enable_gprofng_jp=yes
92 else
93   AC_PATH_PROG([JAVAC], [javac], [javac])
94   if test -f $JAVAC; then
95     x=`readlink -f $JAVAC`
96     x=`dirname $x`
97     x=`dirname $x`
98     if ! test -f $x/include/jni.h; then
99       x=`dirname $x`
100     fi
101     if test -f $x/include/jni.h; then
102       jdk_inc="-I$x/include -I$x/include/linux"
103       enable_gprofng_jp=yes
104     fi
105   fi
107 if test "x$enable_gprofng_jp" = x; then
108   AC_PATH_PROG([JAVA], [java], [java])
109   if test -f $JAVA; then
110     x=`readlink -f $JAVA`
111     x=`dirname $x`
112     x=`dirname $x`
113     if ! test -f $x/include/jni.h; then
114       x=`dirname $x`
115     fi
116     if test -f $x/include/jni.h; then
117       jdk_inc="-I$x/include -I$x/include/linux"
118       enable_gprofng_jp=yes
119     fi
120   fi
122 if test "x$enable_gprofng_jp" = x; then
123   AC_CHECK_HEADER([jni.h], [ enable_gprofng_jp=yes ], [], [] )
125 GPROFNG_BROKEN_JAVAC=no
126 if test "x$enable_gprofng_jp" = x; then
127     AC_MSG_WARN([ Cannot find the JDK include directory.
128       gprofng will be build without support for profiling Java applications.
129       Use --with-jdk=PATH to specify directory for the installed JDK])
130 else
131     AC_DEFINE(GPROFNG_JAVA_PROFILING, 1, [Enable java profiling])
132     if test "x$JAVAC" != x; then
133       cat > configtest.java << EOF
134 class Simple{
135   public static void main(String args[]){
136     System.out.println("Hello Java");
137   }
140       if AC_TRY_COMMAND($JAVAC configtest.java >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD); then
141         GPROFNG_BROKEN_JAVAC=no
142       else
143         GPROFNG_BROKEN_JAVAC=yes
144       fi
145       rm -f configtest.*
146     fi
148 AC_SUBST(GPROFNG_BROKEN_JAVAC)
149 AC_SUBST(jdk_inc)
151 DEBUG=
152 GCC_ENABLE([gprofng-debug], [no], [], [Enable debugging output])
153 if test "${enable_gprofng_debug}" = yes; then
154     AC_DEFINE(DEBUG, 1, [Enable debugging output.])
157 cat > "dummy.c" << EOF
158 #include <features.h>
159 #if defined(__UCLIBC__)
160 LIBC=uclibc
161 #elif defined(__dietlibc__)
162 LIBC=dietlibc
163 #elif defined(__GLIBC__)
164 LIBC=gnu
165 #else
166 #include <stdarg.h>
167 /* First heuristic to detect musl libc.  */
168 #ifdef __DEFINED_va_list
169 LIBC=musl
170 #else
171 LIBC=gnu
172 #endif
173 #endif
175 cc_set_libc=`$CC -E "dummy.c" 2>/dev/null | grep '^LIBC=' | sed 's, ,,g'`
176 eval "$cc_set_libc"
177 if test "$LIBC" = musl; then
178   AC_DEFINE(__MUSL_LIBC, 1, [Build with musl-libc.])
182 # Check if linker supports --as-needed and --no-as-needed options.
183 AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed,
184         [bfd_cv_ld_as_needed=no
185         if $LD --help 2>/dev/null | grep as-needed > /dev/null; then
186                 bfd_cv_ld_as_needed=yes
187         fi
188         ])
190 no_as_needed=
191 if test x"$bfd_cv_ld_as_needed" = xyes; then
192     no_as_needed='-Wl,--no-as-needed'
195 AC_PATH_PROG([EXPECT], [expect])
196 AC_CACHE_CHECK([for Tcl supporting try/catch], [ac_cv_libctf_tcl_try],
197   [ac_cv_libctf_tcl_try=`if test -z $EXPECT; then echo no; else $EXPECT << EOF
198 if @<:@llength @<:@info commands try@:>@@:>@ then { puts yes } else { puts no }
203 # Only native testing and only on supported platforms:
204 AM_CONDITIONAL(TCL_TRY, [test "${ac_cv_libctf_tcl_try}" = yes \
205         -a "x${build_src}" = xtrue -a "x${build_collector}" = xtrue \
206         -a "x${host}" = "x${target}"])
208 AM_ZLIB
210 # Generate manpages, if possible.
211 build_man=false
212 build_doc=false
213 if test $cross_compiling = no; then
214   AC_CHECK_PROGS([HELP2MAN], help2man, [$MISSING help2man])
215   case "x$HELP2MAN" in
216     x | */missing\ help2man* )
217       AC_MSG_WARN([gprofng: help2man is missing. Man pages will not be built.])
218       ;;
219     * ) build_man=true ;;
220     esac
222   AC_CHECK_PROGS([MAKEINFO], makeinfo, [$MISSING makeinfo])
223   case "x$MAKEINFO" in
224     x | */missing\ makeinfo*)
225       AC_MSG_WARN([gprofng: makeinfo is missing. Info documentation will not be built.])
226       ;;
227     *)
228       case x"`$MAKEINFO --version | grep 'GNU texinfo'`" in
229         x*\ [[1-5]].*|x*\ 6.[[0-4]].* )
230           AC_MSG_WARN([gprofng: $MAKEINFO is too old. Info documentation will not be built.])
231           MAKEINFO="@echo $MAKEINFO is too old, 6.5 or newer required; true"
232           ;;
233         x* ) build_doc=true ;;
234         esac
235       ;;
236     esac
237   AC_SUBST(MAKEINFO)
239 AM_CONDITIONAL([BUILD_MAN], [test x$build_man = xtrue])
240 AM_CONDITIONAL([BUILD_DOC], [test x$build_doc = xtrue])
242 AC_SUBST(LD_NO_AS_NEEDED, [${no_as_needed}])
243 AC_SUBST(GPROFNG_CFLAGS, [${gprofng_cflags}])
244 AC_SUBST(GPROFNG_NO_FORMAT_TRUNCATION_CFLAGS)
245 AC_SUBST(GPROFNG_NO_SWITCH_CFLAGS)
246 AC_SUBST(GPROFNG_CPPFLAGS, [${gprofng_cppflags}])
248 AC_CHECK_DECLS([basename])
249 AC_CHECK_FUNCS(clock_gettime strsignal)
251 clock_gettime_link=
252 # At least for glibc, clock_gettime is in librt.  But don't
253 # pull that in if it still doesn't give us the function we want.  This
254 # test is copied from libgomp, and modified to not link in -lrt as
255 # we're using this for test timing only.
256 if test "$ac_cv_func_clock_gettime" = no; then
257   AC_CHECK_LIB(rt, clock_gettime,
258     [CLOCK_GETTIME_LINK=-lrt
259      AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
260                [Define to 1 if you have the `clock_gettime' function.])])
262 AC_SUBST(CLOCK_GETTIME_LINK)
264 AC_SUBST(BUILD_SUBDIRS)
266 AC_CONFIG_FILES([Makefile src/Makefile gp-display-html/Makefile doc/Makefile])
267 AC_CONFIG_HEADERS([config.h:common/config.h.in])
269 AC_OUTPUT