[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="" |
---|
| 87 | |
---|
| 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 | " |
---|
| 98 | |
---|
| 99 | QT_COMMON_LIB_DIRECTORIES=" |
---|
| 100 | `ls -dr ${QT_PREFIX}/lib 2>/dev/null` |
---|
| 101 | /usr/include |
---|
| 102 | `ls -dr /usr/lib/qt* 2>/dev/null` |
---|
| 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 | " |
---|
| 108 | |
---|
| 109 | ## Search in all IncludeDirectories for QT-includes |
---|
| 110 | for _include_directory in ${QT_COMMON_INCLUDE_DIRECTORIES} |
---|
| 111 | do |
---|
| 112 | if test -e ${_include_directory}/Qt/QtCore ; then |
---|
| 113 | QT_INCLUDE_DIRECTORY=${_include_directory} |
---|
| 114 | break |
---|
| 115 | fi |
---|
| 116 | done |
---|
| 117 | if test -n ${QT_INCLUDE_DIRECTORY} ; then |
---|
| 118 | echo "Qt-Include Directory is: ${QT_INCLUDE_DIRECTORY}" |
---|
| 119 | else |
---|
| 120 | AC_MSG_ERROR([Qt Headers not found]) |
---|
| 121 | fi |
---|
| 122 | |
---|
| 123 | ## Search in all LibraryDirectories for QT-includes |
---|
| 124 | for _lib_directory in ${QT_COMMON_LIB_DIRECTORIES} |
---|
| 125 | do |
---|
| 126 | if test -e ${_lib_directory}/libQtCore.so || test -e ${_lib_directory}/libQtCore.dll ; then |
---|
| 127 | QT_LIB_DIRECTORY=${_lib_directory} |
---|
| 128 | break |
---|
| 129 | fi |
---|
| 130 | done |
---|
| 131 | if test -n ${QT_LIB_DIRECTORY} ; then |
---|
| 132 | echo "Qt-Library Directory is: ${QT_LIB_DIRECTORY}" |
---|
| 133 | else |
---|
| 134 | AC_MSG_ERROR([Qt LIB not found]) |
---|
| 135 | fi |
---|
| 136 | |
---|
| 137 | ## Setting up the Environment Variables. |
---|
| 138 | QT_LIBS="" |
---|
| 139 | QT_CXXFLAGS="-I${QT_INCLUDE_DIRECTORY}" |
---|
| 140 | LDFLAGS="${LDFLAGS} -L${QT_LIB_DIRECTORY} -Wl,-rpath -Wl,${QT_LIB_DIRECTORY}" |
---|
| 141 | QT_BIN_DIR="${QT_PREFIX}/bin" |
---|
| 142 | |
---|
| 143 | CACHED_CPPFLAG=${CPPFLAGS} |
---|
| 144 | CACHED_LDFLAGS=${LDFLAGS} |
---|
| 145 | |
---|
| 146 | LDFLAGS="${LDFLAGS} ${QT_LDFLAGS}" |
---|
| 147 | for _lib in $2 |
---|
| 148 | do |
---|
| 149 | AC_CHECK_LIB([$_lib], [main], [_lib_check="yes"], [_lib_check="no"]) |
---|
| 150 | if test "x$_lib_check" = "xyes" ; then |
---|
| 151 | _found_lib=$_lib |
---|
| 152 | break |
---|
| 153 | fi |
---|
| 154 | done |
---|
| 155 | |
---|
| 156 | if [test "x$_lib_check" = "xyes"] ; then |
---|
| 157 | QT_LIBS="${QT_LIBS} -l$_found_lib" |
---|
| 158 | AX_CHECK_REQUIRED_LIB([QtCore QtCore4], [main],,,[http://www.trolltech.com] ) |
---|
| 159 | AX_CHECK_REQUIRED_LIB([QtGui QtGui4], [main],,,[http://www.trolltech.com] ) |
---|
| 160 | AX_CHECK_REQUIRED_LIB([QtOpenGL QtOpenGL4], [main],,,[http://www.trolltech.com] ) |
---|
| 161 | |
---|
| 162 | $3 |
---|
| 163 | else |
---|
| 164 | echo "------------------" |
---|
| 165 | echo "LIBRARY $2 not found.in $1" |
---|
| 166 | echo "please install the $1-LIBRARY-package which can be found at $5" |
---|
| 167 | echo "------------------" |
---|
| 168 | $4 |
---|
| 169 | exit -1 |
---|
| 170 | fi |
---|
| 171 | |
---|
| 172 | echo "QT_LIBS = ${QT_LIBS}" |
---|
| 173 | echo "QT_CXXFLAGS = ${QT_CXXFLAGS}" |
---|
| 174 | echo "QT_LD_FLAGS = ${QT_LDFLAGS}" |
---|
| 175 | |
---|
| 176 | AC_SUBST([QT_LIBS]) |
---|
| 177 | AC_SUBST([QT_CXXFLAGS]) |
---|
| 178 | AC_SUBST([QT_LDFLAGS]) |
---|
| 179 | |
---|
| 180 | #----------# |
---|
| 181 | # QT - MOC # |
---|
| 182 | #----------# |
---|
| 183 | AC_PATH_PROG([QT_MOC], [moc], [no], ["${QT_BIN_DIR}:${PATH}"]) |
---|
| 184 | if test x${QT_MOC} = xno ; then |
---|
| 185 | AC_MSG_ERROR([QT MOC not found]) |
---|
| 186 | fi |
---|
| 187 | AC_SUBST([QT_MOC]) |
---|
| 188 | |
---|
| 189 | AC_PATH_PROG([QT_UIC], [uic], [no], ["${QT_BIN_DIR}:${PATH}"]) |
---|
| 190 | # if test x${QT_UIC} = xno ; then |
---|
| 191 | # AC_MSG_WARN([QT UIC not found]) |
---|
| 192 | # fi |
---|
| 193 | AC_SUBST([QT_UIC]) |
---|
| 194 | |
---|
| 195 | AC_PATH_PROG([QT_RCC], [rcc], [no], ["${QT_BIN_DIR}:${PATH}"]) |
---|
| 196 | # if test x${QT_RCC} = xno ; then |
---|
| 197 | # AC_MSG_WARN([QT RCC not found]) |
---|
| 198 | # fi |
---|
| 199 | AC_SUBST([QT_RCC]) |
---|
| 200 | |
---|
| 201 | |
---|
| 202 | |
---|
| 203 | # Restore Values of CPPFLAGS and LDFLAGS |
---|
| 204 | CPPFLAGS=${CACHED_CPPFLAG} |
---|
| 205 | LDFLAGS=${CACHED_LDFLAGS} |
---|
| 206 | ]) |
---|