summaryrefslogtreecommitdiff
path: root/configure.ac
blob: ebddf0529b805bfba0e83dc55c11cd38374c94cb (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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)
AC_INIT(rarian, 0.8.1)
AC_CONFIG_SRCDIR([util/rarian-example.c])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE ([foreign dist-bzip2 dist-gzip])

AM_MAINTAINER_MODE

# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_CXX

# All the fun stuff that is used for installing
AC_ARG_ENABLE([installed],
	[AC_HELP_STRING([--enable-installed],
			[Make rarian run in install mode [default=yes]])],,
	enable_installed=yes)
AC_ARG_ENABLE([scrollkeeper-compat],
	[AC_HELP_STRING([--enable-scrollkeeper-compat],
			[Build and install scrollkeeper compatibility gunk [default=yes]])],,
	enable_scrollkeeper_compat=yes)
AC_ARG_ENABLE([omf-read],
	[AC_HELP_STRING([--enable-omf-read],
			[Allow librarian to read omf files [default=yes]])],,
	enable_omf_read=yes)
AC_ARG_ENABLE([skdb-update],
	[AC_HELP_STRING([--enable-skdb-update],
			[Update the Scrollkeeper database [default=yes]])],,
	enable_skdb_update=yes)
AC_ARG_WITH([convert-dir],
	[AC_HELP_STRING([--with-convert-dir=<path/to/omfs>],
			[Chose a specific path to convert when installed [default=<prefix>/share/omf]])], ,
	with_convert_dir="$prefix/share/omf")

DISTCHECK_CONFIGURE_FLAGS="--disable-skdb-update"
AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)

# If we try and install without setting the prefix, the convert dir will turn into NONE/omf
# Reset it here properly
if test "x$with_convert_dir" = "xNONE/share/omf"; then
echo Resetting conv dir
with_convert_dir="/usr/local/share/omf"
fi

echo conv dir is $with_convert_dir

if test "x$enable_installed" = "xyes"; then
    AC_DEFINE(ENABLE_INSTALL, 1, [turn on Installed Mode])
    AM_CONDITIONAL(ENABLE_INSTALL, true)
	ENABLE_INSTALL=1
	AC_SUBST([ENABLE_INSTALL])
else
	AC_DEFINE(ENABLE_INSTALL, 0, [turn on Installed Mode])
    AM_CONDITIONAL(ENABLE_INSTALL, false)
	ENABLE_INSTALL=0
   	AC_SUBST([ENABLE_INSTALL])
fi

if test "x$enable_scrollkeeper_compat" = "xyes"; then
    AC_DEFINE(ENABLE_SK_COMPAT, 1, [Scrollkeeper compatibility stuff])
    AM_CONDITIONAL(ENABLE_SK_COMPAT, true)
	ENABLE_SK_COMPAT=1
	AC_SUBST([ENABLE_SK_COMPAT])
else
	AC_DEFINE(ENABLE_SK_COMPAT, 0, [scrollkeeper compatibility stuff])
    AM_CONDITIONAL(ENABLE_SK_COMPAT, false)
	ENABLE_SK_COMPAT=0
   	AC_SUBST([ENABLE_SK_COMPAT])
fi

if test "x$enable_omf_read" = "xyes"; then
    AC_DEFINE(ENABLE_OMF_READ, 1, [Scrollkeeper compatibility stuff])
    AM_CONDITIONAL(ENABLE_OMF_READ, true)
	ENABLE_OMF_READ=1
	AC_SUBST([ENABLE_OMF_READ])
else
	AC_DEFINE(ENABLE_OMF_READ, 0, [scrollkeeper compatibility stuff])
    AM_CONDITIONAL(ENABLE_OMF_READ, false)
	ENABLE_OMF_READ=0
   	AC_SUBST([ENABLE_OMF_READ])
fi

if test "x$enable_skdb_update" = "xyes"; then
    AC_DEFINE(ENABLE_SKDB_UPDATE, 1, [Update the Scrollkeeper database])
    AM_CONDITIONAL(ENABLE_SKDB_UPDATE, true)
	ENABLE_SKDB_UPDATE=1
	AC_SUBST([ENABLE_SKDB_UPDATE])
