/[CvsGraph]/cvsgraph/configure.in
ViewVC logotype

Diff of /cvsgraph/configure.in

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.15, Sat Dec 4 02:18:13 2004 UTC revision 1.15.4.1, Mon Nov 13 20:42:23 2006 UTC
# Line 1  Line 1 
1  dnl Configure.in script for CvsGraph  #                                               -*- Autoconf -*-
2  dnl Most of the stuff is gathered from other  # Process this file with autoconf to produce a configure script.
 dnl scripts that seem to do a pretty good job.  
3    
4  AC_INIT(cvsgraph.c)  #AC_PREREQ(2.59)
5  AC_CONFIG_HEADER(config.h)  AC_INIT(cvsgraph, 1.7.0, cvsgraph@akhphd.au.dk)
6    AM_INIT_AUTOMAKE
7    AC_CONFIG_SRCDIR([README])
8    AC_CONFIG_HEADER([config.h])
9    AC_CONFIG_FILES([Makefile contrib/Makefile cvsgraph.1 cvsgraph.conf.5 cvsgraph.spec contrib/mkimage.php contrib/cvsgraphwrapper.php ])
10    
11    with_gd=yes
12    
13    AC_DEFUN([AX_CHECK_GD], [
14            AC_ARG_WITH(gd,
15                    AC_HELP_STRING([--with-gd(=DIR)], [use the gd library (in DIR)]),,
16                    with_gd=yes)
17    
18    
19            AC_PATH_PROG(GDLIB_CONFIG, gdlib-config, , [$with_gd/bin:$PATH])
20            if test -n "$GDLIB_CONFIG"; then
21                    GD_CFLAGS=`$GDLIB_CONFIG --cflags`
22                    GD_LDFLAGS=`$GDLIB_CONFIG --ldflags`
23                    GD_LIBS=`$GDLIB_CONFIG --libs`
24            elif test -d "$with_gd"; then
25                    GD_CFLAGS="-I$with_gd/include"
26                    GD_LDFLAGS="-L$with_gd/lib"
27                    AC_CHECK_LIB(z, inflateReset, GD_LIBS="-lz")
28                    AC_CHECK_LIB(png, png_check_sig, GD_LIBS="-lpng $GD_LIBS", , $GD_LIBS)
29            fi
30    
31            save_CFLAGS="$CFLAGS"
32            CFLAGS="$GD_CFLAGS $CFLAGS"
33            save_LDFLAGS="$LDFLAGS"
34            LDFLAGS="$GD_LDFLAGS $LDFLAGS"
35            save_LIBS="$LIBS"
36            LIBS="$GD_LIBS $LIBS"
37    
38            AC_CHECK_LIB(gd, gdImageCreate, [
39                    AC_DEFINE(HAVE_GD, 1, [ Define if you have gd library. ])
40                    AC_CHECK_LIB(gd, gdImageGif, AC_DEFINE(HAVE_GD_GIF, 1, [ Define if GD supports gif. ]), , "$GD_LIBS")
41                    AC_CHECK_LIB(gd, gdImageJpeg, AC_DEFINE(HAVE_GD_JPEG, 1, [ Define if GD supports jpeg. ]), , "$GD_LIBS")
42                    AC_CHECK_LIB(gd, gdImagePng, AC_DEFINE(HAVE_GD_PNG, 1, [ Define if GD supports png. ]), , "$GD_LIBS")
43                    AC_CHECK_LIB(gd, gdImagePngEx, AC_DEFINE(HAVE_GD_PNGEX, 1, [ Define if GD supports extended png. ]), , "$GD_LIBS")
44                    AC_CHECK_LIB(gd, gdImageFilledArc, AC_DEFINE(HAVE_GD_FILLEDARC, 1, [ Define if GD supports filled arcs]), , "$GD_LIBS")
45    
46  AC_PROG_CC                  if test "$ac_cv_lib_freetype_FT_Load_Glyph" = "yes"
 AC_PROG_LEX  
 AC_PROG_YACC  
   
 LEXFLAGS="-8"  
 LEXSPEED="-Cf"  
 INCL=""  
   
 dnl Extra libraries 'with'-options  
 AC_ARG_WITH(gd-inc,[  --with-gd-inc=DIR       location of the gd includes],  
                 [INCL="${INCL} -I${withval}"  
                 ])  
   
 AC_ARG_WITH(gd-lib,[  --with-gd-lib=DIR       location of the gd library],  
                 [LIBS="${LIBS} -L${withval}"  
                 ])  
   
 LIBS="$LIBS -lgd"  
 LIBPATH=""  
   
 AC_ARG_WITH(freetype-lib,[  --with-freetype-lib=DIR    location of freetype library],  
                 [LIBS="${LIBS} -L${withval}"  
                 ])  
   
 AC_ARG_WITH(freetype2-lib,[  --with-freetype2-lib=DIR    location of freetype2 library],  
                 [LIBS="${LIBS} -L${withval}"  
                 ])  
   
 AC_ARG_WITH(png-inc,[  --with-png-inc=DIR      location of png includes],  
                 [INCL="${INCL} -I${withval}"  
                 ])  
   
 AC_ARG_WITH(png-lib,[  --with-png-lib=DIR      location of png library],  
                 [LIBS="${LIBS} -L${withval}"  
                 ])  
   
 AC_ARG_WITH(jpeg-inc,[  --with-jpeg-inc=DIR    location of jpeg includes],  
                 [INCL="${INCL} -I${withval}"  
                 ])  
   
 AC_ARG_WITH(jpeg-lib,[  --with-jpeg-lib=DIR    location of jpeg library],  
                 [LIBS="${LIBS} -L${withval}"  
                 ])  
   
 AC_ARG_WITH(z-inc,[  --with-z-inc=DIR        location of zlib includes],  
                 [INCL="${INCL} -I${withval}"  
                 ])  
   
 AC_ARG_WITH(z-lib,[  --with-z-lib=DIR        location of zlib library],  
                 [LIBS="${LIBS} -L${withval}"  
                 ])  
   
 AC_ARG_ENABLE(speed,[  --disable-speed         Turn off lex table optimization reducing speed and size of executable],  
                 [if test "$enableval" = "no"; then LEXSPEED=""; fi])  
   
 if test "x$LEXSPEED" != "x"  
 then  
   LEXFLAGS="$LEXFLAGS $LEXSPEED"  
 fi  
   
 CPPFLAGS="$CPPFLAGS $INCL"  
 CFLAGS="$CFLAGS $INCL"  
   
 dnl Tests for gcc  
 if test "x${GCC}" = "xyes"  
 then  
   CFLAGS="$CFLAGS -Wall"  
   AC_CACHE_CHECK( "for gcc strength-reduce bug", ac_cv_c_gcc_strength_bug,  
                   AC_TRY_RUN([  
 int main(void) {  
   static int Array[[3]];  
   unsigned int B = 3;  
   int i;  
   for(i=0; i<B; i++) Array[[i]] = i - 3;  
   exit( Array[[1]] != -2 );  
 }],  
     ac_cv_c_gcc_strength_bug="no",  
     ac_cv_c_gcc_strength_bug="yes",  
     ac_cv_c_gcc_strength_bug="yes") )  
   if test "$ac_cv_c_gcc_strength_bug" = "yes"  
   then  
     CFLAGS="$CFLAGS -fno-strength-reduce"  
   fi  
 fi  
   
 AC_CACHE_CHECK( "sizes of int and void *", ac_cv_c_size_int_ptr,  
           AC_TRY_RUN([  
 int main(void) {  
   return sizeof(int) == sizeof(void *);  
 }],  
     ac_cv_c_size_int_ptr="no",  
     ac_cv_c_size_int_ptr="yes",  
     ac_cv_c_size_int_ptr="yes") )  
   
 AC_CACHE_CHECK( "sizes of long and void *", ac_cv_c_size_long_ptr,  
           AC_TRY_RUN([  
 int main(void) {  
   return sizeof(long) == sizeof(void *);  
 }],  
     ac_cv_c_size_long_ptr="no",  
     ac_cv_c_size_long_ptr="yes",  
     ac_cv_c_size_long_ptr="yes") )  
   
 AC_CACHE_CHECK( "sizes of long long and void *", ac_cv_c_size_longlong_ptr,  
           AC_TRY_RUN([  
 int main(void) {  
   return sizeof(long long) == sizeof(void *);  
 }],  
     ac_cv_c_size_longlong_ptr="no",  
     ac_cv_c_size_longlong_ptr="yes",  
     ac_cv_c_size_longlong_ptr="yes") )  
   
 if test "$ac_cv_c_size_int_ptr" = "no"  
 then  
         if test "$ac_cv_c_size_long_ptr" = "no"  
         then  
                 if test "$ac_cv_c_size_longlong_ptr" = "no"  
47                  then                  then
48                          echo "** The size of an integer is not equal to a pointer."                          AC_CHECK_LIB(gd, gdImageStringFT, AC_DEFINE(HAVE_GD_STRINGFT, 1, [ Define if GD supports truetype lib v2]), , "$GD_LIBS")
                         echo "   There are currently assumtions in the app that"  
                         echo "   prevents it from running if these sizes are not"  
                         echo "   equal."  
                         echo "   Please configure with a compiler that uses the"  
                         echo "   same sizes for ints and pointers."  
                         exit 1  
                 else  
                         INTTYPE="long long"  
49                  fi                  fi
50          else                  if test "$ac_cv_lib_ttf_TT_Load_Glyph" = "yes"
51                  INTTYPE="long"                  then
52          fi                          AC_CHECK_LIB(gd, gdImageStringTTF, AC_DEFINE(HAVE_GD_STRINGTTF, 1, [ Define if GD supports truetype lib v1]), , "$GD_LIBS")
53  else                  fi
54          INTTYPE="int"                  GD_LIBS="-lgd $GD_LIBS"
55  fi          ], , $GD_LIBS)
   
 dnl Check getopt.h because Solaris 8 doesn't have one  
 AC_CHECK_HEADER(getopt.h, [ AC_DEFINE(HAVE_GETOPT_H) ])  
   
 dnl Check sys/wait.h because Windows doesn't have one  
 AC_CHECK_HEADER(sys/wait.h, [ AC_DEFINE(HAVE_SYS_WAIT_H) ])  
   
 dnl Make sure the gd header is here  
 AC_CHECK_HEADER( gd.h,[ have_gd_h="yes" ],[ have_gd_h="no" ])  
   
 if test "$have_gd_h" != "yes"; then  
 echo  
         echo "** The GD library is required for CvsGraph to function."  
         echo "   Get it from http://www.boutell.com, compile it and"  
         echo "   use either --with-gd-lib=DIR and --with-gd-inc=DIR to specify"  
         echo "   its location. You might also have to use --with-z-inc, --with-z-lib"  
         echo "   and --with-png-inc, --with-png-lib for gd versions 1.6 and higher."  
         echo "   Check config.log for more information on the problem. If your system"  
         echo "   has libgd installed, you probably mis the gd.h header file."  
         exit 1  
 fi  
   
 dnl Checks for libraries.  
 AC_CHECK_LIB(m, sqrt, [  
         AC_DEFINE(LIBM)  
         MATHLIBS="-lm"  
         ])  
   
 AC_CHECK_LIB(z, compress, [  
         ac_have_libz="yes"  
         LIBZ="-lz"  
         ] , [  
         ac_have_libz="no"  
         ] , ${LIBPATH} ${MATHLIBS} )  
   
 AC_CHECK_LIB(freetype, FT_Load_Glyph, [  
         ac_have_libfreetype="yes"  
         LIBFT="-lfreetype"  
         ] , [  
         ac_have_libfreetype="no"  
         ] , ${LIBPATH} ${MATHLIBS} )  
   
 AC_CHECK_LIB(ttf, TT_Load_Glyph, [  
         ac_have_libttf="yes"  
         LIBTT="-lttf"  
         ] , [  
         ac_have_libttf="no"  
         ] , ${LIBPATH} ${MATHLIBS} )  
   
 AC_CHECK_LIB(png, png_create_read_struct , [  
         ac_have_libpng="yes"  
         LIBPNG="-lpng"  
         ] , [  
         ac_have_libpng="no"  
         ] , ${LIBPATH} ${LIBZ} ${MATHLIBS} )  
   
 AC_CHECK_LIB(jpeg, jpeg_CreateCompress, [  
         ac_have_libjpeg="yes"  
         LIBJPEG="-ljpeg"  
         ] , [  
         ac_have_libjpeg="no"  
         ] , ${LIBPATH} ${MATHLIBS} )  
   
 dnl Check which libraries we need to add  
 OLIBS="${LIBS}"  
 LIBS="${LIBS} ${MATHLIB}"  
 AC_CACHE_CHECK( "whether libpng needs -lz", ac_cv_png_needs_z,  
           AC_TRY_LINK_FUNC( png_create_read_struct, [  
         ac_cv_png_needs_z="no"  
         ] , [  
         ac_cv_png_needs_z="yes"  
         ] ) )  
 LIBS="${OLIBS}"  
   
   
 OLIBS="${LIBS}"  
 LIBS="${LIBS} ${LIBFT} ${LIBTT} ${LIBJPEG} ${MATHLIB}"  
 AC_CACHE_CHECK( "whether libgd needs -lpng", ac_cv_gd_needs_png,  
           AC_TRY_LINK_FUNC( gdImagePng, [  
         ac_cv_gd_needs_png="no"  
         ] , [  
         ac_cv_gd_needs_png="yes"  
         ] ) )  
 LIBS="${OLIBS}"  
   
 OLIBS="${LIBS}"  
 LIBS="${LIBS} ${LIBFT} ${LIBTT} ${LIBPNG} ${LIBZ} ${MATHLIB}"  
 AC_CACHE_CHECK( "whether libgd needs -ljpeg", ac_cv_gd_needs_jpeg,  
           AC_TRY_LINK_FUNC( gdImageJpeg, [  
         ac_cv_gd_needs_jpeg="no"  
         ] , [  
         ac_cv_gd_needs_jpeg="yes"  
         ] ) )  
 LIBS="${OLIBS}"  
   
 OLIBS="${LIBS}"  
 LIBS="${LIBS} ${LIBFT} ${LIBJPEG} ${LIBPNG} ${LIBZ} ${MATHLIB}"  
 AC_CACHE_CHECK( "whether libgd needs -lttf", ac_cv_gd_needs_ttf,  
           AC_TRY_LINK_FUNC( gdImageStringTTF, [  
         ac_cv_gd_needs_ttf="no"  
         ] , [  
         ac_cv_gd_needs_ttf="yes"  
         ] ) )  
 LIBS="${OLIBS}"  
   
 OLIBS="${LIBS}"  
 LIBS="${LIBS} ${LIBTT} ${LIBJPEG} ${LIBPNG} ${LIBZ} ${MATHLIB}"  
 AC_CACHE_CHECK( "whether libgd needs -lfreetype", ac_cv_gd_needs_freetype,  
           AC_TRY_LINK_FUNC( gdImageStringFT, [  
         ac_cv_gd_needs_freetype="no"  
         ] , [  
         ac_cv_gd_needs_freetype="yes"  
         ] ) )  
 LIBS="${OLIBS}"  
56    
57  if test "$ac_cv_gd_needs_freetype" = "yes"          CFLAGS="$save_CFLAGS"
58  then          LDFLAGS="$save_LDFLAGS"
59          if test "$ac_have_libfreetype" != "yes" -a "$ac_have_libttf" != "yes"          if test -n "$GDLIB_CONFIG"; then
60          then                  LIBS="$GD_LIBS"
61                  echo "** WARNING: Required library libfreetype not found"          else
62                    LIBS="$GD_LIBS $LIBS"
63          fi          fi
64          LIBS="${LIBS} ${LIBFT}"          AC_SUBST(GD_CFLAGS)
65  fi          AC_SUBST(GD_LDFLAGS)
66            AC_SUBST(GD_LIBS)
67    ])
68    
69  if test "$ac_cv_gd_needs_ttf" = "yes"  # Checks for programs.
70  then  AC_PROG_CC
71          if test "$ac_have_libttf" != "yes" -a "$ac_have_libfreetype" != "yes"  AC_PROG_LEX
72          then  AC_PROG_YACC
73                  echo "** WARNING: Required library libttf not found"  AC_PATH_PROG(ac_prog_pkg_config, pkg-config)
         fi  
         LIBS="${LIBS} ${LIBTT}"  
 fi  
