Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/qt_gui/acinclude.m4 @ 7574

Last change on this file since 7574 was 7538, checked in by bensch, 19 years ago

sync

File size: 5.8 KB
RevLine 
[6274]1
2
3dnl AX_CHECK_HEADER_LIB([HEADER-NAME], [LIBRARY-NAME], [FUNCTION-IN-LIB], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [LIB-WEB-PAGE])
4AC_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"
[7502]12         $4
[6274]13    else
14         echo "no Support for $2"
[7502]15         $5
[6274]16    fi
17])
18
19
20
21dnl AX_CHECK_REQUIRED_HEADER_LIB([HEADER-NAME], [LIBRARY-NAME], [FUNCTION-IN-LIB], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [LIB-WEB-PAGE])
22AC_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"
[7502]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 "------------------"
[7502]42         $5
[6274]43         exit -1
44    fi
45])
[7442]46
47
48
49dnl AX_CHECK_REQUIRED_LIB([LIBRARY-NAME], [FUNCTION-IN-LIB], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [LIB-WEB-PAGE])
50AC_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
[7521]78
79
80dnl AX_CHECK_QT([QTDIR], [LIBRARIES], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [LIB-WEB-PAGE])
[7502]81AC_DEFUN([AX_CHECK_QT], [
82    _lib_check=""
83    _found_lib=""
[7534]84    QT_PREFIX="$1"
[7536]85    QT_INCLUDE_DIRECTORY=""
86    QT_LIB_DIRECTORY=""
[7442]87
88
[7536]89    QT_COMMON_INCLUDE_DIRECTORIES="
90      `ls -dr ${QT_PREFIX}/include     2>/dev/null`
91      /usr/include
[7534]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
[7536]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    "
[7534]108
[7536]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
[7502]143    CACHED_CPPFLAG=${CPPFLAGS}
144    CACHED_LDFLAGS=${LDFLAGS}
[7442]145
[7527]146    LDFLAGS="${LDFLAGS} ${QT_LDFLAGS}"
[7502]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
[7521]151        _found_lib=$_lib
[7502]152        break
153      fi
154    done
[7442]155
[7502]156    if [test "x$_lib_check" = "xyes"] ; then
[7521]157         QT_LIBS="${QT_LIBS} -l$_found_lib"
[7534]158         AX_CHECK_REQUIRED_LIB([QtCore QtCore4], [main],,,[http://www.trolltech.com] )
159         AX_CHECK_REQUIRED_LIB([QtGui QtGui4], [main],,,[http://www.trolltech.com] )
[7538]160         AX_CHECK_REQUIRED_LIB([QtOpenGL QtOpenGL4], [main],,,[http://www.trolltech.com] )
[7534]161
[7502]162         $3
[7442]163    else
[7502]164         echo "------------------"
[7527]165         echo "LIBRARY $2 not found.in $1"
[7502]166         echo "please install the $1-LIBRARY-package which can be found at $5"
167         echo "------------------"
168         $4
169         exit -1
[7442]170    fi
[7534]171
172    echo "QT_LIBS = ${QT_LIBS}"
173    echo "QT_CXXFLAGS = ${QT_CXXFLAGS}"
174    echo "QT_LD_FLAGS = ${QT_LDFLAGS}"
175
[7502]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])
[7442]186      fi
[7502]187    AC_SUBST([QT_MOC])
[7442]188
[7502]189    AC_PATH_PROG([QT_UIC], [uic], [no], ["${QT_BIN_DIR}:${PATH}"])
[7521]190 #     if test x${QT_UIC} = xno ; then
191 #       AC_MSG_WARN([QT UIC not found])
192 #     fi
[7502]193    AC_SUBST([QT_UIC])
[7442]194
[7502]195    AC_PATH_PROG([QT_RCC], [rcc], [no], ["${QT_BIN_DIR}:${PATH}"])
[7521]196#      if test x${QT_RCC} = xno ; then
197#        AC_MSG_WARN([QT RCC not found])
198#      fi
[7502]199    AC_SUBST([QT_RCC])
[7442]200
201
202
[7502]203    # Restore Values of CPPFLAGS and LDFLAGS
204    CPPFLAGS=${CACHED_CPPFLAG}
205    LDFLAGS=${CACHED_LDFLAGS}
[7442]206])
Note: See TracBrowser for help on using the repository browser.