~bronger/+junk/package-refdb-svn

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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
dnl Process this file with autoconf to produce a configure script.

dnl check for one of the source files
AC_INIT(refdb, 1.0.0-pre2)
AC_CONFIG_SRCDIR(src/backend-ris.c)

dnl Find out host type
AC_CONFIG_AUX_DIR(./conf)
AC_CANONICAL_HOST

dnl Use automake (shut off warnings about GNU make)
AM_INIT_AUTOMAKE([-Wno-portability])

dnl switch on GNU extensions
AC_DEFINE(_GNU_SOURCE)

dnl see which compiler is available
AC_PROG_CC

dnl set some compile options (just a stub right now)
if test -n "$GCC"; then
   case $host in
   *)
	CFLAGS=$CFLAGS" -O2";;
   esac
fi

dnl see where the libdbi lib is
AC_ARG_WITH(libdbi-lib,
	[  --with-libdbi-lib=DIR         Find libdbi lib in DIR],
	[CFLAGS=$CFLAGS" -L$withval"])

dnl see where expat lib is
AC_ARG_WITH(expat-lib,
	[  --with-expat-lib=DIR          Find expat lib in DIR],
	[CFLAGS=$CFLAGS" -L$withval"])

dnl see where btparse lib is
AC_ARG_WITH(btparse-lib,
	[  --with-btparse-lib=DIR        Find btparse lib in DIR],
	[CFLAGS=$CFLAGS" -L$withval"])

dnl need a sgml declaration
AC_ARG_WITH(sgml-declaration,
	[  --with-sgml-declaration=PATH  Use this file as SGML declaration],
	[sgml_decl=$withval],
	[sgml_decl="\$(pkgdatadir)/declarations/docbook.dcl"])

dnl need a xml declaration
AC_ARG_WITH(xml-declaration,
	[  --with-xml-declaration=PATH   Use this file as XML declaration],
	[xml_decl=$withval],
	[xml_decl="\$(pkgdatadir)/declarations/xml.dcl"])

dnl need the path to the docbook xsl stylesheets
AC_ARG_WITH(docbook-xsl,
	[  --with-docbook-xsl=PATH       Path to the DocBook XSL stylesheet root],
	[docbk_xsl=$withval],
	[docbk_xsl="http://docbook.sourceforge.net/release/xsl/current"])

dnl need the path to the docbook namespaced xsl stylesheets
AC_ARG_WITH(docbook-xsl-ns,
	[  --with-docbook-xsl-ns=PATH     Path to the DocBook XSL NS stylesheet root],
	[docbk_xsl_ns=$withval],
	[docbk_xsl_ns="http://docbook.sourceforge.net/release/xsl-ns/current"])

dnl need the path to the tei P4 xsl stylesheets
AC_ARG_WITH(tei-xsl,
	[  --with-tei-xsl=PATH           Path to the TEI XSL stylesheet root],
	[tei_xsl=$withval],
	[tei_xsl="http://www.tei-c.org/Stylesheets"])

dnl need the path to the tei P5 xsl stylesheets
AC_ARG_WITH(tei-xsl-ns,
	[  --with-tei-xsl-ns=PATH        Path to the TEI XSL NS stylesheet root],
	[tei_xsl_ns=$withval],
	[tei_xsl_ns="http://www.tei-c.org/Stylesheets"])

dnl need the path to the jars
AC_ARG_WITH(classpath_root,
	[  --with-classpath-root=PATH    Path to a Java class repository for XSL processors],
	[classpath_root=$withval],
	[classpath_root=""])

dnl need a path to write a pid file
AC_ARG_WITH(var_dir,
	[  --with-var-dir=PATH           Path of a directory for PID files],
	[var_dir=$withval],
	[var_dir="\$(localstatedir)/run"])

dnl need a path to write log files
AC_ARG_WITH(log_dir,
	[  --with-log-dir=PATH           Path of a directory for log files],
	[log_dir=$withval],
	[log_dir="\$(localstatedir)/log"])

dnl the main database
AC_ARG_WITH(main_db,
	[  --with-main-db=name           The name of the RefDB system database],
	[main_db=$withval],
	[main_db="refdb"])

dnl which directory will hold the databases? This does not only pertain
dnl to SQLite, as the directory also holds the version file
AC_ARG_WITH(db_dir,
	[  --with-db-dir=PATH            Directory for database files],
	[db_dir=$withval],
	[db_dir="\$(localstatedir)/lib/refdb/db"],
])

