1 AC_REVISION([$Id: configure.in,v 1.29.2.41 2005/12/16 08:12:19 tbe Exp $])
3 dnl Process this file with autoconf to produce a configure script.
5 dnl Copyright (C) 1998 Cees A. de Groot
9 dnl Credits: this autoconf script was largely "inspired" <g> by the
10 dnl autoconf script around SP made by Henry Thompson.
15 AC_CONFIG_SRCDIR([pubtext])
16 AM_INIT_AUTOMAKE(OpenSP, 1.5.2, no-define)
19 AM_CONFIG_HEADER(config.h)
22 dnl Autoheader definitions
24 AH_TEMPLATE([HAVE_CATGETS],[Define if you have the gettext() function])
25 AH_TEMPLATE([SGML_CATALOG_FILES_DEFAULT],[set this to the default catalog files list])
26 AH_TEMPLATE([SGML_SEARCH_PATH_DEFAULT],[set this to the default SGML search path])
27 AH_TEMPLATE([SP_DECLARE_H_ERRNO],[define this if h_errno should be declared extern int])
28 AH_TEMPLATE([DECLARE_MEMMOVE],[define this if memmove should be declared extern "C"])
29 AH_TEMPLATE([DECLARE_STRERROR],[define this if strerror should be declared extern "C"])
30 AH_TEMPLATE([SP_HAVE_SOCKET],[define this if sockets are available])
31 AH_TEMPLATE([sig_atomic_t],[define this appropriately if the type sig_atomic_t is not available])
32 AH_TEMPLATE([SP_NEW_H_MISSING],[define this if your system misses new.h])
33 AH_TEMPLATE([SP_SET_NEW_HANDLER_EXTERN_C],[define this if set_new_handler() has to be declared extern "C"])
34 AC_DEFINE(SP_MULTI_BYTE,[1],[define this to build a multi-byte version])
35 AH_TEMPLATE([SP_DEFINE_TEMPLATES],[define this to include template definitions in the headers])
36 AH_TEMPLATE([SP_MANUAL_INST],[define this to compile explicit template instantiations])
37 AH_TEMPLATE([SP_FANCY_NEW_HANDLER],[define this if the new handler takes size_t and returns int.])
38 AH_TEMPLATE([PATH_SEPARATOR],[set this to the path separator])
39 AH_TEMPLATE([DEFAULT_ERROR_LIMIT],[if this is not set it defaults to 200 ])
40 AH_TEMPLATE([SP_USE_OWN_ASSERT],[define this if you can't or don't want to use the builtin assert() macro])
41 AH_TEMPLATE([SP_LINE_TERM1],[set this to the first line term character])
42 AH_TEMPLATE([SP_LINE_TERM2],[set this to the second line term character])
44 dnl These are really windows only
46 AH_TEMPLATE([SP_MUTEX_WIN32],[define this to use win32 mutex mechanisms])
47 AH_TEMPLATE([SP_HAVE_SETMODE],[define this if _setmode is supported])
48 AH_TEMPLATE([SP_NO_MESSAGE_TEXT],[define this to not compile message texts in])
49 AH_TEMPLATE([SP_USE_DLL],[define this to build a dll])
50 AH_TEMPLATE([SP_DLLEXPORT],[define this to build a dll])
51 AH_TEMPLATE([SP_DLLIMPORT],[define this tobuild a dll])
52 AH_TEMPLATE([SP_WIDE_SYSTEM],[define this if the OS provides wide character interfaces])
53 AH_TEMPLATE([SP_PCH],[define this to enable precompiled header support])
54 AH_TEMPLATE([SP_LOCALE_DIR],[the location we install our messages])
56 AH_TEMPLATE([SIZEOF_WCHAR_T],[size of wchar_t])
60 #define SP_INCLUDE_UNISTD_H
64 #undef SP_INCLUDE_IO_H
68 #undef SP_INCLUDE_OSFCN_H
71 #ifndef SP_MSDOS_FILENAMES
72 #define SP_POSIX_FILENAMES
75 #ifdef HAVE_ST_BLKSIZE
76 #define SP_STAT_BLKSIZE
83 #endif /* HAVE_BOOL */
86 #define SP_HAVE_TYPENAME
87 #endif /* HAVE_TYPENAME */
89 #if (SIZEOF_BOOL == 1)
90 #define SP_SIZEOF_BOOL_1
93 #if (SIZEOF_WCHAR_T == SIZEOF_UNSIGNED_SHORT)
94 #define SP_WCHAR_T_USHORT
97 #ifdef SP_HAVE_SETMODE
99 #define SP_LINE_TERM1 '\r'
100 #define SP_LINE_TERM2 '\n'
102 #endif /* not SP_HAVE_SETMODE */
104 #ifndef SP_LINE_TERM1
105 #define SP_LINE_TERM1 '\n'
108 #ifndef HAVE_NEW_FOR_SCOPING
109 // This simulates the new ANSI "for" scope rules
110 #define for if (0); else for
111 #endif /* HAVE_NEW_FOR_SCOPING */
113 #ifndef SP_HAVE_TYPENAME
114 #define typename /* as nothing */
118 #define SP_DLLEXPORT /* as nothing */
122 #define SP_DLLIMPORT /* as nothing */
128 #define SP_API SP_DLLEXPORT
130 #define SP_API SP_DLLIMPORT
133 #else /* not SP_USE_DLL */
135 #define SP_API /* as nothing */
137 #endif /* not SP_USE_DLL */
139 #ifdef SP_WIDE_SYSTEM
140 #ifndef SP_MULTI_BYTE
141 #define SP_MULTI_BYTE
145 #ifdef HAVE_NAMESPACES
146 #define SP_NAMESPACE OpenSP
147 #endif /* HAVE_NAMESPACES */
150 #define SP_NAMESPACE_SCOPE SP_NAMESPACE::
152 #define SP_NAMESPACE_SCOPE
153 #endif /* SP_NAMESPACE */
155 #ifdef HAVE_DYNAMIC_CAST
157 #endif /* HAVE_DYNAMIC_CAST */
159 #ifdef HAVE_PATHNAME_STYLE_DOS
160 #define SP_MSDOS_FILENAMES
162 #define SP_POSIX_FILENAMES
163 #endif /* HAVE_PATHNAME_STYLE_DOS */
165 #ifdef HAVE_INSTANTIATIONS
166 #ifndef SP_ANSI_CLASS_INST
167 #define SP_ANSI_CLASS_INST
169 #endif /* HAVE_INSTANTIATIONS */
171 #ifdef HAVE_SETLOCALE
172 #ifndef SP_HAVE_LOCALE
173 #define SP_HAVE_LOCALE
175 #endif /* HAVE_SETLOCALE */
177 #if defined(HAVE_GETTEXT) && defined(ENABLE_NLS)
178 #ifndef SP_HAVE_GETTEXT
179 #define SP_HAVE_GETTEXT
181 #endif /* HAVE_GETTEXT && ENABLE_NLS */
183 #ifdef WORDS_BIGENDIAN
184 #define SP_BIG_ENDIAN
185 #endif /* WORDS_BIGENDIAN */
187 #ifdef HAVE_LIBTHREADS
188 #define SP_MUTEX_MACH
189 #endif /* HAVE_LIBTHREADS */
191 #ifdef HAVE_LIBPTHREAD
192 #define SP_MUTEX_PTHREADS
193 #endif /* HAVE_LIBPTHREAD */
195 #ifdef HAVE_PLACEMENT_OPERATOR_DELETE
196 #define SP_HAVE_PLACEMENT_OPERATOR_DELETE
197 #endif /* HAVE_PLACEMENT_OPERATOR_DELETE */
199 #ifndef HAVE_PLACEMENT_OPERATOR_NEW
200 #define SP_DECLARE_PLACEMENT_OPERATOR_NEW
201 #endif /* HAVE_PLACEMENT_OPERATOR_NEW */
203 #ifndef HAVE_NAMESPACE_STD
204 #define SP_NO_STD_NAMESPACE
205 #endif /* HAVE_NAMESPACE_STD */
207 #if defined(HAVE_NEW) && defined(HAVE_CASSERT)
208 #define SP_ANSI_LIB 1
209 #endif /* HAVE_NEW && HAVE_CASSERT */
213 #endif /* HAVE_MUTABLE */
216 dnl Since config.h gets included by user programs, we use special names
217 dnl for PACKAGE and VERSION.
218 AC_DEFINE_UNQUOTED(SP_PACKAGE, "$PACKAGE", [Package name])
219 AC_DEFINE_UNQUOTED(SP_VERSION, "$VERSION", [Package version])
221 dnl libosp current:revision:age
223 dnl AC_DEFINE_UNQUOTED(SP_LIBOSP_CUR, "$SP_LIBOSP_CUR", [libosp current])
224 AC_SUBST(SP_LIBOSP_CUR)
225 AC_SUBST(SP_LIBOSP_REV, 0)
226 AC_SUBST(SP_LIBOSP_AGE, 0)
228 dnl Check for programs.
236 AC_PATH_PROGS(PERL, perl, perl)
238 dnl Checks for libraries.
239 AC_CHECK_LIB(pthread,pthread_create,,AC_CHECK_LIB(threads,cthread_fork))
242 AM_GNU_GETTEXT_VERSION([0.14.5])
243 AC_CHECK_HEADERS(locale.h)
244 AC_DEFINE_DIR(SP_LOCALE_DIR, datadir/locale, [location of message catalogs])
245 SP_MESSAGE_DOMAIN="sp$SP_LIBOSP_CUR"
246 AC_DEFINE_UNQUOTED(SP_MESSAGE_DOMAIN, "$SP_MESSAGE_DOMAIN", [message domain])
247 AC_SUBST(SP_MESSAGE_DOMAIN)
249 dnl Checks for header files.
251 AC_CHECK_HEADERS(limits.h unistd.h io.h osfcn.h)
253 AC_CHECK_HEADERS(new cassert)
255 dnl Checks for typedefs, structures, and compiler characteristics.
258 AC_DIAGNOSE([obsolete],[AC_DIAGNOSE([obsolete],[AC_STRUCT_ST_BLKSIZE:
259 your code should no longer depend upon `HAVE_ST_BLKSIZE', but
260 `HAVE_STRUCT_STAT_ST_BLKSIZE'. Remove this warning and
261 the `AC_DEFINE' when you adjust the code.])
262 AC_CHECK_MEMBERS([struct stat.st_blksize],[AC_DEFINE(HAVE_ST_BLKSIZE, 1,
263 [Define to 1 if your `struct stat' has
264 `st_blksize'. Deprecated, use
265 `HAVE_STRUCT_STAT_ST_BLKSIZE' instead.])])
267 your code should no longer depend upon `HAVE_ST_BLKSIZE', but
268 `HAVE_STRUCT_STAT_ST_BLKSIZE'. Remove this warning and
269 the `AC_DEFINE' when you adjust the code.])
270 AC_CHECK_MEMBERS([struct stat.st_blksize],[AC_DEFINE(HAVE_ST_BLKSIZE, 1,
271 [Define if your `struct stat' has
272 `st_blksize'. Deprecated, use
273 `HAVE_STRUCT_STAT_ST_BLKSIZE' instead.])])
275 AC_CACHE_CHECK(for sig_atomic_t in signal.h,
276 ac_cv_have_sig_atomic_t,
277 AC_TRY_LINK([#include <signal.h>],sig_atomic_t x;,
278 ac_cv_have_sig_atomic_t=yes,
279 ac_cv_have_sig_atomic_t=no))
280 if test "$ac_cv_have_sig_atomic_t" = "no"
282 AC_CHECK_TYPE(sig_atomic_t,int)
284 AC_CHECK_SIZEOF(size_t)
285 AC_CHECK_SIZEOF(unsigned int)
286 AC_CHECK_SIZEOF(unsigned short)
287 AC_CHECK_SIZEOF(wchar_t,,[
291 if test "$ac_cv_cxx_bool" = yes; then
292 AC_CHECK_SIZEOF(bool)
296 AC_CXX_NEW_FOR_SCOPING
297 AC_CXX_PLACEMENT_OPERATOR_DELETE
300 AC_CXX_EXPLICIT_INSTANTIATIONS
301 AC_CACHE_CHECK(for placement operator new,
302 ac_cv_cxx_placement_operator_new,
303 [AC_TRY_COMPILE([#include <stddef.h>
319 ac_cv_cxx_placement_operator_new=yes,
320 ac_cv_cxx_placement_operator_new=no)
322 if test "$ac_cv_cxx_placement_operator_new" = yes; then
323 AC_DEFINE(HAVE_PLACEMENT_OPERATOR_NEW,1,
324 [define if placement operator new is declared])
326 AC_CACHE_CHECK(whether the C++ compiler supports the std namespace,
327 ac_cv_cxx_namespace_std,
334 std::set_new_handler(0);],
335 ac_cv_cxx_namespace_std=yes,
336 ac_cv_cxx_namespace_std=no)
338 if test "$ac_cv_cxx_namespace_std" = yes; then
339 AC_DEFINE(HAVE_NAMESPACE_STD,1,
340 [define if the C++ compiler supports the std namespace])
343 dnl FIXME these need tests for non-GNU compilers
344 AC_CACHE_CHECK(whether GNU C++ supports automatic template instantiation,
345 ac_cv_c_gnu_automatic_templates,
347 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 8)
351 ac_cv_c_gnu_automatic_templates=yes,
352 ac_cv_c_gnu_automatic_templates=no)
354 if test "$ac_cv_c_gnu_automatic_templates" = yes; then
355 AC_DEFINE(SP_DEFINE_TEMPLATES,1,
356 [define this to include template definitions in the headers])
358 AC_DEFINE(SP_MANUAL_INST,1,
359 [define this to compile explicit template instantiations])
360 CXXFLAGS="$CXXFLAGS -fno-implicit-templates"
362 AC_CACHE_CHECK(whether GNU C++ links with libg++ if we include new.h,
363 ac_cv_cxx_gnu_avoid_new_h,
365 #if (__GNUC__ == 2 && __GNUC_MINOR__ < 8)
369 ac_cv_cxx_gnu_avoid_new_h=yes,
370 ac_cv_cxx_gnu_avoid_new_h=no)
372 if test "$ac_cv_cxx_gnu_avoid_new_h" = yes; then
373 AC_DEFINE(SP_NEW_H_MISSING,1,
374 [define this if your system misses new.h])
375 AC_CACHE_CHECK(whether to declare set_new_handler extern "C",
376 ac_cv_cxx_new_handler_extern_c,
378 typedef void (*new_handler)();
379 new_handler set_new_handler(new_handler);],[
380 set_new_handler(0);],
381 ac_cv_cxx_new_handler_extern_c=no,
382 ac_cv_cxx_new_handler_extern_c=yes)
384 if test "$ac_cv_cxx_new_handler_extern_c" = yes; then
385 AC_DEFINE(SP_SET_NEW_HANDLER_EXTERN_C,1,
386 [define this if set_new_handler() has to be declared extern "C"])
390 AC_CACHE_CHECK(whether new_handler accepts size_t and returns int,
391 ac_cv_cxx_fancy_new_handler,
395 int oom(size_t) { }],[set_new_handler(oom);],
396 ac_cv_cxx_fancy_new_handler=yes,
397 ac_cv_cxx_fancy_new_handler=no)
399 if test "$ac_cv_cxx_fancy_new_handler" = yes; then
400 AC_DEFINE(SP_FANCY_NEW_HANDLER,1,
401 [define this if the new handler takes size_t and returns int])
404 dnl Checks for library functions.
405 AC_REPLACE_FUNCS(memmove memcmp strerror strtoul)
406 AC_CHECK_FUNCS(setlocale)
408 dnl Checks for system services.
409 ACX_CHECK_PATHNAME_STYLE_DOS
411 AC_MSG_CHECKING(whether to include support for http)
413 [ --enable-http include support for http],
417 AC_DEFINE(SP_HAVE_SOCKET,1,
418 [define this if sockets are available])
419 AC_CHECK_LIB(nsl,main,LIBS="$LIBS -lnsl")
420 AC_CHECK_LIB(socket,main,LIBS="$LIBS -lsocket")
421 AC_MSG_CHECKING(h_errno in netdb.h)
422 AC_EGREP_HEADER(h_errno,netdb.h,
424 AC_DEFINE(SP_DECLARE_H_ERRNO,1,
425 [define this if h_errno should be declared extern int])
431 AC_MSG_CHECKING(for default catalog)
432 AC_ARG_ENABLE(default-catalog,
433 [ --enable-default-catalog=pathlist
434 provide one or more default catalog files or
435 sysids, e.g. /usr/local/lib/sgml/catalog],
438 AC_MSG_RESULT($enableval)
439 AC_DEFINE_UNQUOTED(SGML_CATALOG_FILES_DEFAULT,"$enableval",
440 [set this to the default catalog files list])
445 AC_MSG_CHECKING(for default search path)
446 AC_ARG_ENABLE(default-search-path,
447 [ --enable-default-search-path=pathlist
448 provide a default value for SGML_SEARCH_PATH],
451 AC_MSG_RESULT($enableval)
452 AC_DEFINE_UNQUOTED(SGML_SEARCH_PATH_DEFAULT,"$enableval",
453 [set this to the default SGML search path])
458 AC_MSG_CHECKING(whether to include support for XML Formatted Messages)
459 AC_ARG_ENABLE(xml-messages,
460 [ --enable-xml-messages include support for XML Formatted Messages],
464 AC_DEFINE(SP_XML,1,[set this to enable XML Formatted Messages])
470 AC_MSG_CHECKING(whether to include DTDDECL support)
471 AC_ARG_ENABLE(dtddecl,
472 [ --disable-dtddecl disable support for DTDDECL catalog entries],
473 if test "$enableval" = "no"
481 if test "$DTDDECL" = "yes"
483 AC_DEFINE(SP_DTDDECL,1,[set this to enable DTDDECL support])
484 AM_CONDITIONAL(DTDDECL,true)
486 AM_CONDITIONAL(DTDDECL,false)
490 AC_CONFIG_FILES([${PACKAGE}-${VERSION}.spec:spec.in Makefile msggen.pl
491 lib/Makefile nsgmls/Makefile spent/Makefile
492 spam/Makefile sgmlnorm/Makefile sx/Makefile spcat/Makefile
493 include/Makefile include/config.h.old generic/Makefile doc/Makefile
494 pubtext/Makefile tests/Makefile unicode/Makefile intl/Makefile
498 AC_MSG_CHECKING([whether to build docs (man and html)])
499 AC_ARG_ENABLE(doc-build,
500 [ --disable-doc-build do not build docs from source],
501 if test "$enableval" = "no"
510 if test "$BUILDDOCS" = "yes"
512 AC_PATH_PROG(XMLTO, xmlto)
515 [could not find xmlto; set XMLTO or consider --disable-doc-build])
517 AC_SUBST(DOCSRC, docsrc)
518 AC_CONFIG_FILES(docsrc/Makefile)
522 AC_MSG_CHECKING([whether to build all docs (man, html, pdf, ps)])
523 AC_ARG_ENABLE(full-doc-build,
524 [ --enable-full-doc-build build all docs from source],
525 if test "$enableval" = "yes"
534 if test "$BUILDFULLDOCS" = "yes"
536 AC_PATH_PROG(PDF2PS, pdf2ps)
539 [could not find pdf2ps; set PDF2PS or consider --disable-doc-build])
541 AC_PATH_PROG(JADE, openjade jade)
545 [could not find openjade or jade; set JADE or consider --disable-doc-build])
547 AC_PATH_PROG(JADETEX, jadetex)
548 if test -z "$JADETEX"
551 [could not find jadetex; set JADETEX or consider --disable-doc-build])
553 AC_PATH_PROG(PDFJADETEX, pdfjadetex)
554 if test -z "$PDFJADETEX"
557 [could not find pdfjadetex; set PDFJADETEX or consider --disable-doc-build])
559 AC_SUBST(EXTRADOCS,["releasenotes.pdf releasenotes.ps"])