@@ -2,6 +2,126 @@ dnl $Id$
2
2
dnl
3
3
dnl This file contains local autoconf functions.
4
4
5
+ AC_DEFUN ( PHP_SUBST ,[
6
+ PHP_VAR_SUBST="$PHP_VAR_SUBST $1 "
7
+ AC_SUBST ( $1 )
8
+ ] )
9
+
10
+ AC_DEFUN ( PHP_FAST_OUTPUT ,[
11
+ PHP_FAST_OUTPUT_FILES="$PHP_FAST_OUTPUT_FILES $1 "
12
+ ] )
13
+
14
+ AC_DEFUN ( PHP_MKDIR_P_CHECK ,[
15
+ AC_CACHE_CHECK ( for working mkdir - p , ac_cv_mkdir_p ,[
16
+ test -d conftestdir && rm -rf conftestdir
17
+ mkdir -p conftestdir/somedir >/dev/null 2>&1
18
+ if test -d conftestdir/somedir; then
19
+ ac_cv_mkdir_p=yes
20
+ else
21
+ ac_cv_mkdir_p=no
22
+ fi
23
+ rm -rf conftestdir
24
+ ] )
25
+ ] )
26
+
27
+ AC_DEFUN ( PHP_FAST_GENERATE ,[
28
+ PHP_MKDIR_P_CHECK
29
+ echo creating config_vars.mk
30
+ > config_vars.mk
31
+ for i in $PHP_VAR_SUBST; do
32
+ eval echo "$i = \$$i" >> config_vars.mk
33
+ done
34
+ $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $PHP_FAST_OUTPUT_FILES
35
+ ] )
36
+
37
+ AC_DEFUN ( PHP_TM_GMTOFF ,[
38
+ AC_CACHE_CHECK ( [ for tm_gmtoff in struct tm] , ac_cv_struct_tm_gmtoff ,
39
+ [ AC_TRY_COMPILE ( [ #include <sys/types.h>
40
+ #include <$ac_cv_struct_tm>] , [ struct tm tm; tm.tm_gmtoff;] ,
41
+ ac_cv_struct_tm_gmtoff=yes , ac_cv_struct_tm_gmtoff=no ) ] )
42
+
43
+ if test "$ac_cv_struct_tm_gmtoff" = yes; then
44
+ AC_DEFINE ( HAVE_TM_GMTOFF )
45
+ fi
46
+ ] )
47
+
48
+ dnl PHP_CONFIGURE_PART(MESSAGE)
49
+ dnl Idea borrowed from mm
50
+ AC_DEFUN ( PHP_CONFIGURE_PART ,[
51
+ AC_MSG_RESULT ( )
52
+ AC_MSG_RESULT ( ${T_MD}$1 ${T_ME} )
53
+ ] )
54
+
55
+ AC_DEFUN ( PHP_PROG_SENDMAIL ,[
56
+ AC_PATH_PROG ( PROG_SENDMAIL , sendmail , / usr/lib/sendmail , $PATH / usr/bin / usr/sbin / usr/etc / etc / usr/ucblib )
57
+ if test -n "$PROG_SENDMAIL"; then
58
+ AC_DEFINE ( HAVE_SENDMAIL )
59
+ fi
60
+ ] )
61
+
62
+ AC_DEFUN ( PHP_RUNPATH_SWITCH ,[
63
+ dnl check for -R, etc. switch
64
+ AC_MSG_CHECKING ( if compiler supports - R )
65
+ AC_CACHE_VAL ( php_cv_cc_dashr ,[
66
+ SAVE_LIBS="${LIBS}"
67
+ LIBS="-R /usr/lib ${LIBS}"
68
+ AC_TRY_LINK ( [ ] , [ ] , php_cv_cc_dashr=yes , php_cv_cc_dashr=no )
69
+ LIBS="${SAVE_LIBS}"] )
70
+ AC_MSG_RESULT ( $php_cv_cc_dashr )
71
+ if test $php_cv_cc_dashr = "yes"; then
72
+ ld_runpath_switch="-R"
73
+ else
74
+ AC_MSG_CHECKING ( [ if compiler supports -Wl,-rpath,] )
75
+ AC_CACHE_VAL ( php_cv_cc_rpath ,[
76
+ SAVE_LIBS="${LIBS}"
77
+ LIBS="-Wl,-rpath,/usr/lib ${LIBS}"
78
+ AC_TRY_LINK ( [ ] , [ ] , php_cv_cc_rpath=yes , php_cv_cc_rpath=no )
79
+ LIBS="${SAVE_LIBS}"] )
80
+ AC_MSG_RESULT ( $php_cv_cc_rpath )
81
+ if test $php_cv_cc_rpath = "yes"; then
82
+ ld_runpath_switch="-Wl,-rpath,"
83
+ else
84
+ dnl something innocuous
85
+ ld_runpath_switch="-L"
86
+ fi
87
+ fi
88
+ ] )
89
+
90
+ AC_DEFUN ( PHP_STRUCT_FLOCK ,[
91
+ AC_CACHE_CHECK ( for struct flock ,ac_cv_struct_flock ,
92
+ AC_TRY_COMPILE ( [
93
+ #include <unistd.h>
94
+ #include <fcntl.h>
95
+ ] ,
96
+ [ struct flock x;] ,
97
+ [
98
+ ac_cv_struct_flock=yes
99
+ ] ,[
100
+ ac_cv_struct_flock=no
101
+ ] )
102
+ )
103
+ if test "$ac_cv_struct_flock" = "yes" ; then
104
+ AC_DEFINE ( HAVE_STRUCT_FLOCK , 1 )
105
+ fi
106
+ ] )
107
+
108
+ AC_DEFUN ( PHP_SOCKLEN_T ,[
109
+ AC_CACHE_CHECK ( for socklen_t ,ac_cv_socklen_t ,
110
+ AC_TRY_COMPILE ( [
111
+ #include <sys/types.h>
112
+ #include <sys/socket.h>
113
+ ] ,[
114
+ socklen_t x;
115
+ ] ,[
116
+ ac_cv_socklen_t=yes
117
+ ] ,[
118
+ ac_cv_socklen_t=no
119
+ ] ) )
120
+ if test "$ac_cv_socklen_t" = "no"; then
121
+ AC_DEFINE ( socklen_t , unsigned int )
122
+ fi
123
+ ] )
124
+
5
125
dnl
6
126
dnl PHP_SET_SYM_FILE(path)
7
127
dnl
@@ -176,7 +296,7 @@ if test "$REGEX_TYPE" = "php"; then
176
296
REGEX_DIR=regex
177
297
AC_DEFINE ( HSREGEX )
178
298
AC_DEFINE ( REGEX ,1 )
179
- PHP_OUTPUT (regex/Makefile)
299
+ PHP_FAST_OUTPUT (regex/Makefile)
180
300
elif test "$REGEX_TYPE" = "system"; then
181
301
AC_DEFINE ( REGEX ,0 )
182
302
elif test "$REGEX_TYPE" = "apache"; then
186
306
AC_MSG_CHECKING ( which regex library to use )
187
307
AC_MSG_RESULT ( $REGEX_TYPE )
188
308
189
- AC_SUBST ( REGEX_DIR )
190
- AC_SUBST ( REGEX_LIB )
191
- AC_SUBST ( HSREGEX )
309
+ PHP_SUBST (REGEX_DIR)
310
+ PHP_SUBST (REGEX_LIB)
311
+ PHP_SUBST (HSREGEX)
192
312
] )
193
313
194
314
dnl
@@ -209,17 +329,20 @@ dnl
209
329
dnl Check for broken sprintf()
210
330
dnl
211
331
AC_DEFUN ( AC_BROKEN_SPRINTF ,[
212
- AC_MSG_CHECKING ( [ for broken sprintf] )
213
- AC_TRY_RUN ( [ main() { char buf[ 20] ; exit (sprintf(buf,"testing 123")!=11); }] ,[
214
- AC_DEFINE ( BROKEN_SPRINTF ,0 )
215
- AC_MSG_RESULT ( ok )
216
- ] ,[
217
- AC_DEFINE ( BROKEN_SPRINTF ,1 )
218
- AC_MSG_RESULT ( broken )
219
- ] ,[
220
- AC_DEFINE ( BROKEN_SPRINTF ,0 )
221
- AC_MSG_RESULT ( cannot check , guessing ok )
332
+ AC_CACHE_CHECK ( whether sprintf is broken , ac_cv_broken_sprintf ,[
333
+ AC_TRY_RUN ( [ main() {char buf[ 20] ;exit(sprintf(buf,"testing 123")!=11); }] ,[
334
+ ac_cv_broken_sprintf=no
335
+ ] ,[
336
+ ac_cv_broken_sprintf=yes
337
+ ] ,[
338
+ ac_cv_broken_sprintf=no
339
+ ] )
222
340
] )
341
+ if test "$ac_cv_broken_sprintf" = "yes"; then
342
+ AC_DEFINE ( BROKEN_SPRINTF , 1 )
343
+ else
344
+ AC_DEFINE ( BROKEN_SPRINTF , 0 )
345
+ fi
223
346
] )
224
347
225
348
dnl
@@ -234,24 +357,24 @@ dnl
234
357
AC_DEFUN ( PHP_EXTENSION ,[
235
358
if test -d "$cwd/$srcdir/ext/$1 " ; then
236
359
EXT_SUBDIRS="$EXT_SUBDIRS $1 "
237
- if test "$2 " != "shared" -a "$2 " != "yes"; then
238
- _extlib="libphpext_ $1 .a"
239
- EXT_LTLIBS="$EXT_LTLIBS ext/$1 /libphpext_ $1 .la"
360
+ if test "$2 " != "shared" && test "$2 " != "yes" && test -z "$php_always_shared "; then
361
+ _extlib="lib $1 .a"
362
+ EXT_LTLIBS="$EXT_LTLIBS ext/$1 /lib $1 .la"
240
363
EXT_LIBS="$EXT_LIBS $1 /$_extlib"
241
364
EXT_STATIC="$EXT_STATIC $1 "
242
365
else
243
- AC_DEFINE_UNQUOTED ( COMPILE_DL_`echo $1 |tr a-z A-Z` , 1 , Whether to build $1 as dynamic module )
366
+ AC_DEFINE_UNQUOTED ( [ COMPILE_DL_] translit ( $1 , a-z , A-Z ) , 1 , Whether to build $1 as dynamic module )
244
367
EXT_SHARED="$EXT_SHARED $1 "
245
368
fi
246
- PHP_OUTPUT (ext/$1 /Makefile)
369
+ PHP_FAST_OUTPUT (ext/$1 /Makefile)
247
370
fi
248
371
] )
249
372
250
- AC_SUBST ( EXT_SUBDIRS )
251
- AC_SUBST ( EXT_STATIC )
252
- AC_SUBST ( EXT_SHARED )
253
- AC_SUBST ( EXT_LIBS )
254
- AC_SUBST ( EXT_LTLIBS )
373
+ PHP_SUBST (EXT_SUBDIRS)
374
+ PHP_SUBST (EXT_STATIC)
375
+ PHP_SUBST (EXT_SHARED)
376
+ PHP_SUBST (EXT_LIBS)
377
+ PHP_SUBST (EXT_LTLIBS)
255
378
256
379
dnl
257
380
dnl Solaris requires main code to be position independent in order
@@ -298,6 +421,9 @@ AC_DEFUN(PHP_WITH_SHARED,[
298
421
shared=no
299
422
;;
300
423
esac
424
+ if test -n "$php_always_shared"; then
425
+ shared=yes
426
+ fi
301
427
] )
302
428
303
429
dnl The problem is that the default compilation flags in Solaris 2.6 won't
@@ -354,9 +480,11 @@ AC_DEFUN(AC_SOCKADDR_SA_LEN,[
354
480
] )
355
481
] )
356
482
483
+
357
484
dnl ## PHP_AC_OUTPUT(file)
358
485
dnl ## adds "file" to the list of files generated by AC_OUTPUT
359
486
dnl ## This macro can be used several times.
360
487
AC_DEFUN ( PHP_OUTPUT ,[
361
488
PHP_OUTPUT_FILES="$PHP_OUTPUT_FILES $1 "
362
489
] )
490
+
0 commit comments