dnl maintainers may need the trang jar
AC_ARG_WITH(trang_jar,
	[  --with-trang-jar=PATH         specify the full path to trang],
	[trang_cmd="java -jar "$withval],
	[trang_cmd="cp"])

dnl see whether we should build the docs
ac_docs="YES"
AC_ARG_ENABLE(docs,
	[  --disable-docs		  do not build and install the documentation.],
	[  ac_docs="NO" ])

if test "$ac_docs" = "YES"; then
docs_subdirs="doc"
else
docs_subdirs=""
fi

dnl see whether we should build the man pages
ac_manpages="YES"
AC_ARG_ENABLE(manpages,
	[  --disable-manpages		  do not build and install the man pages.],
	[  ac_manpages="NO" ])

if test "$ac_manpages" = "YES"; then
man_subdirs="man"
else
man_subdirs=""
fi

dnl see whether we should build the server
ac_server="YES"
AC_ARG_ENABLE(server,
	[  --disable-server		  Exclude server.],
	[  ac_server="NO" ])

if test "$ac_server" = "YES"; then
server_subdirs="etc scripts src phpweb sru"
server_bins="refdbd\$(EXEEXT)"
server_scripts="refdbctl refdb-init refdbsru refdb-sruserver"
server_etc_objects="refdbdrc.mysql.example refdbdrc.pgsql.example refdbdrc.sqlite.example refdbdrc.sqlite3.example refdbsrurc.example"
server_etc_distobjects="refdbdrc refdbsrurc"
server_mans="refdb.8 refdbd.1 refdb-init.8 refdbctl.1 refdbsru.1 refdb-sruserver.1"
server8_mans="refdb.sh.8"
else
server_subdirs=""
server_bins=""
server_scripts=""
server_etc_objects=""
server_etc_distobjects=""
server_mans=""
server8_mans=""
fi

dnl see whether we should build the clients
ac_client="YES"
AC_ARG_ENABLE(clients,
	[  --disable-clients		  Exclude clients.],
	[  ac_client="NO" ])

if test "$ac_client" = "YES" && test "$ac_server" = "YES"; then
client_subdirs="declarations dsssl dtd examples styles xsl"
client_bins="refdbib\$(EXEEXT) refdbc\$(EXEEXT) refdba\$(EXEEXT) refdbxp\$(EXEEXT) eenc\$(EXEEXT)"
client_scripts="refdbjade runbib db2ris refdb-bug refdbxml refdbrtf marc2ris med2ris en2ris refdbnd refdb_dos2unix refdb-ms refdb-backup refdb-restore refdb_latex2utf8txt bib2ris-utf8 rtfcitations"
client_etc_objects="bib2risrc.example bib2riscgirc.example db2risrc.example refdbarc.example refdbcrc.example refdbcgirc.example refdbibrc.example med2risrc.example med2riscgirc.example marc2risrc.example refdbxmlrc.example refdbrtfrc.example refdbjaderc.example runbibrc.example"
client_etc_distobjects="bib2risrc bib2riscgirc db2risrc refdbarc refdbcrc refdbcgirc refdbibrc med2risrc med2riscgirc marc2risrc refdbxmlrc refdbrtfrc refdbjaderc runbibrc"
client_mans="RefDB.7 refdba.1 refdbc.1 refdbib.1 bib2ris.1 db2ris.1 en2ris.1 marc2ris.1 med2ris.1 eenc.1 refdb-backup.1 refdb-ms.1 refdb-restore.1 refdbjade.1 refdbnd.1 refdbxml.1 refdbrtf.1 runbib.1 refdbxp.1 refdb-bug.1 refdb_dos2unix.1 refdb_latex2utf8txt.1 rtfcitations.1"
client1_mans="bib2ris-utf8.1"
elif test "$ac_client" = "YES"; then
client_subdirs="declarations dsssl dtd etc examples scripts src styles xsl"
client_bins="refdbib\$(EXEEXT) refdbc\$(EXEEXT) refdba\$(EXEEXT) refdbxp\$(EXEEXT) eenc\$(EXEEXT)"
client_scripts="refdbjade runbib db2ris refdb-bug refdbxml refdbrtf marc2ris med2ris en2ris refdbnd refdb_dos2unix refdb-ms refdb-backup refdb-restore refdb_latex2utf8txt bib2ris-utf8 rtfcitations"
client_etc_objects="bib2risrc.example bib2riscgirc.example db2risrc.example refdbarc.example refdbcrc.example refdbcgirc.example refdbibrc.example med2risrc.example med2riscgirc.example marc2risrc.example refdbxmlrc.example refdbrtfrc.example refdbjaderc.example runbibrc.example"
client_etc_distobjects="bib2risrc bib2riscgirc db2risrc refdbarc refdbcrc refdbcgirc refdbibrc med2risrc med2riscgirc marc2risrc refdbxmlrc refdbrtfrc refdbjaderc runbibrc"
client_mans="RefDB.7 refdba.1 refdbc.1 refdbib.1 bib2ris.1 db2ris.1 en2ris.1 marc2ris.1 med2ris.1 eenc.1 refdb-backup.1 refdb-ms.1 refdb-restore.1 refdbjade.1 refdbnd.1 refdbxml.1 refdbrtf.1 runbib.1 refdbxp.1 refdb-bug.1 refdb_dos2unix.1 refdb_latex2utf8txt.1 rtfcitations.1"
client1_mans="bib2ris-utf8.1"
else
client_subdirs=""
client_bins=""
client_scripts=""
client_etc_objects=""
client_etc_distobjects=""
client_mans=""
client1_mans=""
fi

