Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/playability/acinclude.m4 @ 10554

Last change on this file since 10554 was 10475, checked in by bensch, 18 years ago

fixed a compilation bug on tardis machines, now SDL is only searched for with sdl-config if SDL is not found natively by automake algorithms.
the only problem is, that if SDL is really not found, nothing is reported
but at least it works for the moment

please inform me if any problems on other platforms do arise

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