summaryrefslogtreecommitdiffstats
path: root/configure.in.in
blob: 45009a851e09c242d6f85b5dd736263d2a2723ee (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
102
103
104
dnl Process this file with autoconf to produce a configure script.
dnl Most of this file was shamelessly stolen from Licq Qt plugin, which has similar configuration options
AC_INIT
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_AUX_DIR(admin)
AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM

dnl All versioning is done via the following line
AM_CONFIG_HEADER(src/config.h)
AM_INIT_AUTOMAKE(kchmviewer, 3.1)

dnl Chuck #defines for PACKAGE and VERSION into config.h
AC_DEFINE_UNQUOTED(APP_NAME, "$PACKAGE", [ Application name ] )
AC_DEFINE_UNQUOTED(APP_VERSION, "$VERSION", [ Application version as text ])
AC_DEFINE_UNQUOTED(APP_INT_VERSION,$INT_VERSION, [ Application version as integer ])

# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_CHECK_COMPILERS
AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
KDE_PROG_LIBTOOL

dnl Check for X and extra X libs needed
AC_PATH_XTRA
if test "$no_x" = yes; then
  AC_MSG_ERROR(You need to have the X11 libraries and headers installed)
fi

KDE_SET_DEFAULT_BINDIRS
KDE_ENABLE_HIDDEN_VISIBILITY

CHMLIBDIR="lib/chmlib"
EXTRA_SUBDIRS=""

AC_ARG_WITH(kde,    AC_HELP_STRING([--with-kde],[enable KDE support]))

if test "x$with_kde" = "xyes"; then
	KDE_SET_PREFIX
	AC_PATH_KDE
	AM_KDE_WITH_NLS
	AC_DEFINE(USE_KDE, 1, [use KDE support])
fi

if test "x$with_kde" != "xyes"; then
	include_ARTS_FALSE="yes"
	AC_PREFIX_DEFAULT(${prefix:-/usr/local})
	KDE_SET_DEFAULT_PATHS([default])
	eval "$kde_cv_all_paths"
fi

AM_CONDITIONAL([AMC_USE_KDE], [test "x$with_kde" = "xyes"])

dnl Checking whether to use built-in, or system-wide chmlib
dnl First check for --with-builtin-chmlib configure option - no more checks needed
USE_BUILTIN_CHMLIB="0"
AC_ARG_WITH(builtin-chmlib,  
       AC_HELP_STRING([--with-builtin-chmlib],[link with built-in chmlib]), 
       [ USE_BUILTIN_CHMLIB="1" ])

dnl Check for the libchm in system
if test "$USE_BUILTIN_CHMLIB" = "0"; then
	AC_CHECK_LIB(chm, chm_open, [USE_BUILTIN_CHMLIB="0"], [USE_BUILTIN_CHMLIB="1"])
fi

if test "$USE_BUILTIN_CHMLIB" = "1"; then
	CHM_INCLUDES="-I\$(top_srcdir)/$CHMLIBDIR"
	CHM_LIBS="\$(top_builddir)/$CHMLIBDIR/libchm.la"
	USE_LIB_CHM="internal"
	EXTRA_SUBDIRS="chmlib $EXTRA_SUBDIRS"
    AC_DEFINE(USE_BUILTIN_CHMLIB, 1, [use builtin chmlib])
else
	CHM_LIBS="-lchm"
    USE_LIB_CHM="system"
	AC_DEFINE(USE_BUILTIN_CHMLIB, 0, [use builtin chmlib])
fi

AM_CONDITIONAL([AMC_BUILD_CHMLIB], [test "$USE_BUILTIN_CHMLIB" = "1"])

# libchmfile is built unconditionally
LIBCHMFILE_INCLUDES="-I\$(top_srcdir)/lib/libchmfile -I\$(top_srcdir)/src"
LIBCHMFILE_LIBS="\$(top_builddir)/lib/libchmfile/libchmfile.a"

AC_SUBST([EXTRA_SUBDIRS])
AC_SUBST(CHM_INCLUDES)
AC_SUBST(USE_KDE)
AC_SUBST(CHM_LIBS)
AC_SUBST(LIBCHMFILE_INCLUDES)
AC_SUBST(LIBCHMFILE_LIBS)

echo ""
echo "Please remember to use GNU make, often installed as gmake."
echo ""
echo "Install prefix : $prefix"
if test "$have_kde" = yes; then
  echo "KDE support    : includes in $kde_includes, libs in $kde_libraries"
else
  echo "KDE support    : disabled."
fi
echo "Qt includes    : $QT_INCLUDES"
echo "Qt libraries   : $LIB_QT"
echo "chmlib to link : $USE_LIB_CHM"