summaryrefslogtreecommitdiff
path: root/ext/odbc/config.m4
blob: e1429cd8bfce34e54faab0c3e4cf85a064f5e8b6 (plain)
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
dnl ODBC_INCDIR
dnl ODBC_INCLUDE
dnl ODBC_LIBDIR
dnl ODBC_LIBS
dnl ODBC_LFLAGS

dnl
dnl Figure out which library file to link with for the Solid support.
dnl
AC_DEFUN(AC_FIND_SOLID_LIBS,[
  AC_MSG_CHECKING([Solid library file])
  ac_solid_uname_s=`uname -s 2>/dev/null`
  case $ac_solid_uname_s in
    AIX) ac_solid_os=a3x;;
    HP-UX) ac_solid_os=h9x;;
    IRIX) ac_solid_os=irx;;
    Linux) ac_solid_os=lux;;
    SunOS) ac_solid_os=ssx;; # should we deal with SunOS 4?
    FreeBSD) ac_solid_os=fbx;;
    # "uname -s" on SCO makes no sense.
  esac
  ODBC_LIBS=`echo $1/scl${ac_solid_os}*.so | cut -d' ' -f1`
  if test ! -f $ODBC_LIBS; then
    ODBC_LIBS=`echo $1/scl${ac_solid_os}*.a | cut -d' ' -f1`
  fi
  if test ! -f $ODBC_LIBS; then
    ODBC_LIBS=`echo $1/scl2x${ac_solid_os}*.a | cut -d' ' -f1`
  fi
  if test ! -f $ODBC_LIBS; then
    ODBC_LIBS=`echo $1/scl2x${ac_solid_os}*.a | cut -d' ' -f1`
  fi
  if test ! -f $ODBC_LIBS; then
    ODBC_LIBS=`echo $1/bcl${ac_solid_os}*.so | cut -d' ' -f1`
  fi
  if test ! -f $ODBC_LIBS; then
    ODBC_LIBS=`echo $1/bcl${ac_solid_os}*.a | cut -d' ' -f1`
  fi
  AC_MSG_RESULT(`echo $ODBC_LIBS | sed -e 's!.*/!!'`)
])

dnl
dnl Figure out which library file to link with for the Empress support.
dnl
AC_DEFUN(AC_FIND_EMPRESS_LIBS,[
  AC_MSG_CHECKING([Empress library file])
  ODBC_LIBS=`echo $1/empodbc.so | cut -d' ' -f1`
  if test ! -f $ODBC_LIBS; then
    ODBC_LIBS=`echo $1/empodbc.a | cut -d' ' -f1`
  fi
  AC_MSG_RESULT(`echo $ODBC_LIBS | sed -e 's!.*/!!'`)
])

if test -z "$ODBC_TYPE"; then
AC_MSG_CHECKING(for Adabas support)
AC_ARG_WITH(adabas,
[  --with-adabas[=DIR]     Include Adabas D support.  DIR is the Adabas base
                          install directory, defaults to /usr/local.],
[
  if test "$withval" = "yes"; then
    withval=/usr/local
  fi
  if test "$withval" != "no"; then
    ODBC_INCDIR=$withval/incl
    ODBC_LIBDIR=$withval/lib
    ODBC_LFLAGS=-L$ADA_LIBDIR
    ODBC_INCLUDE=-I$ADA_INCDIR
    ODBC_LIBS="${ADA_LIBDIR}/odbclib.a -lsqlrte -lsqlptc"
    ODBC_TYPE=adabas
    AC_DEFINE(HAVE_ADABAS)
    AC_MSG_RESULT(yes)
  else
    AC_MSG_RESULT(no)
  fi
],[
  AC_MSG_RESULT(no)
])
fi

if test -z "$ODBC_TYPE"; then
AC_MSG_CHECKING(for Solid support)
AC_ARG_WITH(solid,
[  --with-solid[=DIR]      Include Solid support.  DIR is the Solid base
			  install directory, defaults to /usr/local/solid],
[
  if test "$withval" = "yes"; then
    withval=/usr/local/solid
  fi
  if test "$withval" != "no"; then
    ODBC_INCDIR=$withval/include
    ODBC_LIBDIR=$withval/lib
	  ODBC_INCLUDE=-I$ODBC_INCDIR
	  ODBC_TYPE=solid
	  AC_DEFINE(HAVE_SOLID)
	  AC_MSG_RESULT(yes)
	  AC_FIND_SOLID_LIBS($ODBC_LIBDIR)
  else
	  AC_MSG_RESULT(no)
  fi
],[
  AC_MSG_RESULT(no)
])
fi

if test -z "$ODBC_TYPE"; then
AC_MSG_CHECKING(for Empress support)
AC_ARG_WITH(empress,
[  --with-empress[=DIR]    Include Empress support.  DIR is the Empress base
                          install directory, defaults to \$EMPRESSPATH],
[
  if test "$withval" != "no"; then
    if test "$withval" = "yes"; then
      ODBC_INCDIR=$EMPRESSPATH/odbccl/include
      ODBC_LIBDIR=$EMPRESSPATH/odbccl/lib
    else
      ODBC_INCDIR=$withval/include
      ODBC_LIBDIR=$withval/lib
    fi
    ODBC_INCLUDE=-I$ODBC_INCDIR
    ODBC_TYPE=empress
    AC_DEFINE(HAVE_EMPRESS)
    AC_MSG_RESULT(yes)
    AC_FIND_EMPRESS_LIBS($ODBC_LIBDIR)
  else
    AC_MSG_RESULT(no)
  fi
],[
  AC_MSG_RESULT(no)
])
fi

