1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4# Initialization
5AC_PREREQ(2.59)
6AC_INIT(microdc2, 0.15.6, [vladch@k804.mainet.msk.su])
7AC_CONFIG_SRCDIR([src/microdc.h])
8AC_CONFIG_HEADER([config.h])
9AC_CONFIG_MACRO_DIR([m4]) # doesn't seem to have any effect at the moment
10AC_CONFIG_AUX_DIR([build-aux])
11AM_INIT_AUTOMAKE
12
13# Initialize config.h
14AC_GNU_SOURCE
15AC_DEFINE_DIR(LOCALEDIR, datadir/locale, [Directory where gettext translations are kept.])
16
17# Enable maintainer mode
18AM_MAINTAINER_MODE
19
20# Gnulib
21gl_EARLY
22gl_INIT
23
24# Gettext
25AM_GNU_GETTEXT([external])
26# This is commented out, because with it, 'autoreconf -is' in autogen.sh will
27# try to overwrite files in m4 from the gettext distribution. Unfortunately,
28# at least in my case, gnulib provides newer files than the gettext distribution
29# does.
30# AM_GNU_GETTEXT_VERSION(0.14.3)
31
32# Checks for programs
33AC_PROG_CC
34AC_PROG_RANLIB
35
36# Checks for libraries
37#ACX_PTHREAD
38#ACX_PTHREAD([], [AC_MSG_ERROR([POSIX Threads is required to build and run this project.])])
39AC_LIB_READLINE([], [AC_MSG_ERROR([GNU Readline is required to build and run this project.])])
40### FIXME: move these to _rl_mark_modified_lines
41AH_TEMPLATE([HAVE__RL_MARK_MODIFIED_LINES], [Define if _rl_mark_modified_lines exists in -lreadline.])
42OLD_LIBS="$LIBS"
43LIBS="$LIBS $READLINE_LIBS"
44AC_CHECK_FUNC(_rl_mark_modified_lines, [AC_DEFINE([HAVE__RL_MARK_MODIFIED_LINES])])
45LIBS="$OLD_LIBS"
46AH_TEMPLATE([HAVE_LIBXML2], [Define if libxml2 is installed])
47#AH_TEMPLATE([XML_SAVE_FORMAT], [1], [Define if libxml2 has no such option for xmlSave- functions])
48AC_PATH_PROG(XML_CONFIG, xml2-config)
49AC_PATH_PROG(TR, tr)
50if test -n "$XML_CONFIG" && test -n "$TR"; then
51  LIBXML2_VERSION=`$XML_CONFIG --version | $TR -d "."`
52  if test $LIBXML2_VERSION -eq 2616; then
53    AC_DEFINE([XML_SAVE_FORMAT], [1], [The libxml2 version 2.6.16 has no such option defined in the library headers])
54  fi
55  if test $LIBXML2_VERSION -ge 2616; then
56    AC_DEFINE([HAVE_LIBXML2])
57    LIBXML2_LIBS="`$XML_CONFIG --libs`"
58    LIBXML2_CFLAGS="`$XML_CONFIG --cflags`"
59    AC_SUBST(LIBXML2_LIBS)
60    AC_SUBST(LIBXML2_CFLAGS)
61#    LIBS="$LIBS $LIBXML2_LIBS"
62#    CFLAGS="$CFLAGS $LIBXML2_CFLAGS"
63  else
64    AC_MSG_WARN([XML libxml2 library version 2.6.16 or later is required to support XML filelists])
65  fi
66fi
67
68# Checks for header files
69
70# Checks for typedefs, structures, and compiler characteristics
71AC_SYS_LARGEFILE
72AC_CHECK_TYPES([comparison_fn_t])
73AC_CHECK_MEMBERS(struct sigaction.sa_restorer,,,[#include <signal.h>])
74
75# Checks for library functions
76
77# Output generation
78AC_CONFIG_FILES([Makefile
79                 po/Makefile.in
80		 lib/Makefile
81		 src/Makefile
82		 src/common/Makefile
83		 src/bzip2/Makefile
84		 src/tth/Makefile
85		 rpm/microdc.spec])
86AC_CONFIG_FILES([slackware/microdc.SlackBuild],
87		[chmod +x slackware/microdc.SlackBuild])
88AC_OUTPUT
89