74    
75  if test "$ac_cv_gd_needs_jpeg" = "yes"  AC_CHECK_LIB(m, sqrt)
 then  
         if test "$ac_have_libjpeg" != "yes"  
         then  
                 echo "** WARNING: Required library libjpeg not found"  
         fi  
         LIBS="${LIBS} ${LIBJPEG}"  
 fi  
76    
77  if test "$ac_cv_gd_needs_png" = "yes"  AC_CHECK_LIB(freetype, FT_Load_Glyph)
78    if test "$ac_cv_lib_freetype_FT_Load_Glyph" != "yes"
79  then  then
80          if test "$ac_have_libpng" != "yes"          AC_CHECK_LIB(ttf, TT_Load_Glyph)
         then  
                 echo "** WARNING: Required library libpng not found"  
         fi  
         LIBS="${LIBS} ${LIBPNG}"  
         if test "$ac_cv_png_needs_z" = "yes"  
         then  
                 if test "$ac_have_libz" != "yes"  
                 then  
                         echo "** WARNING: Required library libz not found"  
                 fi  
                 LIBS="${LIBS} ${LIBZ}"  
         fi  
81  fi  fi
82    
83  LIBS="${LIBS} ${MATHLIBS}"  # find out what the GD library uses
84    AX_CHECK_GD
 dnl which version of gd do we have here?  
 AC_CHECK_LIB(gd, gdImageGif, [  
         AC_DEFINE(HAVE_IMAGE_GIF)  
         have_gifs="yes"  
         ] ,  
         have_gifs="no"  
         )  
   
 dnl The new versions of libgd include gifs again after the patent expired.  
 dnl So this check should not be required anymore.  
 dnl if test "${have_gifs}" = "yes"  
 dnl then  
 dnl     echo "** You have a very old GD library. Please consider"  
 dnl     echo "   upgrading to a more recent version (1.8.4 or newer)."  
 dnl     echo "   --Note that f.x. ViewCVS needs CvsGraph to generate PNG"  
 dnl     echo "     images and ancient GD libraries might contain many bugs."  
 dnl     echo "     However, if you need GIFs, then you must stick to this"  
 dnl     echo "     old version."  
 dnl fi  
   
 AC_CHECK_LIB(gd, gdImagePng, [  
         AC_DEFINE(HAVE_IMAGE_PNG)  
         ])  
 AC_CHECK_LIB(gd, gdImagePngEx, [  
         AC_DEFINE(HAVE_GDIMAGEPNGEX)  
         ])  
 AC_CHECK_LIB(gd, gdImageJpeg, [  
         AC_DEFINE(HAVE_IMAGE_JPEG)  
         ])  
 AC_CHECK_LIB(gd, gdImageStringTTF, [  
         if test "$ac_have_libttf" = "yes"  
         then  
                 AC_DEFINE(HAVE_GDIMAGESTRINGTTF)  
         fi  
         ])  
 AC_CHECK_LIB(gd, gdImageStringFT, [  
         if test "$ac_have_libfreetype" = "yes"  
         then  
                 AC_DEFINE(HAVE_GDIMAGESTRINGFT)  
         fi  
         ])  
 AC_CHECK_LIB(gd, gdImageFilledArc, [  
         AC_DEFINE(HAVE_GDIMAGEFILLEDARC)  
         ])  
   
85    
86  AC_SUBST(LEXFLAGS)  # Checks for header files.
87  AC_SUBST(INTTYPE)  AC_HEADER_STDC
88    AC_CHECK_HEADERS([getopt.h sys/wait.h gd.h])
89    
90  AC_OUTPUT(Makefile)  # Checks for typedefs, structures, and compiler characteristics.
91    AC_C_CONST
92    AC_C_INLINE
93    AC_TYPE_SIZE_T
94    AC_HEADER_TIME
95    
96  echo "Configure done. Run 'make' to build CvsGraph"  # Checks for library functions.
97    AC_CHECK_FUNCS([memset strdup strtol])
98    
99    AC_OUTPUT

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.15.4.1

  ViewVC Help
Powered by ViewVC 1.1.0 with CvsGraph 1.7.0