1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5
>Adding libdbi to your project</TITLE
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
10
TITLE="Database Independent Abstraction Layer for C"
11
HREF="index.html"><LINK
13
TITLE="libdbi in a Nutshell (Quickstart Guide)"
14
HREF="quickstart.html"><LINK
16
TITLE="Loading libdbi at runtime"
17
HREF="x267.html"><LINK
19
TITLE="Error Handling"
20
HREF="errorhandling.html"></HEAD
31
SUMMARY="Header navigation table"
40
>Database Independent Abstraction Layer for C: libdbi Programmer's Guide</TH
56
>Chapter 2. libdbi in a Nutshell (Quickstart Guide)</TD
62
HREF="errorhandling.html"
77
>2.4. Adding libdbi to your project</A
80
>If your project uses autoconf to manage the build process on the target machine, you should add some tests to your <TT
83
> script to check for the presence and usability of libdbi. The following example shows how this can be done:</P
93
CLASS="PROGRAMLISTING"
94
>dnl check for dynamic linking functions
95
AC_CHECK_LIB(dl,dlopen)
97
dnl check for the libdbi library
98
AC_CHECK_LIB(dbi,dbi_initialize)
100
dnl to check for the availability and function of a particular
101
dnl driver we need a runtime check (since the driver is loaded
102
dnl dynamically). This example checks for the mysql driver
103
AC_MSG_CHECKING("for libdbi mysql driver (dynamic load)")
106
[[dbi_initialize(0); return(dbi_conn_new("mysql") ? 0 : 1);]])],
107
[AC_MSG_RESULT("yes")],
108
[AC_MSG_FAILURE("mysql driver not installed?")])</PRE
114
>The first two tests add the appropriate flags to the <CODE
117
> variable to link against the required libraries.</P
119
>In addition, you have to make sure that both the directory which contains the libdbi header file directory (usually <TT
124
>/usr/local/include</TT
125
>) as well as the directory which contains the libdbi library (usually <TT
131
>) are accessible to the compiler and to the linker by using the <CODE
137
> compiler flags, respectively.</P
144
SUMMARY="Footer navigation table"
173
HREF="errorhandling.html"
183
>Loading libdbi at runtime</TD
189
HREF="quickstart.html"
b'\\ No newline at end of file'