mail[Wesnoth-commits] r24649 - in /trunk: configure.ac m4/zlib.m4


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by shadowm2006 on March 14, 2008 - 20:43:
Author: shadowmaster
Date: Fri Mar 14 20:27:56 2008
New Revision: 24649

URL: http://svn.gna.org/viewcvs/wesnoth?rev=24649&view=rev
Log:
* Test for ZLib installation, as requested by Sirp

Added:
    trunk/m4/zlib.m4
Modified:
    trunk/configure.ac

Modified: trunk/configure.ac
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/configure.ac?rev=24649&r1=24648&r2=24649&view=diff
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Fri Mar 14 20:27:56 2008
@@ -971,6 +971,16 @@
 fi
 
 #######################################################################
+# Check for ZLib                                                      #
+#######################################################################
+
+AM_PATH_ZLIB
+
+CPPFLAGS="$CPPFLAGS $ZLIB_CFLAGS"
+CFLAGS="$CPPFLAGS $ZLIB_CFLAGS"
+LIBS="$LIBS $ZLIB_LIBS"
+
+#######################################################################
 # Check for boost iostreams                                           #
 #######################################################################
 

Added: trunk/m4/zlib.m4
URL: http://svn.gna.org/viewcvs/wesnoth/trunk/m4/zlib.m4?rev=24649&view=auto
==============================================================================
--- trunk/m4/zlib.m4 (added)
+++ trunk/m4/zlib.m4 Fri Mar 14 20:27:56 2008
@@ -1,0 +1,51 @@
+dnl
+dnl zlib.m4 -- Find the path to the zlib library.
+dnl
+AC_DEFUN([AM_PATH_ZLIB],
+[ZLIB_CFLAGS=""
+ZLIB_LDFLAGS=""
+ZLIB_LIBS=""
+
+AC_ARG_WITH([zlib-prefix], 
+            [  --with-zlib-prefix=PFX  Prefix where zlib is installed 
(optional)],
+            zlib_prefix="$withval", zlib_prefix="")
+if test x"$zlib_prefix" = xyes ; then
+  zlib_prefix="";
+fi
+
+AC_MSG_CHECKING([for zlib location])
+if test x"$zlib_prefix" = x ; then
+  zlib_header_found="no"
+  for dir in /usr/local /usr ; do
+  if test -f "$dir/include/zlib.h" ; then
+    zlib_header_found="yes"
+    ZLIB_CFLAGS="-I$dir/include"
+    ZLIB_LDFLAGS="-L$dir/lib"
+    break
+  fi
+  done
+  if test x"$zlib_header_found" = "no" ; then
+    AC_MSG_RESULT([no])
+    AC_MSG_ERROR([zlib header file 'zlib.h' not found.])
+  fi
+  AC_MSG_RESULT([$dir])
+else
+  ZLIB_CFLAGS="-I$zlib_prefix/include"
+  ZLIB_LDFLAGS="-L$zlib_prefix/lib"
+  AC_MSG_RESULT([$zlib_prefix])
+fi
+
+zlib_save_LDFLAGS=$LDFLAGS
+LDFLAGS="$ZLIB_LDFLAGS $LDFLAGS"
+zlib_save_CFLAGS=$CFLAGS
+CFLAGS="$ZLIB_CFLAGS $CFLAGS"
+AC_CHECK_LIB([z], [compress], [ZLIB_LIBS="$ZLIB_LDFLAGS -lz"], 
[ZLIB_LIBS=""])
+LDFLAGS=$zlib_save_LDFLAGS
+CFLAGS=$zlib_save_CFLAGS
+if test x"$ZLIB_LIBS" = x ; then
+  AC_MSG_ERROR([zlib required but not found])
+fi
+
+AC_SUBST([ZLIB_CFLAGS])
+AC_SUBST([ZLIB_LIBS])])
+]




Related Messages


Powered by MHonArc, Updated Fri Mar 14 21:21:07 2008