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
  
78
  
79
  
80
  
81
  
82
  
83
  
84
  
85
  
86
  
87
  
88
  
89
  
90
  
91
  
92
  
93
  
94
  
95
  
96
  
97
  
98
  
99
  
100
  
101
  
102
  
103
  
104
  
105
  
106
  
107
  
108
  
109
  
110
  
111
  
112
  
113
  
114
  
115
  
116
  
117
  
118
  
119
  
120
  
121
  
122
  
123
  
124
  
125
  
126
  
127
  
128
  
129
  
130
  
131
  
132
  
133
  
134
  
135
  
136
  
137
  
138
  
139
  
140
  
141
  
142
  
143
  
144
  
145
  
146
  
147
  
148
  
149
  
150
  
151
  
152
  
153
  
154
  
155
  
156
  
157
  
158
  
159
  
160
  
161
  
162
  
163
  
164
  
165
  
166
  
167
  
168
  
169
  
170
  
171
  
172
  
173
  
174
  
175
  
176
  
177
  
178
  
179
  
180
  
181
  
182
  
183
  
184
  
dnl This file is part of the Sybase driver for the Pike programming language 
dnl by Francesco Chemolli <kinkie@roxen.com> 10/12/1999 
 
 
AC_INIT(sybase.cmod) 
AC_CONFIG_HEADER(sybase_config.h) 
 
AC_MODULE_INIT() 
 
PIKE_FEATURE_WITHOUT(sybase) 
 
echo "Configuring for sybase support" 
OLD_CPPFLAGS="$CPPFLAGS" 
OLD_CFLAGS="$CFLAGS" 
OLD_LIBS="$LIBS" 
OLD_LDFLAGS="$LDFLAGS" 
 
AC_ARG_WITH(sybase, 
    [  --with(out)-sybase               Include the Sybase database driver], 
    [],[with_sybase=yes]) 
AC_ARG_WITH(sybase-include-dir, 
    [  --with-sybase-include-dir        Sybase headers directory location], 
    [pike_sybase_include_dir=$withval]) 
AC_ARG_WITH(sybase-lib-dir, 
    [  --with-sybase-lib-dir            Sybase libraries directory location], 
    [pike_sybase_lib_dir=$withval]) 
 
 
dnl "reasonable" search paths we will look in $root/$prefix/$path 
pike_sybase_reasonable_roots="$SYBASE $with_root/ $with_root/usr/local $with_root/usr $with_root/opt $with_root/usr $HOME" 
pike_sybase_reasonable_prefixes="sybase include lib /" 
pike_sybase_reasonable_paths="sybase include lib /" 
pike_sybase_reasonable_extra_paths="$pike_sybase_include_dir $pike_sybase_lib_dir" 
pike_sybase_reasonable_libs_tosearch="libtcl.a libsybtcl.a libtcl64.a libtcl_r.a libtcl_dce.a libtcl_dce64.a libtcl.so libsybtcl.so libtcl64.so libtcl_r.so libtcl_dce.so libtcl_dce64.so" 
 
AC_MSG_CHECKING(for include files location) 
if test x$pike_sybase_include_dir != x; then 
    AC_MSG_RESULT(user-provided: $pike_sybase_include_dir) 
    pike_cv_sybase_include_dir=$pike_sybase_include_dir 
    CPPFLAGS="-I$pike_cv_sybase_include_dir $CPPFLAGS" 
else 
 
  AC_CACHE_VAL(pike_cv_sybase_include_dir, 
    [ 
    for sybroot in $pike_sybase_reasonable_roots 
    do 
        for sybprefix in $pike_sybase_reasonable_prefixes 
        do 
            for sybpath in $pike_sybase_reasonable_paths 
            do 
dnl                AC_MSG_CHECKING(in $sybroot/$sybprefix/$sybpath) 
                if test -f $sybroot/$sybprefix/$sybpath/ctpublic.h; then 
                    pike_cv_sybase_include_dir="$sybroot/$sybprefix/$sybpath" 
dnl                    AC_MSG_RESULT(found) 
                    break 3; 
                else 
dnl                    AC_MSG_RESULT(not found) 
                  : 
                fi 
            done 
        done 
    done 
    ]) 
 
  if test x$pike_cv_sybase_include_dir != x; then 
    AC_MSG_RESULT(found: $pike_cv_sybase_include_dir) 
    CPPFLAGS="-I$pike_cv_sybase_include_dir $CPPFLAGS" 
  else 
    AC_MSG_RESULT(not found) 
  fi 
fi 
 
AC_CHECK_HEADERS(SybaseOpenClient/SybaseOpenClient.h ctpublic.h) 
 
