]>
Commit | Line | Data |
---|---|---|
213516ef | 1 | dnl Copyright (C) 1997-2023 Free Software Foundation, Inc. |
b15c5d7a MF |
2 | dnl |
3 | dnl This program is free software; you can redistribute it and/or modify | |
4 | dnl it under the terms of the GNU General Public License as published by | |
5 | dnl the Free Software Foundation; either version 3 of the License, or | |
6 | dnl (at your option) any later version. | |
7 | dnl | |
8 | dnl This program is distributed in the hope that it will be useful, | |
9 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
11 | dnl GNU General Public License for more details. | |
12 | dnl | |
13 | dnl You should have received a copy of the GNU General Public License | |
14 | dnl along with this program. If not, see <http://www.gnu.org/licenses/>. | |
15 | dnl | |
16 | dnl Check for various platform settings. | |
17 | AC_DEFUN([SIM_AC_PLATFORM], | |
18 | [dnl | |
19 | dnl Check for common headers. | |
20 | dnl NB: You can assume C11 headers exist. | |
21 | AC_CHECK_HEADERS_ONCE(m4_flatten([ | |
22 | dlfcn.h | |
23 | fcntl.h | |
24 | fpu_control.h | |
25 | termios.h | |
26 | unistd.h | |
27 | utime.h | |
28 | linux/if_tun.h | |
29 | linux/mii.h | |
30 | linux/types.h | |
31 | net/if.h | |
32 | netinet/in.h | |
33 | netinet/tcp.h | |
34 | sys/ioctl.h | |
35 | sys/mman.h | |
a48ff3ef | 36 | sys/mount.h |
b15c5d7a MF |
37 | sys/param.h |
38 | sys/resource.h | |
b15c5d7a MF |
39 | sys/socket.h |
40 | sys/stat.h | |
a48ff3ef MF |
41 | sys/statfs.h |
42 | sys/termio.h | |
43 | sys/termios.h | |
44 | sys/types.h | |
45 | sys/vfs.h | |
b15c5d7a | 46 | ])) |
a48ff3ef | 47 | AC_HEADER_DIRENT |
b15c5d7a MF |
48 | |
49 | AC_CHECK_FUNCS_ONCE(m4_flatten([ | |
50 | __setfpucw | |
a48ff3ef | 51 | access |
b15c5d7a MF |
52 | aint |
53 | anint | |
a48ff3ef MF |
54 | cfgetispeed |
55 | cfgetospeed | |
56 | cfsetispeed | |
57 | cfsetospeed | |
58 | chdir | |
b15c5d7a | 59 | chmod |
a48ff3ef MF |
60 | dup |
61 | dup2 | |
b15c5d7a MF |
62 | execv |
63 | execve | |
a48ff3ef | 64 | fcntl |
b15c5d7a | 65 | fork |
a48ff3ef MF |
66 | fstat |
67 | fstatfs | |
b15c5d7a | 68 | ftruncate |
a48ff3ef | 69 | getdirentries |
b15c5d7a | 70 | getegid |
a48ff3ef | 71 | geteuid |
b15c5d7a | 72 | getgid |
a48ff3ef MF |
73 | getpid |
74 | getppid | |
b15c5d7a | 75 | getrusage |
a48ff3ef | 76 | gettimeofday |
b15c5d7a | 77 | getuid |
a48ff3ef | 78 | ioctl |
b15c5d7a | 79 | kill |
a48ff3ef MF |
80 | link |
81 | lseek | |
95955095 MF |
82 | lstat |
83 | mkdir | |
b15c5d7a MF |
84 | mmap |
85 | munmap | |
a48ff3ef | 86 | pipe |
b15c5d7a MF |
87 | posix_fallocate |
88 | pread | |
a48ff3ef MF |
89 | rmdir |
90 | setregid | |
91 | setreuid | |
b15c5d7a | 92 | setgid |
a48ff3ef | 93 | setuid |
b15c5d7a | 94 | sigaction |
a48ff3ef | 95 | sigprocmask |
b15c5d7a | 96 | sqrt |
a48ff3ef | 97 | stat |
b15c5d7a | 98 | strsignal |
a48ff3ef MF |
99 | symlink |
100 | tcdrain | |
101 | tcflow | |
102 | tcflush | |
103 | tcgetattr | |
104 | tcgetpgrp | |
105 | tcsendbreak | |
106 | tcsetattr | |
107 | tcsetpgrp | |
b15c5d7a MF |
108 | time |
109 | truncate | |
a48ff3ef MF |
110 | umask |
111 | unlink | |
b15c5d7a MF |
112 | utime |
113 | ])) | |
114 | ||
a48ff3ef MF |
115 | AC_STRUCT_ST_BLKSIZE |
116 | AC_STRUCT_ST_BLOCKS | |
117 | AC_STRUCT_ST_RDEV | |
118 | AC_STRUCT_TIMEZONE | |
119 | ||
b15c5d7a MF |
120 | AC_CHECK_MEMBERS([[struct stat.st_dev], [struct stat.st_ino], |
121 | [struct stat.st_mode], [struct stat.st_nlink], [struct stat.st_uid], | |
122 | [struct stat.st_gid], [struct stat.st_rdev], [struct stat.st_size], | |
123 | [struct stat.st_blksize], [struct stat.st_blocks], [struct stat.st_atime], | |
124 | [struct stat.st_mtime], [struct stat.st_ctime]], [], [], | |
125 | [[#ifdef HAVE_SYS_TYPES_H | |
126 | #include <sys/types.h> | |
127 | #endif | |
128 | #ifdef HAVE_SYS_STAT_H | |
129 | #include <sys/stat.h> | |
130 | #endif]]) | |
131 | ||
132 | AC_CHECK_TYPES([__int128]) | |
133 | AC_CHECK_TYPES(socklen_t, [], [], | |
134 | [#include <sys/types.h> | |
135 | #include <sys/socket.h> | |
136 | ]) | |
137 | ||
138 | dnl Types used by common code | |
a48ff3ef MF |
139 | AC_TYPE_GETGROUPS |
140 | AC_TYPE_MODE_T | |
141 | AC_TYPE_OFF_T | |
142 | AC_TYPE_PID_T | |
b15c5d7a | 143 | AC_TYPE_SIGNAL |
a48ff3ef MF |
144 | AC_TYPE_SIZE_T |
145 | AC_TYPE_UID_T | |
07490bf8 | 146 | |
89cf99a9 | 147 | LT_INIT |
b5689863 | 148 | |
07490bf8 | 149 | dnl Libraries. |
05108158 MF |
150 | AC_SEARCH_LIBS([bind], [socket]) |
151 | AC_SEARCH_LIBS([gethostbyname], [nsl]) | |
152 | AC_SEARCH_LIBS([fabs], [m]) | |
153 | AC_SEARCH_LIBS([log2], [m]) | |
d57b6533 | 154 | |
05108158 | 155 | AC_SEARCH_LIBS([dlopen], [dl]) |
f050cfdd MF |
156 | if test "${ac_cv_lib_dl_dlopen}" = "yes"; then |
157 | PKG_CHECK_MODULES(SDL, sdl2, [dnl | |
158 | SDL_CFLAGS="${SDL_CFLAGS} -DHAVE_SDL=2" | |
f050cfdd MF |
159 | ], [ |
160 | PKG_CHECK_MODULES(SDL, sdl, [dnl | |
161 | SDL_CFLAGS="${SDL_CFLAGS} -DHAVE_SDL=1" | |
f050cfdd MF |
162 | ], [:]) |
163 | ]) | |
c55c1f6e MF |
164 | dnl If we use SDL, we need dlopen support. |
165 | AS_IF([test -n "$SDL_CFLAGS"], [dnl | |
166 | AS_IF([test "$ac_cv_search_dlopen" = no], [dnl | |
167 | AC_MSG_WARN([SDL support requires dlopen support]) | |
168 | ]) | |
169 | ]) | |
f050cfdd MF |
170 | else |
171 | SDL_CFLAGS= | |
f050cfdd | 172 | fi |
c55c1f6e MF |
173 | dnl We dlopen the libs at runtime, so never pass down SDL_LIBS. |
174 | SDL_LIBS= | |
d57b6533 | 175 | AC_SUBST(SDL_CFLAGS) |
5d0b3088 MF |
176 | |
177 | dnl In the Cygwin environment, we need some additional flags. | |
178 | AC_CACHE_CHECK([for cygwin], sim_cv_os_cygwin, | |
179 | [AC_EGREP_CPP(lose, [ | |
180 | #ifdef __CYGWIN__ | |
181 | lose | |
182 | #endif],[sim_cv_os_cygwin=yes],[sim_cv_os_cygwin=no])]) | |
183 | ||
184 | dnl Keep in sync with gdb's configure.ac list. | |
185 | AC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncurses], | |
186 | [TERMCAP_LIB=$ac_cv_search_tgetent], [TERMCAP_LIB=""]) | |
187 | if test x$sim_cv_os_cygwin = xyes; then | |
188 | TERMCAP_LIB="${TERMCAP_LIB} -luser32" | |
189 | fi | |
190 | AC_SUBST(TERMCAP_LIB) | |
191 | ||
192 | dnl We prefer the in-tree readline. Top-level dependencies make sure | |
193 | dnl src/readline (if it's there) is configured before src/sim. | |
194 | if test -r ../readline/Makefile; then | |
5a988617 | 195 | READLINE_LIB=../readline/readline/libreadline.a |
5d0b3088 MF |
196 | READLINE_CFLAGS='-I$(READLINE_SRC)/..' |
197 | else | |
198 | AC_CHECK_LIB(readline, readline, READLINE_LIB=-lreadline, | |
199 | AC_ERROR([the required "readline" library is missing]), $TERMCAP_LIB) | |
200 | READLINE_CFLAGS= | |
201 | fi | |
202 | AC_SUBST(READLINE_LIB) | |
203 | AC_SUBST(READLINE_CFLAGS) | |
b15c5d7a | 204 | ]) |