1 | |
---|
2 | |
---|
3 | dnl AX_CHECK_HEADER_LIB([HEADER-NAME], [LIBRARY-NAME], [FUNCTION-IN-LIB], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [LIB-WEB-PAGE]) |
---|
4 | AC_DEFUN([AX_CHECK_HEADER_LIB], [ |
---|
5 | _header_check="" |
---|
6 | _lib_check="" |
---|
7 | |
---|
8 | AC_CHECK_HEADER([$1], [_header_check="yes"], [_header_check="no"]) |
---|
9 | AC_CHECK_LIB([$2], [$3], [_lib_check="yes"], [_lib_check="no"]) |
---|
10 | if [test "x$_header_check" = "xyes" && test "x$_lib_check" = "xyes"] ; then |
---|
11 | LIBS="$LIBS -l$2" |
---|
12 | $4 |
---|
13 | else |
---|
14 | echo "no Support for $2" |
---|
15 | $5 |
---|
16 | fi |
---|
17 | ]) |
---|
18 | |
---|
19 | |
---|
20 | |
---|
21 | dnl AX_CHECK_REQUIRED_HEADER_LIB([HEADER-NAME], [LIBRARY-NAME], [FUNCTION-IN-LIB], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [LIB-WEB-PAGE]) |
---|
22 | AC_DEFUN([AX_CHECK_REQUIRED_HEADER_LIB], [ |
---|
23 | _header_check="" |
---|
24 | _lib_check="" |
---|
25 | |
---|
26 | for _header in $1 |
---|
27 | do |
---|
28 | AC_CHECK_HEADER([$_header], [_header_check="yes"], [_header_check="no"]) |
---|
29 | if test "x$_header_check" = "xyes" ; then |
---|
30 | break |
---|
31 | fi |
---|
32 | done |
---|
33 | AC_CHECK_LIB([$2], [$3], [_lib_check="yes"], [_lib_check="no"]) |
---|
34 | if [test x$_header_check = "xyes" && test "x$_lib_check" = "xyes"] ; then |
---|
35 | LIBS="$LIBS -l$2" |
---|
36 | $4 |
---|
37 | else |
---|
38 | echo "------------------" |
---|
39 | echo "LIBRARY $2 not found." |
---|
40 | echo "please install the $2-LIBRARY-package which can be found at $6" |
---|
41 | echo "------------------" |
---|
42 | $5 |
---|
43 | exit -1 |
---|
44 | fi |
---|
45 | ]) |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | dnl AX_CHECK_REQUIRED_LIB([LIBRARY-NAME], [FUNCTION-IN-LIB], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [LIB-WEB-PAGE]) |
---|
50 | AC_DEFUN([AX_CHECK_REQUIRED_LIB], [ |
---|
51 | _lib_check="" |
---|
52 | _found_lib="" |
---|
53 | |
---|
54 | |
---|
55 | for _lib in $1 |
---|
56 | do |
---|
57 | AC_CHECK_LIB([$_lib], [$2], [_lib_check="yes"], [_lib_check="no"]) |
---|
58 | if test "x$_lib_check" = "xyes" ; then |
---|
59 | _found_lib=$_lib |
---|
60 | break |
---|
61 | fi |
---|
62 | done |
---|
63 | |
---|
64 | if [test "x$_lib_check" = "xyes"] ; then |
---|
65 | LIBS="$LIBS -l$_found_lib" |
---|
66 | $3 |
---|
67 | else |
---|
68 | echo "------------------" |
---|
69 | echo "LIBRARY $1 not found." |
---|
70 | echo "please install the $1-LIBRARY-package which can be found at $5" |
---|
71 | echo "------------------" |
---|
72 | $4 |
---|
73 | exit -1 |
---|
74 | fi |
---|
75 | ]) |
---|
76 | |
---|
77 | |
---|
78 | |
---|
79 | |
---|
80 | dnl AX_CHECK_QT([QTDIR], [LIBRARIES], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [LIB-WEB-PAGE]) |
---|
81 | AC_DEFUN([AX_CHECK_QT], [ |
---|
82 | _lib_check="" |
---|
83 | _found_lib="" |
---|
84 | QT_PREFIX="$1" |
---|
85 | QT_INCLUDE_DIRECTORY="" |
---|
86 | QT_LIB_DIRECTORY="" |
---|
87 | QT_BIN_DIRECTORY="" |
---|
88 | |
---|
89 | QT_COMMON_INCLUDE_DIRECTORIES=" |
---|
90 | `ls -dr ${QT_PREFIX}/include 2>/dev/null` |
---|
91 | /usr/include |
---|
92 | `ls -dr /usr/include/qt* 2>/dev/null` |
---|
93 | `ls -dr /usr/lib/qt*/include 2>/dev/null` |
---|
94 | `ls -dr /usr/local/qt*/include 2>/dev/null` |
---|
95 | `ls -dr /opt/qt*/include 2>/dev/null` |
---|
96 | `ls -dr /Developer/qt*/include 2>/dev/null` |
---|
97 | `ls -dr /c/Qt/*/include 2>/dev/null` |
---|
98 | " |
---|
99 | |
---|
100 | QT_COMMON_LIB_DIRECTORIES=" |
---|
101 | `ls -dr ${QT_PREFIX}/lib 2>/dev/null` |
---|
102 | /usr/include |
---|
103 | `ls -dr /usr/lib/qt* 2>/dev/null` |
---|
104 | `ls -dr /usr/local/qt*/lib 2>/dev/null` |
---|
105 | `ls -dr /opt/qt*/lib 2>/dev/null` |
---|
106 | `ls -dr /Developer/qt*/lib 2>/dev/null` |
---|
107 | `ls -dr /c/Qt/*/lib 2>/dev/null` |
---|
108 | " |
---|
109 | |
---|
110 | QT_COMMON_BIN_DIRECTORIES=" |
---|
111 | `ls -dr ${QT_PREFIX}/bin 2>/dev/null` |
---|
112 | /usr/bin |
---|
113 | `ls -dr /usr/bin/qt* 2>/dev/null` |
---|
114 | `ls -dr /usr/local/qt*/bin 2>/dev/null` |
---|
115 | `ls -dr /opt/qt*/bin 2>/dev/null` |
---|
116 | `ls -dr /Developer/qt*/bin 2>/dev/null` |
---|
117 | `ls -dr /c/Qt/*/bin 2>/dev/null` |
---|
118 | " |
---|
119 | |
---|
120 | ## Search in all IncludeDirectories for QT-includes |
---|
121 | for _qt_include_directory in ${QT_COMMON_INCLUDE_DIRECTORIES} |
---|
122 | do |
---|
123 | if test -e ${_qt_include_directory}/QtCore/QCoreApplication ; then |
---|
124 | QT_INCLUDE_DIRECTORY="${_qt_include_directory}" |
---|
125 | break |
---|
126 | fi |
---|
127 | done |
---|
128 | if test -n ${QT_INCLUDE_DIRECTORY} ; then |
---|
129 | echo "Qt-Include Directory is: ${QT_INCLUDE_DIRECTORY}" |
---|
130 | else |
---|
131 | AC_MSG_ERROR([Qt Headers not found]) |
---|
132 | fi |
---|
133 | |
---|
134 | ## Search in all LibraryDirectories for QT-includes |
---|
135 | for _lib_directory in ${QT_COMMON_LIB_DIRECTORIES} |
---|
136 | do |
---|
137 | if test -e ${_lib_directory}/libQtCore.so || test -e ${_lib_directory}/libQtCore4.a || \ |
---|
138 | test -e ${_lib_directory}/QtCore.framework ; then |
---|
139 | QT_LIB_DIRECTORY=${_lib_directory} |
---|
140 | break |
---|
141 | fi |
---|
142 | done |
---|
143 | if test -n ${QT_LIB_DIRECTORY} ; then |
---|
144 | echo "Qt-Library Directory is: ${QT_LIB_DIRECTORY}" |
---|
145 | else |
---|
146 | AC_MSG_ERROR([Qt LIB not found]) |
---|
147 | fi |
---|
148 | |
---|
149 | ## Search in all BINDirectories for QT-executables |
---|
150 | for _bin_directory in ${QT_COMMON_BIN_DIRECTORIES} |
---|
151 | do |
---|
152 | if test -e ${_bin_directory}/moc || test -e ${_bin_directory}/moc.exe ; then |
---|
153 | QT_BIN_DIRECTORY=${_bin_directory} |
---|
154 | break |
---|
155 | fi |
---|
156 | done |
---|
157 | if test -n ${QT_BIN_DIRECTORY} ; then |
---|
158 | echo "Qt-Bin Directory is: ${QT_BIN_DIRECTORY}" |
---|
159 | else |
---|
160 | QT_BIN_DIRECTORY=${QT_PREFIX}/bin |
---|
161 | fi |
---|
162 | |
---|
163 | ## Setting up the Environment Variables. |
---|
164 | QT_LIBS="" |
---|
165 | QT_CXXFLAGS="-I${QT_INCLUDE_DIRECTORY}" |
---|
166 | LDFLAGS="${LDFLAGS} -L${QT_LIB_DIRECTORY} -Wl,-rpath -Wl,${QT_LIB_DIRECTORY}" |
---|
167 | |
---|
168 | CACHED_CPPFLAG=${CPPFLAGS} |
---|
169 | CACHED_LDFLAGS=${LDFLAGS} |
---|
170 | |
---|
171 | LDFLAGS="${LDFLAGS} ${QT_LDFLAGS}" |
---|
172 | for _lib in $2 |
---|
173 | do |
---|
174 | AC_CHECK_LIB([$_lib], [main], [_lib_check="yes"], [_lib_check="no"]) |
---|
175 | if test "x$_lib_check" = "xyes" ; then |
---|
176 | _found_lib=$_lib |
---|
177 | break |
---|
178 | fi |
---|
179 | done |
---|
180 | |
---|
181 | if [test "x$_lib_check" = "xyes"] ; then |
---|
182 | QT_LIBS="${QT_LIBS} -l$_found_lib" |
---|
183 | AX_CHECK_REQUIRED_LIB([QtCore QtCore4], [main],,,[http://www.trolltech.com] ) |
---|
184 | AX_CHECK_REQUIRED_LIB([QtGui QtGui4], [main],,,[http://www.trolltech.com] ) |
---|
185 | AX_CHECK_REQUIRED_LIB([QtOpenGL QtOpenGL4], [main],,,[http://www.trolltech.com] ) |
---|
186 | |
---|
187 | $3 |
---|
188 | else |
---|
189 | echo "------------------" |
---|
190 | echo "LIBRARY $2 not found.in $1" |
---|
191 | echo "please install the $1-LIBRARY-package which can be found at $5" |
---|
192 | echo "------------------" |
---|
193 | $4 |
---|
194 | exit -1 |
---|
195 | fi |
---|
196 | |
---|
197 | echo "QT_LIBS = ${QT_LIBS}" |
---|
198 | echo "QT_CXXFLAGS = ${QT_CXXFLAGS}" |
---|
199 | echo "QT_LD_FLAGS = ${QT_LDFLAGS}" |
---|
200 | echo "QT_BIN_DIRECTORY = ${QT_BIN_DIRECTORY}" |
---|
201 | |
---|
202 | AC_SUBST([QT_LIBS]) |
---|
203 | AC_SUBST([QT_CXXFLAGS]) |
---|
204 | AC_SUBST([QT_LDFLAGS]) |
---|
205 | |
---|
206 | #----------# |
---|
207 | # QT - MOC # |
---|
208 | #----------# |
---|
209 | AC_PATH_PROG([QT_MOC], [moc], [no], ["${QT_BIN_DIRECTORY}:${PATH}"]) |
---|
210 | if test x${QT_MOC} = xno ; then |
---|
211 | AC_MSG_ERROR([QT MOC not found]) |
---|
212 | fi |
---|
213 | AC_SUBST([QT_MOC]) |
---|
214 | |
---|
215 | AC_PATH_PROG([QT_UIC], [uic], [no], ["${QT_BIN_DIRECTORY}:${PATH}"]) |
---|
216 | # if test x${QT_UIC} = xno ; then |
---|
217 | # AC_MSG_WARN([QT UIC not found]) |
---|
218 | # fi |
---|
219 | AC_SUBST([QT_UIC]) |
---|
220 | |
---|
221 | AC_PATH_PROG([QT_RCC], [rcc], [no], ["${QT_BIN_DIRECTORY}:${PATH}"]) |
---|
222 | # if test x${QT_RCC} = xno ; then |
---|
223 | # AC_MSG_WARN([QT RCC not found]) |
---|
224 | # fi |
---|
225 | AC_SUBST([QT_RCC]) |
---|
226 | |
---|
227 | |
---|
228 | |
---|
229 | # Restore Values of CPPFLAGS and LDFLAGS |
---|
230 | CPPFLAGS=${CACHED_CPPFLAG} |
---|
231 | LDFLAGS=${CACHED_LDFLAGS} |
---|
232 | ]) |
---|