Index: trunk/config.h.in
===================================================================
--- trunk/config.h.in	(revision 6253)
+++ trunk/config.h.in	(revision 6271)
@@ -6,7 +6,4 @@
 /* in which debug mode we are */
 #undef DEBUG
-
-/* Define to 1 if you have the <AL/alut.h> header file. */
-#undef HAVE_AL_ALUT_H
 
 /* Define to 1 if you have the <AL/al.h> header file. */
@@ -18,7 +15,4 @@
 /* if we have CURL */
 #undef HAVE_CURL
-
-/* Define to 1 if you have the <curl/curl.h> header file. */
-#undef HAVE_CURL_CURL_H
 
 /* Define to 1 if you have the <GL/glew.h> header file. */
@@ -47,7 +41,4 @@
 #undef HAVE_MEMORY_H
 
-/* Define to 1 if you have the <ogg/ogg.h> header file. */
-#undef HAVE_OGG_OGG_H
-
 /* Define to 1 if you have the <OpenAL/al.h> header file. */
 #undef HAVE_OPENAL_AL_H
@@ -59,27 +50,6 @@
 #undef HAVE_OPENGL_GL_H
 
-/* Define to 1 if you have the <SDL.h> header file. */
-#undef HAVE_SDL_H
-
-/* Define to 1 if you have the <SDL_image.h> header file. */
-#undef HAVE_SDL_IMAGE_H
-
-/* Define to 1 if you have the <SDL_net.h> header file. */
-#undef HAVE_SDL_NET_H
-
 /* Define to 1 if you have the <SDL/SDL.h> header file. */
 #undef HAVE_SDL_SDL_H
-
-/* Define to 1 if you have the <SDL/SDL_image.h> header file. */
-#undef HAVE_SDL_SDL_IMAGE_H
-
-/* Define to 1 if you have the <SDL/SDL_net.h> header file. */
-#undef HAVE_SDL_SDL_NET_H
-
-/* Define to 1 if you have the <SDL/SDL_ttf.h> header file. */
-#undef HAVE_SDL_SDL_TTF_H
-
-/* Define to 1 if you have the <SDL_ttf.h> header file. */
-#undef HAVE_SDL_TTF_H
 
 /* Define to 1 if you have the `sqrt' function. */
@@ -109,7 +79,4 @@
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
-
-/* Define to 1 if you have the <vorbis/vorbisfile.h> header file. */
-#undef HAVE_VORBIS_VORBISFILE_H
 
 /* Define to 1 if the system has the type `_Bool'. */
Index: trunk/configure.ac
===================================================================
--- trunk/configure.ac	(revision 6253)
+++ trunk/configure.ac	(revision 6271)
@@ -408,21 +408,6 @@
 #--------#
 
