r6118: Make it so that we can do --with-zlib=no in configure and also a couple
[Samba.git] / source4 / librpc / config.m4
blob290b0d16f2f62b35cf02683abb0bbedf99f05483
1 ########################################################
2 # Compile with compression support
4 with_zlib_support=auto
5 ZLIB_LIBS=""
6 ZLIB_CFLAGS=""
7 ZLIB_CPPFLAGS=""
8 ZLIB_LDFLAGS=""
10 AC_MSG_CHECKING([for ZLIB support])
12 AC_ARG_WITH(zlib,
13 [  --with-zlib             ZLIB support (default yes)],
14 [ case "$withval" in
15     yes|no)
16         with_zlib_support=$withval
17         ;;
18   esac ])
20 AC_MSG_RESULT($with_zlib_support)
22 if test x"$with_zlib_support" != x"no"; then
24   AC_MSG_CHECKING(whether ZLIB support is available)AC_CHECK_HEADERS(zlib.h)  
25   if test x"$ac_cv_header_zlib_h" != x"yes"; then
26           with_zlib_support=no
27   fi
29   if test x"$with_zlib_support" != x"no"; then
30     AC_CHECK_LIB_EXT(z, ZLIB_LIBS, inflate)
32     if test x"$ac_cv_lib_ext_z_inflate" = x"yes"; then
33       AC_DEFINE(HAVE_ZLIB,1,[Whether zlib is available])
34       with_zlib_support=yes
35       SMB_EXT_LIB_ENABLE(ZLIB,YES)
36     else
37       ZLIB_LIBS=""
38       with_zlib_support=no
39     fi
40     LIBS=$ac_save_LIBS
41   fi
43   AC_MSG_RESULT($with_zlib_support)
45   # for now enable this always but maybe all fields are empty
46   # TODO: move compression methods to seperate files each
47   SMB_EXT_LIB_ENABLE(ZLIB,YES)
49   SMB_EXT_LIB(ZLIB,[${ZLIB_LIBS}],[${ZLIB_CFLAGS}],[${ZLIB_CPPFLAGS}],[${ZLIB_LDFLAGS}])