1# -*-Shell-script-*- 2# 3# DjVuLibre-3.5 4# Copyright (c) 2002 Leon Bottou and Yann Le Cun. 5# Copyright (c) 2001 AT&T 6# 7# This software is subject to, and may be distributed under, the 8# GNU General Public License, either Version 2 of the license, 9# or (at your option) any later version. The license should have 10# accompanied the software or you may obtain a copy of the license 11# from the Free Software Foundation at http://www.fsf.org . 12# 13# This program is distributed in the hope that it will be useful, 14# but WITHOUT ANY WARRANTY; without even the implied warranty of 15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16# GNU General Public License for more details. 17# 18# DjVuLibre-3.5 is derived from the DjVu(r) Reference Library 19# distribued by Lizardtech Software. 20# 21# ---------------------------------------- 22# Initialization 23# ---------------------------------------- 24 25m4_define([v_maj], [3]) 26m4_define([v_min], [5]) 27m4_define([v_mic], [28]) 28m4_define([v_ver], [v_maj.v_min.v_mic]) 29 30m4_define([lt_compat], [21]) 31m4_define([lt_cur], [v_mic]) 32m4_define([lt_rev], [0]) 33m4_define([lt_age], [m4_eval(v_mic - lt_compat)]) 34 35AC_PREREQ([2.65]) 36AC_INIT([djvulibre],[v_ver]) 37 38AC_CONFIG_AUX_DIR(config) 39AC_CONFIG_MACRO_DIR(config) 40AC_CONFIG_SRCDIR(libdjvu/ddjvuapi.cpp) 41AC_CONFIG_HEADER(config.h:config/config.h.in) 42AC_CANONICAL_HOST 43 44AM_INIT_AUTOMAKE([1.6 subdir-objects dist-bzip2 dist-xz -Wall]) 45m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 46m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) 47 48LT_INIT([win32-dll disable-static]) 49 50# Library version 51version_info="lt_cur:lt_rev:lt_age" 52AC_SUBST([version_info]) 53 54# Additional libraries 55AC_ARG_WITH(extra-includes, 56 AS_HELP_STRING([--with-extra-includes=DIR],[Define an additional directory for include files]), 57 [ if test -d "$withval" ; then 58 CPPFLAGS="$CPPFLAGS -I$withval" 59 else 60 AC_MSG_ERROR([Cannot stat directory $withval]) 61 fi ] ) 62 63AC_ARG_WITH(extra-libraries, 64 AS_HELP_STRING([--with-extra-libraries=DIR],[Define an additional directory for library files]), 65 [ if test -d "$withval" ; then 66 LDFLAGS="$LDFLAGS -L$withval" 67 else 68 AC_MSG_ERROR([Cannot stat directory $withval]) 69 fi ] ) 70 71# Always look into a "gnu" directory. 72curwd=`pwd` 73if test -d $curwd/gnu/include ; then 74 CPPFLAGS="$CPPFLAGS -I$curwd/gnu/include" 75fi 76if test -d $curwd/gnu/lib ; then 77 LDFLAGS="$LDFLAGS -L$curwd/gnu/lib" 78fi 79 80# Special cases 81 82AC_CHECK_DECL([_WIN32],[have_os_win32=yes],[have_os_win32=no]) 83AM_CONDITIONAL([HAVE_OS_WIN32], [test "x${have_os_win32}" = "xyes"]) 84 85AC_CHECK_DECL([__APPLE__],[have_os_apple=yes],[have_os_apple=no]) 86AM_CONDITIONAL([HAVE_OS_APPLE], [test "x${have_os_apple}" = "xyes"]) 87 88if test x$have_os_apple = xyes && test -d /opt/local ; then 89 CPPFLAGS="$CPPFLAGS -I/opt/local/include" 90 LDFLAGS="$LDFLAGS -L/opt/local/lib" 91elif test x$have_os_apple = xyes && test -d /sw ; then 92 CPPFLAGS="$CPPFLAGS -I/sw/include" 93 LDFLAGS="$LDFLAGS -L/sw/lib" 94fi 95 96 97 98# ---------------------------------------- 99# Programs 100# ---------------------------------------- 101 102# Does make set variable $(MAKE) 103AC_PROG_MAKE_SET 104 105# Programs 106AC_PROG_INSTALL 107AC_PROG_LN_S 108AC_PROG_MKDIR_P 109AC_PROG_SED 110AC_PATH_PROG([TOUCH], [touch]) 111AC_PATH_PROG([RSVG], [rsvg-convert], [false]) 112AC_PATH_PROG([INKSCAPE], [inkscape], [false]) 113AC_PATH_PROG([CONVERT], [convert], [false]) 114conversion_tool=no 115if test "x${RSVG}" != xfalse ; then 116 conversion_tool=rsvg 117elif test "x${INKSCAPE}" != xfalse ; then 118 conversion_tool=inkscape 119elif test "x${CONVERT}" != xfalse ; then 120 ( ${CONVERT} --version 2>&1 | grep -q ImageMagick ) && conversion_tool=convert 121fi 122AM_CONDITIONAL([HAVE_CONVERSION_RSVG], [test x${conversion_tool} = xrsvg]) 123AM_CONDITIONAL([HAVE_CONVERSION_INKSCAPE], [test x${conversion_tool} = xinkscape]) 124AM_CONDITIONAL([HAVE_CONVERSION_CONVERT], [test x${conversion_tool} = xconvert]) 125AM_CONDITIONAL([HAVE_CONVERSION_TOOL], [test x${conversion_tool} != xno]) 126 127# tweak rm to make libtool happy 128AC_PATH_PROG(RM, rm) 129RM="$RM -f" 130 131# Libtool & Compilers 132AC_PROG_CC 133AC_PROG_CXX 134AC_OPTIMIZE 135 136# C++ 137AC_LANG(C++) 138AC_CXX_BOOL 139AC_CXX_EXCEPTIONS 140AC_CXX_TYPENAME 141AC_CXX_STDINCLUDES 142AC_CXX_NAMESPACES 143AC_CXX_MEMBER_TEMPLATES 144AC_CXX_INTEL_ATOMIC_BUILTINS 145AC_CXX_GCCTLS 146 147# ---------------------------------------- 148# Libraries 149# ---------------------------------------- 150 151AC_CHECK_LIB(m,sqrt) 152 153# AC_CHECK_LIB(iconv,libiconv_open) # not really used. 154 155 156# ---------------------------------------- 157# Header Files 158# ---------------------------------------- 159 160AC_HEADER_DIRENT 161AC_HEADER_TIME 162AC_HEADER_SYS_WAIT 163AC_CHECK_HEADERS(wchar.h wctype.h sys/mman.h iconv.h getopt.h) 164AC_CHECK_HEADERS(langinfo.h sched.h new.h) 165AC_CHECK_HEADERS(stdint.h inttypes.h sys/ipc.h sys/shm.h) 166AC_CHECK_HEADERS(cpuid.h) 167 168# ---------------------------------------- 169# Types 170# ---------------------------------------- 171 172AC_TYPE_INT16_T 173AC_TYPE_INT32_T 174AC_TYPE_UINT16_T 175AC_TYPE_UINT32_T 176AC_CHECK_TYPES(wchar_t) 177AC_CHECK_TYPES(long long int) 178AC_CHECK_TYPES(mbstate_t,,,[#include "wchar.h"]) 179AC_SYS_LARGEFILE 180 181# ---------------------------------------- 182# Functions 183# ---------------------------------------- 184 185AC_FUNC_MMAP 186AC_FUNC_FORK 187AC_FUNC_FSEEKO 188AC_CHECK_FUNCS(wcrtomb iswspace setenv nl_langinfo) 189AC_CHECK_FUNCS(putc_unlocked strerror vsnprintf) 190AC_CHECK_FUNCS(gethostname strftime getpwuid) 191AC_CHECK_FUNCS(sigaction mkstemp sched_yield) 192 193# iconv function might be defined as libiconv in iconv.h 194AC_MSG_CHECKING([for iconv]) 195ac_has_iconv=no 196AC_LANG_PUSH(C) 197AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "iconv.h"]], 198 [[iconv((iconv_t)0, (char**)0, (size_t*)0, (char**)0, (size_t*)0);]])], 199 [ac_has_iconv=yes],[]) 200AC_MSG_RESULT($ac_has_iconv) 201AC_LANG_POP(C) 202if test x$ac_has_iconv = xyes ; then 203 AC_DEFINE(HAVE_ICONV,1, 204 [Define to 1 if you have the iconv function.]) 205fi 206 207 208# ---------------------------------------- 209# Test auxilliary packages 210# ---------------------------------------- 211 212# Search for PTHREADS (when not on windows) 213have_pthread=no 214AM_COND_IF([HAVE_OS_WIN32],,[AC_PATH_PTHREAD([have_pthread=yes])]) 215 216# Search JPEG library 217AC_PATH_JPEG([have_jpeg="yes"], [have_jpeg="no"]) 218AC_MSG_CHECKING([for libjpeg]) 219AC_MSG_RESULT([${have_jpeg}]) 220 221# Search TIFF library 222AC_PATH_TIFF([have_tiff="yes"], [have_tiff="no"]) 223AC_MSG_CHECKING([for libtiff]) 224AC_MSG_RESULT([${have_tiff}]) 225 226 227# ---------------------------------------- 228# What to compile 229# ---------------------------------------- 230 231# Check compilation of xmltools 232want_xmltools="yes" 233AC_ARG_ENABLE([xmltools], 234 [AS_HELP_STRING([--disable-xmltools], 235 [Disable djvu xml tools. @<:@default=enabled@:>@])], 236 [want_xmltools=${enableval}]) 237 238AM_CONDITIONAL([WANT_XMLTOOLS], [test "x${want_xmltools}" = "xyes"]) 239 240# ---------------------------------------- 241# Desktop files 242# ---------------------------------------- 243 244ac_desktopfiles="yes" 245AC_ARG_ENABLE(desktopfiles, 246 AS_HELP_STRING([--disable-desktopfiles], 247 [Do not install icons and mime types. @<:@default=enabled@:>@]), 248 [ac_desktopfiles=$enableval]) 249 250AM_CONDITIONAL([WANT_DESKTOPFILES], [test "x${ac_desktopfiles}" = "xyes"]) 251 252# ---------------------------------------- 253# End 254# ---------------------------------------- 255 256# Define installation path for .pc files 257PKG_INSTALLDIR 258 259# Define installation paths and version string 260AC_DEFINE_UNQUOTED(DJVULIBRE_VERSION,["${PACKAGE_VERSION}"],[version string]) 261 262# Output files 263AC_CONFIG_FILES([ 264Makefile 265libdjvu/Makefile 266tools/Makefile 267xmltools/Makefile 268share/Makefile 269desktopfiles/Makefile 270]) 271 272# Go 273AC_OUTPUT 274 275# Final message 276 277echo 278echo "$PACKAGE $VERSION" 279echo 280echo "Configuration Options Summary:" 281echo 282echo " OS.................: ${host_os}" 283echo " Win32 support......: ${have_os_win32}" 284echo " Pthread support....: ${have_pthread}" 285echo " Iconv support......: ${ac_has_iconv}" 286echo " JPEG support.......: ${have_jpeg}" 287echo " TIFF support.......: ${have_tiff}" 288echo " XML tools..........: ${want_xmltools}" 289echo " Desktop files......: ${ac_desktopfiles}" 290echo " Icon generation....: ${conversion_tool}" 291echo 292echo "Compilation..........: make (or gmake)" 293echo " CPPFLAGS...........: $CPPFLAGS" 294echo " CFLAGS.............: $CFLAGS" 295echo " CXXFLAGS...........: $CXXFLAGS" 296echo " LDFLAGS............: $LDFLAGS" 297echo 298echo "Installation...........: make install (as root if needed, with 'su' or 'sudo')" 299echo " prefix...............: $prefix" 300echo 301 302# ---------------------------------------- 303# Stuff added to config.h 304# ---------------------------------------- 305 306# Fence 307AH_TOP([ 308#ifndef CONFIG_H 309#define CONFIG_H 310/* config.h: begin */ 311]) 312 313# L18N Macros 314AH_BOTTOM([ 315 316/* - Miscellaneous */ 317#define AUTOCONF 1 318#if defined(__CYGWIN32__) || !defined(_WIN32) 319# define UNIX 1 320#endif 321 322/* - BOOL */ 323#if !defined(HAVE_BOOL) && !defined(bool) 324#define bool char 325#define true 1 326#define false 0 327#endif 328 329/* - WCHAR etc.*/ 330#if ! defined(HAVE_WCHAR_T) 331#define HAS_WCHAR 0 332#define HAS_WCTYPE 0 333#define HAS_MBSTATE 0 334#else 335#define HAS_WCHAR 1 336#if defined(HAVE_WCTYPE_H) && defined(HAVE_ISWSPACE) 337#define HAS_WCTYPE 1 338#endif 339#if defined(HAVE_MBSTATE_T) && defined(HAVE_WCRTOMB) 340#define HAS_MBSTATE 1 341#endif 342#endif 343#if defined(HAVE_ICONV_H) && defined(HAVE_ICONV) 344#define HAS_ICONV 1 345#else 346#define HAS_ICONV 0 347#endif 348 349/* - I18N MESSAGES HELL */ 350#define HAS_CTRL_C_IN_ERR_MSG 1 351 352/* - CONTAINERS */ 353#ifndef HAVE_MEMBER_TEMPLATES 354#define GCONTAINER_NO_MEMBER_TEMPLATES 1 355#endif 356#ifndef HAVE_TYPENAME 357#define GCONTAINER_NO_TYPENAME 1 358#endif 359 360/* - JPEG */ 361#ifdef HAVE_JPEG 362#define NEED_JPEG_DECODER 1 363#endif 364 365/* - MMAP */ 366#if defined(HAVE_MMAP) && defined(HAVE_SYS_MMAN_H) 367#define HAS_MEMMAP 1 368#else 369#define HAS_MEMMAP 0 370#endif 371 372/* config.h: end */ 373#endif 374]) 375