Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 9367 was 9324, checked in by ponder, 18 years ago

Added byte_order.h to
Added binary_file.h binary_file.cc
Changed the bsp code to work on big endian machines.

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