Commit | Line | Data |
---|---|---|
3266f10b | 1 | dnl Autoconf configure snippets for common. |
b811d2c2 | 2 | dnl Copyright (C) 1995-2020 Free Software Foundation, Inc. |
3266f10b TT |
3 | dnl |
4 | dnl This file is part of GDB. | |
5 | dnl | |
6 | dnl This program is free software; you can redistribute it and/or modify | |
7 | dnl it under the terms of the GNU General Public License as published by | |
8 | dnl the Free Software Foundation; either version 3 of the License, or | |
9 | dnl (at your option) any later version. | |
10 | dnl | |
11 | dnl This program is distributed in the hope that it will be useful, | |
12 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | dnl GNU General Public License for more details. | |
15 | dnl | |
16 | dnl You should have received a copy of the GNU General Public License | |
17 | dnl along with this program. If not, see <http://www.gnu.org/licenses/>. | |
18 | ||
19 | dnl Invoke configury needed by the files in 'common'. | |
20 | AC_DEFUN([GDB_AC_COMMON], [ | |
21 | AC_HEADER_STDC | |
3266f10b TT |
22 | AC_FUNC_ALLOCA |
23 | ||
b2ceabe8 TT |
24 | WIN32APILIBS= |
25 | case ${host} in | |
26 | *mingw32*) | |
27 | AC_DEFINE(USE_WIN32API, 1, | |
28 | [Define if we should use the Windows API, instead of the | |
29 | POSIX API. On Windows, we use the Windows API when | |
30 | building for MinGW, but the POSIX API when building | |
31 | for Cygwin.]) | |
32 | WIN32APILIBS="-lws2_32" | |
33 | ;; | |
34 | esac | |
35 | ||
3266f10b TT |
36 | dnl Note that this requires codeset.m4, which is included |
37 | dnl by the users of common.m4. | |
38 | AM_LANGINFO_CODESET | |
39 | ||
40 | AC_CHECK_HEADERS(linux/perf_event.h locale.h memory.h signal.h dnl | |
44122162 | 41 | sys/resource.h sys/socket.h dnl |
3266f10b | 42 | sys/un.h sys/wait.h dnl |
be628ab8 | 43 | thread_db.h wait.h dnl |
2d41fa11 SDJ |
44 | termios.h dnl |
45 | dlfcn.h) | |
3266f10b | 46 | |
c12d372d | 47 | AC_CHECK_FUNCS([fdwalk getrlimit pipe pipe2 socketpair sigaction \ |
5abebf3c | 48 | sigprocmask]) |
3266f10b | 49 | |
ab7d13f0 | 50 | AC_CHECK_DECLS([strstr]) |
e9bcb658 | 51 | |
5e030278 TT |
52 | # Check for std::thread. This does not work on some platforms, like |
53 | # mingw and DJGPP. | |
54 | AC_LANG_PUSH([C++]) | |
55 | AX_PTHREAD([threads=yes], [threads=no]) | |
56 | if test "$threads" = "yes"; then | |
57 | save_LIBS="$LIBS" | |
58 | LIBS="$PTHREAD_LIBS $LIBS" | |
59 | save_CXXFLAGS="$CXXFLAGS" | |
60 | CXXFLAGS="$PTHREAD_CFLAGS $save_CXXFLAGS" | |
61 | AC_CACHE_CHECK([for std::thread], | |
62 | gdb_cv_cxx_std_thread, | |
63 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( | |
64 | [[#include <thread> | |
65 | void callback() { }]], | |
66 | [[std::thread t(callback);]])], | |
67 | gdb_cv_cxx_std_thread=yes, | |
68 | gdb_cv_cxx_std_thread=no)]) | |
21987b9c TT |
69 | |
70 | # This check must be here, while LIBS includes any necessary | |
71 | # threading library. | |
4da8c3a8 | 72 | AC_CHECK_FUNCS([pthread_sigmask pthread_setname_np]) |
21987b9c | 73 | |
5e030278 TT |
74 | LIBS="$save_LIBS" |
75 | CXXFLAGS="$save_CXXFLAGS" | |
76 | fi | |
0ad6b8ee | 77 | if test "$gdb_cv_cxx_std_thread" = "yes"; then |
5e030278 TT |
78 | AC_DEFINE(CXX_STD_THREAD, 1, |
79 | [Define to 1 if std::thread works.]) | |
80 | fi | |
81 | AC_LANG_POP | |
82 | ||
e9bcb658 GB |
83 | dnl Check if sigsetjmp is available. Using AC_CHECK_FUNCS won't |
84 | dnl do since sigsetjmp might only be defined as a macro. | |
25c51f71 TT |
85 | AC_CACHE_CHECK([for sigsetjmp], gdb_cv_func_sigsetjmp, |
86 | [AC_TRY_COMPILE([ | |
87 | #include <setjmp.h> | |
88 | ], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);], | |
89 | gdb_cv_func_sigsetjmp=yes, gdb_cv_func_sigsetjmp=no)]) | |
90 | if test "$gdb_cv_func_sigsetjmp" = "yes"; then | |
91 | AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available. ]) | |
92 | fi | |
3266f10b | 93 | ]) |