Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/terrain/acinclude.m4 @ 8910

Last change on this file since 8910 was 8748, checked in by ponder, 18 years ago

Small changes to help debug

File size: 11.7 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"
[7661]12         $4
[6274]13    else
14         echo "no Support for $2"
[7661]15         $5
[6274]16    fi
17])
18
19
20
[8061]21dnl AX_CHECK_REQUIRED_HEADER_LIB([HEADER-NAME], [LIBRARY-NAME], [FUNCTION-IN-LIB], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [LIB-WEB-PAGE], [CFLAGS], [OTHER_LIBS])
[6274]22AC_DEFUN([AX_CHECK_REQUIRED_HEADER_LIB], [
23    _header_check=""
24    _lib_check=""
[8061]25    LAST_FOUND_LIB=""
[6274]26
[8061]27    _lib_USED=""
28    _header_USED=""
29
[6274]30    for _header in $1
31    do
[8061]32      AC_CHECK_HEADER([${_header}], [_header_check="yes" ; _header_USED=${_header}], [_header_check="no"], $7)
33      if  test "x${_header_check}" = "xyes" ; then
[6274]34        break
35      fi
36    done
[8061]37    for _check_library in $2
38    do
39      AC_CHECK_LIB([${_check_library}], [$3], [_lib_check="yes"; _lib_USED=${_check_library}], [_lib_check="no"], $8)
40      if test "x${_lib_check}" = "xyes" ; then
41        LAST_FOUND_LIB=${_lib_USED}
42        break
43      fi
44    done
45    if [test "x${_header_check}" = "xyes" && test "x${_lib_check}" = "xyes"] ; then
46        m4_ifval([$4], [$4], [
47         LIBS="${LIBS} -l${_lib_USED}"])
[6274]48    else
[8061]49        m4_ifval([$5], [$5], [
[6274]50         echo "------------------"
51         echo "LIBRARY $2 not found."
52         echo "please install the $2-LIBRARY-package which can be found at $6"
53         echo "------------------"
[8061]54         exit -1])
[6274]55    fi
56])
[7661]57
58
59
60dnl AX_CHECK_REQUIRED_LIB([LIBRARY-NAME], [FUNCTION-IN-LIB], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [LIB-WEB-PAGE])
61AC_DEFUN([AX_CHECK_REQUIRED_LIB], [
62    _lib_check=""
63    _found_lib=""
64
65
66    for _lib in $1
67    do
68      AC_CHECK_LIB([$_lib], [$2], [_lib_check="yes"], [_lib_check="no"])
69      if test "x$_lib_check" = "xyes" ; then
70        _found_lib=$_lib
71        break
72      fi
73    done
74
75    if [test "x$_lib_check" = "xyes"] ; then
76         LIBS="$LIBS -l$_found_lib"
77         $3
78    else
79         echo "------------------"
80         echo "LIBRARY $1 not found."
81         echo "please install the $1-LIBRARY-package which can be found at $5"
82         echo "------------------"
83         $4
84         exit -1
85    fi
86])
87
88
89
90
91dnl AX_CHECK_QT([QTDIR], [LIBRARIES], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [LIB-WEB-PAGE])
92AC_DEFUN([AX_CHECK_QT], [
93    _lib_check=""
94    _found_lib=""
95    QT_PREFIX="$1"
96    QT_INCLUDE_DIRECTORY=""
97    QT_LIB_DIRECTORY=""
[7669]98    QT_BIN_DIRECTORY=""
[7661]99
100    QT_COMMON_INCLUDE_DIRECTORIES="
101      `ls -dr ${QT_PREFIX}/include     2>/dev/null`
102      /usr/include
103      `ls -dr /usr/include/qt*         2>/dev/null`
104      `ls -dr /usr/lib/qt*/include     2>/dev/null`
105      `ls -dr /usr/local/qt*/include   2>/dev/null`
106      `ls -dr /opt/qt*/include         2>/dev/null`
[8715]107      `ls -dr /opt/local/include       2>/dev/null`
[7661]108      `ls -dr /Developer/qt*/include   2>/dev/null`
[7669]109      `ls -dr /c/Qt/*/include          2>/dev/null`
[7661]110    "
111
112    QT_COMMON_LIB_DIRECTORIES="
113      `ls -dr ${QT_PREFIX}/lib         2>/dev/null`
[8042]114      /usr/lib
[7661]115      `ls -dr /usr/lib/qt*             2>/dev/null`
116      `ls -dr /usr/local/qt*/lib       2>/dev/null`
117      `ls -dr /opt/qt*/lib             2>/dev/null`
[8715]118      `ls -dr /opt/local/lib               2>/dev/null`
[7661]119      `ls -dr /Developer/qt*/lib       2>/dev/null`
[7669]120      `ls -dr /c/Qt/*/lib              2>/dev/null`
[7661]121    "
122
[7669]123    QT_COMMON_BIN_DIRECTORIES="
124      `ls -dr ${QT_PREFIX}/bin         2>/dev/null`
125      /usr/bin
126      `ls -dr /usr/bin/qt*             2>/dev/null`
127      `ls -dr /usr/local/qt*/bin       2>/dev/null`
128      `ls -dr /opt/qt*/bin             2>/dev/null`
[8715]129      `ls -dr /opt/local/bin                  2>/dev/null`
[7669]130      `ls -dr /Developer/qt*/bin       2>/dev/null`
131      `ls -dr /c/Qt/*/bin              2>/dev/null`
132    "
133
134## Search in all IncludeDirectories for QT-includes
[7670]135    for _qt_include_directory in ${QT_COMMON_INCLUDE_DIRECTORIES}
[7661]136    do
[7670]137      if test -e ${_qt_include_directory}/QtCore/QCoreApplication ; then
138        QT_INCLUDE_DIRECTORY="${_qt_include_directory}"
[7661]139        break
140      fi
141    done
142    if test -n ${QT_INCLUDE_DIRECTORY} ; then
143      echo "Qt-Include Directory is: ${QT_INCLUDE_DIRECTORY}"
144    else
145      AC_MSG_ERROR([Qt Headers not found])
146    fi
147
148## Search in all LibraryDirectories for QT-includes
149    for _lib_directory in ${QT_COMMON_LIB_DIRECTORIES}
150    do
[8293]151      if test -e ${_lib_directory}/libQtCore.so || test -e ${_lib_directory}/libQtCore4.a || \
152                        test -e ${_lib_directory}/QtCore.framework ; then
[7661]153        QT_LIB_DIRECTORY=${_lib_directory}
154        break
[8293]155          fi
[7661]156    done
157    if test -n ${QT_LIB_DIRECTORY} ; then
158      echo "Qt-Library Directory is: ${QT_LIB_DIRECTORY}"
159    else
160      AC_MSG_ERROR([Qt LIB not found])
161    fi
162
[7669]163## Search in all BINDirectories for QT-executables
164    for _bin_directory in ${QT_COMMON_BIN_DIRECTORIES}
165    do
166      if test -e ${_bin_directory}/moc || test -e  ${_bin_directory}/moc.exe ; then
167        QT_BIN_DIRECTORY=${_bin_directory}
168        break
169      fi
170    done
171    if test -n ${QT_BIN_DIRECTORY} ; then
[8061]172        echo "Qt-Bin Directory is: ${QT_BIN_DIRECTORY}"
[7669]173    else
[8061]174        QT_BIN_DIRECTORY=${QT_PREFIX}/bin
[7669]175    fi
176
[7661]177## Setting up the Environment Variables.
178    QT_LIBS=""
179    QT_CXXFLAGS="-I${QT_INCLUDE_DIRECTORY}"
[8715]180         if test x$osX = xyes ; then
181                LDFLAGS="${LDFLAGS} -L${QT_LIB_DIRECTORY}"
182         else
183        LDFLAGS="${LDFLAGS} -L${QT_LIB_DIRECTORY} -Wl,-rpath -Wl,${QT_LIB_DIRECTORY}"
184         fi
[7661]185    CACHED_CPPFLAG=${CPPFLAGS}
186    CACHED_LDFLAGS=${LDFLAGS}
187
188    LDFLAGS="${LDFLAGS} ${QT_LDFLAGS}"
189    for _lib in $2
190    do
191      AC_CHECK_LIB([$_lib], [main], [_lib_check="yes"], [_lib_check="no"])
192      if test "x$_lib_check" = "xyes" ; then
193        _found_lib=$_lib
194        break
195      fi
196    done
197
[8715]198    if [test "x$_lib_check" = "xyes" || test "x$osX" = "xyes"] ; then
199                        if [test x$osX = xyes] ; then
200# kraus: Need to add a check here. For the moment this just works fine...
201                                QT_LIBS="${QT_LIBS} -framework QtCore -framework QtGui -framework QtOpenGL"
202                                QT_LD_FLAGS="${QT_LD_FLAGS} -L${QT_LIB_DIRECTORY}"
203                        else
204                QT_LIBS="${QT_LIBS} -l$_found_lib"
205                AX_CHECK_REQUIRED_LIB([QtCore QtCore4], [main],,,[http://www.trolltech.com] )
206                AX_CHECK_REQUIRED_LIB([QtGui QtGui4], [main],,,[http://www.trolltech.com] )
207                AX_CHECK_REQUIRED_LIB([QtOpenGL QtOpenGL4], [main],,,[http://www.trolltech.com] )
[7661]208
[8715]209                $3
210                        fi
[7661]211    else
212         echo "------------------"
213         echo "LIBRARY $2 not found.in $1"
214         echo "please install the $1-LIBRARY-package which can be found at $5"
215         echo "------------------"
216         $4
217         exit -1
218    fi
[8715]219         echo "configuration for qt: "
[8293]220    echo "QT_LIBS          = ${QT_LIBS}"
221    echo "QT_CXXFLAGS      = ${QT_CXXFLAGS}"
222    echo "QT_LD_FLAGS      = ${QT_LDFLAGS}"
[7669]223    echo "QT_BIN_DIRECTORY = ${QT_BIN_DIRECTORY}"
[7661]224
225    AC_SUBST([QT_LIBS])
226    AC_SUBST([QT_CXXFLAGS])
227    AC_SUBST([QT_LDFLAGS])
228
229    #----------#
230    # QT - MOC #
231    #----------#
[8042]232    AC_PATH_PROGS([QT_MOC], [moc-qt4 moc], [no], ["${QT_BIN_DIRECTORY}:${PATH}"])
[7661]233      if test x${QT_MOC} = xno ; then
[8042]234         AC_MSG_ERROR([QT MOC not found])
[7661]235      fi
236    AC_SUBST([QT_MOC])
237
[7669]238    AC_PATH_PROG([QT_UIC], [uic], [no], ["${QT_BIN_DIRECTORY}:${PATH}"])
[7661]239 #     if test x${QT_UIC} = xno ; then
240 #       AC_MSG_WARN([QT UIC not found])
241 #     fi
242    AC_SUBST([QT_UIC])
243
[7669]244    AC_PATH_PROG([QT_RCC], [rcc], [no], ["${QT_BIN_DIRECTORY}:${PATH}"])
[7661]245#      if test x${QT_RCC} = xno ; then
246#        AC_MSG_WARN([QT RCC not found])
247#      fi
248    AC_SUBST([QT_RCC])
249
250
251
252    # Restore Values of CPPFLAGS and LDFLAGS
253    CPPFLAGS=${CACHED_CPPFLAG}
254    LDFLAGS=${CACHED_LDFLAGS}
255])
[8061]256
257
258dnl AX_CHECK_LUA([LUA_DIR])
259AC_DEFUN([AX_CHECK_LUA], [
260#dnl checking for LUA.
261LUA_LIBS=
262LUA_INCLUDES=
263dnl Check for Lua.
264
[8715]265LUA_INCLUDE_DIRECTORY="/$prefix/include"
[8061]266LUA_COMMON_INCLUDE_DIRECTORIES="
267      `ls -dr $1                       2>/dev/null`
268      /usr/include
269      `ls -dr /usr/include/lua*        2>/dev/null`
270      `ls -dr /usr/lib/lua/include     2>/dev/null`
271      `ls -dr /usr/local/include/lua   2>/dev/null`
272      `ls -dr /opt/lua*/include        2>/dev/null`
[8715]273      `ls -dr /opt/local/include       2>/dev/null`
[8061]274      `ls -dr /Developer/lua*/include  2>/dev/null`
275    "
276
277  for _lua_include_directory in ${LUA_COMMON_INCLUDE_DIRECTORIES}
278    do
279      if test -e ${_lua_include_directory}/lua.h ; then
280        LUA_INCLUDE_DIRECTORY=${_lua_include_directory}
281        CPPFLAGS="${CPPFLAGS} -I${LUA_INCLUDE_DIRECTORY}"
282        break
283      fi
284  done
285    if test -n ${LUA_INCLUDE_DIRECTORY} ; then
286      echo "Lua-Include Directory is: ${LUA_INCLUDE_DIRECTORY}"
287    else
288      AC_MSG_ERROR([Lua Headers not found])
289    fi
290
[8715]291if [ test x$osX = xyes ] ; then
292        LUA_COMMON_LIB_DIRECTORIES="
293        `ls -dr $1                    2>/dev/null`
294      /usr/lib
295      `ls -dr /usr/lib/lua*        2>/dev/null`
296      `ls -dr /usr/local/lib/lua   2>/dev/null`
297      `ls -dr /opt/lua*/lib        2>/dev/null`
298      `ls -dr /opt/local/lib       2>/dev/null`
299      `ls -dr /Developer/lua*/lib  2>/dev/null`
300         "
301  for _lua_lib_directory in ${LUA_COMMON_LIB_DIRECTORIES}
302    do
303      if test -e ${_lua_lib_directory}/liblua.a  || test -e ${_lua_lib_directory}/liblua.dylib ; then
304        LUA_LIB_DIRECTORY=${_lua_lib_directory}
[8748]305        LDFLAGS="${LDFLAGS} -L${LUA_LIB_DIRECTORY} -llualib -ldl"
[8715]306        break
307      fi
308  done 
309else
[8061]310AC_CHECK_LIB([dl], [dlopen])
[8523]311AX_CHECK_REQUIRED_HEADER_LIB([lua.h], [lua lua50], [lua_open],,,)
312AX_CHECK_REQUIRED_HEADER_LIB([lualib.h], [lualib lualib50], [luaopen_base])
313#dnl libLUA found
314#     [LUA_LIBS="${LUA_LIBS} -l${LAST_FOUND_LIB}"  AX_CHECK_REQUIRED_HEADER_LIB([lualib.h], [lualib lualib50], [luaopen_base],
[8061]315dnl liblualib found
[8523]316#      [LUA_LIBS="${LUA_LIBS} -l${LAST_FOUND_LIB}"],,
317#      [http://www.lua.org],, [${LUA_LIBS} -ldl -lm])],
318#dnl liblua not found (download it)
319#       [AX_GET_INSTALL_NECESSARY_LIB([http://www.lua.org/ftp], [lua-5.0.tar.gz], [lua-5.0], [extern_libs/], [include/*.h lib/*.a])
320#       LUA_LIBS="-llualib -llua"  LUA_INCLUDES="-I$(top_build_dir)/extern_libs" ], [http://www.lua.org])
[8715]321fi
[8061]322AC_SUBST([LUA_LIBS])
323AC_SUBST([LUA_INCLUDES])
324])
325
326
327
328
329
330dnl AX_GET_INSTALL_NECESSARY_LIB([FTP-DIR], [DIST-FILE], [DIST-DIR], [INSTALL-DIR], [INSTALL-FILES], [CONFIG-FLAGS], [MAKE-OPTS])
331AC_DEFUN([AX_GET_INSTALL_NECESSARY_LIB], [
332
333   _get_install_FTP=$1
334   _get_install_DISTFILE=$2
335   _get_install_DISTDIR=$3
336   _get_install_INSTALLDIR=$4
337   dnl $5 is left out (inegrated bellow)
338   _get_install_CONFIGFLAGS=$6
339   _get_install_MAKEOPTS=$7
340
341dnl DOWNLOADING THE FILE
342   if test -f "${_get_install_DISTFILE}" ; then
343     echo "${_get_install_DISTFILE} already downloaded"
344   else
345     echo "Getting ${_get_install_DISTFILE} from ${_get_install_FTP}/${_get_install_DISTFILE}"
346     echo `wget ${_get_install_FTP}/${_get_install_DISTFILE}`
347   fi
348
349dnl UNCOMPRESS STAGE
350   echo "Uncompressing ${_get_install_DISTFILE}"
351   echo `tar xzvf ${_get_install_DISTFILE}`
352
353dnl ENTER DIRECTORY AND EXECUTE CONFIGURE AND MAKE
354   _get_install_PWD=`pwd`
355   cd ${_get_install_DISTDIR}
356dnl configure
357   if test -x "configure" ; then
358    ./configure ${_get_install_CONFIGFLAGS}
359   fi
360   make ${_get_install_MAKEOPTS}
361   cd ${_get_install_PWD}
362
363dnl INSTALL STAGE
364   echo "Installing Libraries and Headers into ${_get_install_INSTALLDIR} local directory"
365
366   mkdir -p ${_get_install_INSTALLDIR}
367   for _get_install_installfile in $5
368    do
369     echo "copy  ${_get_install_DISTDIR}/${_get_install_installfile} to ${_get_install_INSTALLDIR}/"
370     cp `ls -dr ${_get_install_DISTDIR}/${_get_install_installfile}` "${_get_install_INSTALLDIR}/"
371    done
372
373#cleaning up
[8523]374#  echo "rm -rf ${_get_install_DISTDIR}"
375#  rm -rf ${_get_install_DISTDIR}
376#  echo "rm ${_get_install_DISTFILE}"
377#  rm ${_get_install_DISTFILE}
[8061]378])
Note: See TracBrowser for help on using the repository browser.