dnl Checks for programs.
AC_PATH_PROGS(myshell, bash sh)

if test "$ac_client" = "YES"; then
AC_PATH_PROGS(myjade, openjade jade)
AC_PATH_PROG(myperl, perl)
AC_PATH_PROG(myxsltproc, xsltproc)
AC_PATH_PROG(myxmlcatalog, xmlcatalog)
fi

if test "$ac_docs" = "YES"; then
AC_PATH_PROG(mydtdparse, dtdparse)
AC_PATH_PROG(mydtdformat, dtdformat)
AC_PATH_PROG(mysgrep, sgrep)
AC_PATH_PROG(mytidy, tidy)
AC_PATH_PROG(mybatik, batik-rasterizer)
fi

dnl see whether subversion is installed
AC_PATH_PROG(svnversioncommand, svnversion)

dnl use svnversion to record the current repository revision only if
dnl subversion is installed and we are in a working copy
if test "X$svnversioncommand" = "X" || test `$svnversioncommand -n '.'` = "exported"; then
mysvnversion="cat svn_dist_version"
else
mysvnversion="svnversion -n '.'"
fi

dnl this is for building docs only, but the conditional must not be defined
dnl inside of an if block
AM_CONDITIONAL(HAVEBATIK, test x$mybatik != "x")

AM_CONDITIONAL(HAVESERVER, test "$ac_server" = "YES")

dnl this is used to make sure we create the file svn_dist_version only if 
dnl we have svnversion and if we are in a svn working copy. In all other
dnl cases the distributed copy of svn_dist_version should be used
AM_CONDITIONAL(HAVESVNWC, test "X$svnversioncommand" != "X" && test `$svnversioncommand -n '.'` != "exported")

dnl
dnl Checks for libraries.
dnl

if test "$ac_client" = "YES"; then
dnl libtermcap; libreadline needs either libtermcap or lib(n)curses, so
dnl we have to check this first
AC_CHECK_LIB(termcap, tputs, [
rltestlib="-ltermcap"], 
[AC_CHECK_LIB(ncurses, tputs, [
rltestlib="-lncurses"], 
[AC_CHECK_LIB(curses, tputs, [
rltestlib="-lcurses"], 
[echo "Cannot build refdb without either libtermcap, libncurses, or libcurses"
exit 1])])])

dnl libreadline
AC_CHECK_LIB(readline, readline, [
refdba_LDADD=$refdba_LDADD" -lreadline "$rltestlib
refdbc_LDADD=$refdbc_LDADD" -lreadline "$rltestlib], [
echo "Cannot build refdb without libreadline"
exit 1], $rltestlib)

AC_MSG_CHECKING(for libreadline version)

AC_TRY_RUN(
#include <stdio.h>
#include <readline/readline.h>
char* rl_readline_name;
int main(void) {
exit(0);
}
, ac_cv_lib_readline=old, ac_cv_lib_readline=new, ac_cv_lib_readline=old)

AC_MSG_RESULT($ac_cv_lib_readline)
if test "$ac_cv_lib_readline" = "old" ; then
  AC_DEFINE(READLINE41)
else
  AC_DEFINE(READLINE42)
fi
fi dnl end if build clients

if test "$ac_server" = "YES"; then

dnl see how to get iconv support
AM_ICONV_LINK

dnl linking with libdl is necessary on some systems
AC_SEARCH_LIBS_VAR(dlopen, dl,,,,refdbd_LDADD)

dnl linking with libltdl may be required by libdbi
AC_SEARCH_LIBS_VAR(lt_dlopen, ltdl,,,,refdbd_LDADD)

