xref: /PHP-5.3/ext/sybase_ct/config.m4 (revision 55aab4e6)
1dnl
2dnl $Id$
3dnl
4
5PHP_ARG_WITH(sybase-ct, for Sybase-CT support,
6[  --with-sybase-ct[=DIR]  Include Sybase-CT support.  DIR is the Sybase home
7                          directory [/home/sybase]])
8
9if test "$PHP_SYBASE_CT" != "no"; then
10
11  if test "$PHP_SYBASE" && test "$PHP_SYBASE" != "no" && test "$ext_shared" = "no"; then
12    AC_MSG_ERROR([You can not use both --with-sybase and --with-sybase-ct in same build!])
13  fi
14
15  AC_DEFINE(HAVE_SYBASE_CT,1,[ ])
16  PHP_NEW_EXTENSION(sybase_ct, php_sybase_ct.c, $ext_shared)
17  PHP_SUBST(SYBASE_CT_SHARED_LIBADD)
18
19  if test "$PHP_SYBASE_CT" = "yes"; then
20    SYBASE_CT_INCDIR=/home/sybase/include
21    SYBASE_CT_LIBDIR=/home/sybase/lib
22  else
23    SYBASE_CT_INCDIR=$PHP_SYBASE_CT/include
24    SYBASE_CT_LIBDIR=$PHP_SYBASE_CT/lib
25  fi
26
27  dnl Determine whether we're building 64 or 32 bit...
28  AC_CHECK_SIZEOF(long int, 4)
29  AC_MSG_CHECKING([checking if we're on a 64-bit platform])
30  if test "$ac_cv_sizeof_long_int" = "4"; then
31    AC_MSG_RESULT([no])
32    PHP_SYBASE_64=no
33  else
34    AC_MSG_RESULT([yes])
35    PHP_SYBASE_64=yes
36  fi
37
38
39  AC_MSG_CHECKING([Checking for ctpublic.h])
40  if test -f $SYBASE_CT_INCDIR/ctpublic.h; then
41    AC_MSG_RESULT([found in $SYBASE_CT_INCDIR])
42    PHP_ADD_INCLUDE($SYBASE_CT_INCDIR)
43  else
44    AC_MSG_ERROR([ctpublic.h missing!])
45  fi
46
47  AC_MSG_CHECKING([Checking Sybase libdir])
48  AC_MSG_RESULT([Have $SYBASE_CT_LIBDIR])
49
50  AC_MSG_CHECKING([Checking for Sybase platform libraries])
51
52  PHP_ADD_LIBPATH($SYBASE_CT_LIBDIR, SYBASE_CT_SHARED_LIBADD)
53  if test -f $SYBASE_CT_INCDIR/tds.h || test -f $SYBASE_CT_INCDIR/tds_sysdep_public.h; then
54    PHP_ADD_LIBRARY(ct,, SYBASE_CT_SHARED_LIBADD)
55    SYBASE_CT_LIBS="-L$SYBASE_CT_LIBDIR -lct"
56    AC_MSG_RESULT([FreeTDS: $SYBASE_CT_LIBS])
57  elif test -f $SYBASE_CT_LIBDIR/libsybct64.so && test $PHP_SYBASE_64 = "yes"; then
58    PHP_ADD_LIBRARY(sybcs64,, SYBASE_CT_SHARED_LIBADD)
59    PHP_ADD_LIBRARY(sybct64,, SYBASE_CT_SHARED_LIBADD)
60    PHP_ADD_LIBRARY(sybcomn64,, SYBASE_CT_SHARED_LIBADD)
61    PHP_ADD_LIBRARY(sybintl64,, SYBASE_CT_SHARED_LIBADD)
62
63    ac_solid_uname_s=`uname -s 2>/dev/null`
64    case $ac_solid_uname_s in
65      *OSF*)                            ;; # Tru64/DEC OSF does NOT use the SYB_LP64 define
66      *) CFLAGS="${CFLAGS} -DSYB_LP64"  ;; #
67    esac
68    SYBASE_CT_LIBS="-L$SYBASE_CT_LIBDIR -lsybcs64 -lsybct64 -lsybcomn64 -lsybintl64"
69    AC_MSG_RESULT([Sybase64: $SYBASE_CT_LIBS])
70
71    PHP_CHECK_LIBRARY(sybtcl64, netg_errstr, [
72      PHP_ADD_LIBRARY(sybtcl64,,SYBASE_CT_SHARED_LIBADD)
73    ],[
74      PHP_ADD_LIBRARY(sybtcl64,,SYBASE_CT_SHARED_LIBADD)
75    ],[
76      $SYBASE_CT_LIBS
77    ])
78
79    PHP_CHECK_LIBRARY(insck64, insck__getVdate, [PHP_ADD_LIBRARY(insck64,, SYBASE_CT_SHARED_LIBADD)],[],[-L$SYBASE_CT_LIBDIR])
80    PHP_CHECK_LIBRARY(insck64, bsd_tcp,         [PHP_ADD_LIBRARY(insck64,, SYBASE_CT_SHARED_LIBADD)],[],[-L$SYBASE_CT_LIBDIR])
81  elif test -f $SYBASE_CT_LIBDIR/libsybct.so; then
82    PHP_ADD_LIBRARY(sybcs,, SYBASE_CT_SHARED_LIBADD)
83    PHP_ADD_LIBRARY(sybct,, SYBASE_CT_SHARED_LIBADD)
84    PHP_ADD_LIBRARY(sybcomn,, SYBASE_CT_SHARED_LIBADD)
85    PHP_ADD_LIBRARY(sybintl,, SYBASE_CT_SHARED_LIBADD)
86
87    SYBASE_CT_LIBS="-L$SYBASE_CT_LIBDIR -lsybcs -lsybct -lsybcomn -lsybintl"
88    AC_MSG_RESULT([Sybase32 syb-prefix: $SYBASE_CT_LIBS])
89
90    PHP_CHECK_LIBRARY(sybtcl, netg_errstr, [
91      PHP_ADD_LIBRARY(sybtcl,,SYBASE_CT_SHARED_LIBADD)
92    ],[
93      PHP_ADD_LIBRARY(sybtcl,,SYBASE_CT_SHARED_LIBADD)
94    ],[
95      $SYBASE_CT_LIBS
96    ])
97
98    PHP_CHECK_LIBRARY(insck, insck__getVdate, [PHP_ADD_LIBRARY(insck,, SYBASE_CT_SHARED_LIBADD)],[],[-L$SYBASE_CT_LIBDIR])
99    PHP_CHECK_LIBRARY(insck, bsd_tcp,         [PHP_ADD_LIBRARY(insck,, SYBASE_CT_SHARED_LIBADD)],[],[-L$SYBASE_CT_LIBDIR])
100  else
101    PHP_ADD_LIBRARY(cs,, SYBASE_CT_SHARED_LIBADD)
102    PHP_ADD_LIBRARY(ct,, SYBASE_CT_SHARED_LIBADD)
103    PHP_ADD_LIBRARY(comn,, SYBASE_CT_SHARED_LIBADD)
104    PHP_ADD_LIBRARY(intl,, SYBASE_CT_SHARED_LIBADD)
105
106    SYBASE_CT_LIBS="-L$SYBASE_CT_LIBDIR -lcs -lct -lcomn -lintl"
107    AC_MSG_RESULT([Sybase32 default: $SYBASE_CT_LIBS])
108
109    PHP_CHECK_LIBRARY(tcl, netg_errstr, [
110      PHP_ADD_LIBRARY(tcl,,SYBASE_CT_SHARED_LIBADD)
111    ],[
112      PHP_ADD_LIBRARY(sybtcl,,SYBASE_CT_SHARED_LIBADD)
113    ],[
114      $SYBASE_CT_LIBS
115    ])
116
117    PHP_CHECK_LIBRARY(insck, insck__getVdate, [PHP_ADD_LIBRARY(insck,, SYBASE_CT_SHARED_LIBADD)],[],[-L$SYBASE_CT_LIBDIR])
118    PHP_CHECK_LIBRARY(insck, bsd_tcp,         [PHP_ADD_LIBRARY(insck,, SYBASE_CT_SHARED_LIBADD)],[],[-L$SYBASE_CT_LIBDIR])
119  fi
120fi
121