Blame configure.in

Packit 667938
AC_INIT(src/rateup.c)
Packit 667938
AC_PREREQ(2.13)
Packit 667938
Packit 667938
dnl Check for programs.
Packit 667938
AC_PROG_CC
Packit 667938
AC_PREFIX_DEFAULT( /opt/mrtg-2 )
Packit 667938
Packit 667938
AC_PROG_CPP
Packit 667938
AC_PROG_MAKE_SET
Packit 667938
AC_PROG_INSTALL
Packit 667938
AC_PATH_PROG(PERL, perl, no, $PATH:/usr/bin:/usr/local/bin)
Packit 667938
if test $PERL = no; then 
Packit 667938
   echo
Packit 667938
   echo "** No Perl found in the PATH. A recent copy of Perl"
Packit 667938
   echo "   is required for mrtg to work. Check www.perl.com"
Packit 667938
   echo 
Packit 667938
   exit 1
Packit 667938
fi
Packit 667938
Packit 667938
AC_PATH_PROGS(NROFF, groff nroff)
Packit 667938
Packit 667938
dnl Check for long long type (64 bit rateup)
Packit 667938
AC_CHECK_HEADERS(inttypes.h)
Packit 667938
AC_CHECK_TYPE(unsigned long long)
Packit 667938
AC_CHECK_TYPE(long long)
Packit 667938
AC_CHECK_FUNCS(strtoll)
Packit 667938
Packit 667938
# Taken from libIDL-0.8.2
Packit 667938
AC_MSG_CHECKING([for printf long long format specifier])
Packit 667938
AC_CACHE_VAL(mr_cv_long_long_format_specifier,[
Packit 667938
    for format in ll l q I64; do
Packit 667938
        AC_TRY_RUN([#include <stdio.h>  
Packit 667938
            int main()
Packit 667938
            {
Packit 667938
                long long b, a = -0x3AFAFAFAFAFAFAFALL;
Packit 667938
                char buffer[1000];
Packit 667938
                sprintf (buffer, "%${format}u", a);
Packit 667938
                sscanf (buffer, "%${format}u", &b);
Packit 667938
                exit (b!=a);
Packit 667938
            }
Packit 667938
            ],
Packit 667938
            mr_cv_long_long_format_specifier="%${format}d"
Packit 667938
            mr_cv_long_long_format="${format}d"
Packit 667938
            break)
Packit 667938
        done])
Packit 667938
AC_MSG_RESULT($mr_cv_long_long_format_specifier)
Packit 667938
AC_DEFINE_UNQUOTED(LLD, "$mr_cv_long_long_format_specifier",
Packit 667938
    [How to print a long long])
Packit 667938
AC_DEFINE_UNQUOTED(LLD_FORMAT, "$mr_cv_long_long_format",
Packit 667938
    [long long format without % specifier])
