1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182
|
AC_DEFUN([SILLY_CHECK_ZLIB], [
dnl save environment
silly_zlib_save_CPPFLAGS="$CPPFLAGS"
silly_zlib_save_LDFLAGS="$LDFLAGS"
AC_LANG_PUSH(C)
dnl define search path
silly_zlib_search="/usr/local /usr"
AC_ARG_WITH([zlib],
AC_HELP_STRING([--with-zlib=DIR], [root directory path of zlib installation]),
[if test "$withval" != no ; then
silly_zlib_search="$withval $zlib_search"
fi],
[])
dnl search in all path
HAVE_ZLIB=no
for dir in $silly_zlib_search
do
if test "$HAVE_ZLIB" = "no" ; then
silly_zlib_home="$dir"
silly_zlib_cppflags="-I$silly_zlib_home/include"
silly_zlib_ldflags="-L$silly_zlib_home/lib"
if test -f "${silly_zlib_home}/include/zlib.h" ; then
CPPFLAGS="$silly_zlib_cppflags $silly_zlib_save_CPPFLAGS"
LDFALGS="$silly_zlib_ldflags $silly_zlib_save_LDFLAGS"
AC_CHECK_HEADER(zlib.h, [silly_zlib_cv_zlib_h=yes], [silly_zlib_cv_zlib_h=no])
AC_CHECK_LIB(z, inflateEnd, [silly_zlib_cv_libz=yes], [silly_zlib_cv_libz=no])
if test "$silly_zlib_cv_libz" = "yes" -a "$silly_zlib_cv_zlib_h" = "yes" ; then
HAVE_ZLIB=yes
ZLIB_CFLAGS="$silly_zlib_cflags"
ZLIB_LIBS="$silly_zlib_ldflags -lz"
fi
fi
fi
done
dnl if found update env
if test "$HAVE_ZLIB" = "yes" ; then
AC_DEFINE_UNQUOTED([HAVE_ZLIB], [1], [zlib is available])
AC_SUBST(HAVE_ZLIB)
AC_SUBST(ZLIB_CFLAGS)
AC_SUBST(ZLIB_LIBS)
fi
dnl restore previous environment
AC_LANG_POP(C)
CPPFLAGS="$silly_zlib_save_CPPFLAGS"
LDFLAGS="$silly_zlib_save_LDFLAGS"
])
AC_DEFUN([SILLY_OPT], [
dnl inline
AC_ARG_ENABLE([inline],
AC_HELP_STRING([--disable-inline], [Disable function inlining]),
[silly_with_opt_inline=$enableval], [silly_with_opt_inline=yes])
AC_MSG_CHECKING([whether to enable source inlining])
if test "x$silly_with_opt_inline" = "xyes"
then
AC_DEFINE_UNQUOTED([SILLY_OPT_INLINE], [1],
[Set to 1 if the source code should use inline],
[include/SILLYOptions.h])
fi
AM_CONDITIONAL(SILLY_OPT_INLINE, test "x$silly_with_opt_inline" = "xyes")
AC_MSG_RESULT($silly_with_opt_inline)
dnl debug
AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug], [Activate debugging information]),
[silly_with_opt_debug=$enableval], [silly_with_opt_debug=no])
AC_MSG_CHECKING([whether to enable debug mode])
if test "x$silly_with_opt_debug" = "xyes"
then
AC_DEFINE_UNQUOTED([SILLY_OPT_DEBUG], [1],
[Set to 1 if the source code is build in debug mode],
[include/SILLYOptions.h])
CFLAGS="$CLFAGS -g3 -Wall"
fi
AM_CONDITIONAL(SILLY_OPT_INLINE, test "x$silly_with_opt_debug" = "xyes")
AC_MSG_RESULT($silly_with_opt_debug)
dnl profile
AC_ARG_ENABLE([profile],
AC_HELP_STRING([--enable-profile], [Build with profiling information]),
[silly_with_opt_profile=$enableval], [silly_with_opt_profile=no])
AC_MSG_CHECKING([wether to enable profiling information])
if test "x$silly_with_opt_profile" = "xyes"
then
AC_DEFINE_UNQUOTED([SILLY_OPT_PROFILE], [1],
[Set to 1 if the source code is build with profile information],
[include/SILLYOptions.h])
CFLAGS="$CFLAGS -pg"
fi
AM_CONDITIONAL(SILLY_OPT_PROFILE, test "x$silly_with_opt_profile" = "xyes")
AC_MSG_RESULT($silly_with_opt_profile)
])
AC_DEFUN([SILLY_OPT_SUM], [
echo "Silly options: "
echo " - inline: $silly_with_opt_inline"
echo " - debug: $silly_with_opt_debug"
echo " - profile: $silly_with_opt_profile"
])
AC_DEFUN([SILLY_JPG], [
AC_ARG_ENABLE([jpeg],
AC_HELP_STRING([--disable-jpeg], [Disable jpeg support]),
[silly_with_jpg=$enableval], [silly_with_jpg=yes])
if test x$silly_with_jpg = xyes ; then
AC_CHECK_LIB([jpeg], [jpeg_read_header], [silly_with_jpg_lib=yes], [silly_with_jpg_lib=no])
AC_CHECK_HEADER([jpeglib.h], [silly_with_jpg_header=yes], [silly_with_jpg_header=no])
if test "x$silly_with_jpg_lib" = "xyes" -a "x$silly_with_jpg_header" = "xyes"
then
AC_DEFINE_UNQUOTED([SILLY_HAVE_JPG],
[1],
[Defined to 1 if JPG support is enabled])
JPG_LIBS=-ljpeg
AC_MSG_NOTICE([Enable jpg image loading support])
silly_with_jpg=yes
else
AC_MSG_NOTICE([Disable jpg image loading support])
silly_with_jpg=no
fi
else
AC_MSG_NOTICE([Disable jpg image loading support])
silly_with_jpg=no
fi
AM_CONDITIONAL(SILLY_HAVE_JPG, test "x$silly_with_jpg" = "xyes")
AC_SUBST(JPG_CFLAGS)
AC_SUBST(JPG_LIBS)
])
AC_DEFUN([SILLY_JPG_SUM], [
echo " - JPG: $silly_with_jpg"
])
AC_DEFUN([SILLY_PNG], [
AC_ARG_ENABLE([png],
AC_HELP_STRING([--disable-png], [Disable png support]),
[silly_with_png=$enableval], [silly_with_png=yes])
if test x$silly_with_png = xyes ; then
SILLY_CHECK_ZLIB()
if test "x$HAVE_ZLIB" = "xyes" ;
then
PKG_CHECK_MODULES([PNG], [libpng >= 1.2.10],
[silly_with_png=yes],
[silly_with_libpng=no])
if test "x$silly_with_png" = "xyes"
then
AC_DEFINE_UNQUOTED([SILLY_HAVE_PNG],
[1],
[Defined to 1 if PNG support is enabled])
AC_MSG_NOTICE([Enable png image format loading])
else
AC_MSG_NOTICE([Disable png image format loading])
fi
else
AC_MSG_NOTICE([Disable png image format loading])
fi
PNG_CFLAGS="$PNG_CFLAGS $ZLIB_CFLAGS"
PNG_LIBS="$PNG_LIBS $ZLIB_LIBS"
fi
AM_CONDITIONAL(SILLY_HAVE_PNG, test "x$silly_with_png" = "xyes")
AC_SUBST(PNG_CFLAGS)
AC_SUBST(PNG_LIBS)
])
AC_DEFUN([SILLY_PNG_SUM], [
echo " - PNG: $silly_with_png"
])
AC_DEFUN([SILLY_IMAGE_FORMAT], [
SILLY_JPG
SILLY_PNG
])
AC_DEFUN([SILLY_IMAGE_FORMAT_SUM], [
echo "Image Format Supported: "
echo " - TGA: yes"
SILLY_JPG_SUM
SILLY_PNG_SUM
])
|