summaryrefslogtreecommitdiffstats
path: root/configure.in
blob: e2fe1c40e85eb6891314c755c6ec62523f8946b0 (plain)
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
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/librcc.c)
AC_CONFIG_HEADERS(config.h)

PACKAGE=librcc
LIBRCC_VERSION_MAJOR=`cat VERSION | sed -e s/CVS// | cut -d . -f 1 | sed -e s/^$/0/`
LIBRCC_VERSION_MINOR=`cat VERSION | sed -e s/CVS// | cut -d . -f 2 | sed -e s/^$/0/`
LIBRCC_VERSION_SUBMINOR=`cat VERSION | sed -e s/CVS// | cut -d . -f 3 | sed -e s/^$/0/`
LIBRCC_VERSION=$LIBRCC_VERSION_MAJOR.$LIBRCC_VERSION_MINOR.$LIBRCC_VERSION_SUBMINOR
VERSION=$LIBRCC_VERSION
LIBRCC_VERSION_INFO=`echo $LIBRCC_VERSION | awk -F. '{ printf "%d:%d:%d", $1+$2, $3, $2 }'`

AC_SUBST(LIBRCC_VERSION)
AC_SUBST(LIBRCC_VERSION_MAJOR)
AC_SUBST(LIBRCC_VERSION_MINOR)
AC_SUBST(LIBRCC_VERSION_SUBMINOR)
AC_SUBST(LIBRCC_VERSION_INFO)

LIBRCC_CVS=`cat VERSION | sed -e s/.*CVS.*/CVS/`
if test "x$LIBRCC_CVS" = "x"; then
LIBRCC_CVS=0
LIBRCC_CVS_DATE=0
else 
LIBRCC_CVS=1
LIBRCC_CVS_DATE=`date +%y%m%d.%H`
fi
AC_SUBST(LIBRCC_CVS)
AC_SUBST(LIBRCC_CVS_DATE)

AM_INIT_AUTOMAKE($PACKAGE, $VERSION)

AC_PROG_CC
AC_PROG_INSTALL
AM_PROG_LIBTOOL

AC_PATH_PROG(RM, rm, /bin/rm)
AC_PATH_PROG(MV, mv, /bin/mv)
AC_PATH_PROG(TAR, tar, /bin/tar)

dnl Checks for programs.

dnl Checks for header files.
AC_CHECK_HEADERS(iconv.h,, [AC_MSG_ERROR(Missing iconv header)])
AC_CHECK_HEADERS(mntent.h pwd.h sys/types.h unistd.h)

AC_TRY_COMPILE([#include <langinfo.h>],
    [char *codeset = nl_langinfo (CODESET);],
    [AC_DEFINE(HAVE_CODESET,,[Define if nl_langinfo(CODESET) is available.])]
)
    
dnl Checks for libraries.

AC_PATH_PROG(XML2_CONFIG, xml2-config, no)
if test $XML2_CONFIG = no; then
    AC_MSG_ERROR(LibXML2 is required)
fi
XML_LIBS="\`xml2-config --libs\`"
XML_INCLUDES="\`xml2-config --cflags\`"
AC_SUBST(XML_LIBS)
AC_SUBST(XML_INCLUDES)

AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
AM_CONDITIONAL(HAVE_GTK, [ test $GTK_CONFIG != no ])
GTK_LIBS="\`gtk-config --libs\`"
GTK_INCLUDES="\`gtk-config --cflags\`"
AC_SUBST(GTK_LIBS)
AC_SUBST(GTK_INCLUDES)

AC_CHECK_HEADER(librcd.h, [AC_CHECK_LIB(rcd, rcdGetRussianCharset, [
	RCD_LIBS="-lrcd"
	RCD_INCLUDES=""
], AC_MSG_ERROR(LibRCD is required))], [AC_MSG_ERROR(LibRCD is required)])
AC_SUBST(RCD_LIBS)
AC_SUBST(RCD_INCLUDES)

AC_CHECK_HEADER(enca.h, [AC_CHECK_LIB(enca, enca_analyse, [ 
    AC_DEFINE(HAVE_ENCA,1,[Defines if enca is available])
    ENCA_LIBS="-lenca"
    ENCA_INCLUDES=""
])])

if test "x$ENCA_LIBS" = "x"; then
    AC_CHECK_HEADER(dlfcn.h, [AC_CHECK_LIB(dl, dlopen, [
	AC_DEFINE(HAVE_DLOPEN,1,[Defines if dlopen is available])
	ENCA_LIBS="-ldl"
	ENCA_INCLUDES=""
    ],[
	ENCA_LIBS=""
	ENCA_INCLUDES=""
    ])])
fi
AC_SUBST(ENCA_LIBS)
AC_SUBST(ENCA_INCLUDES)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

dnl Checks for library functions.
AC_CHECK_FUNCS(strcasecmp strncasecmp strdup)

AC_OUTPUT(src/Makefile ui/Makefile examples/Makefile Makefile librcc.spec)