-
-# checking for openAL-headers
-  AC_CHECK_HEADERS([AL/al.h] ,,
-      [AC_MSG_ERROR([cannot find openAL header.])])
-# checking for openAL-lib
-  AC_CHECK_LIB([openal], [main], [FOUND_OPENAL=yes; LIBS="$LIBS -lopenal"])
-     if test x$FOUND_OPENAL != xyes ; then
-        echo "------------------"
-        echo "openal library not found."
-        echo "please install the openal library, which can be found at http://www.openal.org"
-        echo "------------------"
-        exit -1
-     fi
-# checking for alut
-  AC_CHECK_HEADERS([AL/alut.h] ,,
-      [AC_MSG_ERROR([cannot find openAL Utility Toolkit (alut) header.])])
-  AC_CHECK_LIB([alut], [main], [FOUND_ALUT=yes; LIBS="-lalut $LIBS"])
+AX_CHECK_REQUIRED_HEADER_LIB([AL/al.h], [openal], [main],,, [http://www.openal.org])
+AX_CHECK_HEADER_LIB([AL/alut.h], [alut], [main],,, [http://www.openal.org])
 
 #-----#
@@ -433,17 +418,7 @@
   SDL_VERSION=`sdl-config --version`
   echo $SDL_VERSION
-
    CPPFLAGS="$CPPFLAGS `sdl-config --cflags`"
-   AC_CHECK_HEADERS([SDL.h] ,,
-      [AC_CHECK_HEADERS([SDL/SDL.h] ,,AC_MSG_ERROR([cannot find SDL header. please download from libsdl.org])]))
-   LIBS="`sdl-config --libs` $LIBS"
-   AC_CHECK_LIB([SDL], [main], [FOUND_SDL=yes])
-    if test x$FOUND_SDL != xyes ; then
-        echo "------------------"
-        echo "SDL library not found."
-        echo "please install the SDL library, which can be found at http://www.libsdl.org"
-        echo "------------------"
-        exit -1
-     fi
+
+  AX_CHECK_REQUIRED_HEADER_LIB([SDL.h SDL/SDL.h], [SDL], [main],,, [http://www.libsdl.org])
 
     ;;
@@ -529,115 +504,37 @@
 # SDL_ttf #
 #---------#
-# checking for SDL_ttf-headers
-  AC_CHECK_HEADERS([SDL_ttf.h] ,,
-      [AC_CHECK_HEADERS([SDL/SDL_ttf.h] ,,AC_MSG_ERROR([cannot find SDL_ttf header.])]))
-# checking for SDL_ttf-lib
-  AC_CHECK_LIB([SDL_ttf], [TTF_OpenFont], [FOUND_SDL_ttf=yes; LIBS="$LIBS -lSDL_ttf"])
-     if test x$FOUND_SDL_ttf != xyes ; then
-        echo "------------------"
-        echo "SDL_ttf library not found."
-        echo "please install the SDL_ttf library, which can be found at http://www.libsdl.org/projects/SDL_ttf/"
-        echo "------------------"
-        exit -1
-     fi
-
+AX_CHECK_REQUIRED_HEADER_LIB([SDL_ttf.h SDL/SDL_ttf.h], [SDL_ttf], [TTF_OpenFont],,, [http://www.libsdl.org/projects/SDL_ttf])
 #-----------#
 # SDL_Image #
 #-----------#
-# checking for SDL_image-headers
-AC_CHECK_HEADERS([SDL_image.h] ,,
-    [AC_CHECK_HEADERS([SDL/SDL_image.h],, AC_MSG_ERROR([SDL_image header not found.]))])
-# checking for SDL_image-lib
-AC_CHECK_LIB([SDL_image], [main], [FOUND_SDL_image=yes; LIBS="$LIBS -lSDL_image"])
-   if test x$FOUND_SDL_image != xyes ; then
-      echo "------------------"
-      echo "SDL_image library not found."
-      echo "please install the SDL_image library, which can be found at http://www.libsdl.org/projects/SDL_image/"
-      echo "------------------"
-      exit -1
-   fi
-
+AX_CHECK_REQUIRED_HEADER_LIB([SDL_image.h SDL/SDL_image.h], [SDL_image], [main],,, [http://www.libsdl.org/projects/SDL_image])
 #---------#
 # SDL_Net #
 #---------#
-# checking for SDL_net-headers
-AC_CHECK_HEADERS([SDL_net.h] ,,
-    [AC_CHECK_HEADERS([SDL/SDL_net.h],, AC_MSG_ERROR([SDL_net header not found.]))])
-# checking for SDL_net-lib
-AC_CHECK_LIB([SDL_net], [main], [FOUND_SDL_net=yes; LIBS="$LIBS -lSDL_net"])
-   if test x$FOUND_SDL_net != xyes ; then
-      echo "------------------"
-      echo "SDL_net library not found."
-      echo "please install the SDL_net library, which can be found at http://www.libsdl.org/projects/SDL_net/"
-      echo "------------------"
-      exit -1
-   fi
-
+AX_CHECK_REQUIRED_HEADER_LIB([SDL_net.h SDL/SDL_net.h], [SDL_net], [main],,, [http://www.libsdl.org/projects/SDL_net])
 
 #-----#
 # ogg #
 #-----#
-# checking for ogg-headers
-  AC_CHECK_HEADERS([ogg/ogg.h] ,,
-      [AC_MSG_ERROR([cannot find ogg header.])])
-# checking for ogg-lib
-  AC_CHECK_LIB([ogg], [main], [FOUND_ogg=yes; LIBS="$LIBS -logg"])
-     if test x$FOUND_ogg != xyes ; then
-        echo "------------------"
-        echo "ogg library not found."
-        echo "please install the ogg library, which can be found at http://www.xiph.org/ogg/vorbis/index.html"
-        echo "------------------"
-        exit -1
-     fi
-
+AX_CHECK_REQUIRED_HEADER_LIB([ogg/ogg.h], [ogg], [main],,, [http://www.xiph.org/ogg/vorbis/index.html])
 #--------#
 # vorbis #
 #--------#
-# checking for vorbis-lib
-  AC_CHECK_LIB([vorbis], [main], [FOUND_vorbis=yes; LIBS="$LIBS -lvorbis"])
-     if test x$FOUND_vorbis != xyes ; then
-        echo "------------------"
-        echo "vorbis library not found."
-        echo "please install the vorbis library, which can be found at http://www.xiph.org/ogg/vorbis/index.html"
-        echo "------------------"
-        exit -1
-     fi
-
-#------------#
-# vorbisfile #
-#------------#
-# checking for vorbis-headers
-  AC_CHECK_HEADERS([vorbis/vorbisfile.h] ,,
-      [AC_MSG_ERROR([cannot find vorbisfile header.])])
-# checking for vorbisfile-lib
-  AC_CHECK_LIB([vorbisfile], [main], [FOUND_vorbisfile=yes; LIBS="$LIBS -lvorbisfile"])
-     if test x$FOUND_vorbisfile != xyes ; then
-        echo "------------------"
-        echo "vorbisfile library not found."
-        echo "please install the vorbisfile library, which can be found at http://www.xiph.org/ogg/vorbis/index.html"
-        echo "------------------"
-        exit -1
-     fi
-
+AX_CHECK_REQUIRED_HEADER_LIB([vorbis/codec.h], [vorbis], [main],,, [http://www.xiph.org/ogg/vorbis/index.html])
+AX_CHECK_REQUIRED_HEADER_LIB([vorbis/vorbisfile.h], [vorbisfile], [main],,, [http://www.xiph.org/ogg/vorbis/index.html])
 
 #---------#
 # libcURL #
 #---------#
-if test x$def_curl = xyes; then
- AC_CHECK_HEADERS([curl/curl.h], [curlHeader=yes], [curlHeader=no])
- AC_CHECK_LIB([curl], [main], [FOUND_curl=yes])
- if test x$curlHeader = xyes & test x$FOUND_curl = xyes ; then
-  have_curl=yes
+AX_CHECK_HEADER_LIB([curl/curl.h], [curl], [main], [
+ have_curl=yes
   CURL_LIBS=`curl-config --libs`
   CURLCFLAGS=`curl-config --cflags`
-  AC_DEFINE_UNQUOTED(HAVE_CURL, 1, [if we have CURL])
- else
-  have_curl=no
- fi
-
-fi
+  AC_DEFINE_UNQUOTED(HAVE_CURL, 1, [if we have CURL]) ]
+  ,, [http://curl.haxx.se/])
+
 AC_SUBST(CURL_LIBS)
 AC_SUBST(CURL_CFLAGS)
-AM_CONDITIONAL(HAVE_CURL, test x$have_curl = xyes)
+AM_CONDITIONAL(HAVE_CURL, test "x$have_curl" = "xyes")
 
 #--------#
Index: trunk/m4/ax_check_header_lib.m4
===================================================================
--- trunk/m4/ax_check_header_lib.m4	(revision 6271)
+++ trunk/m4/ax_check_header_lib.m4	(revision 6271)
@@ -0,0 +1,17 @@
+
+dnl AX_CHECK_HEADER_LIB([HEADER-NAME], [LIBRARY-NAME], [FUNCTION-IN-LIB], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [LIB-WEB-PAGE])
+AC_DEFUN([AX_CHECK_HEADER_LIB], [
+    _header_check=""
+    _lib_check=""
+
+    AC_CHECK_HEADER([$1], [_header_check="yes"], [_header_check="no"])
+    AC_CHECK_LIB([$2], [$3], [_lib_check="yes"], [_lib_check="no"])
+    if [test "x$_header_check" = "xyes" && test "x$_lib_check" = "xyes"] ; then
+         LIBS="$LIBS -l$2"
+	 $4
+    else
+         echo "no Support for $2"
+	 $5
+    fi
+])
+
Index: trunk/m4/ax_check_lib.m4
===================================================================
--- trunk/m4/ax_check_lib.m4	(revision 6253)
+++ 	(revision )
@@ -1,36 +1,0 @@
-dnl AX_CHECK_REQUIRED_HEADER_LIB([HEADER-NAME], [LIBRARY-NAME], [FUNCTION-IN-LIB], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [LIB-WEB-PAGE])
-AC_DEFUN([AX_CHECK_REQUIRED_HEADER_LIB], [
-    _header_check=""
-    _lib_check=""
-
-    AC_CHECK_HEADER([$1], [_header_check="yes"], [_header_check="no"])
-    AC_CHECK_LIB([$2], [$3], [_lib_check="yes"], [_lib_check="no"])
-    if [test x$_header_check = "xyes" && test "x$_lib_check" = "xyes"] ; then
-         LIBS="$LIBS -l$2"
-	 $4
-    else
-         echo "------------------"
-         echo "LIBRARY $2 not found."
-         echo "please install the $2-LIBRARY-package which can be found at $6"
-         echo "------------------"
-	 $5
-         exit -1
-    fi
-])
-
-
-dnl AX_CHECK_HEADER_LIB([HEADER-NAME], [LIBRARY-NAME], [FUNCTION-IN-LIB], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [LIB-WEB-PAGE])
-AC_DEFUN([AX_CHECK_HEADER_LIB], [
-    _header_check=""
-    _lib_check=""
-
-    AC_CHECK_HEADER([$1], [_header_check="yes"], [_header_check="no"])
-    AC_CHECK_LIB([$2], [$3], [_lib_check="yes"], [_lib_check="no"])
-    if [test x$_header_check = "xyes" && test "x$_lib_check" = "xyes"] ; then
-         LIBS="$LIBS -l$2"
-	 $4
-    else
-	 $5
-    fi
-])
-
Index: trunk/m4/ax_check_required_header_lib.m4
===================================================================
--- trunk/m4/ax_check_required_header_lib.m4	(revision 6271)
+++ trunk/m4/ax_check_required_header_lib.m4	(revision 6271)
@@ -0,0 +1,25 @@
+dnl AX_CHECK_REQUIRED_HEADER_LIB([HEADER-NAME], [LIBRARY-NAME], [FUNCTION-IN-LIB], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [LIB-WEB-PAGE])
+AC_DEFUN([AX_CHECK_REQUIRED_HEADER_LIB], [
+    _header_check=""
+    _lib_check=""
+
+    for _header in $1
+    do
+      AC_CHECK_HEADER([$_header], [_header_check="yes"], [_header_check="no"])
+      if  test "x$_header_check" = "xyes" ; then
+        break
+      fi
+    done
+    AC_CHECK_LIB([$2], [$3], [_lib_check="yes"], [_lib_check="no"])
+    if [test x$_header_check = "xyes" && test "x$_lib_check" = "xyes"] ; then
+         LIBS="$LIBS -l$2"
+	 $4
+    else
+         echo "------------------"
+         echo "LIBRARY $2 not found."
+         echo "please install the $2-LIBRARY-package which can be found at $6"
+         echo "------------------"
+	 $5
+         exit -1
+    fi
+])
