1## $Id$ -*- autoconf -*- 2dnl ## Process this file with autoconf to produce a configure script. 3 4dnl include Zend specific macro definitions first 5dnl ------------------------------------------------------------------------- 6sinclude(Zend/acinclude.m4) 7 8dnl Basic autoconf + automake initialization, generation of config.nice. 9dnl ------------------------------------------------------------------------- 10 11AC_PREREQ(2.59) 12AC_INIT(README.GIT-RULES) 13ifdef([AC_PRESERVE_HELP_ORDER], [AC_PRESERVE_HELP_ORDER], []) 14 15PHP_CONFIG_NICE(config.nice) 16 17PHP_CANONICAL_HOST_TARGET 18 19AC_CONFIG_HEADER(main/php_config.h) 20AH_TOP([ 21#if defined(__GNUC__) && __GNUC__ >= 4 22# define ZEND_API __attribute__ ((visibility("default"))) 23# define ZEND_DLEXPORT __attribute__ ((visibility("default"))) 24#else 25# define ZEND_API 26# define ZEND_DLEXPORT 27#endif 28 29#define ZEND_DLIMPORT 30 31#undef uint 32#undef ulong 33 34/* Define if you want to enable memory limit support */ 35#define MEMORY_LIMIT 0 36]) 37AH_BOTTOM([ 38#ifndef ZEND_ACCONFIG_H_NO_C_PROTOS 39 40#ifdef HAVE_STDLIB_H 41# include <stdlib.h> 42#endif 43 44#ifdef HAVE_SYS_TYPES_H 45# include <sys/types.h> 46#endif 47 48#ifdef HAVE_SYS_SELECT_H 49#include <sys/select.h> 50#endif 51 52#ifdef HAVE_IEEEFP_H 53# include <ieeefp.h> 54#endif 55 56#ifdef HAVE_STRING_H 57# include <string.h> 58#else 59# include <strings.h> 60#endif 61 62#if ZEND_BROKEN_SPRINTF 63int zend_sprintf(char *buffer, const char *format, ...); 64#else 65# define zend_sprintf sprintf 66#endif 67 68#include <math.h> 69 70/* To enable the is_nan, is_infinite and is_finite PHP functions */ 71#ifdef NETWARE 72 #define HAVE_ISNAN 1 73 #define HAVE_ISINF 1 74 #define HAVE_ISFINITE 1 75#endif 76 77#ifndef zend_isnan 78#ifdef HAVE_ISNAN 79#define zend_isnan(a) isnan(a) 80#elif defined(HAVE_FPCLASS) 81#define zend_isnan(a) ((fpclass(a) == FP_SNAN) || (fpclass(a) == FP_QNAN)) 82#else 83#define zend_isnan(a) 0 84#endif 85#endif 86 87#ifdef HAVE_ISINF 88#define zend_isinf(a) isinf(a) 89#elif defined(INFINITY) 90/* Might not work, but is required by ISO C99 */ 91#define zend_isinf(a) (((a)==INFINITY)?1:0) 92#elif defined(HAVE_FPCLASS) 93#define zend_isinf(a) ((fpclass(a) == FP_PINF) || (fpclass(a) == FP_NINF)) 94#else 95#define zend_isinf(a) 0 96#endif 97 98#ifdef HAVE_FINITE 99#define zend_finite(a) finite(a) 100#elif defined(HAVE_ISFINITE) || defined(isfinite) 101#define zend_finite(a) isfinite(a) 102#elif defined(fpclassify) 103#define zend_finite(a) ((fpclassify((a))!=FP_INFINITE&&fpclassify((a))!=FP_NAN)?1:0) 104#else 105#define zend_finite(a) (zend_isnan(a) ? 0 : zend_isinf(a) ? 0 : 1) 106#endif 107 108#endif /* ifndef ZEND_ACCONFIG_H_NO_C_PROTOS */ 109 110#ifdef NETWARE 111#ifdef USE_WINSOCK 112#/*This detection against winsock is of no use*/ undef HAVE_SOCKLEN_T 113#/*This detection against winsock is of no use*/ undef HAVE_SYS_SOCKET_H 114#endif 115#endif 116 117#undef PTHREADS 118]) 119 120PHP_MAJOR_VERSION=5 121PHP_MINOR_VERSION=6 122PHP_RELEASE_VERSION=41 123PHP_EXTRA_VERSION="-dev" 124PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION" 125PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION` 126 127dnl Allow version values to be used in Makefile 128PHP_SUBST(PHP_MAJOR_VERSION) 129PHP_SUBST(PHP_MINOR_VERSION) 130PHP_SUBST(PHP_RELEASE_VERSION) 131PHP_SUBST(PHP_EXTRA_VERSION) 132 133dnl Define where extension directories are located in the configure context 134AC_DEFUN([PHP_EXT_BUILDDIR],[ext/$1])dnl 135AC_DEFUN([PHP_EXT_DIR],[ext/$1])dnl 136AC_DEFUN([PHP_EXT_SRCDIR],[$abs_srcdir/ext/$1])dnl 137AC_DEFUN([PHP_ALWAYS_SHARED],[])dnl 138 139dnl Setting up the PHP version based on the information above. 140dnl ------------------------------------------------------------------------- 141 142echo "/* automatically generated by configure */" > php_version.h.new 143echo "/* edit configure.in to change version number */" >> php_version.h.new 144echo "#define PHP_MAJOR_VERSION $PHP_MAJOR_VERSION" >> php_version.h.new 145echo "#define PHP_MINOR_VERSION $PHP_MINOR_VERSION" >> php_version.h.new 146echo "#define PHP_RELEASE_VERSION $PHP_RELEASE_VERSION" >> php_version.h.new 147echo "#define PHP_EXTRA_VERSION \"$PHP_EXTRA_VERSION\"" >> php_version.h.new 148echo "#define PHP_VERSION \"$PHP_VERSION\"" >> php_version.h.new 149echo "#define PHP_VERSION_ID $PHP_VERSION_ID" >> php_version.h.new 150cmp php_version.h.new $srcdir/main/php_version.h >/dev/null 2>&1 151if test $? -ne 0 ; then 152 rm -f $srcdir/main/php_version.h && mv php_version.h.new $srcdir/main/php_version.h && \ 153 echo 'Updated main/php_version.h' 154else 155 rm -f php_version.h.new 156fi 157 158 159dnl Catch common errors here to save a few seconds of our users' time 160dnl ------------------------------------------------------------------------- 161 162if test "$with_shared_apache" != "no" && test -n "$with_shared_apache" ; then 163 AC_MSG_ERROR([--with-shared-apache is not supported. Please refer to the documentation for using APXS]) 164fi 165 166if test -n "$with_apache" && test -n "$with_apxs"; then 167 AC_MSG_ERROR([--with-apache and --with-apxs cannot be used together]) 168fi 169 170if test -n "$with_apxs2filter" && test -n "$with_apxs2"; then 171 AC_MSG_ERROR([--with-apxs2filter and --with-apxs2 cannot be used together]) 172fi 173 174 175dnl Settings we want to make before the checks. 176dnl ------------------------------------------------------------------------- 177 178cwd=`pwd` 179 180php_shtool=$srcdir/build/shtool 181T_MD=`$php_shtool echo -n -e %B` 182T_ME=`$php_shtool echo -n -e %b` 183 184PHP_INIT_BUILD_SYSTEM 185 186dnl We want this one before the checks, so the checks can modify CFLAGS. 187test -z "$CFLAGS" && auto_cflags=1 188 189abs_srcdir=`(cd $srcdir; pwd)` 190abs_builddir=`pwd` 191 192php_abs_top_srcdir=$abs_srcdir 193php_abs_top_builddir=$abs_builddir 194 195dnl Because ``make install'' is often performed by the superuser, 196dnl we create the libs subdirectory as the user who configures PHP. 197dnl Otherwise, the current user will not be able to delete libs 198dnl or the contents of libs. 199 200$php_shtool mkdir -p libs 201rm -f libs/* 202 203dnl Checks for programs. 204dnl ------------------------------------------------------------------------- 205 206AC_PROG_CC([cc gcc]) 207PHP_DETECT_ICC 208PHP_DETECT_SUNCC 209AC_PROG_CC_C_O 210dnl Change to AC_PROG_CC_STDC when we start requiring a post-2.13 autoconf 211dnl AC_PROG_CC_STDC 212AC_PROG_CPP 213AC_AIX 214AC_PROG_LN_S 215 216dnl Support systems with system libraries in e.g. /usr/lib64 217PHP_ARG_WITH(libdir, for system library directory, 218[ --with-libdir=NAME Look for libraries in .../NAME rather than .../lib],lib,no) 219 220PHP_ARG_ENABLE(rpath, whether to enable runpaths, 221[ --disable-rpath Disable passing additional runtime library 222 search paths], yes, no) 223 224dnl check for -R, etc. switch 225PHP_RUNPATH_SWITCH 226 227dnl Checks for some support/generator progs 228PHP_PROG_AWK 229PHP_PROG_BISON 230PHP_PROG_RE2C 231 232dnl Check if bison generated files exist when bison does not.. 233case $php_cv_bison_version in 234 ""|invalid[)] 235 if ! test -f "$abs_srcdir/Zend/zend_language_parser.h" || ! test -f "$abs_srcdir/Zend/zend_language_parser.c" ; then 236 AC_MSG_ERROR([bison is required to build PHP/Zend when building a GIT checkout!]) 237 fi 238 ;; 239esac 240 241PHP_ARG_ENABLE(re2c-cgoto, whether to enable computed goto gcc extension with re2c, 242[ --enable-re2c-cgoto Enable -g flag to re2c to use computed goto gcc extension], no, no) 243 244if test "$PHP_RE2C_CGOTO" = "no"; then 245 RE2C_FLAGS="" 246else 247 AC_MSG_CHECKING([whether re2c -g works]) 248 AC_TRY_COMPILE([],[ 249int main(int argc, const char **argv) 250{ 251 argc = argc; 252 argv = argv; 253label1: 254label2: 255 static void *adr[] = { &&label1, &&label2}; 256 goto *adr[0]; 257 return 0; 258} 259 ],[ 260 RE2C_FLAGS="" 261 AC_MSG_RESULT([no]) 262 ],[ 263 RE2C_FLAGS="-g" 264 AC_MSG_RESULT([yes]) 265 ]) 266fi 267PHP_SUBST(RE2C_FLAGS) 268 269dnl Platform-specific compile settings. 270dnl ------------------------------------------------------------------------- 271 272dnl See bug #28605 273case $host_cpu in 274 alpha*) 275 if test "$GCC" = "yes"; then 276 CFLAGS="$CFLAGS -mieee" 277 else 278 CFLAGS="$CFLAGS -ieee" 279 fi 280 ;; 281 sparc*) 282 if test "$SUNCC" = "yes"; then 283 CFLAGS="$CFLAGS -xmemalign=8s" 284 fi 285 ;; 286esac 287 288dnl activate some gcc specific optimizations for gcc >= 4 289if test "$GCC" = "yes"; then 290 case $host_alias in 291 *darwin*) 292 GCC_MAJOR_VERSION=`$CC -dumpversion | /usr/bin/sed -nE '1s/([[0-9]]+)\.[[0-9]]+\..*/\1/;1p'` 293 ;; 294 *) 295 GCC_MAJOR_VERSION=`$CC --version | $SED -n '1s/[[^0-9]]*//;1s/\..*//;1p'` 296 ;; 297 esac 298 if test $GCC_MAJOR_VERSION -ge 4; then 299 CFLAGS="$CFLAGS -fvisibility=hidden" 300 fi 301fi 302 303case $host_alias in 304 *solaris*) 305 CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS" 306 if test "${enable_libgcc+set}" != "set" && test "$GCC" = "yes"; then 307 enable_libgcc=yes 308 fi 309 ;; 310 *dgux*) 311 CPPFLAGS="$CPPFLAGS -D_BSD_TIMEOFDAY_FLAVOR" 312 ;; 313 *darwin*|*rhapsody*) 314 if test -n "$GCC"; then 315 PHP_CHECK_GCC_ARG(-no-cpp-precomp, gcc_no_cpp_precomp=yes) 316 if test "$gcc_no_cpp_precomp" = "yes"; then 317 CPPFLAGS="$CPPFLAGS -no-cpp-precomp" 318 fi 319 fi 320 php_multiple_shlib_versions_ok=yes 321 ;; 322 *beos*) 323 beos_threads=1 324 LIBS="$LIBS -lbe -lroot" 325 ;; 326 *mips*) 327 CPPFLAGS="$CPPFLAGS -D_XPG_IV" 328 ;; 329 *hpux*) 330 if test "$GCC" = "yes"; then 331 CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" 332 fi 333 ;; 334 *netware*) 335 PHP_BUILD_PROGRAM 336 PHP_ADD_SOURCES(/main, internal_functions.c,,PHP_GLOBAL_OBJS) 337 PHP_ADD_SOURCES(win32, sendmail.c, -I$CFLAGS, PHP_GLOBAL_OBJS) 338 PHP5LIB_SHARED_LIBADD=\$\(EXTRA_LIBS\) 339 EXTENSION_DIR=sys:/php$PHP_MAJOR_VERSION/ext 340 PHP_SUBST(PHP5LIB_SHARED_LIBADD) 341 PHP_SHARED_MODULE(php5lib, PHP_GLOBAL_OBJS, netware) 342 ;; 343esac 344 345# Disable PIC mode by default where it is known to be safe to do so, 346# to avoid the performance hit from the lost register 347AC_MSG_CHECKING([whether to force non-PIC code in shared modules]) 348case $host_alias in 349 i?86-*-linux*|i?86-*-freebsd*) 350 if test "${with_pic+set}" != "set" || test "$with_pic" = "no"; then 351 with_pic=no 352 AC_MSG_RESULT(yes) 353 else 354 AC_MSG_RESULT(no) 355 fi 356 ;; 357 *) 358 AC_MSG_RESULT(no) 359 ;; 360esac 361 362 363dnl Include Zend and TSRM configurations. 364dnl ------------------------------------------------------------------------- 365 366sinclude(Zend/Zend.m4) 367sinclude(TSRM/threads.m4) 368sinclude(TSRM/tsrm.m4) 369 370dnl . 371dnl ------------------------------------------------------------------------- 372 373PTHREADS_CHECK 374PHP_HELP_SEPARATOR([SAPI modules:]) 375PHP_SHLIB_SUFFIX_NAMES 376PHP_BUILD_PROGRAM 377PHP_SAPI=none 378 379 380dnl SAPI configuration. 381dnl ------------------------------------------------------------------------- 382 383dnl paths to the targets are relative to the build directory 384SAPI_SHARED=libs/libphp[]$PHP_MAJOR_VERSION[.]$SHLIB_DL_SUFFIX_NAME 385SAPI_STATIC=libs/libphp[]$PHP_MAJOR_VERSION[.a] 386SAPI_LIBTOOL=libphp[]$PHP_MAJOR_VERSION[.la] 387 388PHP_CONFIGURE_PART(Configuring SAPI modules) 389 390esyscmd(./build/config-stubs sapi) 391 392dnl Show which main SAPI was selected 393AC_MSG_CHECKING([for chosen SAPI module]) 394AC_MSG_RESULT([$PHP_SAPI]) 395 396dnl Show which binaries were selected 397AC_MSG_CHECKING([for executable SAPI binaries]) 398if test "$PHP_BINARIES"; then 399 AC_MSG_RESULT([$PHP_BINARIES]) 400else 401 AC_MSG_RESULT([none]) 402fi 403 404dnl Exit early 405if test -z "$PHP_INSTALLED_SAPIS"; then 406 AC_MSG_ERROR([Nothing to build.]) 407fi 408 409dnl force ZTS 410if test "$enable_maintainer_zts" = "yes"; then 411 PTHREADS_ASSIGN_VARS 412 PTHREADS_FLAGS 413fi 414 415dnl Starting system checks. 416dnl ------------------------------------------------------------------------- 417 418PHP_CONFIGURE_PART(Running system checks) 419 420dnl Find sendmail binary 421PHP_PROG_SENDMAIL 422 423dnl Check whether the system uses EBCDIC (not ASCII) as its native codeset 424PHP_EBCDIC 425 426dnl Check whether the system byte ordering is bigendian 427PHP_C_BIGENDIAN 428 429dnl Check whether writing to stdout works 430PHP_TEST_WRITE_STDOUT 431 432dnl Check for /usr/pkg/{lib,include} which is where NetBSD puts binary 433dnl and source packages. This should be harmless on other OSs. 434if test -d /usr/pkg/include -a -d /usr/pkg/lib ; then 435 CPPFLAGS="$CPPFLAGS -I/usr/pkg/include" 436 LDFLAGS="$LDFLAGS -L/usr/pkg/lib" 437fi 438test -d /usr/ucblib && PHP_ADD_LIBPATH(/usr/ucblib) 439 440 441dnl First, library checks. 442dnl ------------------------------------------------------------------------- 443 444dnl Some systems (OpenServer 5) dislike -lsocket -lnsl, so we try 445dnl to avoid -lnsl checks, if we already have the functions which 446dnl are usually in libnsl 447dnl Also, uClibc will bark at linking with glibc's libnsl. 448 449PHP_CHECK_FUNC(socket, socket) 450PHP_CHECK_FUNC(socketpair, socket) 451PHP_CHECK_FUNC(htonl, socket) 452PHP_CHECK_FUNC(gethostname, nsl) 453PHP_CHECK_FUNC(gethostbyaddr, nsl) 454PHP_CHECK_FUNC(yp_get_default_domain, nsl) 455 456PHP_CHECK_FUNC(dlopen, dl) 457if test "$ac_cv_func_dlopen" = "yes"; then 458 AC_DEFINE(HAVE_LIBDL, 1, [ ]) 459fi 460AC_CHECK_LIB(m, sin) 461 462dnl Check for inet_aton 463dnl in -lc, -lbind and -lresolv 464PHP_CHECK_FUNC(inet_aton, resolv, bind) 465 466dnl Then headers. 467dnl ------------------------------------------------------------------------- 468 469dnl Checks for header files. 470AC_HEADER_STDC 471AC_HEADER_DIRENT 472 473dnl QNX requires unix.h to allow functions in libunix to work properly 474AC_CHECK_HEADERS([ \ 475inttypes.h \ 476stdint.h \ 477dirent.h \ 478ApplicationServices/ApplicationServices.h \ 479sys/param.h \ 480sys/types.h \ 481sys/time.h \ 482netinet/in.h \ 483alloca.h \ 484arpa/inet.h \ 485arpa/nameser.h \ 486assert.h \ 487crypt.h \ 488dns.h \ 489fcntl.h \ 490grp.h \ 491ieeefp.h \ 492langinfo.h \ 493limits.h \ 494locale.h \ 495monetary.h \ 496netdb.h \ 497pwd.h \ 498resolv.h \ 499signal.h \ 500stdarg.h \ 501stdlib.h \ 502string.h \ 503syslog.h \ 504sysexits.h \ 505sys/ioctl.h \ 506sys/file.h \ 507sys/mman.h \ 508sys/mount.h \ 509sys/poll.h \ 510sys/resource.h \ 511sys/select.h \ 512sys/socket.h \ 513sys/stat.h \ 514sys/statfs.h \ 515sys/statvfs.h \ 516sys/vfs.h \ 517sys/sysexits.h \ 518sys/varargs.h \ 519sys/wait.h \ 520sys/loadavg.h \ 521termios.h \ 522unistd.h \ 523unix.h \ 524utime.h \ 525sys/utsname.h \ 526sys/ipc.h \ 527dlfcn.h \ 528assert.h 529],[],[],[ 530#ifdef HAVE_SYS_PARAM_H 531#include <sys/param.h> 532#endif 533#ifdef HAVE_SYS_TYPES_H 534#include <sys/types.h> 535#endif 536#ifdef HAVE_SYS_TIME_H 537#include <sys/time.h> 538#endif 539#ifdef HAVE_NETINET_IN_H 540#include <netinet/in.h> 541#endif 542#ifdef HAVE_ARPA_NAMESER_H 543#include <arpa/nameser.h> 544#endif 545]) 546 547PHP_FOPENCOOKIE 548PHP_BROKEN_GETCWD 549PHP_BROKEN_GLIBC_FOPEN_APPEND 550 551dnl Checks for typedefs, structures, and compiler characteristics. 552dnl ------------------------------------------------------------------------- 553 554AC_STRUCT_TM 555AC_STRUCT_TIMEZONE 556 557PHP_MISSING_TIME_R_DECL 558PHP_MISSING_FCLOSE_DECL 559 560PHP_TM_GMTOFF 561PHP_STRUCT_FLOCK 562PHP_SOCKLEN_T 563 564AC_CHECK_SIZEOF(size_t, 8) 565AC_CHECK_SIZEOF(long long, 8) 566AC_CHECK_SIZEOF(long long int, 8) 567AC_CHECK_SIZEOF(long, 8) 568AC_CHECK_SIZEOF(int, 4) 569 570dnl These are defined elsewhere than stdio.h 571PHP_CHECK_SIZEOF(intmax_t, 0) 572PHP_CHECK_SIZEOF(ssize_t, 8) 573PHP_CHECK_SIZEOF(ptrdiff_t, 8) 574 575dnl Check stdint types (must be after header check) 576PHP_CHECK_STDINT_TYPES 577 578dnl Check for members of the stat structure 579AC_STRUCT_ST_BLKSIZE 580dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exists 581dnl The WARNING_LEVEL required because cc in QNX hates -w option without an argument 582if test "`uname -s 2>/dev/null`" != "QNX"; then 583 AC_STRUCT_ST_BLOCKS 584else 585 AC_MSG_WARN([warnings level for cc set to 0]) 586 WARNING_LEVEL=0 587fi 588AC_STRUCT_ST_RDEV 589 590dnl Checks for types 591AC_TYPE_SIZE_T 592AC_TYPE_UID_T 593 594dnl Checks for sockaddr_storage and sockaddr.sa_len 595PHP_SOCKADDR_CHECKS 596 597dnl Check for IPv6 support 598AC_CACHE_CHECK([for IPv6 support], ac_cv_ipv6_support, 599[AC_TRY_LINK([ #include <sys/types.h> 600#include <sys/socket.h> 601#include <netinet/in.h>], [struct sockaddr_in6 s; struct in6_addr t=in6addr_any; int i=AF_INET6; s; t.s6_addr[0] = 0;], 602 [ac_cv_ipv6_support=yes], [ac_cv_ipv6_support=no])]) 603 604dnl Checks for library functions. 605dnl ------------------------------------------------------------------------- 606 607AC_FUNC_VPRINTF 608AC_CHECK_FUNCS( 609alphasort \ 610asctime_r \ 611chroot \ 612ctime_r \ 613cuserid \ 614crypt \ 615flock \ 616ftok \ 617funopen \ 618gai_strerror \ 619gcvt \ 620getloadavg \ 621getlogin \ 622getprotobyname \ 623getprotobynumber \ 624getservbyname \ 625getservbyport \ 626gethostname \ 627getrusage \ 628gettimeofday \ 629gmtime_r \ 630getpwnam_r \ 631getgrnam_r \ 632getpwuid_r \ 633grantpt \ 634inet_ntoa \ 635inet_ntop \ 636inet_pton \ 637isascii \ 638link \ 639localtime_r \ 640lockf \ 641lchown \ 642lrand48 \ 643memcpy \ 644memmove \ 645mkstemp \ 646mmap \ 647nl_langinfo \ 648perror \ 649poll \ 650ptsname \ 651putenv \ 652realpath \ 653random \ 654rand_r \ 655scandir \ 656setitimer \ 657setlocale \ 658localeconv \ 659setenv \ 660setpgid \ 661setsockopt \ 662setvbuf \ 663shutdown \ 664sin \ 665snprintf \ 666srand48 \ 667srandom \ 668statfs \ 669statvfs \ 670std_syslog \ 671strcasecmp \ 672strcoll \ 673strdup \ 674strerror \ 675strftime \ 676strnlen \ 677strptime \ 678strstr \ 679strtok_r \ 680symlink \ 681tempnam \ 682tzset \ 683unlockpt \ 684unsetenv \ 685usleep \ 686utime \ 687vsnprintf \ 688vasprintf \ 689asprintf \ 690nanosleep \ 691) 692 693dnl Some systems (like OpenSolaris) do not have nanosleep in libc 694PHP_CHECK_FUNC_LIB(nanosleep, rt) 695 696dnl Check for getaddrinfo, should be a better way, but... 697dnl Also check for working getaddrinfo 698AC_CACHE_CHECK([for getaddrinfo], ac_cv_func_getaddrinfo, 699[AC_TRY_LINK([#include <netdb.h>], 700 [struct addrinfo *g,h;g=&h;getaddrinfo("","",g,&g);], 701 AC_TRY_RUN([ 702#include <netdb.h> 703#include <sys/types.h> 704#ifndef AF_INET 705# include <sys/socket.h> 706#endif 707int main(void) { 708 struct addrinfo *ai, *pai, hints; 709 710 memset(&hints, 0, sizeof(hints)); 711 hints.ai_flags = AI_NUMERICHOST; 712 713 if (getaddrinfo("127.0.0.1", 0, &hints, &ai) < 0) { 714 exit(1); 715 } 716 717 if (ai == 0) { 718 exit(1); 719 } 720 721 pai = ai; 722 723 while (pai) { 724 if (pai->ai_family != AF_INET) { 725 /* 127.0.0.1/NUMERICHOST should only resolve ONE way */ 726 exit(1); 727 } 728 if (pai->ai_addr->sa_family != AF_INET) { 729 /* 127.0.0.1/NUMERICHOST should only resolve ONE way */ 730 exit(1); 731 } 732 pai = pai->ai_next; 733 } 734 freeaddrinfo(ai); 735 exit(0); 736} 737 ],ac_cv_func_getaddrinfo=yes, ac_cv_func_getaddrinfo=no, ac_cv_func_getaddrinfo=no), 738ac_cv_func_getaddrinfo=no)]) 739if test "$ac_cv_func_getaddrinfo" = yes; then 740 AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function]) 741fi 742 743dnl Check for the __sync_fetch_and_add builtin 744AC_CACHE_CHECK([for __sync_fetch_and_add], ac_cv_func_sync_fetch_and_add, 745[AC_TRY_LINK([],[int x;__sync_fetch_and_add(&x,1);],ac_cv_func_sync_fetch_and_add=yes,ac_cv_func_sync_fetch_and_add=no)]) 746if test "$ac_cv_func_sync_fetch_and_add" = yes; then 747 AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD,1,[Define if you have the __sync_fetch_and_add function]) 748fi 749 750AC_REPLACE_FUNCS(strlcat strlcpy getopt) 751AC_FUNC_UTIME_NULL 752AC_FUNC_ALLOCA 753dnl PHP_AC_BROKEN_SPRINTF 754dnl PHP_AC_BROKEN_SNPRINTF 755PHP_DECLARED_TIMEZONE 756PHP_TIME_R_TYPE 757PHP_READDIR_R_TYPE 758PHP_CHECK_IN_ADDR_T 759 760AC_CHECK_FUNCS(crypt_r, [ php_crypt_r="1" ], [ php_crypt_r="0" ]) 761if test "x$php_crypt_r" = "x1"; then 762 PHP_CRYPT_R_STYLE 763fi 764 765dnl General settings. 766dnl ------------------------------------------------------------------------- 767PHP_CONFIGURE_PART(General settings) 768 769PHP_HELP_SEPARATOR([General settings:]) 770 771PHP_ARG_ENABLE(gcov, whether to include gcov symbols, 772[ --enable-gcov Enable GCOV code coverage (requires LTP) - FOR DEVELOPERS ONLY!!], no, no) 773 774if test "$PHP_GCOV" = "yes"; then 775 776 if test "$GCC" != "yes"; then 777 AC_MSG_ERROR([GCC is required for --enable-gcov]) 778 fi 779 780 dnl Check if ccache is being used 781 case `$php_shtool path $CC` in 782 *ccache*[)] gcc_ccache=yes;; 783 *[)] gcc_ccache=no;; 784 esac 785 786 if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then 787 AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.]) 788 fi 789 790 dnl min: 1.5 (i.e. 105, major * 100 + minor for easier comparison) 791 ltp_version_min="105" 792 dnl non-working versions, e.g. "1.8 1.18"; 793 dnl remove "none" when introducing the first incompatible LTP version an 794 dnl separate any following additions by spaces 795 ltp_version_exclude="1.8" 796 797 AC_CHECK_PROG(LTP, lcov, lcov) 798 AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml) 799 PHP_SUBST(LTP) 800 PHP_SUBST(LTP_GENHTML) 801 802 if test "$LTP"; then 803 AC_CACHE_CHECK([for ltp version], php_cv_ltp_version, [ 804 php_cv_ltp_version=invalid 805 ltp_version_vars=`$LTP -v 2>/dev/null | $SED -e 's/^.* //' -e 's/\./ /g' | tr -d a-z` 806 if test -n "$ltp_version_vars"; then 807 set $ltp_version_vars 808 ltp_version="${1}.${2}" 809 ltp_version_num="`expr ${1} \* 100 + ${2}`" 810 if test $ltp_version_num -ge $ltp_version_min; then 811 php_cv_ltp_version="$ltp_version (ok)" 812 for ltp_check_version in $ltp_version_exclude; do 813 if test "$ltp_version" = "$ltp_check_version"; then 814 php_cv_ltp_version=invalid 815 break 816 fi 817 done 818 fi 819 fi 820 ]) 821 else 822 ltp_msg="To enable code coverage reporting you must have LTP installed" 823 AC_MSG_ERROR([$ltp_msg]) 824 fi 825 826 case $php_cv_ltp_version in 827 ""|invalid[)] 828 ltp_msg="This LTP version is not supported (found: $ltp_version, min: $ltp_version_min, excluded: $ltp_version_exclude)." 829 AC_MSG_ERROR([$ltp_msg]) 830 LTP="exit 0;" 831 ;; 832 esac 833 834 if test -z "$LTP_GENHTML"; then 835 AC_MSG_ERROR([Could not find genhtml from the LTP package]) 836 fi 837 838 AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov]) 839 PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Makefile.gcov, $abs_srcdir) 840 841 dnl Remove all optimization flags from CFLAGS 842 changequote({,}) 843 CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'` 844 CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'` 845 changequote([,]) 846 847 dnl Add the special gcc flags 848 CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage" 849 CXXFLAGS="$CXXFLAGS -O0 -fprofile-arcs -ftest-coverage" 850fi 851 852PHP_ARG_ENABLE(debug, whether to include debugging symbols, 853[ --enable-debug Compile with debugging symbols], no, no) 854 855if test "$PHP_DEBUG" = "yes"; then 856 PHP_DEBUG=1 857 ZEND_DEBUG=yes 858 changequote({,}) 859 CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'` 860 CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'` 861 changequote([,]) 862 dnl add -O0 only if GCC or ICC is used 863 if test "$GCC" = "yes" || test "$ICC" = "yes"; then 864 CFLAGS="$CFLAGS -O0" 865 CXXFLAGS="$CXXFLAGS -g -O0" 866 fi 867 if test "$SUNCC" = "yes"; then 868 if test -n "$auto_cflags"; then 869 CFLAGS="-g" 870 CXXFLAGS="-g" 871 else 872 CFLAGS="$CFLAGS -g" 873 CXXFLAGS="$CFLAGS -g" 874 fi 875 fi 876else 877 PHP_DEBUG=0 878 ZEND_DEBUG=no 879fi 880 881PHP_ARG_WITH(layout, layout of installed files, 882[ --with-layout=TYPE Set how installed files will be laid out. Type can 883 be either PHP or GNU @<:@PHP@:>@], PHP, no) 884 885case $PHP_LAYOUT in 886 GNU) 887 oldstyleextdir=no 888 ;; 889 *) 890 oldstyleextdir=yes 891 ;; 892esac 893 894PHP_ARG_WITH(config-file-path, path to configuration file, 895[ --with-config-file-path=PATH 896 Set the path in which to look for php.ini @<:@PREFIX/lib@:>@], DEFAULT, no) 897 898if test "$PHP_CONFIG_FILE_PATH" = "DEFAULT"; then 899 case $PHP_LAYOUT in 900 GNU) 901 PHP_CONFIG_FILE_PATH=$sysconfdir 902 ;; 903 *) 904 PHP_CONFIG_FILE_PATH=$libdir 905 ;; 906 esac 907fi 908 909AC_MSG_CHECKING([where to scan for configuration files]) 910PHP_ARG_WITH(config-file-scan-dir,, 911[ --with-config-file-scan-dir=PATH 912 Set the path where to scan for configuration files], DEFAULT, no) 913if test "$PHP_CONFIG_FILE_SCAN_DIR" = "DEFAULT"; then 914 PHP_CONFIG_FILE_SCAN_DIR= 915fi 916AC_MSG_RESULT([$PHP_CONFIG_FILE_SCAN_DIR]) 917 918test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS" 919 920PHP_ARG_ENABLE(sigchild, whether to enable PHP's own SIGCHLD handler, 921[ --enable-sigchild Enable PHP's own SIGCHLD handler], no, no) 922 923if test "$PHP_SIGCHILD" = "yes"; then 924 AC_DEFINE(PHP_SIGCHILD, 1, [ ]) 925else 926 AC_DEFINE(PHP_SIGCHILD, 0, [ ]) 927fi 928 929PHP_ARG_ENABLE(libgcc, whether to explicitly link against libgcc, 930[ --enable-libgcc Enable explicitly linking against libgcc], no, no) 931 932if test "$PHP_LIBGCC" = "yes"; then 933 PHP_LIBGCC_LIBPATH(gcc) 934 if test -z "$libgcc_libpath"; then 935 AC_MSG_ERROR([Cannot locate libgcc. Make sure that gcc is in your path]) 936 fi 937 PHP_ADD_LIBPATH($libgcc_libpath) 938 PHP_ADD_LIBRARY(gcc, yes) 939fi 940 941PHP_ARG_ENABLE(short-tags, whether to enable short tags by default, 942[ --disable-short-tags Disable the short-form <? start tag by default], yes, no) 943 944if test "$PHP_SHORT_TAGS" = "yes"; then 945 AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, "1", [ ]) 946else 947 AC_DEFINE(DEFAULT_SHORT_OPEN_TAG, "0", [ ]) 948fi 949 950PHP_ARG_ENABLE(dmalloc, whether to enable dmalloc, 951[ --enable-dmalloc Enable dmalloc], no, no) 952 953if test "$PHP_DMALLOC" = "yes"; then 954 AC_CHECK_LIB(dmalloc, dmalloc_error, [ 955 PHP_ADD_LIBRARY(dmalloc) 956 AC_DEFINE(HAVE_DMALLOC,1,[Whether you have dmalloc]) 957 CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK" 958 ], [ 959 AC_MSG_ERROR([Problem with enabling dmalloc. Please check config.log for details.]) 960 ]) 961fi 962 963PHP_ARG_ENABLE(ipv6, whether to enable IPv6 support, 964[ --disable-ipv6 Disable IPv6 support], yes, no) 965 966if test "$PHP_IPV6" != "no" && test "$ac_cv_ipv6_support" = yes; then 967 AC_DEFINE(HAVE_IPV6, 1, [Whether to enable IPv6 support]) 968fi 969 970dnl ## 971dnl ## DTRACE CHECKS 972dnl ## Note: this has to be done after SAPI configuration! 973dnl ## 974PHP_ARG_ENABLE(dtrace, whether to enable DTrace support, 975[ --enable-dtrace Enable DTrace support], no, no) 976 977if test "$PHP_DTRACE" = "yes"; then 978 AC_CHECK_HEADERS([sys/sdt.h], [ 979 PHP_INIT_DTRACE([Zend/zend_dtrace.d],[Zend/zend_dtrace_gen.h],[main/main.c Zend/zend_API.c \ 980 Zend/zend_execute.c Zend/zend_exceptions.c \ 981 Zend/zend_dtrace.c Zend/zend.c]) 982 AC_DEFINE(HAVE_DTRACE, 1, [Whether to enable DTrace support]) 983 PHP_SUBST(PHP_DTRACE_OBJS) 984 ], [ 985 AC_MSG_ERROR([Cannot find sys/sdt.h which is required for DTrace support]) 986 ]) 987fi 988 989AC_MSG_CHECKING([how big to make fd sets]) 990PHP_ARG_ENABLE(fd-setsize,, 991[ --enable-fd-setsize Set size of descriptor sets], no, no) 992 993if test "$PHP_FD_SETSIZE" != "no"; then 994 if test "0$PHP_FD_SETSIZE" -gt 0 2>/dev/null; then 995 CPPFLAGS="$CPPFLAGS -DFD_SETSIZE=$PHP_FD_SETSIZE" 996 AC_MSG_RESULT([using $PHP_FD_SETSIZE]) 997 else 998 AC_MSG_ERROR([Invalid value passed to --enable-fd-setsize!]) 999 fi 1000else 1001 AC_MSG_RESULT([using system default]) 1002fi 1003 1004dnl Extension configuration. 1005dnl ------------------------------------------------------------------------- 1006 1007PHP_HELP_SEPARATOR([Extensions: 1008 1009 --with-EXTENSION=[shared[,PATH]] 1010 1011 NOTE: Not all extensions can be build as 'shared'. 1012 1013 Example: --with-foobar=shared,/usr/local/foobar/ 1014 1015 o Builds the foobar extension as shared extension. 1016 o foobar package install prefix is /usr/local/foobar/ 1017]) 1018 1019PHP_CONFIGURE_PART(Configuring extensions) 1020 1021dnl 1022dnl Check if all enabled by default extensions should be disabled 1023dnl 1024 1025AC_ARG_ENABLE(all, 1026[ --disable-all Disable all extensions which are enabled by default 1027], [ 1028 PHP_ENABLE_ALL=$enableval 1029]) 1030 1031# reading config stubs 1032esyscmd(./build/config-stubs ext) 1033 1034dnl Extensions post-config 1035dnl ------------------------------------------------------------------------- 1036 1037enable_shared=yes 1038enable_static=yes 1039 1040case $php_sapi_module in 1041 shared[)] 1042 enable_static=no 1043 case $with_pic in 1044 yes) 1045 standard_libtool_flag='-prefer-pic' 1046 ;; 1047 no) 1048 standard_libtool_flag='-prefer-non-pic' 1049 ;; 1050 esac 1051 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -avoid-version -module" 1052 ;; 1053 *[)] 1054 standard_libtool_flag='-prefer-non-pic -static' 1055 if test -z "$PHP_MODULES" && test -z "$PHP_ZEND_EX"; then 1056 enable_shared=no 1057 fi 1058 ;; 1059esac 1060 1061EXTRA_LIBS="$EXTRA_LIBS $DLIBS $LIBS" 1062 1063dnl this has to be here to prevent the openssl crypt() from 1064dnl overriding the system provided crypt(). 1065if test "$ac_cv_lib_crypt_crypt" = "yes"; then 1066 EXTRA_LIBS="-lcrypt $EXTRA_LIBS -lcrypt" 1067fi 1068 1069unset LIBS LDFLAGS 1070 1071dnl PEAR 1072dnl ------------------------------------------------------------------------- 1073 1074PHP_HELP_SEPARATOR([PEAR:]) 1075PHP_CONFIGURE_PART(Configuring PEAR) 1076 1077# compatibility 1078if test -z "$with_pear" && test "$enable_pear" = "no"; then 1079 with_pear=no 1080fi 1081 1082# If CLI is disabled -> disable PEAR 1083if test "$PHP_CLI" = "no"; then 1084 with_pear=no 1085fi 1086 1087PHP_ARG_WITH(pear, [whether to install PEAR], 1088[ --with-pear=DIR Install PEAR in DIR @<:@PREFIX/lib/php@:>@ 1089 --without-pear Do not install PEAR], DEFAULT, yes) 1090 1091if test "$PHP_PEAR" != "no"; then 1092 1093 dnl 1094 dnl PEAR dependancies 1095 dnl 1096 if test "$PHP_XML" = "no"; then 1097 pear_error_msg="$pear_error_msg 1098 PEAR requires XML to be enabled. Add --enable-xml to the configure line. (or --without-pear)" 1099 fi 1100 1101dnl 1102dnl if test "$PHP_XMLRPC" = "no"; then 1103dnl pear_error_msg="$pear_error_msg 1104dnl PEAR requires XML-RPC to be enabled. Add --with-xmlrpc to the configure line. (or --without-pear)" 1105dnl fi 1106dnl 1107 1108 if test "$pear_error_msg"; then 1109 AC_MSG_ERROR([$pear_error_msg]) 1110 fi 1111 1112 install_pear="install-pear" 1113 PEAR_INSTALLDIR=$PHP_PEAR 1114 1115 if test "$PHP_PEAR" = "DEFAULT" || test "$PHP_PEAR" = "yes"; then 1116 case $PHP_LAYOUT in 1117 GNU) PEAR_INSTALLDIR=$datadir/pear;; 1118 *) PEAR_INSTALLDIR=$libdir/php;; 1119 esac 1120 fi 1121 1122 PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/pear/Makefile.frag,$abs_srcdir/pear,pear) 1123fi 1124 1125 1126dnl Configuring Zend and TSRM. 1127dnl ------------------------------------------------------------------------- 1128 1129PHP_HELP_SEPARATOR([Zend:]) 1130PHP_CONFIGURE_PART(Configuring Zend) 1131 1132LIBZEND_BASIC_CHECKS 1133LIBZEND_DLSYM_CHECK 1134LIBZEND_OTHER_CHECKS 1135 1136if test "$ZEND_MAINTAINER_ZTS" = "yes"; then 1137 AC_DEFINE(ZTS,1,[ ]) 1138 PHP_THREAD_SAFETY=yes 1139else 1140 PHP_THREAD_SAFETY=no 1141fi 1142 1143INCLUDES="$INCLUDES -I\$(top_builddir)/TSRM" 1144INCLUDES="$INCLUDES -I\$(top_builddir)/Zend" 1145 1146if test "$abs_srcdir" != "$abs_builddir"; then 1147 INCLUDES="$INCLUDES -I\$(top_srcdir)/main -I\$(top_srcdir)/Zend" 1148 INCLUDES="$INCLUDES -I\$(top_srcdir)/TSRM -I\$(top_builddir)/" 1149fi 1150 1151ZEND_EXTRA_LIBS="$LIBS" 1152unset LIBS LDFLAGS 1153 1154PHP_HELP_SEPARATOR([TSRM:]) 1155PHP_CONFIGURE_PART(Configuring TSRM) 1156TSRM_BASIC_CHECKS 1157if test "$PHP_THREAD_SAFETY" = "yes"; then 1158 TSRM_THREADS_CHECKS 1159fi 1160 1161EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LDFLAGS" 1162EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $LDFLAGS" 1163EXTRA_LIBS="$EXTRA_LIBS $LIBS" 1164unset LIBS LDFLAGS 1165 1166test "$prefix" = "NONE" && prefix=/usr/local 1167test "$exec_prefix" = "NONE" && exec_prefix='${prefix}' 1168test "$program_prefix" = "NONE" && program_prefix= 1169test "$program_suffix" = "NONE" && program_suffix= 1170 1171case $libdir in 1172 '${exec_prefix}/lib') 1173 libdir=$libdir/php 1174 ;; 1175esac 1176case `eval echo $datadir` in 1177 '${prefix}/share') 1178 datadir=$datadir/php 1179 ;; 1180esac 1181 1182phplibdir=`pwd`/modules 1183$php_shtool mkdir -p $phplibdir 1184phptempdir=`pwd`/libs 1185 1186old_exec_prefix=$exec_prefix 1187old_libdir=$libdir 1188old_datadir=$datadir 1189exec_prefix=`eval echo $exec_prefix` 1190libdir=`eval echo $libdir` 1191datadir=`eval eval echo $datadir` 1192 1193dnl Build extension directory path 1194 1195ZEND_MODULE_API_NO=`$EGREP '#define ZEND_MODULE_API_NO ' $srcdir/Zend/zend_modules.h|$SED 's/#define ZEND_MODULE_API_NO //'` 1196 1197if test -z "$EXTENSION_DIR"; then 1198 extbasedir=$ZEND_MODULE_API_NO 1199 if test "$oldstyleextdir" = "yes"; then 1200 if test "$PHP_DEBUG" = "1"; then 1201 part1=debug 1202 else 1203 part1=no-debug 1204 fi 1205 if test "$enable_maintainer_zts" = "yes"; then 1206 part2=zts 1207 else 1208 part2=non-zts 1209 fi 1210 extbasedir=$part1-$part2-$extbasedir 1211 EXTENSION_DIR=$libdir/extensions/$extbasedir 1212 else 1213 if test "$enable_maintainer_zts" = "yes"; then 1214 extbasedir=$extbasedir-zts 1215 fi 1216 1217 if test "$PHP_DEBUG" = "1"; then 1218 extbasedir=$extbasedir-debug 1219 fi 1220 EXTENSION_DIR=$libdir/$extbasedir 1221 fi 1222fi 1223 1224case $PHP_LAYOUT in 1225 GNU) 1226 datarootdir=$prefix/share 1227 ;; 1228 *) 1229 datarootdir=$prefix/php 1230 ;; 1231esac 1232 1233dnl Expand all directory names for use in macros/constants 1234EXPANDED_PEAR_INSTALLDIR=`eval echo $PEAR_INSTALLDIR` 1235EXPANDED_EXTENSION_DIR=`eval echo $EXTENSION_DIR` 1236EXPANDED_LOCALSTATEDIR=`eval echo $localstatedir` 1237EXPANDED_BINDIR=`eval echo $bindir` 1238EXPANDED_SBINDIR=`eval echo $sbindir` 1239EXPANDED_MANDIR=`eval echo $mandir` 1240EXPANDED_LIBDIR=$libdir 1241EXPANDED_SYSCONFDIR=`eval echo $sysconfdir` 1242EXPANDED_DATADIR=$datadir 1243EXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"` 1244EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=`eval echo "$PHP_CONFIG_FILE_SCAN_DIR"` 1245INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR 1246 1247exec_prefix=$old_exec_prefix 1248libdir=$old_libdir 1249datadir=$old_datadir 1250 1251AC_SUBST(INCLUDE_PATH) 1252AC_SUBST(EXPANDED_PEAR_INSTALLDIR) 1253AC_SUBST(EXPANDED_EXTENSION_DIR) 1254AC_SUBST(EXPANDED_BINDIR) 1255AC_SUBST(EXPANDED_SBINDIR) 1256AC_SUBST(EXPANDED_MANDIR) 1257AC_SUBST(EXPANDED_LIBDIR) 1258AC_SUBST(EXPANDED_DATADIR) 1259AC_SUBST(EXPANDED_SYSCONFDIR) 1260AC_SUBST(EXPANDED_LOCALSTATEDIR) 1261AC_SUBST(EXPANDED_PHP_CONFIG_FILE_PATH) 1262AC_SUBST(EXPANDED_PHP_CONFIG_FILE_SCAN_DIR) 1263 1264if test -n "$php_ldflags_add_usr_lib"; then 1265 PHP_RPATHS="$PHP_RPATHS /usr/lib" 1266fi 1267 1268PHP_UTILIZE_RPATHS 1269 1270if test -z "$php_ldflags_add_usr_lib"; then 1271 PHP_REMOVE_USR_LIB(PHP_LDFLAGS) 1272 PHP_REMOVE_USR_LIB(LDFLAGS) 1273fi 1274 1275EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PHP_LDFLAGS" 1276EXTRA_LDFLAGS_PROGRAM="$EXTRA_LDFLAGS_PROGRAM $PHP_LDFLAGS" 1277 1278PHP_BUILD_DATE=`date '+%Y-%m-%d'` 1279AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,"$PHP_BUILD_DATE",[PHP build date]) 1280 1281case $host_alias in 1282*netware*) 1283 PHP_OS="NetWare" 1284 PHP_UNAME="NetWare" 1285 AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[hardcode for each of the cross compiler host]) 1286 AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[hardcode for each of the cross compiler host]) 1287 ;; 1288*) 1289 PHP_UNAME=`uname -a | xargs` 1290 AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[uname -a output]) 1291 PHP_OS=`uname | xargs` 1292 AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output]) 1293 ;; 1294esac 1295 1296PHP_SUBST_OLD(PHP_INSTALLED_SAPIS) 1297 1298PHP_SUBST(PHP_EXECUTABLE) 1299 1300PHP_SUBST(PHP_SAPI_OBJS) 1301PHP_SUBST(PHP_BINARY_OBJS) 1302PHP_SUBST(PHP_GLOBAL_OBJS) 1303 1304PHP_SUBST(PHP_BINARIES) 1305PHP_SUBST(PHP_MODULES) 1306PHP_SUBST(PHP_ZEND_EX) 1307 1308PHP_SUBST(EXT_LIBS) 1309 1310PHP_SUBST_OLD(abs_builddir) 1311PHP_SUBST_OLD(abs_srcdir) 1312PHP_SUBST_OLD(php_abs_top_builddir) 1313PHP_SUBST_OLD(php_abs_top_srcdir) 1314 1315PHP_SUBST(bindir) 1316PHP_SUBST(sbindir) 1317PHP_SUBST(exec_prefix) 1318PHP_SUBST_OLD(program_prefix) 1319PHP_SUBST_OLD(program_suffix) 1320PHP_SUBST(includedir) 1321PHP_SUBST(libdir) 1322PHP_SUBST(mandir) 1323PHP_SUBST(phplibdir) 1324PHP_SUBST(phptempdir) 1325PHP_SUBST(prefix) 1326PHP_SUBST(localstatedir) 1327PHP_SUBST(datadir) 1328PHP_SUBST(datarootdir) 1329PHP_SUBST(sysconfdir) 1330 1331PHP_SUBST(EXEEXT) 1332PHP_SUBST(CC) 1333PHP_SUBST(CFLAGS) 1334PHP_SUBST(CFLAGS_CLEAN) 1335PHP_SUBST(CPP) 1336PHP_SUBST(CPPFLAGS) 1337PHP_SUBST(CXX) 1338PHP_SUBST(CXXFLAGS) 1339PHP_SUBST(CXXFLAGS_CLEAN) 1340PHP_SUBST_OLD(DEBUG_CFLAGS) 1341PHP_SUBST_OLD(EXTENSION_DIR) 1342PHP_SUBST_OLD(EXTRA_LDFLAGS) 1343PHP_SUBST_OLD(EXTRA_LDFLAGS_PROGRAM) 1344PHP_SUBST_OLD(EXTRA_LIBS) 1345PHP_SUBST_OLD(ZEND_EXTRA_LIBS) 1346PHP_SUBST_OLD(INCLUDES) 1347PHP_SUBST_OLD(EXTRA_INCLUDES) 1348PHP_SUBST_OLD(INCLUDE_PATH) 1349PHP_SUBST_OLD(INSTALL_IT) 1350PHP_SUBST(LFLAGS) 1351PHP_SUBST(LIBTOOL) 1352PHP_SUBST(LN_S) 1353PHP_SUBST_OLD(NATIVE_RPATHS) 1354PHP_SUBST_OLD(PEAR_INSTALLDIR) 1355PHP_SUBST(PHP_BUILD_DATE) 1356PHP_SUBST_OLD(PHP_LDFLAGS) 1357PHP_SUBST_OLD(PHP_LIBS) 1358PHP_SUBST(OVERALL_TARGET) 1359PHP_SUBST(PHP_RPATHS) 1360PHP_SUBST(PHP_SAPI) 1361PHP_SUBST_OLD(PHP_VERSION) 1362PHP_SUBST_OLD(PHP_VERSION_ID) 1363PHP_SUBST(SHELL) 1364PHP_SUBST(SHARED_LIBTOOL) 1365PHP_SUBST(WARNING_LEVEL) 1366PHP_SUBST(PHP_FRAMEWORKS) 1367PHP_SUBST(PHP_FRAMEWORKPATH) 1368PHP_SUBST(INSTALL_HEADERS) 1369 1370old_CC=$CC 1371 1372if test "$PHP_THREAD_SAFETY" = "yes" && test -n "$ac_cv_pthreads_cflags"; then 1373 CXXFLAGS="$CXXFLAGS $ac_cv_pthreads_cflags" 1374 INLINE_CFLAGS="$INLINE_CFLAGS $ac_cv_pthreads_cflags" 1375 cat >meta_ccld<<EOF 1376#! /bin/sh 1377exec $CC $ac_cv_pthreads_cflags \$@ 1378EOF 1379 CC="$abs_builddir/meta_ccld" 1380 chmod +x meta_ccld 1381fi 1382 1383dnl This will go away, if we have a facility to run per-extension code 1384dnl after the thread_safety decision was done 1385if test "$PHP_THREAD_SAFETY" = "yes" && test "$PHP_MYSQL" = "yes"; then 1386 CPPFLAGS="$CPPFLAGS -DTHREAD=1" 1387fi 1388 1389ZEND_EXT_TYPE="zend_extension" 1390PHP_SUBST(ZEND_EXT_TYPE) 1391 1392dnl 1393dnl Libtool creation 1394dnl 1395 1396PHP_HELP_SEPARATOR([Libtool:]) 1397PHP_CONFIGURE_PART(Configuring libtool) 1398 1399LDFLAGS="$LDFLAGS $PHP_AIX_LDFLAGS" 1400 1401dnl Autoconf 2.13's libtool checks go slightly nuts on Mac OS X 10.5 and 10.6. 1402dnl This hack works around it. Ugly. 1403case $host_alias in 1404*darwin9*|*darwin10*) 1405 ac_cv_exeext= 1406 ;; 1407esac 1408 1409dnl Only allow AC_PROG_CXX and AC_PROG_CXXCPP if they are explicitly called (by PHP_REQUIRE_CXX). 1410dnl Otherwise AC_PROG_LIBTOOL fails if there is no working C++ compiler. 1411AC_PROVIDE_IFELSE([PHP_REQUIRE_CXX], [], [ 1412 undefine([AC_PROG_CXX]) 1413 AC_DEFUN([AC_PROG_CXX], []) 1414 undefine([AC_PROG_CXXCPP]) 1415 AC_DEFUN([AC_PROG_CXXCPP], [php_prog_cxxcpp=disabled]) 1416]) 1417AC_PROG_LIBTOOL 1418 1419if test "$enable_debug" != "yes"; then 1420 PHP_SET_LIBTOOL_VARIABLE([--silent]) 1421fi 1422 1423dnl libtool 1.4.3 needs this. 1424PHP_SET_LIBTOOL_VARIABLE([--preserve-dup-deps]) 1425 1426test -z "$PHP_COMPILE" && PHP_COMPILE='$(LIBTOOL) --mode=compile $(COMPILE) -c $<' 1427test -z "$CXX_PHP_COMPILE" && CXX_PHP_COMPILE='$(LIBTOOL) --mode=compile $(CXX_COMPILE) -c $<' 1428SHARED_LIBTOOL='$(LIBTOOL)' 1429 1430CC=$old_CC 1431 1432PHP_CONFIGURE_PART(Generating files) 1433 1434CXXFLAGS_CLEAN=$CXXFLAGS 1435CFLAGS_CLEAN=$CFLAGS 1436CFLAGS="\$(CFLAGS_CLEAN) $standard_libtool_flag" 1437INLINE_CFLAGS="$INLINE_CFLAGS $standard_libtool_flag" 1438CXXFLAGS="$CXXFLAGS $standard_libtool_flag" 1439 1440if test "$PHP_PHAR" != "no" && test "$PHP_CLI" != "no"; then 1441 pharcmd=pharcmd 1442 pharcmd_install=install-pharcmd 1443else 1444 pharcmd= 1445 pharcmd_install= 1446fi; 1447 1448all_targets="$lcov_target \$(OVERALL_TARGET) \$(PHP_MODULES) \$(PHP_ZEND_EX) \$(PHP_BINARIES) $pharcmd" 1449install_targets="$install_sapi $install_modules $install_binaries install-build install-headers install-programs $install_pear $pharcmd_install" 1450 1451PHP_SUBST(all_targets) 1452PHP_SUBST(install_targets) 1453PHP_SUBST(install_binary_targets) 1454 1455PHP_INSTALL_HEADERS([Zend/ TSRM/ include/ main/ main/streams/]) 1456 1457PHP_ADD_SOURCES(TSRM, TSRM.c tsrm_strtok_r.c) 1458 1459PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c php_sprintf.c \ 1460 fopen_wrappers.c alloca.c php_scandir.c \ 1461 php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \ 1462 strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c \ 1463 network.c php_open_temporary_file.c \ 1464 output.c getopt.c) 1465 1466PHP_ADD_SOURCES(main/streams, streams.c cast.c memory.c filter.c \ 1467 plain_wrapper.c userspace.c transports.c xp_socket.c mmap.c \ 1468 glob_wrapper.c) 1469 1470PHP_ADD_SOURCES(/main, internal_functions.c,, sapi) 1471 1472case $host_alias in 1473 *netware*) 1474 PHP_ADD_BUILD_DIR(win32) 1475 PHP_ADD_BUILD_DIR(netware) 1476 ;; 1477 *) 1478 PHP_ADD_SOURCES_X(/main, internal_functions_cli.c,, PHP_BINARY_OBJS) 1479 ;; 1480esac 1481 1482PHP_ADD_SOURCES(Zend, \ 1483 zend_language_parser.c zend_language_scanner.c \ 1484 zend_ini_parser.c zend_ini_scanner.c \ 1485 zend_alloc.c zend_compile.c zend_constants.c zend_dynamic_array.c zend_dtrace.c \ 1486 zend_execute_API.c zend_highlight.c zend_llist.c \ 1487 zend_vm_opcodes.c zend_opcode.c zend_operators.c zend_ptr_stack.c zend_stack.c \ 1488 zend_variables.c zend.c zend_API.c zend_extensions.c zend_hash.c \ 1489 zend_list.c zend_indent.c zend_builtin_functions.c zend_sprintf.c \ 1490 zend_ini.c zend_qsort.c zend_multibyte.c zend_ts_hash.c zend_stream.c \ 1491 zend_iterators.c zend_interfaces.c zend_exceptions.c zend_strtod.c zend_gc.c \ 1492 zend_closures.c zend_float.c zend_string.c zend_signal.c zend_generators.c \ 1493 zend_virtual_cwd.c zend_ast.c) 1494 1495if test -r "$abs_srcdir/Zend/zend_objects.c"; then 1496 PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c zend_objects_API.c zend_default_classes.c) 1497fi 1498 1499dnl Selectively disable optimization due to high RAM usage during 1500dnl compiling the executor. 1501if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then 1502 flag=-O0 1503else 1504 flag= 1505fi 1506 1507PHP_ADD_SOURCES_X(Zend, zend_execute.c,,PHP_GLOBAL_OBJS,,$flag) 1508 1509PHP_ADD_BUILD_DIR(main main/streams) 1510PHP_ADD_BUILD_DIR(TSRM) 1511PHP_ADD_BUILD_DIR(Zend) 1512 1513PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/scripts/Makefile.frag,$abs_srcdir/scripts,scripts) 1514PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Makefile.frag,$abs_srcdir/Zend,Zend) 1515PHP_ADD_MAKEFILE_FRAGMENT($abs_srcdir/Zend/Makefile.frag,$abs_srcdir/Zend,Zend) 1516 1517PHP_GEN_BUILD_DIRS 1518PHP_GEN_GLOBAL_MAKEFILE 1519 1520AC_DEFINE([HAVE_BUILD_DEFS_H], 1, [ ]) 1521 1522$php_shtool mkdir -p pear/scripts 1523$php_shtool mkdir -p scripts 1524$php_shtool mkdir -p scripts/man1 1525 1526ALL_OUTPUT_FILES="php5.spec main/build-defs.h \ 1527scripts/phpize scripts/man1/phpize.1 \ 1528scripts/php-config scripts/man1/php-config.1 \ 1529$PHP_OUTPUT_FILES" 1530 1531dnl 1532dnl Check for unknown configure options 1533dnl 1534PHP_CHECK_CONFIGURE_OPTIONS 1535 1536dnl 1537dnl Generate build files 1538dnl 1539AC_OUTPUT($ALL_OUTPUT_FILES, [], [ 1540 1541if test "\$CONFIG_FILES" = "$ALL_OUTPUT_FILES" || test "\$CONFIG_FILES" = " $ALL_OUTPUT_FILES" || test -z "\$CONFIG_FILES"; then 1542 REDO_ALL=yes 1543fi 1544 1545################################################################ 1546# Create configuration headers 1547# 1548 1549test -d TSRM || $php_shtool mkdir TSRM 1550echo '#include <../main/php_config.h>' > TSRM/tsrm_config.h 1551 1552test -d Zend || $php_shtool mkdir Zend 1553 1554cat >Zend/zend_config.h <<FEO 1555#include <../main/php_config.h> 1556#if defined(APACHE) && defined(PHP_API_VERSION) 1557#undef HAVE_DLFCN_H 1558#endif 1559FEO 1560 1561# run this only when generating all the files? 1562if test -n "\$REDO_ALL"; then 1563 # Hacking while airborne considered harmful. 1564 # 1565 echo "creating main/internal_functions.c" 1566 extensions="$EXT_STATIC" 1567dnl mv -f main/internal_functions.c main/internal_functions.c.old 2>/dev/null 1568 sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in $srcdir "$EXTRA_MODULE_PTRS" $AWK \$extensions > main/internal_functions.c 1569 1570 echo "creating main/internal_functions_cli.c" 1571 cli_extensions="$EXT_CLI_STATIC" 1572 sh $srcdir/build/genif.sh $srcdir/main/internal_functions.c.in $srcdir "$EXTRA_MODULE_PTRS" $AWK \$cli_extensions > main/internal_functions_cli.c 1573 1574 if test "$UNAME" = "FreeBSD" && test "$PHP_SAPI" = "apache2filter" && test "$TSRM_PTH" != "pth-config" ; then 1575 echo "+--------------------------------------------------------------------+" 1576 echo "| *** WARNING *** |" 1577 echo "| |" 1578 echo "| In order to build PHP as a Apache2 module on FreeBSD, you have to |" 1579 echo "| add --with-tsrm-pth to your ./configure line. Therefore you need |" 1580 echo "| to install gnu-pth from /usr/ports/devel/pth. |" 1581 fi 1582 1583 if test -n "$PHP_APXS_BROKEN"; then 1584 echo "+--------------------------------------------------------------------+" 1585 echo "| WARNING: Your $APXS script is most likely broken." 1586 echo "| |" 1587 echo "| Please go read http://www.php.net/faq.build#faq.build.apxs |" 1588 echo "| and make the changes described there and try again. |" 1589 fi 1590 1591 if test -n "$DEBUG_LOG"; then 1592 rm -f config.cache 1593cat <<X 1594+--------------------------------------------------------------------+ 1595| *** ATTENTION *** | 1596| | 1597| Something is likely to be messed up here, because the configure | 1598| script was not able to detect a simple feature on your platform. | 1599| This is often caused by incorrect configuration parameters. Please | 1600| see the file debug.log for error messages. | 1601| | 1602| If you are unable to fix this, send the file debug.log to the | 1603| php-install@lists.php.net mailing list and include appropriate | 1604| information about your setup. | 1605X 1606 fi 1607 1608 if test "$PHP_SAPI" = "apache2handler" || test "$PHP_SAPI" = "apache2filter"; then 1609 if test "$APACHE_VERSION" -ge 2004001; then 1610 if test -z "$APACHE_THREADED_MPM"; then 1611cat <<X 1612+--------------------------------------------------------------------+ 1613| *** WARNING *** | 1614| | 1615| You have built PHP for Apache's current non-threaded MPM. | 1616| If you change Apache to use a threaded MPM you must reconfigure | 1617| PHP with --enable-maintainer-zts | 1618X 1619 fi 1620 fi 1621 fi 1622 1623 # Warn about linking Apache with libpthread if oci8 extension is enabled on linux. 1624 if test "$PHP_OCI8" != "no"; then 1625 if test "$PHP_SAPI" = "apache"; then 1626 if test `uname` = "Linux"; then 1627cat <<X 1628+--------------------------------------------------------------------+ 1629| *** WARNING *** | 1630| | 1631| Please check that your Apache (httpd) is linked with libpthread. | 1632| If not, you have to recompile Apache with pthread. For more | 1633| details, see this page: http://www.php.net/manual/ref.oci8.php | 1634X 1635 fi 1636 fi 1637 1638 if test "$PHP_SIGCHILD" != "yes"; then 1639 if test "$PHP_OCI8_INSTANT_CLIENT" = "no"; then 1640cat <<X 1641+--------------------------------------------------------------------+ 1642| Notice: | 1643| If you encounter <defunc> processes when using a local Oracle | 1644| database, set the value BEQUEATH_DETACH=YES in Oracle Net's | 1645| sqlnet.ora file on the PHP host, or set the environment variable | 1646| BEQUEATH_DETACH to YES before starting Apache. If the problem | 1647| still occurs, then recompile PHP and specify --enable-sigchild | 1648| when configuring. | 1649X 1650 fi 1651 fi 1652 fi 1653 1654cat <<X 1655+--------------------------------------------------------------------+ 1656| License: | 1657| This software is subject to the PHP License, available in this | 1658| distribution in the file LICENSE. By continuing this installation | 1659| process, you are bound by the terms of this license agreement. | 1660| If you do not agree with the terms of this license, you must abort | 1661| the installation process at this point. | 1662+--------------------------------------------------------------------+ 1663 1664Thank you for using PHP. 1665 1666X 1667 1668 # Output unknown configure options 1669 if test "$PHP_UNKNOWN_CONFIGURE_OPTIONS"; then 1670 echo "Notice: Following unknown configure options were used: 1671$PHP_UNKNOWN_CONFIGURE_OPTIONS 1672 1673Check '[$]0 --help' for available options 1674" 1675 fi 1676 1677fi 1678]) 1679 1680dnl ## Local Variables: 1681dnl ## tab-width: 4 1682dnl ## End: 1683