dnl jpegoptim dnl dnl Process this file with autoconf to produce a configure script. AC_INIT AC_CONFIG_SRCDIR([jpegoptim.c]) AC_CONFIG_HEADER(config.h) AC_CONFIG_AUX_DIR(tools) AC_CANONICAL_HOST HOST_TYPE=$host AC_DEFINE_UNQUOTED(HOST_TYPE,"$host") dnl Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET AC_ARG_WITH(libjpeg, [ --with-libjpeg=DIR libjpeg is installed in ], [if test $withval != yes; then jpeginfo_cv_libjpeg=$withval fi if test -d "${jpeginfo_cv_libjpeg}/lib"; then LDFLAGS="-L${jpeginfo_cv_libjpeg}/lib $LDFLAGS" CPPFLAGS="$CPPFLAGS -I${jpeginfo_cv_libjpeg}/include" else LDFLAGS="-L${jpeginfo_cv_libjpeg} $LDFLAGS" CPPFLAGS="$CPPFLAGS -I${jpeginfo_cv_libjpeg}" fi]) arith_code=0 AC_ARG_WITH(arith, [ --with-arith Enable arithmetic coding support ], [ if test $withval == yes; then arith_code=1 fi ]) dnl Checks for libraries. AC_CHECK_LIB(jpeg, jpeg_read_header, ,[ echo "Cannot find libjpeg or you have too old version (v6 or later required)." exit 1 ]) dnl AC_CHECK_LIB(m, round) AC_CHECK_LIB(m, floor) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(unistd.h getopt.h string.h libgen.h math.h fcntl.h sys/wait.h) AC_CHECK_HEADERS(jpeglib.h,,[ echo "Cannot find jpeglib.h You need libjpeg v6 (or later)." exit 1 ]) dnl Checks for typedefs, structures, and compiler characteristics. AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(int) dnl Checks for library functions. AC_CHECK_FUNCS(getopt_long, break, [GNUGETOPT="getopt.o getopt1.o"]) AC_SUBST(GNUGETOPT) AC_CHECK_FUNCS(mkstemps) AC_CHECK_FUNCS(labs) AC_CHECK_FUNCS(fileno) AC_CHECK_FUNCS(utimensat) AC_CHECK_FUNCS(fork) AC_CHECK_FUNCS(wait) AC_CHECK_MEMBERS([struct stat.st_mtim]) dnl own tests AC_MSG_CHECKING([for broken jmorecfg.h (METHODDEF)]) AC_CACHE_VAL(jpeginfo_cv_broken_methoddef, [AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include METHODDEF(void) foo(void) { }; int main(void) { return 0; }]])],[jpeginfo_cv_broken_methoddef=no],[jpeginfo_cv_broken_methoddef=yes],[jpeginfo_cv_broken_methoddef=no])]) if test $jpeginfo_cv_broken_methoddef = yes; then AC_DEFINE(BROKEN_METHODDEF) fi AC_MSG_RESULT($jpeginfo_cv_broken_methoddef) AC_MSG_CHECKING([Arithmetic Coding support in JPEG library]) AC_CACHE_VAL(jpegoptim_cv_arith_code_support, [AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include int main(void) { struct jpeg_compress_struct cinfo; cinfo.arith_code=TRUE; return 0; } ]])],[jpegoptim_cv_arith_code_support=yes],[jpegoptim_cv_arith_code_support=no],[jpegoptim_cv_arith_code_support=no])]) if test $arith_code == 1 -a $jpegoptim_cv_arith_code_support = yes; then arith_code_status="Enabled" AC_DEFINE(HAVE_ARITH_CODE) else arith_code_status="Disabled" fi AC_MSG_RESULT($jpegoptim_cv_arith_code_support) AC_MSG_CHECKING([Extension settings in JPEG library]) AC_CACHE_VAL(jpegoptim_cv_extension_settings, [AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include #include int main(void) { struct jpeg_compress_struct cinfo; if (jpeg_c_int_param_supported(&cinfo, JINT_DC_SCAN_OPT_MODE)) jpeg_c_set_int_param(&cinfo, JINT_DC_SCAN_OPT_MODE, 1); return 0; } ]])],[jpegoptim_cv_extension_settings=yes],[jpegoptim_cv_extension_settings=no],[jpegoptim_cv_extension_settings=no])]) if test $jpegoptim_cv_extension_settings = yes; then extension_settings_status="Present" AC_DEFINE(HAVE_JINT_DC_SCAN_OPT_MODE) else extension_settings_status="Absent" fi AC_MSG_RESULT($jpegoptim_cv_extension_settings) echo "--------------------------------------------------" echo "Extension settings: $extension_settings_status" echo "Arithmetic coding: $arith_code_status" if test $arith_code == 0 -a "$jpegoptim_cv_arith_code_support" == "yes"; then echo "(use --with-arith to enable Arithmetic coding support)" fi echo "--------------------------------------------------" AC_CONFIG_FILES([Makefile]) AC_OUTPUT