Skip to content

Commit aeaab8e

Browse files
fweimer-rhcmb69
authored andcommitted
Port various autoconf bits to C99 compilers
C99 no longer has implicit function declarations and implicit ints. Current GCC versions enable them as an extension, but this will change in a future GCC version.
1 parent 0128f6e commit aeaab8e

File tree

5 files changed

+37
-11
lines changed

5 files changed

+37
-11
lines changed

Zend/Zend.m4

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ AC_MSG_CHECKING(whether double cast to long preserves least significant bits)
157157
158158
AC_RUN_IFELSE([AC_LANG_SOURCE([[
159159
#include <limits.h>
160+
#include <stdlib.h>
160161
161162
int main()
162163
{
@@ -256,6 +257,7 @@ AC_MSG_CHECKING(for MM alignment and log values)
256257
257258
AC_RUN_IFELSE([AC_LANG_SOURCE([[
258259
#include <stdio.h>
260+
#include <stdlib.h>
259261
260262
typedef union _mm_align_test {
261263
void *ptr;

build/libtool.m4

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,7 @@ else
945945
#endif
946946
947947
#include <stdio.h>
948+
#include <stdlib.h>
948949
949950
#ifdef RTLD_GLOBAL
950951
# define LT_DLGLOBAL RTLD_GLOBAL
@@ -978,10 +979,6 @@ else
978979
# endif
979980
#endif
980981
981-
#ifdef __cplusplus
982-
extern "C" void exit (int);
983-
#endif
984-
985982
void fnord() { int i=42;}
986983
int main ()
987984
{

build/php.m4

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ AC_CACHE_CHECK(for type of reentrant time-related functions, ac_cv_time_r_type,[
11181118
AC_RUN_IFELSE([AC_LANG_SOURCE([[
11191119
#include <time.h>
11201120
1121-
main() {
1121+
int main() {
11221122
char buf[27];
11231123
struct tm t;
11241124
time_t old = 0;
@@ -1134,7 +1134,7 @@ return (1);
11341134
],[
11351135
AC_RUN_IFELSE([AC_LANG_SOURCE([[
11361136
#include <time.h>
1137-
main() {
1137+
int main() {
11381138
struct tm t, *s;
11391139
time_t old = 0;
11401140
char buf[27], *p;
@@ -1173,8 +1173,9 @@ AC_DEFUN([PHP_DOES_PWRITE_WORK],[
11731173
#include <fcntl.h>
11741174
#include <unistd.h>
11751175
#include <errno.h>
1176+
#include <stdlib.h>
11761177
$1
1177-
main() {
1178+
int main() {
11781179
int fd = open("conftest_in", O_WRONLY|O_CREAT, 0600);
11791180
11801181
if (fd < 0) exit(1);
@@ -1206,8 +1207,9 @@ AC_DEFUN([PHP_DOES_PREAD_WORK],[
12061207
#include <fcntl.h>
12071208
#include <unistd.h>
12081209
#include <errno.h>
1210+
#include <stdlib.h>
12091211
$1
1210-
main() {
1212+
int main() {
12111213
char buf[3];
12121214
int fd = open("conftest_in", O_RDONLY);
12131215
if (fd < 0) exit(1);
@@ -1460,6 +1462,7 @@ dnl Even newer glibcs have a different seeker definition.
14601462
AC_RUN_IFELSE([AC_LANG_SOURCE([[
14611463
#define _GNU_SOURCE
14621464
#include <stdio.h>
1465+
#include <stdlib.h>
14631466
14641467
struct cookiedata {
14651468
__off64_t pos;
@@ -1476,7 +1479,7 @@ int seeker(void *cookie, __off64_t *position, int whence)
14761479
14771480
cookie_io_functions_t funcs = {reader, writer, seeker, closer};
14781481
1479-
main() {
1482+
int main() {
14801483
struct cookiedata g = { 0 };
14811484
FILE *fp = fopencookie(&g, "r", funcs);
14821485
@@ -1595,7 +1598,7 @@ AC_DEFUN([PHP_CHECK_FUNC_LIB],[
15951598
if test "$found" = "yes"; then
15961599
ac_libs=$LIBS
15971600
LIBS="$LIBS -l$2"
1598-
AC_RUN_IFELSE([AC_LANG_SOURCE([[main() { return (0); }]])],[found=yes],[found=no],[found=no])
1601+
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return (0); }]])],[found=yes],[found=no],[found=no])
15991602
LIBS=$ac_libs
16001603
fi
16011604
@@ -2281,7 +2284,7 @@ AC_DEFUN([PHP_TEST_WRITE_STDOUT],[
22812284
22822285
#define TEXT "This is the test message -- "
22832286
2284-
main()
2287+
int main()
22852288
{
22862289
int n;
22872290

configure.ac

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,8 @@ AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo,
662662
[[struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);]])],[AC_RUN_IFELSE([AC_LANG_SOURCE([[
663663
#include <netdb.h>
664664
#include <sys/types.h>
665+
#include <string.h>
666+
#include <stdlib.h>
665667
#ifndef AF_INET
666668
# include <sys/socket.h>
667669
#endif

ext/standard/config.m4

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ AC_CACHE_CHECK([whether flush should be called explicitly after a buffered io],
55
AC_RUN_IFELSE([AC_LANG_SOURCE([[
66
#include <stdio.h>
77
#include <stdlib.h>
8+
#ifdef HAVE_UNISTD_H
9+
#include <unistd.h>
10+
#endif
11+
#include <string.h>
812
913
int main(int argc, char **argv)
1014
{
@@ -67,6 +71,9 @@ AC_CACHE_CHECK(for standard DES crypt, ac_cv_crypt_des,[
6771
#include <crypt.h>
6872
#endif
6973
74+
#include <stdlib.h>
75+
#include <string.h>
76+
7077
int main() {
7178
#if HAVE_CRYPT
7279
char *encrypted = crypt("rasmuslerdorf","rl");
@@ -92,6 +99,9 @@ AC_CACHE_CHECK(for extended DES crypt, ac_cv_crypt_ext_des,[
9299
#include <crypt.h>
93100
#endif
94101
102+
#include <stdlib.h>
103+
#include <string.h>
104+
95105
int main() {
96106
#if HAVE_CRYPT
97107
char *encrypted = crypt("rasmuslerdorf","_J9..rasm");
@@ -117,6 +127,9 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
117127
#include <crypt.h>
118128
#endif
119129
130+
#include <stdlib.h>
131+
#include <string.h>
132+
120133
int main() {
121134
#if HAVE_CRYPT
122135
char salt[15], answer[40];
@@ -152,6 +165,9 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
152165
#include <crypt.h>
153166
#endif
154167
168+
#include <stdlib.h>
169+
#include <string.h>
170+
155171
int main() {
156172
#if HAVE_CRYPT
157173
char salt[30], answer[70];
@@ -184,6 +200,9 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
184200
#include <crypt.h>
185201
#endif
186202
203+
#include <stdlib.h>
204+
#include <string.h>
205+
187206
int main() {
188207
#if HAVE_CRYPT
189208
char salt[21], answer[21+86];
@@ -215,6 +234,9 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[
215234
#include <crypt.h>
216235
#endif
217236
237+
#include <stdlib.h>
238+
#include <string.h>
239+
218240
int main() {
219241
#if HAVE_CRYPT
220242
char salt[21], answer[21+43];

0 commit comments

Comments
 (0)