if test -z "$ODBC_TYPE"; then
AC_MSG_CHECKING(for Velocis support)
AC_ARG_WITH(velocis,
[  --with-velocis[=DIR]    Include Velocis support.  DIR is the Velocis
                          base install directory, defaults to /usr/local/velocis.],
[
  if test "$withval" != "no"; then
    if test "$withval" = "yes"; then
      ODBC_INCDIR=/usr/local/velocis/include
      ODBC_LIBDIR=/usr/local/velocis
    else
      ODBC_INCDIR=$withval/include
      ODBC_LIBDIR=$withval
    fi
    ODBC_INCLUDE=-I$ODBC_INCDIR
    ODBC_LIBDIR="$ODBC_LIBDIR/bin"
    case `uname` in
      FreeBSD|BSD/OS)
        ODBC_LIBS="$ODBC_LIBDIR/../lib/rdscli.a -lcompat";;
      *)
        ODBC_LIBS="-l_rdbc -l_sql";;
    esac
    ODBC_TYPE=velocis
    AC_DEFINE(HAVE_VELOCIS)
    AC_MSG_RESULT(yes)
  else
    AC_MSG_RESULT(no)
  fi
],[
  AC_MSG_RESULT(no)
])
fi

if test -z "$ODBC_TYPE"; then
AC_MSG_CHECKING(for a custom ODBC support)
AC_ARG_WITH(custom-odbc,
[  --with-custom-odbc[=DIR]      Include a user defined ODBC support.
                          The DIR is ODBC install base directory, 
                          which defaults to /usr/local.
                          Make sure to define CUSTOM_ODBC_LIBS and
                          have some odbc.h in your include dirs.
                          E.g., you should define following for 
                          Sybase SQL Anywhere 5.5.00 on QNX, prior to
                          run configure script:
                              CFLAGS=\"-DODBC_QNX -DSQLANY_BUG\"
                              LDFLAGS=-lunix
                              CUSTOM_ODBC_LIBS=\"-ldblib -lodbc\".],
[
  if test "$withval" = "yes"; then
    withval=/usr/local
  fi
  if test "$withval" != "no"; then
    ODBC_INCDIR=$withval/include
    ODBC_LIBDIR=$withval/lib
    ODBC_LFLAGS=-L$CODBC_LIBDIR
    ODBC_INCLUDE=-I$CODBC_INCDIR
    ODBC_LIBS=$CUSTOM_ODBC_LIBS
    ODBC_TYPE=custom
    AC_DEFINE(HAVE_CODBC)
    AC_MSG_RESULT(yes)
  else
    AC_MSG_RESULT(no)
  fi
],[
  AC_MSG_RESULT(no)
])
fi

if test -z "$ODBC_TYPE"; then
AC_MSG_CHECKING(for iODBC support)
AC_ARG_WITH(iodbc,
[  --with-iodbc[=DIR]      Include iODBC support.  DIR is the iODBC base
                          install directory, defaults to /usr/local.],
[
  if test "$withval" = "yes"; then
    withval=/usr/local
  fi
  if test "$withval" != "no"; then
    ODBC_INCDIR=$withval/include
    ODBC_LIBDIR=$withval/lib
    ODBC_LFLAGS=-L$IODBC_LIBDIR
    ODBC_INCLUDE=-I$IODBC_INCDIR
    ODBC_LIBS=-liodbc
    ODBC_TYPE=iodbc
    AC_DEFINE(HAVE_IODBC)
    AC_MSG_RESULT(yes)
  else
    AC_MSG_RESULT(no)
  fi
],[
  AC_MSG_RESULT(no)
])
fi

if test -z "$ODBC_TYPE"; then
AC_MSG_CHECKING(for OpenLink ODBC support)
AC_ARG_WITH(openlink,
[  --with-openlink[=DIR]   Include OpenLink ODBC support.  DIR is the
                          OpenLink base install directory, defaults to
                          /usr/local/openlink.],
[
  if test "$withval" = "yes"; then
    withval=/usr/local/openlink
  fi
  if test "$withval" != "no"; then
    ODBC_INCDIR=$withval/odbcsdk/include
    ODBC_LIBDIR=$withval/odbcsdk/lib
    ODBC_LFLAGS=-L$OPENLINK_LIBDIR
    ODBC_INCLUDE=-I$OPENLINK_INCDIR
    ODBC_LIBS=-liodbc
    ODBC_TYPE=openlink
    AC_DEFINE(HAVE_OPENLINK)
    AC_MSG_RESULT(yes)
  else
    AC_MSG_RESULT(no)
  fi
],[
  AC_MSG_RESULT(no)
])
fi

if test -n "$ODBC_TYPE"; then
  INCLUDES="$INCLUDES $ODBC_INCLUDE"
  EXTRA_LIBS="$EXTRA_LIBS $ODBC_LFLAGS $ODBC_LIBS"
  AC_DEFINE(HAVE_UODBC, 1)
  AC_SUBST(ODBC_INCDIR)
  AC_SUBST(ODBC_INCLUDE)
  AC_SUBST(ODBC_LIBDIR)
  AC_SUBST(ODBC_LIBS)
  AC_SUBST(ODBC_LFLAGS)
  AC_SUBST(ODBC_TYPE)
  PHP_EXTENSION(odbc)
fi