dnl libdbi - depends on libdl on some systems
AC_CHECK_LIB(dbi, dbi_initialize, [
refdbd_LDADD=$refdbd_LDADD" -ldbi"], [
echo "Cannot build refdb without libdbi"
exit 1])

dnl compress is in glibc, but not in Cygwin newlib
AC_SEARCH_LIBS_VAR(compress, z, , , , refdbd_LDADD)

fi dnl end if build server

dnl linking with libsocket may be necessary (Solaris?)
AC_SEARCH_LIBS(setsockopt, socket,,)

dnl in some cases Solaris seems to need libnsl too
AC_SEARCH_LIBS(gethostbyname, nsl,,)

dnl libexpat
if test "$ac_server" = "YES"; then
AC_CHECK_LIB(expat, XML_ParserCreate, [
refdbd_LDADD=$refdbd_LDADD" -lexpat"], [
echo "Cannot build refdb without libexpat"
exit 1])
fi

dnl btparse
if test "$ac_client" = "YES"; then
AC_CHECK_LIB(btparse, bt_initialize, [
bib2ris_LDADD=$bib2ris_LDADD" -lbtparse"
BIB2RIS="bib2ris\$(EXEEXT)"], [
echo "libbtparse not found; bib2ris import filter will not be built"])
fi

dnl check types that aren't really portable
AC_CHECK_TYPES(socklen_t)

dnl this is the dusty corner of configure and attempts to tackle the
dnl following issues:
dnl (1) printf uses non-standard conversion specifiers on some platforms
dnl (2) ps uses different arguments on BSD/SysV style systems to list
dnl     all running processes. Some ps'es accept both styles which makes
dnl     the list a little less ugly
case $host in
    *-sun-solaris*)
        ULLSPEC="%llu"
	psarg="-e" ;;
    *)
        ULLSPEC="%llu"
	psarg="ax" ;;
esac

AC_SUBST(refdba_LDADD)
AC_SUBST(refdbc_LDADD)
AC_SUBST(refdbd_LDADD)
AC_SUBST(bib2ris_LDADD)
AC_SUBST(BIB2RIS)
AC_SUBST(myjade)
AC_SUBST(myshell)
AC_SUBST(myxsltproc)
AC_SUBST(mysvnversion)
AC_SUBST(sgml_decl)
AC_SUBST(xml_decl)
AC_SUBST(docbk_xsl)
AC_SUBST(docbk_xsl_ns)
AC_SUBST(tei_xsl)
AC_SUBST(tei_xsl_ns)
AC_SUBST(classpath_root)
AC_SUBST(log_dir)
AC_SUBST(var_dir)
AC_SUBST(main_db)
AC_SUBST(db_dir)
AC_SUBST(ULLSPEC)
AC_SUBST(psarg)
AC_SUBST(trang_cmd)
AC_SUBST(server_subdirs)
AC_SUBST(client_subdirs)
AC_SUBST(docs_subdirs)
AC_SUBST(man_subdirs)
AC_SUBST(server_bins)
AC_SUBST(client_bins)
AC_SUBST(server_scripts)
AC_SUBST(client_scripts)
AC_SUBST(server_etc_objects)
AC_SUBST(client_etc_objects)
AC_SUBST(server_etc_distobjects)
AC_SUBST(client_etc_distobjects)
AC_SUBST(server_mans)
AC_SUBST(server8_mans)
AC_SUBST(client_mans)
AC_SUBST(client1_mans)

dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h limits.h sys/file.h sys/time.h sys/ioctl.h syslog.h unistd.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM

dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_FUNC_MKFIFO
AC_CHECK_FUNCS(gethostname select socket strcspn strstr strtoll atoll)

dnl these checks are required only for clients
if test "$ac_client" = "YES"; then

dnl Check for XSL stylesheets
AC_CHECK_FILE($docbk_xsl/fo/docbook.xsl,
[echo "DocBook XSL stylesheets found"],
[if test -n "$myxmlcatalog"; then
REFDB_XML_FILE($myxmlcatalog,${docbk_xsl}/fo/docbook.xsl)
else
echo "cannot locate DocBook XSL stylesheets via XML catalog"
fi])

dnl Check for XSL NS stylesheets
AC_CHECK_FILE($docbk_xsl_ns/fo/docbook.xsl,
[echo "DocBook XSL NS stylesheets found"],
[if test -n "$myxmlcatalog"; then
REFDB_XML_FILE($myxmlcatalog,${docbk_xsl_ns}/fo/docbook.xsl)
else
echo "cannot locate DocBook XSL NS stylesheets via XML catalog"
fi])