Packit 667938
Packit 667938
AH_BOTTOM(
Packit 667938
#ifndef HAVE_STRTOLL     
Packit 667938
long long int strtoll(const char *str, char **ptr, int base)
Packit 667938
{
Packit 667938
        long long int ll;
Packit 667938
        sscanf(str, LLD, &ll);
Packit 667938
        return ll;
Packit 667938
}
Packit 667938
#endif
Packit 667938
)
Packit 667938
Packit 667938
dnl Checks for libraries.
Packit 667938
AC_CHECK_LIB(m, pow, [ MATHLIBS="-lm" ])
Packit 667938
Packit 667938
AC_ARG_WITH(gd,[  --with-gd=DIR           location of the gd lib/inc],
Packit 667938
		[LDFLAGS="${LDFLAGS} -L${withval}"
Packit 667938
		CPPFLAGS="${CPPFLAGS} -I${withval}"
Packit 667938
		LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"])
Packit 667938
Packit 667938
AC_ARG_WITH(gd-lib,[  --with-gd-lib=DIR       location of the gd library],
Packit 667938
		[LDFLAGS="${LDFLAGS} -L${withval}"
Packit 667938
		LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"])
Packit 667938
Packit 667938
AC_ARG_WITH(gd-inc,[  --with-gd-inc=DIR       location of the gd include files],
Packit 667938
		[CPPFLAGS="${CPPFLAGS} -I${withval}"])
Packit 667938
Packit 667938
AC_ARG_WITH(z,[  --with-z=DIR            location of zlib lib/inc],
Packit 667938
		[LDFLAGS="${LDFLAGS} -L${withval}"
Packit 667938
		CPPFLAGS="${CPPFLAGS} -I${withval}"
Packit 667938
		LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"])
Packit 667938
Packit 667938
AC_ARG_WITH(z-lib,[  --with-z-lib=DIR        location of zlib library],
Packit 667938
		[LDFLAGS="${LDFLAGS} -L${withval}"
Packit 667938
		LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"])
Packit 667938
Packit 667938
AC_ARG_WITH(z-inc,[  --with-z-inc=DIR        location of the zlib include files],
Packit 667938
		[CPPFLAGS="${CPPFLAGS} -I${withval}"])
Packit 667938
Packit 667938
AC_ARG_WITH(png,[  --with-png=DIR          location of png lib/inc],
Packit 667938
		[LDFLAGS="${LDFLAGS} -L${withval}"
Packit 667938
		CPPFLAGS="${CPPFLAGS} -I${withval}"
Packit 667938
		LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"])
Packit 667938
Packit 667938
AC_ARG_WITH(png-lib,[  --with-png-lib=DIR      location of png library],
Packit 667938
		[LDFLAGS="${LDFLAGS} -L${withval}"
Packit 667938
		LD_RUN_PATH="${withval}${LD_RUN_PATH:+:}${LD_RUN_PATH}"])
Packit 667938
Packit 667938
AC_ARG_WITH(png-inc,[  --with-png-inc=DIR      location of the libpng include files],
Packit 667938
		[CPPFLAGS="${CPPFLAGS} -I${withval}"])
Packit 667938
Packit 667938
Packit 667938
LIBS="${LIBS} ${MATHLIBS}"
Packit 667938
Packit 667938
GDEXTRALIB=""
Packit 667938
dnl which version of gd do we have here ?
Packit 667938
AC_CHECK_LIB(gd,gdImageGif,[
Packit 667938
  GDFORM_EXT=gif
Packit 667938
  GLIBS="-lgd"
Packit 667938
                           ],:,[-lgd ${MATHLIBS}])
Packit 667938
Packit 667938
AC_CHECK_LIB(gd,gdImagePng,[
Packit 667938
   GDFORM_EXT=png
Packit 667938
   GLIBS="-lgd -lpng -lz"
Packit 667938
        ],:,[-lgd -lpng -lz ${MATHLIBS}])
Packit 667938
Packit 667938
AC_CHECK_LIB(gd,gdImagePng_jpg,[
Packit 667938
   GDFORM_EXT=png
Packit 667938
   GLIBS="-lgd -lpng -lz -ljpeg"
Packit 667938
        ],:,[-lgd -lpng -lz -ljpeg ${MATHLIBS}])
Packit 667938
Packit 667938
AC_CHECK_LIB(gd,gdImagePng_jpg_ft,[
Packit 667938
   GDFORM_EXT=png
Packit 667938
   GLIBS="-lgd -lpng -lz -ljpeg -lfreetype"
Packit 667938
        ],:,[-lgd -lpng -lz -ljpeg -lfreetype ${MATHLIBS}])
Packit 667938
Packit 667938
if test x$GDFORM_EXT = xgif; then
Packit 667938
  CPPFLAGS="$CPPFLAGS -DGFORM_GD=gdImageGif"
Packit 667938
fi
Packit 667938
Packit 667938
LIBS="${GLIBS} ${LIBS}" 
Packit 667938
Packit 667938
if test x$LD_RUN_PATH != x; then
Packit 667938
	SET_LD_RUN_PATH="LD_RUN_PATH=${LD_RUN_PATH}"
Packit 667938
fi
Packit 667938
Packit 667938
dnl Make sure the header is here
Packit 667938
AC_CHECK_HEADER( gd.h,:,[ GDFORM_EXT="" ])
Packit 667938
Packit 667938
if test x$GDFORM_EXT = x; then
Packit 667938
echo
Packit 667938
	echo "** Ooops, one of many bad things happened:"
Packit 667938
	echo ""
Packit 667938
	echo "   a)  You don't have the GD library installed."
Packit 667938
	echo "       Get it from http://www.boutell.com, compile it and"
Packit 667938
	echo "       use either --with-gd-lib=DIR and --with-gd-inc=DIR to specify"
Packit 667938
	echo "       its location. You might also have to use --with-z-inc,"
Packit 667938
        echo "	     --with-z-lib and --with-png-inc, --with-png-lib for gd"
Packit 667938
        echo "	     versions 1.6 and higher.  Check config.log for more"
Packit 667938
	echo "       information on the problem."
Packit 667938
	echo ""
Packit 667938
	echo "   b)  You have the GD library installed, but not the gd.h"
Packit 667938
	echo "       header file.  Download the source (see above) and use"
Packit 667938
	echo "       --with-gd-inc=DIR to specify where the file can be found."
Packit 667938
	echo ""
Packit 667938
	echo "   c)  You have the library and the header file installed, but"
Packit 667938
	echo "       you also have a shared GD library in the same directory. "
Packit 667938
        echo "       Remove the shared library files and/or links (e.g. "
Packit 667938
	echo "       libgd.so.2.0.0, libgd.so and libgd.so.2).  This is especially"
Packit 667938
        echo "	     likely if you're using a recent (post 1.8.4) version of GD"
Packit 667938
	echo "       and didn't configure it with --disable-shared."
Packit 667938
	echo ""
Packit 667938
	echo "   d)  You have gd library installed and also it's headers, but you are"
Packit 667938
	echo "       missing libpng (and headers) or freetype (and headers)"
Packit 667938
	echo "       (mrtg does not use freetype, but if your copy of gd is precompiled"
Packit 667938
	echo "       against it, you have to install it ... "
Packit 667938
	echo ""
Packit 667938
        echo "   Consider following the instructions in doc/mrtg-unix-guide.txt"
Packit 667938
	exit 1
Packit 667938
fi
Packit 667938
Packit 667938
AC_MSG_CHECKING(the weather)
Packit 667938
AC_MSG_RESULT((cached) it's fine)
Packit 667938
Packit 667938
dnl Does the compiler like -Wall and
Packit 667938
if test "x$GCC" = "xyes"; then
Packit 667938
  oCFLAGS=$CFLAGS
Packit 667938
  CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wcast-align -Wmissing-declarations -Wnested-externs -Winline -W"
Packit 667938
  AC_CACHE_CHECK(if we can use GCC-specific compiler options, rd_cv_gcc_opt,
Packit 667938
                [AC_TRY_COMPILE( , return 0 ,
Packit 667938
                    rd_cv_gcc_opt=yes,
Packit 667938
                    rd_cv_gcc_opt=no )
Packit 667938
               ]
Packit 667938
        )
Packit 667938
  if test $rd_cv_gcc_opt = no; then
Packit 667938
         CFLAGS=$oCFLAGS
Packit 667938
  fi
Packit 667938
fi
Packit 667938
Packit 667938
AC_SUBST(PERL)
Packit 667938
AC_SUBST(RRD_PERL)
Packit 667938
AC_SUBST(GDFORM_EXT)
Packit 667938
AC_SUBST(SET_LD_RUN_PATH)
Packit 667938
AC_SUBST(LIBS)
Packit 667938
AC_SUBST(CFLAGS)
Packit 667938
AC_CONFIG_HEADERS(config.h)
Packit 667938
AC_OUTPUT(Makefile)
Packit 667938
Packit 667938
Packit 667938
echo $ECHO_N "ordering CD from http://tobi.oetiker.ch/wish $ECHO_C" 1>&6
Packit 667938
sleep 1
Packit 667938
echo $ECHO_N ".$ECHO_C" 1>&6
Packit 667938
sleep 1
Packit 667938
echo $ECHO_N ".$ECHO_C" 1>&6
Packit 667938
sleep 1
Packit 667938
echo $ECHO_N ".$ECHO_C" 1>&6
Packit 667938
sleep 1
Packit 667938
echo $ECHO_N ".$ECHO_C" 1>&6
Packit 667938
sleep 1
Packit 667938
AC_MSG_RESULT([ just kidding ;-)])
Packit 667938
sleep 2
Packit 667938
echo
Packit 667938
echo "----------------------------------------------------------------"
Packit 667938
echo "Config is DONE!"
Packit 667938
echo
Packit 667938
echo "Type 'make' to compile the software"
Packit 667938
echo 
Packit 667938
echo "       ... that wishlist mentioned above does really exist. So if"
Packit 667938
echo "you feel like showing your appreciation for MRTG, this is the"
Packit 667938
echo "place to go. I just love CDs and DVDs"
Packit 667938
echo 
Packit 667938
echo "                            -- Tobi Oetiker <tobi@oetiker.ch>"
Packit 667938
echo "----------------------------------------------------------------"