Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
dmytroskr dmytroskr
file 77 lines (64 sloc) 2.164 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
dnl $Id$
dnl config.m4 for extension excel

PHP_ARG_WITH(excel, whether to enable excel support,
[ --with-excel Enable excel support])

PHP_ARG_WITH(libxl-incdir, C include dir for libxl,
[ --with-libxl-incdir[=DIR] Include path for the C headers of libxl])

PHP_ARG_WITH(libxl-libdir, lib dir for libxl,
[ --with-libxl-libdir[=DIR] Library path for libxl])

if test "$PHP_EXCEL" != "no"; then
  SEARCH_PATH="/usr/local /usr"
  SEARCH_FOR="libxl.h"

  AC_MSG_CHECKING([for excel includes])
  if test -r $PHP_LIBXL_INCDIR/include/$SEARCH_FOR; then
    EXCEL_INCDIR=$PHP_LIBXL_INCDIR/include
  elif test -r $PHP_LIBXL_INCDIR/$SEARCH_FOR; then
    EXCEL_INCDIR=$PHP_LIBXL_INCDIR
  else # search default path list
    for i in $SEARCH_PATH ; do
      if test -r $i/include/$SEARCH_FOR; then
        EXCEL_INCDIR=$i/include
      fi
    done
  fi

  if test -z "$EXCEL_INCDIR"; then
    AC_MSG_RESULT([not found])
    AC_MSG_ERROR([Please reinstall the excel distribution])
  else
    AC_MSG_RESULT(found in $EXCEL_INCDIR)
  fi

  SEARCH_FOR="libxl.${SHLIB_SUFFIX_NAME}"

  AC_MSG_CHECKING([for excel libraries])
  if test -r $PHP_LIBXL_LIBDIR/$PHP_LIBDIR/$SEARCH_FOR; then
    EXCEL_LIBDIR=$PHP_LIBXL_LIBDIR/$PHP_LIBDIR
  elif test -r $PHP_LIBXL_LIBDIR/$SEARCH_FOR; then
    EXCEL_LIBDIR=$PHP_LIBXL_LIBDIR
  elif test -z "$EXCEL_LIBDIR"; then
    for i in $SEARCH_PATH ; do
      if test -r $i/$PHP_LIBDIR/$SEARCH_FOR; then
        EXCEL_LIBDIR=$i/$PHP_LIBDIR
      fi
    done
  fi

  if test -z "$EXCEL_LIBDIR"; then
    AC_MSG_RESULT([not found])
    AC_MSG_ERROR([Please reinstall the excel distribution])
  else
    AC_MSG_RESULT(found in $EXCEL_LIBDIR)
  fi


  PHP_CHECK_LIBRARY(xl, xlCreateBookCA,
  [
    PHP_ADD_INCLUDE($EXCEL_INCDIR)
    PHP_ADD_LIBRARY_WITH_PATH(xl, $EXCEL_LIBDIR, EXCEL_SHARED_LIBADD)
    AC_DEFINE(HAVE_EXCELLIB, 1, [ ])
  ], [
    AC_MSG_ERROR([excel module requires libxl >= 2.4.3])
  ], [
    -L$EXCEL_LIBDIR
  ])

  if test `grep -c FILLPATTERN_HORSTRIPE $EXCEL_INCDIR/enum.h` -eq 1; then
    AC_DEFINE(HAVE_LIBXL_243_PLUS,1,[ ])
  fi

  PHP_SUBST(EXCEL_SHARED_LIBADD)
  PHP_NEW_EXTENSION(excel, excel.c, $ext_shared)
fi
Something went wrong with that request. Please try again.