AC_CHECK_FILE($tei_xsl/p4/fo/tei.xsl,
[echo "TEI XSL stylesheets found"],
[if test -n "$myxmlcatalog"; then
REFDB_XML_FILE($myxmlcatalog,${tei_xsl}/p4/fo/tei.xsl)
else
echo "cannot locate TEI XSL stylesheets via XML catalog"
fi])

AC_CHECK_FILE($tei_xsl_ns/p5/fo/tei.xsl,
[echo "TEI XSL NS stylesheets found"],
[if test -n "$myxmlcatalog"; then
REFDB_XML_FILE($myxmlcatalog,${tei_xsl_ns}/p5/fo/tei.xsl)
else
echo "cannot locate TEI XSL NS stylesheets via XML catalog"
fi])

dnl Check for Perl version and Perl modules
changequote(<<,>>)dnl
refdb_perl_command='print $]'
changequote([,])dnl
REFDB_PERL_VERSION($myperl, 5.006)
REFDB_PERL_MODULE($myperl, Text::Iconv, refdb_iconv)
REFDB_PERL_MODULE($myperl, Term::Clui, refdb_clui)
REFDB_PERL_MODULE($myperl, RefDB::Makestyle, refdb_makestyle)
REFDB_PERL_MODULE($myperl, RefDB::Prefs, refdb_prefs)
REFDB_PERL_MODULE($myperl, RefDB::SRU, refdb_sru)
REFDB_PERL_MODULE($myperl, RefDB::SRUserver, refdb_sruserver)
REFDB_PERL_MODULE($myperl, XML::Parser, refdb_parser)
REFDB_PERL_MODULE($myperl, MARC::Record, refdb_record)
REFDB_PERL_MODULE($myperl, MARC::Charset, refdb_charset)
REFDB_PERL_MODULE($myperl, CGI, refdb_cgi)

fi dnl end if build clients

AC_OUTPUT(src/Makefile scripts/Makefile etc/Makefile doc/Makefile dtd/Makefile declarations/Makefile examples/Makefile styles/Makefile phpweb/Makefile phpweb/css/Makefile phpweb/images/Makefile phpweb/includes/Makefile phpweb/xsl/Makefile sru/Makefile dsssl/Makefile dsssl/refdb/Makefile dsssl/refdb/html/Makefile dsssl/refdb/print/Makefile dsssl/refdb/lib/Makefile xsl/Makefile xsl/refdb/Makefile xsl/refdb/common-refdb/Makefile xsl/refdb/docbk-refdb-xsl/Makefile xsl/refdb/docbk-refdb-xsl/docbk-fo/Makefile xsl/refdb/docbk-refdb-xsl/docbk-html/Makefile xsl/refdb/docbk-refdb-xsl/docbk-xhtml/Makefile xsl/refdb/docbk-refdb-xsl/docbk-lib/Makefile xsl/refdb/tei-refdb-xsl/Makefile xsl/refdb/tei-refdb-xsl/tei-fo/Makefile xsl/refdb/tei-refdb-xsl/tei-html/Makefile xsl/refdb/tei-refdb-xsl/tei-lib/Makefile man/Makefile Makefile)

echo

if test "$ac_client" = "YES"; then
if test -z "$refdb_makestyle" || test -z "$refdb_prefs" || test -z "$refdb_parser" || test -z "$refdb_record" || test -z "$refdb_charset" || test -z "$refdb_iconv" || test -z "$refdb_clui" || test -z "$refdb_sru" || test -z "$refdb_sruserver" || test -z "$refdb_cgi"; then
echo "Your system seems to miss some of the recommended Perl modules. Please"
echo "check the output above for details. It is safe to make and make install"
echo "anyway, but some of the accessory Perl scripts will fail to run if the"
echo " required modules are not installed. Please consult the manual where to"
echo "get the missing modules from."
echo
fi
fi

echo "Configuration summary:"
if test "$ac_client" = "YES"; then
echo "will build clients"
fi
if test "$ac_server" = "YES"; then
echo "will build server"
fi
if test "$ac_docs" = "YES"; then
echo "will build docs"
fi
if test "$ac_manpages" = "YES"; then
echo "will build man pages"
fi

echo ""
echo "What you should do next:"
echo "- run \"make\" to build RefDB."
echo "- run \"make install\" as root to install everything."
echo "- create the main database and the configuration files. Either run the"
echo "  refdb-init shell script as root, or peruse the handbook if you"
echo "  prefer a manual installation."
echo ""