You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

684 lines
15 KiB

27 years ago
27 years ago
27 years ago
27 years ago
  1. dnl $Id$
  2. dnl
  3. dnl This file contains local autoconf functions.
  4. sinclude(dynlib.m4)
  5. dnl
  6. dnl PHP_LIBGCC_LIBPATH(gcc)
  7. dnl Stores the location of libgcc in libgcc_libpath
  8. dnl
  9. AC_DEFUN(PHP_LIBGCC_LIBPATH,[
  10. changequote({,})
  11. libgcc_libpath="`$1 --print-libgcc-file-name|sed 's%[^/][^/]*$%%'`"
  12. changequote([,])
  13. ])
  14. AC_DEFUN(PHP_ARG_ANALYZE,[
  15. case "[$]$1" in
  16. shared,*)
  17. ext_output="yes, shared"
  18. ext_shared=yes
  19. $1=`echo $ac_n "[$]$1$ac_c"|sed s/^shared,//`
  20. ;;
  21. shared)
  22. ext_output="yes, shared"
  23. ext_shared=yes
  24. $1=yes
  25. ;;
  26. no)
  27. ext_output="no"
  28. ext_shared=no
  29. ;;
  30. *)
  31. ext_output="yes"
  32. ext_shared=no
  33. ;;
  34. esac
  35. AC_MSG_RESULT($ext_output)
  36. ])
  37. dnl
  38. dnl PHP_ARG_WITH(arg-name, check message, help text[, default-val])
  39. dnl Sets PHP_ARG_NAME either to the user value or to the default value.
  40. dnl default-val defaults to no.
  41. dnl
  42. AC_DEFUN(PHP_ARG_WITH,[
  43. PHP_REAL_ARG_WITH([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z-,A-Z_))
  44. ])
  45. AC_DEFUN(PHP_REAL_ARG_WITH,[
  46. AC_MSG_CHECKING($2)
  47. AC_ARG_WITH($1,[$3],$5=[$]withval,$5=ifelse($4,,no,$4))
  48. PHP_ARG_ANALYZE($5)
  49. ])
  50. dnl
  51. dnl PHP_ARG_ENABLE(arg-name, check message, help text[, default-val])
  52. dnl Sets PHP_ARG_NAME either to the user value or to the default value.
  53. dnl default-val defaults to no.
  54. dnl
  55. AC_DEFUN(PHP_ARG_ENABLE,[
  56. PHP_REAL_ARG_ENABLE([$1],[$2],[$3],[$4],PHP_[]translit($1,a-z-,A-Z_))
  57. ])
  58. AC_DEFUN(PHP_REAL_ARG_ENABLE,[
  59. AC_MSG_CHECKING($2)
  60. AC_ARG_ENABLE($1,[$3],$5=[$]enableval,$5=ifelse($4,,no,$4))
  61. PHP_ARG_ANALYZE($5)
  62. ])
  63. AC_DEFUN(PHP_MODULE_PTR,[
  64. EXTRA_MODULE_PTRS="$EXTRA_MODULE_PTRS $1,"
  65. ])
  66. AC_DEFUN(PHP_CONFIG_NICE,[
  67. rm -f $1
  68. cat >$1<<EOF
  69. #! /bin/sh
  70. #
  71. # Created by configure
  72. EOF
  73. for arg in [$]0 "[$]@"; do
  74. echo "\"[$]arg\" \\" >> $1
  75. done
  76. echo '"[$]@"' >> $1
  77. chmod +x $1
  78. ])
  79. AC_DEFUN(PHP_TIME_R_TYPE,[
  80. AC_CACHE_CHECK(for time_r type, ac_cv_time_r_type,[
  81. AC_TRY_RUN([
  82. #include <time.h>
  83. #include <stdlib.h>
  84. main() {
  85. char buf[27];
  86. struct tm t;
  87. time_t old = 0;
  88. int r, s;
  89. s = gmtime_r(&old, &t);
  90. r = (int) asctime_r(&t, buf, 26);
  91. if (r == s && s == 0) exit(0);
  92. exit(1);
  93. }
  94. ],[
  95. ac_cv_time_r_type=hpux
  96. ],[
  97. ac_cv_time_r_type=normal
  98. ],[
  99. ac_cv_time_r_type=normal
  100. ])
  101. ])
  102. if test "$ac_cv_time_r_type" = "hpux"; then
  103. AC_DEFINE(PHP_HPUX_TIME_R,1,[Whether you have HP-SUX 10.x])
  104. fi
  105. ])
  106. AC_DEFUN(PHP_SUBST,[
  107. PHP_VAR_SUBST="$PHP_VAR_SUBST $1"
  108. AC_SUBST($1)
  109. ])
  110. AC_DEFUN(PHP_FAST_OUTPUT,[
  111. PHP_FAST_OUTPUT_FILES="$PHP_FAST_OUTPUT_FILES $1"
  112. ])
  113. AC_DEFUN(PHP_MKDIR_P_CHECK,[
  114. AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[
  115. test -d conftestdir && rm -rf conftestdir
  116. mkdir -p conftestdir/somedir >/dev/null 2>&1
  117. if test -d conftestdir/somedir; then
  118. ac_cv_mkdir_p=yes
  119. else
  120. ac_cv_mkdir_p=no
  121. fi
  122. rm -rf conftestdir
  123. ])
  124. ])
  125. AC_DEFUN(PHP_FAST_GENERATE,[
  126. PHP_MKDIR_P_CHECK
  127. echo creating config_vars.mk
  128. > config_vars.mk
  129. for i in $PHP_VAR_SUBST; do
  130. eval echo "$i = \$$i" >> config_vars.mk
  131. done
  132. $SHELL $srcdir/build/fastgen.sh $srcdir $ac_cv_mkdir_p $PHP_FAST_OUTPUT_FILES
  133. ])
  134. AC_DEFUN(PHP_TM_GMTOFF,[
  135. AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff,
  136. [AC_TRY_COMPILE([#include <sys/types.h>
  137. #include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_gmtoff;],
  138. ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)])
  139. if test "$ac_cv_struct_tm_gmtoff" = yes; then
  140. AC_DEFINE(HAVE_TM_GMTOFF)
  141. fi
  142. ])
  143. dnl PHP_CONFIGURE_PART(MESSAGE)
  144. dnl Idea borrowed from mm
  145. AC_DEFUN(PHP_CONFIGURE_PART,[
  146. AC_MSG_RESULT()
  147. AC_MSG_RESULT(${T_MD}$1${T_ME})
  148. ])
  149. AC_DEFUN(PHP_PROG_SENDMAIL,[
  150. AC_PATH_PROG(PROG_SENDMAIL, sendmail, /usr/lib/sendmail, $PATH /usr/bin /usr/sbin /usr/etc /etc /usr/ucblib)
  151. if test -n "$PROG_SENDMAIL"; then
  152. AC_DEFINE(HAVE_SENDMAIL)
  153. fi
  154. ])
  155. AC_DEFUN(PHP_RUNPATH_SWITCH,[
  156. dnl check for -R, etc. switch
  157. AC_MSG_CHECKING(if compiler supports -R)
  158. AC_CACHE_VAL(php_cv_cc_dashr,[
  159. SAVE_LIBS="${LIBS}"
  160. LIBS="-R /usr/lib ${LIBS}"
  161. AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
  162. LIBS="${SAVE_LIBS}"])
  163. AC_MSG_RESULT($php_cv_cc_dashr)
  164. if test $php_cv_cc_dashr = "yes"; then
  165. ld_runpath_switch="-R"
  166. else
  167. AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
  168. AC_CACHE_VAL(php_cv_cc_rpath,[
  169. SAVE_LIBS="${LIBS}"
  170. LIBS="-Wl,-rpath,/usr/lib ${LIBS}"
  171. AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
  172. LIBS="${SAVE_LIBS}"])
  173. AC_MSG_RESULT($php_cv_cc_rpath)
  174. if test $php_cv_cc_rpath = "yes"; then
  175. ld_runpath_switch="-Wl,-rpath,"
  176. else
  177. dnl something innocuous
  178. ld_runpath_switch="-L"
  179. fi
  180. fi
  181. ])
  182. AC_DEFUN(PHP_STRUCT_FLOCK,[
  183. AC_CACHE_CHECK(for struct flock,ac_cv_struct_flock,
  184. AC_TRY_COMPILE([
  185. #include <unistd.h>
  186. #include <fcntl.h>
  187. ],
  188. [struct flock x;],
  189. [
  190. ac_cv_struct_flock=yes
  191. ],[
  192. ac_cv_struct_flock=no
  193. ])
  194. )
  195. if test "$ac_cv_struct_flock" = "yes" ; then
  196. AC_DEFINE(HAVE_STRUCT_FLOCK, 1)
  197. fi
  198. ])
  199. AC_DEFUN(PHP_SOCKLEN_T,[
  200. AC_CACHE_CHECK(for socklen_t,ac_cv_socklen_t,
  201. AC_TRY_COMPILE([
  202. #include <sys/types.h>
  203. #include <sys/socket.h>
  204. ],[
  205. socklen_t x;
  206. ],[
  207. ac_cv_socklen_t=yes
  208. ],[
  209. ac_cv_socklen_t=no
  210. ]))
  211. if test "$ac_cv_socklen_t" = "yes"; then
  212. AC_DEFINE(HAVE_SOCKLEN_T, 1, [Whether you have socklen_t])
  213. fi
  214. ])
  215. dnl
  216. dnl PHP_SET_SYM_FILE(path)
  217. dnl
  218. dnl set the path of the file which contains the symbol export list
  219. dnl
  220. AC_DEFUN(PHP_SET_SYM_FILE,
  221. [
  222. PHP_SYM_FILE="$1"
  223. ])
  224. dnl
  225. dnl PHP_BUILD_THREAD_SAFE
  226. dnl
  227. AC_DEFUN(PHP_BUILD_THREAD_SAFE,[
  228. enable_experimental_zts=yes
  229. ])
  230. dnl
  231. dnl PHP_BUILD_SHARED
  232. dnl
  233. AC_DEFUN(PHP_BUILD_SHARED,[
  234. php_build_target=shared
  235. ])
  236. dnl
  237. dnl PHP_BUILD_STATIC
  238. dnl
  239. AC_DEFUN(PHP_BUILD_STATIC,[
  240. php_build_target=static
  241. ])
  242. dnl
  243. dnl PHP_BUILD_PROGRAM
  244. dnl
  245. AC_DEFUN(PHP_BUILD_PROGRAM,[
  246. php_build_target=program
  247. ])
  248. dnl
  249. dnl AC_PHP_ONCE(namespace, variable, code)
  250. dnl
  251. dnl execute code, if variable is not set in namespace
  252. dnl
  253. AC_DEFUN(AC_PHP_ONCE,[
  254. unique=`echo $ac_n "$2$ac_c" | tr -cd a-zA-Z0-9`
  255. cmd="echo $ac_n \"\$$1$unique$ac_c\""
  256. if test -n "$unique" && test "`eval $cmd`" = "" ; then
  257. eval "$1$unique=set"
  258. $3
  259. fi
  260. ])
  261. dnl
  262. dnl AC_EXPAND_PATH(path, variable)
  263. dnl
  264. dnl expands path to an absolute path and assigns it to variable
  265. dnl
  266. AC_DEFUN(AC_EXPAND_PATH,[
  267. if test -z "$1" || echo "$1" | grep '^/' >/dev/null ; then
  268. $2="$1"
  269. else
  270. ep_dir="`dirname \"$1\"`"
  271. ep_realdir="`(cd \"$ep_dir\" && pwd)`"
  272. $2="$ep_realdir/`basename \"$1\"`"
  273. fi
  274. ])
  275. dnl
  276. dnl AC_ADD_LIBPATH(path)
  277. dnl
  278. dnl add a library to linkpath/runpath
  279. dnl
  280. AC_DEFUN(AC_ADD_LIBPATH,[
  281. if test "$1" != "/usr/lib"; then
  282. AC_EXPAND_PATH($1, ai_p)
  283. AC_PHP_ONCE(LIBPATH, $ai_p, [
  284. test -n "$ld_runpath_switch" && LDFLAGS="$LDFLAGS $ld_runpath_switch$ai_p"
  285. LDFLAGS="$LDFLAGS -L$ai_p"
  286. PHP_RPATHS="$PHP_RPATHS $ai_p"
  287. ])
  288. fi
  289. ])
  290. dnl
  291. dnl AC_BUILD_RPATH()
  292. dnl
  293. dnl builds RPATH from PHP_RPATHS
  294. dnl
  295. AC_DEFUN(AC_BUILD_RPATH,[
  296. if test "$PHP_RPATH" = "yes" && test -n "$PHP_RPATHS"; then
  297. OLD_RPATHS="$PHP_RPATHS"
  298. PHP_RPATHS=""
  299. for i in $OLD_RPATHS; do
  300. PHP_LDFLAGS="$PHP_LDFLAGS -L$i"
  301. PHP_RPATHS="$PHP_RPATHS -R $i"
  302. NATIVE_RPATHS="$NATIVE_RPATHS ${ld_runpath_switch}$i"
  303. done
  304. fi
  305. ])
  306. dnl
  307. dnl AC_ADD_INCLUDE(path)
  308. dnl
  309. dnl add a include path
  310. dnl
  311. AC_DEFUN(AC_ADD_INCLUDE,[
  312. if test "$1" != "/usr/include"; then
  313. AC_EXPAND_PATH($1, ai_p)
  314. AC_PHP_ONCE(INCLUDEPATH, $ai_p, [
  315. INCLUDES="$INCLUDES -I$ai_p"
  316. ])
  317. fi
  318. ])
  319. dnl
  320. dnl AC_ADD_LIBRARY(library[, append])
  321. dnl
  322. dnl add a library to the link line
  323. dnl
  324. AC_DEFUN(AC_ADD_LIBRARY,[
  325. AC_PHP_ONCE(LIBRARY, $1, [
  326. ifelse($#, 1, LIBS="-l$1 $LIBS", LIBS="$LIBS -l$1")
  327. ])
  328. ])
  329. dnl
  330. dnl AC_ADD_LIBRARY_DEFER(library[, append])
  331. dnl
  332. dnl add a library to the link line (deferred)
  333. AC_DEFUN(AC_ADD_LIBRARY_DEFER,[
  334. AC_PHP_ONCE(LIBRARY, $1, [
  335. ifelse($#, 1, DLIBS="-l$1 $DLIBS", DLIBS="$DLIBS -l$1")
  336. ])
  337. ])
  338. dnl
  339. dnl AC_ADD_LIBRARY_WITH_PATH(library, path[, shared-libadd])
  340. dnl
  341. dnl add a library to the link line and path to linkpath/runpath.
  342. dnl if shared-libadd is not empty and $ext_shared is yes,
  343. dnl shared-libadd will be assigned the library information
  344. dnl
  345. AC_DEFUN(AC_ADD_LIBRARY_WITH_PATH,[
  346. ifelse($3,,[
  347. AC_ADD_LIBPATH($2)
  348. AC_ADD_LIBRARY($1)
  349. ],[
  350. if test "$ext_shared" = "yes"; then
  351. if test -n "$2"; then
  352. $3="[$]$3 -R$2 -L$2"
  353. fi
  354. $3="[$]$3 -l$1"
  355. else
  356. AC_ADD_LIBPATH($2)
  357. AC_ADD_LIBRARY($1)
  358. fi
  359. ])
  360. ])
  361. dnl
  362. dnl AC_ADD_LIBRARY_DEFER_WITH_PATH(library, path)
  363. dnl
  364. dnl add a library to the link line (deferred)
  365. dnl and path to linkpath/runpath (not deferred)
  366. dnl
  367. AC_DEFUN(AC_ADD_LIBRARY_DEFER_WITH_PATH,[
  368. AC_ADD_LIBPATH($2)
  369. AC_ADD_LIBRARY_DEFER($1)
  370. ])
  371. AC_DEFUN(AM_SET_LIBTOOL_VARIABLE,[
  372. LIBTOOL='$(SHELL) $(top_builddir)/libtool $1'
  373. ])
  374. dnl
  375. dnl Check for cc option
  376. dnl
  377. AC_DEFUN(AC_CHECK_CC_OPTION,[
  378. echo "main(){return 0;}" > conftest.$ac_ext
  379. opt="$1"
  380. var=`echo $ac_n "$opt$ac_c"|tr -c a-zA-Z0-9 _`
  381. AC_MSG_CHECKING([if compiler supports -$1 really])
  382. ac_php_compile="${CC-cc} -$opt -o conftest $CFLAGS $CPPFLAGS conftest.$ac_ext 2>&1"
  383. if eval $ac_php_compile 2>&1 | egrep "$opt" > /dev/null 2>&1 ; then
  384. eval php_cc_$var=no
  385. AC_MSG_RESULT(no)
  386. else
  387. if eval ./conftest 2>/dev/null ; then
  388. eval php_cc_$var=yes
  389. AC_MSG_RESULT(yes)
  390. else
  391. eval php_cc_$var=no
  392. AC_MSG_RESULT(no)
  393. fi
  394. fi
  395. ])
  396. AC_DEFUN(PHP_REGEX,[
  397. if test "$REGEX_TYPE" = "php"; then
  398. REGEX_LIB=regex/libregex.la
  399. REGEX_DIR=regex
  400. AC_DEFINE(HSREGEX)
  401. AC_DEFINE(REGEX,1)
  402. PHP_FAST_OUTPUT(regex/Makefile)
  403. elif test "$REGEX_TYPE" = "system"; then
  404. AC_DEFINE(REGEX,0)
  405. fi
  406. AC_MSG_CHECKING(which regex library to use)
  407. AC_MSG_RESULT($REGEX_TYPE)
  408. PHP_SUBST(REGEX_DIR)
  409. PHP_SUBST(REGEX_LIB)
  410. PHP_SUBST(HSREGEX)
  411. ])
  412. dnl
  413. dnl See if we have broken header files like SunOS has.
  414. dnl
  415. AC_DEFUN(AC_MISSING_FCLOSE_DECL,[
  416. AC_MSG_CHECKING([for fclose declaration])
  417. AC_TRY_COMPILE([#include <stdio.h>],[int (*func)() = fclose],[
  418. AC_DEFINE(MISSING_FCLOSE_DECL,0)
  419. AC_MSG_RESULT(ok)
  420. ],[
  421. AC_DEFINE(MISSING_FCLOSE_DECL,1)
  422. AC_MSG_RESULT(missing)
  423. ])
  424. ])
  425. dnl
  426. dnl Check for broken sprintf()
  427. dnl
  428. AC_DEFUN(AC_BROKEN_SPRINTF,[
  429. AC_CACHE_CHECK(whether sprintf is broken, ac_cv_broken_sprintf,[
  430. AC_TRY_RUN([main() {char buf[20];exit(sprintf(buf,"testing 123")!=11); }],[
  431. ac_cv_broken_sprintf=no
  432. ],[
  433. ac_cv_broken_sprintf=yes
  434. ],[
  435. ac_cv_broken_sprintf=no
  436. ])
  437. ])
  438. if test "$ac_cv_broken_sprintf" = "yes"; then
  439. AC_DEFINE(BROKEN_SPRINTF, 1)
  440. else
  441. AC_DEFINE(BROKEN_SPRINTF, 0)
  442. fi
  443. ])
  444. dnl
  445. dnl PHP_EXTENSION(extname [, shared])
  446. dnl
  447. dnl Includes an extension in the build.
  448. dnl
  449. dnl "extname" is the name of the ext/ subdir where the extension resides
  450. dnl "shared" can be set to "shared" or "yes" to build the extension as
  451. dnl a dynamically loadable library.
  452. dnl
  453. AC_DEFUN(PHP_EXTENSION,[
  454. EXT_SUBDIRS="$EXT_SUBDIRS $1"
  455. if test -d "$abs_srcdir/ext/$1"; then
  456. dnl ---------------------------------------------- Internal Module
  457. ext_builddir="ext/$1"
  458. ext_srcdir="$abs_srcdir/ext/$1"
  459. else
  460. dnl ---------------------------------------------- External Module
  461. ext_builddir="."
  462. ext_srcdir="$abs_srcdir"
  463. fi
  464. if test "$2" != "shared" && test "$2" != "yes"; then
  465. dnl ---------------------------------------------- Static module
  466. LIB_BUILD($ext_builddir)
  467. EXT_LTLIBS="$EXT_LTLIBS $ext_builddir/lib$1.la"
  468. EXT_STATIC="$EXT_STATIC $1"
  469. else
  470. dnl ---------------------------------------------- Shared module
  471. LIB_BUILD($ext_builddir,yes)
  472. AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z-,A-Z_), 1, Whether to build $1 as dynamic module)
  473. fi
  474. PHP_FAST_OUTPUT($ext_builddir/Makefile)
  475. ])
  476. PHP_SUBST(EXT_SUBDIRS)
  477. PHP_SUBST(EXT_STATIC)
  478. PHP_SUBST(EXT_SHARED)
  479. PHP_SUBST(EXT_LIBS)
  480. PHP_SUBST(EXT_LTLIBS)
  481. dnl
  482. dnl Solaris requires main code to be position independent in order
  483. dnl to let shared objects find symbols. Weird. Ugly.
  484. dnl
  485. dnl Must be run after all --with-NN options that let the user
  486. dnl choose dynamic extensions, and after the gcc test.
  487. dnl
  488. AC_DEFUN(PHP_SOLARIS_PIC_WEIRDNESS,[
  489. AC_MSG_CHECKING(whether -fPIC is required)
  490. if test "$EXT_SHARED" != ""; then
  491. os=`uname -sr 2>/dev/null`
  492. case "$os" in
  493. "SunOS 5.6"|"SunOS 5.7")
  494. case "$CC" in
  495. gcc*|egcs*) CFLAGS="$CFLAGS -fPIC";;
  496. *) CFLAGS="$CFLAGS -fpic";;
  497. esac
  498. AC_MSG_RESULT(yes);;
  499. *)
  500. AC_MSG_RESULT(no);;
  501. esac
  502. else
  503. AC_MSG_RESULT(no)
  504. fi
  505. ])
  506. dnl
  507. dnl Checks whether $withval is "shared" or starts with "shared,XXX"
  508. dnl and sets $shared to "yes" or "no", and removes "shared,?" stuff
  509. dnl from $withval.
  510. dnl
  511. AC_DEFUN(PHP_WITH_SHARED,[
  512. case $withval in
  513. shared)
  514. shared=yes
  515. withval=yes
  516. ;;
  517. shared,*)
  518. shared=yes
  519. withval=`echo $withval | sed -e 's/^shared,//'`
  520. ;;
  521. *)
  522. shared=no
  523. ;;
  524. esac
  525. if test -n "$php_always_shared"; then
  526. shared=yes
  527. fi
  528. ])
  529. dnl The problem is that the default compilation flags in Solaris 2.6 won't
  530. dnl let programs access large files; you need to tell the compiler that
  531. dnl you actually want your programs to work on large files. For more
  532. dnl details about this brain damage please see:
  533. dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
  534. dnl Written by Paul Eggert <eggert@twinsun.com>.
  535. AC_DEFUN(AC_SYS_LFS,
  536. [dnl
  537. # If available, prefer support for large files unless the user specified
  538. # one of the CPPFLAGS, LDFLAGS, or LIBS variables.
  539. AC_MSG_CHECKING(whether large file support needs explicit enabling)
  540. ac_getconfs=''
  541. ac_result=yes
  542. ac_set=''
  543. ac_shellvars='CPPFLAGS LDFLAGS LIBS'
  544. for ac_shellvar in $ac_shellvars; do
  545. case $ac_shellvar in
  546. CPPFLAGS) ac_lfsvar=LFS_CFLAGS ;;
  547. *) ac_lfsvar=LFS_$ac_shellvar ;;
  548. esac
  549. eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar
  550. (getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; }
  551. ac_getconf=`getconf $ac_lfsvar`
  552. ac_getconfs=$ac_getconfs$ac_getconf
  553. eval ac_test_$ac_shellvar=\$ac_getconf
  554. done
  555. case "$ac_result$ac_getconfs" in
  556. yes) ac_result=no ;;
  557. esac
  558. case "$ac_result$ac_set" in
  559. yes?*) ac_result="yes, but $ac_set is already set, so use its settings"
  560. esac
  561. AC_MSG_RESULT($ac_result)
  562. case $ac_result in
  563. yes)
  564. for ac_shellvar in $ac_shellvars; do
  565. eval $ac_shellvar=\$ac_test_$ac_shellvar
  566. done ;;
  567. esac
  568. ])
  569. AC_DEFUN(AC_SOCKADDR_SA_LEN,[
  570. AC_CACHE_CHECK([for field sa_len in struct sockaddr],ac_cv_sockaddr_sa_len,[
  571. AC_TRY_COMPILE([#include <sys/types.h>
  572. #include <sys/socket.h>],
  573. [struct sockaddr s; s.sa_len;],
  574. [ac_cv_sockaddr_sa_len=yes
  575. AC_DEFINE(HAVE_SOCKADDR_SA_LEN)],
  576. [ac_cv_sockaddr_sa_len=no])
  577. ])
  578. ])
  579. dnl ## PHP_AC_OUTPUT(file)
  580. dnl ## adds "file" to the list of files generated by AC_OUTPUT
  581. dnl ## This macro can be used several times.
  582. AC_DEFUN(PHP_OUTPUT,[
  583. PHP_OUTPUT_FILES="$PHP_OUTPUT_FILES $1"
  584. ])
  585. AC_DEFUN(PHP_DECLARED_TIMEZONE,[
  586. AC_CACHE_CHECK(for declared timezone, ac_cv_declared_timezone,[
  587. AC_TRY_COMPILE([
  588. #include <sys/types.h>
  589. #include <time.h>
  590. #ifdef HAVE_SYS_TIME_H
  591. #include <sys/time.h>
  592. #endif
  593. ],[
  594. time_t foo = (time_t) timezone;
  595. ],[
  596. ac_cv_declared_timezone=yes
  597. ],[
  598. ac_cv_declared_timezone=no
  599. ])])
  600. if test "$ac_cv_declared_timezone" = "yes"; then
  601. AC_DEFINE(HAVE_DECLARED_TIMEZONE, 1, [Whether system headers declare timezone])
  602. fi
  603. ])
  604. AC_DEFUN(PHP_EBCDIC,[
  605. AC_CACHE_CHECK([whether system uses EBCDIC],ac_cv_ebcdic,[
  606. AC_TRY_RUN( [
  607. int main(void) {
  608. return (unsigned char)'A' != (unsigned char)0xC1;
  609. }
  610. ],[
  611. ac_cv_ebcdic="yes"
  612. ],[
  613. ac_cv_ebcdic="no"
  614. ],[
  615. ac_cv_ebcdic="no"
  616. ])])
  617. if test "$ac_cv_ebcdic" = "yes"; then
  618. AC_DEFINE(CHARSET_EBCDIC,, [Define if system uses EBCDIC])
  619. fi
  620. ])