[6274] | 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" |
---|
[7661] | 12 | $4 |
---|
[6274] | 13 | else |
---|
| 14 | echo "no Support for $2" |
---|
[7661] | 15 | $5 |
---|
[6274] | 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" |
---|
[7661] | 36 | $4 |
---|
[6274] | 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 "------------------" |
---|
[7661] | 42 | $5 |
---|
[6274] | 43 | exit -1 |
---|
| 44 | fi |
---|
| 45 | ]) |
---|
[7661] | 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="" |
---|
[7669] | 87 | QT_BIN_DIRECTORY="" |
---|
[7661] | 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` |
---|
[7669] | 97 | `ls -dr /c/Qt/*/include 2>/dev/null` |
---|
[7661] | 98 | " |
---|
| 99 | |
---|
| 100 | QT_COMMON_LIB_DIRECTORIES=" |
---|
| 101 | `ls -dr ${QT_PREFIX}/lib 2>/dev/null` |
---|
[7961] | 102 | /usr/lib |
---|
[7661] | 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` |
---|
[7669] | 107 | `ls -dr /c/Qt/*/lib 2>/dev/null` |
---|
[7661] | 108 | " |
---|
| 109 | |
---|
[7669] | 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 |
---|
[7670] | 121 | for _qt_include_directory in ${QT_COMMON_INCLUDE_DIRECTORIES} |
---|
[7661] | 122 | do |
---|
[7670] | 123 | if test -e ${_qt_include_directory}/QtCore/QCoreApplication ; then |
---|
| 124 | QT_INCLUDE_DIRECTORY="${_qt_include_directory}" |
---|
[7661] | 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 |
---|
[7669] | 137 | if test -e ${_lib_directory}/libQtCore.so || test -e ${_lib_directory}/libQtCore4.a ; then |
---|
[7661] | 138 | QT_LIB_DIRECTORY=${_lib_directory} |
---|
| 139 | break |
---|
| 140 | fi |
---|
| 141 | done |
---|
| 142 | if test -n ${QT_LIB_DIRECTORY} ; then |
---|
| 143 | echo "Qt-Library Directory is: ${QT_LIB_DIRECTORY}" |
---|
| 144 | else |
---|
| 145 | AC_MSG_ERROR([Qt LIB not found]) |
---|
| 146 | fi |
---|
| 147 | |
---|
[7669] | 148 | ## Search in all BINDirectories for QT-executables |
---|
| 149 | for _bin_directory in ${QT_COMMON_BIN_DIRECTORIES} |
---|
| 150 | do |
---|
| 151 | if test -e ${_bin_directory}/moc || test -e ${_bin_directory}/moc.exe ; then |
---|
| 152 | QT_BIN_DIRECTORY=${_bin_directory} |
---|
| 153 | break |
---|
| 154 | fi |
---|
| 155 | done |
---|
| 156 | if test -n ${QT_BIN_DIRECTORY} ; then |
---|
| 157 | echo "Qt-Bin Directory is: ${QT_BIN_DIRECTORY}" |
---|
| 158 | else |
---|
| 159 | QT_BIN_DIRECTORY=${QT_PREFIX}/bin |
---|
| 160 | fi |
---|
| 161 | |
---|
[7661] | 162 | ## Setting up the Environment Variables. |
---|
| 163 | QT_LIBS="" |
---|
| 164 | QT_CXXFLAGS="-I${QT_INCLUDE_DIRECTORY}" |
---|
| 165 | LDFLAGS="${LDFLAGS} -L${QT_LIB_DIRECTORY} -Wl,-rpath -Wl,${QT_LIB_DIRECTORY}" |
---|
| 166 | |
---|
| 167 | CACHED_CPPFLAG=${CPPFLAGS} |
---|
| 168 | CACHED_LDFLAGS=${LDFLAGS} |
---|
| 169 | |
---|
| 170 | LDFLAGS="${LDFLAGS} ${QT_LDFLAGS}" |
---|
| 171 | for _lib in $2 |
---|
| 172 | do |
---|
| 173 | AC_CHECK_LIB([$_lib], [main], [_lib_check="yes"], [_lib_check="no"]) |
---|
| 174 | if test "x$_lib_check" = "xyes" ; then |
---|
| 175 | _found_lib=$_lib |
---|
| 176 | break |
---|
| 177 | fi |
---|
| 178 | done |
---|
| 179 | |
---|
| 180 | if [test "x$_lib_check" = "xyes"] ; then |
---|
| 181 | QT_LIBS="${QT_LIBS} -l$_found_lib" |
---|
| 182 | AX_CHECK_REQUIRED_LIB([QtCore QtCore4], [main],,,[http://www.trolltech.com] ) |
---|
| 183 | AX_CHECK_REQUIRED_LIB([QtGui QtGui4], [main],,,[http://www.trolltech.com] ) |
---|
| 184 | AX_CHECK_REQUIRED_LIB([QtOpenGL QtOpenGL4], [main],,,[http://www.trolltech.com] ) |
---|
| 185 | |
---|
| 186 | $3 |
---|
| 187 | else |
---|
| 188 | echo "------------------" |
---|
| 189 | echo "LIBRARY $2 not found.in $1" |
---|
| 190 | echo "please install the $1-LIBRARY-package which can be found at $5" |
---|
| 191 | echo "------------------" |
---|
| 192 | $4 |
---|
| 193 | exit -1 |
---|
| 194 | fi |
---|
| 195 | |
---|
| 196 | echo "QT_LIBS = ${QT_LIBS}" |
---|
| 197 | echo "QT_CXXFLAGS = ${QT_CXXFLAGS}" |
---|
| 198 | echo "QT_LD_FLAGS = ${QT_LDFLAGS}" |
---|
[7669] | 199 | echo "QT_BIN_DIRECTORY = ${QT_BIN_DIRECTORY}" |
---|
[7661] | 200 | |
---|
| 201 | AC_SUBST([QT_LIBS]) |
---|
| 202 | AC_SUBST([QT_CXXFLAGS]) |
---|
| 203 | AC_SUBST([QT_LDFLAGS]) |
---|
| 204 | |
---|
| 205 | #----------# |
---|
| 206 | # QT - MOC # |
---|
| 207 | #----------# |
---|
[7669] | 208 | AC_PATH_PROG([QT_MOC], [moc], [no], ["${QT_BIN_DIRECTORY}:${PATH}"]) |
---|
[7661] | 209 | if test x${QT_MOC} = xno ; then |
---|
| 210 | AC_MSG_ERROR([QT MOC not found]) |
---|
| 211 | fi |
---|
| 212 | AC_SUBST([QT_MOC]) |
---|
| 213 | |
---|
[7669] | 214 | AC_PATH_PROG([QT_UIC], [uic], [no], ["${QT_BIN_DIRECTORY}:${PATH}"]) |
---|
[7661] | 215 | # if test x${QT_UIC} = xno ; then |
---|
| 216 | # AC_MSG_WARN([QT UIC not found]) |
---|
| 217 | # fi |
---|
| 218 | AC_SUBST([QT_UIC]) |
---|
| 219 | |
---|
[7669] | 220 | AC_PATH_PROG([QT_RCC], [rcc], [no], ["${QT_BIN_DIRECTORY}:${PATH}"]) |
---|
[7661] | 221 | # if test x${QT_RCC} = xno ; then |
---|
| 222 | # AC_MSG_WARN([QT RCC not found]) |
---|
| 223 | # fi |
---|
| 224 | AC_SUBST([QT_RCC]) |
---|
| 225 | |
---|
| 226 | |
---|
| 227 | |
---|
| 228 | # Restore Values of CPPFLAGS and LDFLAGS |
---|
| 229 | CPPFLAGS=${CACHED_CPPFLAG} |
---|
| 230 | LDFLAGS=${CACHED_LDFLAGS} |
---|
| 231 | ]) |
---|