else
	AC_DEFINE(ENABLE_SKDB_UPDATE, 0, [Update the Scrollkeeper database])
    AM_CONDITIONAL(ENABLE_SKDB_UPDATE, false)
	ENABLE_SKDB_UPDATE=0
   	AC_SUBST([ENABLE_SKDB_UPDATE])
fi

#AC_DEFINE_UNQUOTED(CONVERT_DIR, "$convert_dir", [Choose a directory to convert])
CONVERT_DIR="$with_convert_dir"
AC_SUBST([CONVERT_DIR])

# Check for existing scrollkeeper install.  If so, we're moving the
# files and symlinking
#AC_CHECK_PROG (SK_PRESENT, scrollkeeper-update, 1, 0, $bindir)
#echo $SK_PRESENT

if test "x$prefix" = xNONE ; then
   REAL_PREFIX=/usr/local
else
   REAL_PREFIX=$prefix
fi
old_prefix=$prefix
prefix=$REAL_PREFIX

if test "x$exec_prefix" = xNONE ; then
   REAL_EXEC_PREFIX=$prefix
else
   REAL_EXEC_PREFIX=$exec_prefix
fi
old_exec_prefix=$exec_prefix
exec_prefix=$REAL_EXEC_PREFIX

BINDIR_TMP="$bindir"
EXPANDED_BINDIR=`eval echo $BINDIR_TMP`
bindir=$EXPANDED_BINDIR

DATAROOTDIR_TMP="$datarootdir"
EXPANDED_DATAROOTDIR=`eval echo $DATAROOTDIR_TMP`
datarootdir=$EXPANDED_DATAROOTDIR

DATADIR_TMP="$datadir"
EXPANDED_DATADIR=`eval echo $DATADIR_TMP`
datadir=$EXPANDED_DATADIR

STATEDIR_TMP="$localstatedir"
EXPANDED_STATEDIR=`eval echo $STATEDIR_TMP`
localstatedir=$EXPANDED_STATEDIR

prefix=$old_prefix

#AC_SUBST(EXPANDED_BINDIR)
#echo $bindir

#exec_prefix=${prefix}
#echo ${exec_prefix} ...
#ENABLE_SK_COMPAT=0

# Ensure the sysconfdir exists

# Checks for libraries.
AC_CHECK_PROG(have_xslt, xsltproc, yes, no)

AM_CONDITIONAL(ENABLE_EXTRACT, test x"$have_xslt" = xyes)

AC_PATH_PROG(have_bash, bash)

AC_SUBST(BASH, $have_bash)

# Checks for header files.
AC_CHECK_HEADERS(malloc.h)

# Check for databases supported for man page support
# Adapted from man-db sources
## Check for Berkeley db
#AC_CHECK_HEADER(db4/db_185.h, 
#		AC_CHECK_LIB(db, dbopen, ,AC_CHECK_LIB(db-4, dbopen)))
#AC_CHECK_HEADER(db_185.h, 
#		AC_CHECK_LIB(db, dbopen, ,AC_CHECK_LIB(db-4, dbopen)))

dnl Check for GNU dbm routines
dnl
#AC_CHECK_HEADER(gdbm.h,[
#      AC_CHECK_LIB(gdbm, gdbm_open)])
dnl
dnl Check for UNIX ndbm routines
dnl
#AC_CHECK_HEADER(ndbm.h,[
#      AC_CHECK_LIB(ndbm, dbm_open)])

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

AC_CONFIG_FILES([Makefile
		 rarian.pc
                 data/Makefile
		 docs/Makefile
                 librarian/Makefile
                 util/Makefile
 		 util/rarian-sk-update
		 util/rarian-sk-install
		 util/rarian-sk-rebuild
		 util/rarian-sk-config
		 util/rarian-sk-get-scripts
		 util/rarian-sk-extract
		 util/rarian-sk-get-content-list
		 util/rarian-sk-get-extended-content-list
		 docs/rarian.document])
AC_OUTPUT

echo "
Rarian-$VERSION:
This is not API-stable yet."
if test "x$enable_installed" = "xyes"; then
	echo Prefix......... $prefix
else
	echo "Running in uninstalled (i.e. testing and broken) mode"
fi