File: acinclude.m4

package info (click to toggle)
myodbc 2.50.39-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,372 kB
  • ctags: 571
  • sloc: sh: 8,709; ansic: 6,505; makefile: 84
file content (100 lines) | stat: -rw-r--r-- 1,948 bytes parent folder | download
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
dnl Macro: AC_CHECK_ODBC_TYPE
dnl Checks if $1 is a valid type in the ODBC environment,
dnl and #defines it to $2 if not

AC_DEFUN(AC_CHECK_ODBC_TYPE,
[

AC_MSG_CHECKING([for $1])
AC_CACHE_VAL(ac_cv_odbc_$1,
[
echo > conftest.c

for i in $odbc_headers
do
	echo "#include <$i>" >> conftest.c
done

echo "int main(void) { $1 x; return 0; }" >> conftest.c

if $CC -c $CFLAGS $CPPFLAGS conftest.c > /dev/null 2> /dev/null
then
	eval ac_cv_odbc_$1=yes
else
	eval ac_cv_odbc_$2=no
fi
rm -f conftest*
])

eval ac_odbc_check_res=$ac_cv_odbc_$1
if test "x$ac_odbc_check_res" = "xyes"
then
	AC_MSG_RESULT(yes)
else
	AC_MSG_RESULT([no ($2)])
	AC_DEFINE($1,$2)
fi
])


dnl Macro: AC_CHECK_IODBC
dnl Optional arguments: $1=includedir, $2=libdir
dnl Sets have_iodbcinst=yes if inst library is found
AC_DEFUN(AC_CHECK_IODBC,
[
if test "$1" != ""
then
      CPPFLAGS="$CPPFLAGS -I$1"
      if test "$2" != ""
      then
              LDFLAGS="$LDFLAGS -L$2"
       fi
fi

AC_CHECK_HEADERS(isql.h isqlext.h,
iodbc_ok=yes;odbc_headers="$odbc_headers $ac_header",iodbc_ok=no; break)

if test "x$iodbc_ok" != "xyes"
then
	AC_MSG_ERROR([Unable to find the iodbc headers in $1])
fi

AC_CHECK_HEADERS(iodbcinst.h)

if test "x$ac_cv_header_iodbcinst_h" = "xyes"
then
	AC_CHECK_LIB(iodbcinst,SQLGetPrivateProfileString,
	[AC_DEFINE(HAVE_SQLGETPRIVATEPROFILESTRING)
	LIBS="$LIBS -liodbcinst"
	have_iodbcinst=yes])
fi
])



dnl Macro: AC_CHECK_UNIXODBC
dnl Required arguments:
dnl	$1=includedir
dnl	$2=libdir
AC_DEFUN(AC_CHECK_UNIXODBC,
[
CPPFLAGS="$CPPFLAGS -I$1"
AC_CHECK_HEADERS(sql.h sqlext.h odbcinst.h,
unixODBC_ok=yes;odbc_headers="$odbc_headers $ac_header",unixODBC_ok=no; break)

if test "x$unixODBC_ok" != "xyes"
then
	AC_MSG_ERROR([Unable to find the unixODBC headers in $1])
fi

save_LIBS="$LIBS"
LIBS="-L$2 $LIBS"

AC_CHECK_LIB(odbcinst,SQLGetPrivateProfileString,
[AC_DEFINE(HAVE_SQLGETPRIVATEPROFILESTRING)
LIBS="$LIBS -lodbcinst"],
[LIBS="$save_LIBS"])

])