AC_MSG_CHECKING(for SybaseOpenClient framework) 
AC_CACHE_VAL(pike_cv_framework_sybaseopenclient, [ 
  pike_cv_framework_sybaseopenclient="no" 
  OLD_LDFLAGS="${LDFLAGS}" 
  LDFLAGS="-framework SybaseOpenClient ${LDFLAGS}" 
  AC_TRY_LINK([ 
#ifdef HAVE_SYBASEOPENCLIENT_SYBASEOPENCLIENT_H 
#include <SybaseOpenClient/SybaseOpenClient.h> 
#elif defined(HAVE_CTPUBLIC_H) 
#include <ctpublic.h> 
#endif 
  ], [ 
    CS_CONTEXT *context; 
    CS_RETCODE ret; 
    ret = cs_ctx_alloc(CS_VERSION_110, &context); 
    ret = ct_init(context, CS_VERSION_110); 
  ], [ 
    pike_cv_framework_sybaseopenclient="yes" 
  ]) 
  LDFLAGS="${OLD_LDFLAGS}" 
]) 
if test "$pike_cv_framework_sybaseopenclient" = "no"; then 
  AC_MSG_RESULT(no) 
else 
  AC_MSG_RESULT(yes) 
  LDFLAGS="-framework SybaseOpenClient $LDFLAGS" 
fi 
 
if test "$pike_cv_framework_sybaseopenclient" = "no"; then 
AC_MSG_CHECKING(for library files location) 
if test x$pike_sybase_lib_dir != x; then 
    AC_MSG_RESULT(user-provided: $pike_sybase_lib_dir) 
    pike_cv_sybase_lib_dir=$pike_sybase_lib_dir 
    LDFLAGS="-L$pike_cv_sybase_lib_dir $LDFLAGS" 
else 
 
  AC_CACHE_VAL(pike_cv_sybase_lib_dir, 
    [ 
    for sybroot in $pike_sybase_reasonable_roots 
    do 
        for sybprefix in $pike_sybase_reasonable_prefixes 
        do 
            for sybpath in $pike_sybase_reasonable_paths 
            do 
dnl                AC_MSG_CHECKING(in $sybroot/$sybprefix/$sybpath) 
                for syblib in $pike_sybase_reasonable_libs_tosearch 
                do 
                    if test -f $sybroot/$sybprefix/$sybpath/$syblib; then 
                        pike_cv_sybase_lib_dir="$sybroot/$sybprefix/$sybpath" 
dnl                        AC_MSG_RESULT(found) 
                        break 4; 
                    fi 
                done 
dnl            AC_MSG_RESULT(not found) 
            done 
        done 
    done 
    ]) 
 
  if test x$pike_cv_sybase_lib_dir != x; then 
    AC_MSG_RESULT(found: $pike_cv_sybase_lib_dir) 
    LDFLAGS="-L$pike_cv_sybase_lib_dir $LDFLAGS" 
  else 
    AC_MSG_RESULT(not found) 
  fi 
fi 
fi 
 
if test x$with_sybase != xno; then 
  PIKE_FEATURE_NODEP(sybase) 
 
  AC_CHECK_LIB(m,floor) 
  AC_CHECK_LIB(dl,dlopen) 
  AC_CHECK_LIB(nsl,gethostbyname) 
 
  if test x$pike_cv_framework_sybaseopenclient = "xyes"; then 
    AC_DEFINE(HAVE_SYBASE) 
    PIKE_FEATURE(sybase, [yes, SybaseOpenClient framework]) 
  else 
    AC_SEARCH_LIBS(intl_datetime, 
                   intl_r64 intl_r intl64 intl, 
    [ 
      AC_SEARCH_LIBS(comn_bintobin, 
                     comn_r64 comn_r comn_dce64 comn_dce comn64 comn, 
      [ 
        AC_SEARCH_LIBS(cs_ctx_alloc, 
                       cs_r64 cs_r cs64 cs, 
        [ 
          AC_SEARCH_LIBS(iface_open, 
                         tcl_r64 tcl_r tcl_dce64 tcl_dce sybtcl tcl64 tcl, 
          [ 
            AC_SEARCH_LIBS(ct_callback, 
                           ct_r64 ct_r ct64 ct, 
            [ 
              AC_CHECK_HEADERS(ctpublic.h, [ 
                AC_DEFINE(HAVE_SYBASE) 
                PIKE_FEATURE(sybase, yes) 
              ]) 
            ]) 
          ]) 
        ]) 
      ]) 
    ]) 
  fi 
fi 
 
AC_SUBST_FILE(make_variables) 
 
AC_OUTPUT(Makefile,echo FOO >stamp-h)