-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsqlite.m4
144 lines (128 loc) · 4.11 KB
/
sqlite.m4
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
# sqlite3.m4
# ----------
#
# Copyright 2008 by Thomas Baumgart
#
# License: See file COPYING
#
# Checks for the necessity to build our own qt-sqlite3 support library
# and the presence of the sqlite3 development headers.
#
# Supports the following options:
#
# --enable-sqlite3
# --disable-sqlite3
#
# If none of them is present, the detection is automatic. If the development
# headers are not found for automatic detection, the generation will be
# disabled w/o error. If --enable-sqlite3 is provided in the same stage,
# an error is given if the sqlite3 development files are not installed.
#
# The following variables are provided via AC_SUBST:
#
# SQLITE3 - contains the subdirectory to visit for compilation
# LIBSQLITE3 - contains the full pathname for the Qt plugin driver
AC_DEFUN([AC_SQLITE3], [
AC_MSG_CHECKING(if the SQLITE3 support is desired)
AC_ARG_ENABLE(sqlite3,
AC_HELP_STRING([--enable-sqlite3],[build SQLITE3 support library (default=auto)]),
enable_sqlite3="$enableval",
enable_sqlite3="auto")
AC_MSG_RESULT($enable_sqlite3)
if test ! $enable_sqlite3 = no; then
# determine name and path of sqlite3 plugin library
qtlib=""
if test ! "lib${kdelibsuff}" = "lib"; then
qtlib=".lib64"
fi
if test x$QTDIR = x; then
QTDIR=`dirname $MOC`
QTDIR=${QTDIR%/bin}
fi
LIBSQLITE3=${QTDIR}/plugins/sqldrivers/libsqlite3${qtlib}.so
# do the checks
if test $enable_sqlite3 = auto; then
AC_MSG_CHECKING(if the SQLITE3 support is already present)
if test ! -e ${LIBSQLITE3}; then
result=no
else
# add check for local qt-sqlite3 directory here
result=yes
enable_sqlite3=no
# in case a previous run unpacked the SQLITE3 support stuff
# it is pretty sure that we have build the existing support
# if that's the case, we just enable it again
if test -d qt-sqlite3-0.2; then
enable_sqlite3=auto
fi
fi
AC_MSG_RESULT($result)
fi
# we only need to check for the headers in case we need to build
if test ! $enable_sqlite3 = no; then
# now check for the presence of SQLITE libraries
AC_CHECK_HEADER([sqlite3.h], [enable_sqlite3=yes],
[
if test $enable_sqlite3 = auto; then
enable_sqlite3=no
else
AC_MSG_ERROR(SQLITE development files not found)
fi
])
fi
fi
if test $enable_sqlite3 = yes; then
AC_MSG_CHECKING(if the environment variable QTDIR is set)
if test x$QTDIR = x; then
AC_MSG_ERROR(QTDIR not set)
fi
AC_MSG_RESULT($QTDIR)
ac_qmake=${QTDIR}/bin/qmake
AC_ARG_WITH(qmake,
AC_HELP_STRING([--with-qmake=PATH],[which version of QMake to use ]),
[ ac_qmake="$withval" ])
fi
if test $enable_sqlite3 = yes; then
rm -rf qt-sqlite3-0.2
gunzip -c `dirname -- ${0}`/23011-qt-sqlite3-0.2.tar.gz | tar -xf -
cd qt-sqlite3-0.2
${ac_qmake} QMAKE=${ac_qmake}
SQLITE3=qt-sqlite3-0.2
sed -i s/^install:.*$// Makefile
sed -i s/^uninstall:.*$// Makefile
# create the targets required for 'make distcheck' and 'make [un]install'
cat >> Makefile <<EOF
dvi:
check:
installcheck:
distuninstallcheck:
dist:
distcleancheck:
# for installation and de-installation we need to take care
# of the _inst case which is caused by running 'make distcheck'
install:
if test ! x$SQLITE3 = x; then \
if test "x\$(DESTDIR)" = "x" -a "${prefix:0-5}" = "_inst"; then \
/bin/sh ../$ac_aux_dir/mkinstalldirs \`dirname ${prefix}${LIBSQLITE3}\`; \
${INSTALL} sqldrivers/libqsqlite3.so ${prefix}${LIBSQLITE3}; \
chmod 755 ${prefix}${LIBSQLITE3}; \
else \
/bin/sh ../$ac_aux_dir/mkinstalldirs \`dirname \$(DESTDIR)${LIBSQLITE3}\`; \
${INSTALL} sqldrivers/libqsqlite3.so \$(DESTDIR)${LIBSQLITE3}; \
chmod 755 \$(DESTDIR)${LIBSQLITE3}; \
fi \
fi
uninstall:
if test ! x$SQLITE3 = x; then \
if test "x\$(DESTDIR)" = "x" -a "${prefix:0-5}" = "_inst"; then \
rm -rf ${prefix}${LIBSQLITE3}; \
else \
rm -rf \$(DESTDIR)${LIBSQLITE3}; \
fi \
fi
EOF
cd ..
AC_SUBST(SQLITE3)
AC_SUBST(LIBSQLITE3)
fi
])