1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(dcmtk, 3.6.6, [bugs@dcmtk.org], [dcmtk-3.6.6], [http://www.dcmtk.org/])
3AC_PREREQ(2.60)
4AC_CONFIG_SRCDIR(Makefile.in)
5AC_CONFIG_HEADERS(include/dcmtk/config/osconfig.h)
6
7m4_include([stdcxx.m4])
8
9dnl -------------------------------------------------------
10dnl Additional Package Information
11dnl -------------------------------------------------------
12
13PACKAGE_VERSION_NUMBER=366
14PACKAGE_VERSION_SUFFIX=""
15PACKAGE_DATE="2021-01-14"
16AC_DEFINE_UNQUOTED(PACKAGE_VERSION_NUMBER,${PACKAGE_VERSION_NUMBER},[Define to the version number of this package.])
17AC_DEFINE_UNQUOTED(PACKAGE_VERSION_SUFFIX,"${PACKAGE_VERSION_SUFFIX}",[Define to the version suffix of this package.])
18AC_DEFINE_UNQUOTED(PACKAGE_DATE,"${PACKAGE_DATE}",[Define to the release date of this package.])
19
20AC_SUBST(PACKAGE_VERSION_NUMBER)
21AC_SUBST(PACKAGE_VERSION_SUFFIX)
22AC_SUBST(PACKAGE_DATE)
23
24dnl -------------------------------------------------------
25dnl Identify the host platform we're compiling for,
26dnl using config.guess and config.sub.
27dnl -------------------------------------------------------
28
29AC_CANONICAL_HOST
30AC_DEFINE_UNQUOTED(CANONICAL_HOST_TYPE, "${host}", [Define the canonical host system type as a string constant.])
31
32case "${host}" in
33	*-*-cygwin)
34	  BINEXT=".exe"
35	  ;;
36	*-*-mingw32)
37	  BINEXT=".exe"
38	  ;;
39	*)
40	  BINEXT=""
41	  ;;
42esac
43
44dnl -------------------------------------------------------
45dnl Configuration Utilities
46dnl -------------------------------------------------------
47
48if test "x$prefix" = xNONE ; then
49AC_DEFINE_UNQUOTED(DCMTK_PREFIX, "${ac_default_prefix}", [Define the DCMTK default path.])
50else
51AC_DEFINE_UNQUOTED(DCMTK_PREFIX, "${prefix}", [Define the DCMTK default path.])
52fi
53
54DATA_DIR="${datadir}"
55DATA_DIR=`(
56	test "$prefix" = NONE && prefix=${ac_default_prefix}
57	test "$exec_prefix" = NONE && exec_prefix=${prefix}
58	eval eval echo "$DATA_DIR"
59)`
60AC_DEFINE_UNQUOTED(DCM_DICT_DEFAULT_PATH, "${DATA_DIR}/dicom.dic", [Define the default data dictionary path for the dcmdata library package.])
61AC_DEFINE_UNQUOTED(DEFAULT_SUPPORT_DATA_DIR, "${DATA_DIR}/", [Define the default directory where support data files reside.])
62
63CONF_DIR="${sysconfdir}"
64CONF_DIR=`(
65	test "$prefix" = NONE && prefix=${ac_default_prefix}
66	test "$exec_prefix" = NONE && exec_prefix=${prefix}
67	eval echo "$CONF_DIR"
68)`
69AC_DEFINE_UNQUOTED(DEFAULT_CONFIGURATION_DIR, "${CONF_DIR}/", [Define the default directory where configuration files reside.])
70
71AH_VERBATIM([PATH_SEPARATOR], [/* Define path separator. */
72#define PATH_SEPARATOR '/'])
73
74AH_VERBATIM([ENVIRONMENT_PATH_SEPARATOR], [/* Define the environment variable path separator. */
75#ifndef ENVIRONMENT_PATH_SEPARATOR
76#define ENVIRONMENT_PATH_SEPARATOR ':'
77#endif])
78
79AH_VERBATIM([HAVE_EMPTY_ARGC_ARGV], [/* Define if your system cannot pass command line arguments into main() (e.g. Macintosh). */
80/* #undef HAVE_EMPTY_ARGC_ARGV */])
81
82AH_TOP([#ifndef OSCONFIG_H
83#define OSCONFIG_H
84
85/*
86** Define enclosures for include files with C linkage (mostly system headers)
87*/
88#ifdef __cplusplus
89#define BEGIN_EXTERN_C extern "C" {
90#define END_EXTERN_C }
91#else
92#define BEGIN_EXTERN_C
93#define END_EXTERN_C
94#endif
95
96/* MinGW needs some special handling because it is a mixture of WIN32 and Posix.
97 * The following settings are not tested by configure but need to be set for MinGW.
98 */
99#ifdef __MINGW32__
100#define HAVE_WINDOWS_H 1
101#define HAVE_WINSOCK_H 1
102#define ENVIRONMENT_PATH_SEPARATOR ';'
103#endif])
104
105AH_BOTTOM([#if defined(HAVE_CXX11) && defined(__cplusplus) && __cplusplus < 201103L
106#error\
107DCMTK was configured to use C++11 features, but your compiler does not or was not configured to provide them.
108#endif
109
110#endif /* OSCONFIG_H */])
111
112
113dnl Include general file
114sinclude(general.m4)dnl
115
116AC_CONFIG_AUX_DIR([.])
117
118dnl Checks for programs.
119
120AC_PROG_INSTALL
121AC_PROG_CC
122AC_PROG_CPP
123AC_CHECK_PROGS(CXX, $CCC c++ cc++ g++ gcc CC cxx, gcc)
124
125pedantic=""
126if test -f /bin/uname ; then
127	os=`uname -s`
128	rev=`uname -r`
129	if test \( "$os" = SunOS \) ; then
130		case "$rev" in
131			# only use the -pedantic compiler option on
132			# Solaris 2 machines.
133			5.*) pedantic="-pedantic" ;;
134		esac
135	fi
136fi
137if test "${CXXFLAGS}set" = set ; then
138	case "$CXX" in
139		c++|g++|gcc)
140		  CXXFLAGS="-Wall $pedantic"
141		  CFLAGS="-Wall $pedantic"
142		  ;;
143		cc++)
144		  CXXFLAGS="-Wall"
145		  CFLAGS="-Wall"
146		  ;;
147		*)
148		  CXXFLAGS=""
149		  CFLAGS=""
150		  ;;
151	esac
152fi
153
154AC_PROG_CXXCPP
155dnl The next test is equivalent to AC_PROG_RANLIB
156dnl Do not use AC_PROG_RANLIB because this produces
157dnl an error on LINUX-systems in the configure script
158AC_CHECK_PROGS(RANLIB, ranlib, :)
159
160dnl Check for "ar" and "libtool". On certain systems, e.g. NeXTStep, we must
161dnl prefer "libtool" over "ar" if both are present. However, we don't use
162dnl GNU libtool at the moment which is something completely different
163dnl (not an "ar" replacement).
164AC_CHECK_PROGS(AR, ar, :)
165AC_CHECK_PROGS(LIBTOOL, libtool, :)
166if test "${LIBTOOL}set" = libtoolset ; then
167  AC_CHECK_GNU_LIBTOOL
168  if test $ac_cv_check_gnu_libtool = yes ; then
169    :
170  else
171    AR=$LIBTOOL
172  fi
173fi
174
175case "$AR" in
176libtool) ARFLAGS=-o ;;
177ar) ARFLAGS=cruv ;;
178esac
179
180if test "${LIBEXT}set" = set ; then
181	LIBEXT="a"
182fi
183
184AC_SUBST(ARFLAGS)
185AC_SUBST(LIBEXT)
186AC_SUBST(BINEXT)
187
188# Try to find a strip utility
189AC_CHECK_PROGS(STRIP, strip, :)
190
191dnl -------------------------------------------------------
192dnl Check special systems
193dnl -------------------------------------------------------
194
195AC_AIX
196AC_ISC_POSIX
197AC_SYS_LONG_FILE_NAMES
198
199dnl -------------------------------------------------------
200dnl Perform some tests with the C compiler, needed for dcmjpeg
201dnl -------------------------------------------------------
202
203AC_MY_C_INLINE
204AC_MY_C_CONST
205AC_MY_C_CHAR_UNSIGNED
206AC_MY_C_RIGHTSHIFT_UNSIGNED
207
208dnl -------------------------------------------------------
209dnl Check some typedefs versus definitions in <sys/types.h>,
210dnl needed for JasPer support
211dnl -------------------------------------------------------
212
213AC_TYPEDEF(uchar, unsigned char)
214AC_TYPEDEF(ushort, unsigned short)
215AC_TYPEDEF(uint, unsigned int)
216AC_TYPEDEF(ulong, unsigned long)
217AC_CHECK_TYPES(longlong)
218AC_CHECK_TYPES(ulonglong)
219AC_CHECK_TYPES(long long)
220AC_CHECK_TYPES(unsigned long long)
221CHECK_VLA
222
223dnl File access stuff
224AC_CHECK_TYPES(fpos64_t)
225AC_CHECK_TYPES(off64_t)
226
227dnl stdbool.h and stdint.h are only defined in ANSI C, not in C++
228AC_CHECK_HEADERS(stdbool.h)
229AC_CHECK_HEADERS(stdint.h)
230AC_CHECK_HEADERS(cstdint)
231
232AC_CHECK_TYPES(int64_t)
233AC_CHECK_TYPES(uint64_t)
234
235AC_CHECK_TYPES(char16_t)
236
237AC_CHECK_TYPES([sigjmp_buf], [], [], [[#include <setjmp.h>]])
238
239dnl -------------------------------------------------------
240dnl Checks for libc library functions.
241dnl -------------------------------------------------------
242
243AC_FUNC_MEMCMP
244AC_FUNC_VPRINTF
245AC_TYPE_SIGNAL
246AC_FUNC_WAIT3
247AC_CHECK_FUNCS(gethostname gethostid socket sysinfo)
248AC_CHECK_FUNCS(strchr strstr strtoul itoa atoll)
249AC_CHECK_FUNCS(memcpy memset memmove memcmp bcopy bcmp)
250AC_CHECK_FUNCS(getpid mktemp tempnam tmpnam getenv mkstemp)
251AC_CHECK_FUNCS(stat)
252AC_CHECK_FUNCS(malloc_debug)
253AC_CHECK_FUNCS(strerror strdup bzero index rindex access)
254AC_CHECK_FUNCS(uname cuserid getlogin getlogin_r)
255AC_CHECK_FUNCS(usleep)
256AC_CHECK_FUNCS(flock lockf)
257AC_CHECK_FUNCS(listen connect setsockopt getsockopt select)
258AC_CHECK_FUNCS(gethostbyname gethostbyname_r)
259AC_CHECK_FUNCS(gethostbyaddr_r getgrnam_r getpwnam_r)
260AC_CHECK_FUNCS(bind accept getsockname getaddrinfo)
261AC_CHECK_FUNCS(getrusage)
262AC_CHECK_FUNCS(gettimeofday)
263AC_CHECK_FUNCS(waitpid)
264AC_CHECK_FUNCS(getuid geteuid setuid getpwnam getgrnam)
265AC_CHECK_FUNCS(sleep fork)
266AC_CHECK_FUNCS(_findfirst)
267AC_CHECK_FUNCS(strlcpy strlcat)
268AC_CHECK_FUNCS(vsnprintf)
269AC_CHECK_FUNCS(mbstowcs wcstombs)
270AC_CHECK_FUNCS(popen pclose)
271AC_CHECK_FUNCS(readdir_r)
272AC_FUNC_FSEEKO
273
274
275dnl -------------------------------------------------------
276dnl Checks for libcs library functions needed by oflog
277dnl -------------------------------------------------------
278
279AC_DEFUN([TYPE_SOCKLEN_T],
280[
281AH_TEMPLATE([socklen_t], [Define to int if undefined.])
282AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t,
283[
284  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
285   #include <sys/socket.h>]], [[socklen_t len = 42; return 0;]])],[ac_cv_type_socklen_t=yes],[ac_cv_type_socklen_t=no])
286])
287  if test $ac_cv_type_socklen_t != yes; then
288    AC_DEFINE(socklen_t, int)
289  fi
290])
291
292AC_CHECK_FUNCS(ftime gmtime_r localtime_r lstat nanosleep fcntl)
293AC_CHECK_FUNCS(htons htonl ntohs ntohl)
294AC_CHECK_HEADERS(netinet/in.h)
295AC_CHECK_HEADERS(syslog.h)
296TYPE_SOCKLEN_T
297
298AH_TEMPLATE([HAVE_ENAMETOOLONG])
299AC_COMPILE_IFELSE(
300  [AC_LANG_PROGRAM([#include <errno.h>], [int value = ENAMETOOLONG;])],
301  [AC_DEFINE([HAVE_ENAMETOOLONG], , [Define if your system provides ENAMETOOLONG errno value.])])
302
303dnl -------------------------------------------------------
304dnl Checks for libm library functions.
305dnl -------------------------------------------------------
306
307SAVELIBS="$LIBS"
308LIBS="$LIBS -lm"
309AC_CHECK_FUNCS(finite isinf isnan)
310LIBS="$SAVELIBS"
311
312dnl -------------------------------------------------------
313dnl Perform remaining tests with C++ compiler
314dnl -------------------------------------------------------
315AC_LANG(C++)
316
317AC_CXX_CONST_CAST
318AC_CXX_DYNAMIC_CAST
319AC_CXX_REINTERPRET_CAST
320AC_CXX_STATIC_CAST
321AC_CXX_STD_NOTHROW
322AC_CXX_NOTHROW_DELETE
323AC_CXX_STATIC_ASSERT
324
325dnl -------------------------------------------------------
326dnl Check for Debug Mode
327dnl -------------------------------------------------------
328
329DEBUG="-DNDEBUG"
330DEBUGCXXFLAGS=
331DEBUGCFLAGS=
332AC_MSG_CHECKING(whether to compile in debug mode)
333AC_ARG_ENABLE(debug,
334[  --enable-debug          compile with debug code, don't optimize
335  --disable-debug         compile without debug code (default)],
336[ case "$enableval" in
337  yes)
338    AC_MSG_RESULT(yes)
339    DEBUGCXXFLAGS="-g"
340    DEBUGCFLAGS="-g"
341    DEBUG="-DDEBUG"
342    ;;
343  *)
344    AC_MSG_RESULT(no)
345    DEBUGCXXFLAGS="-O"
346    DEBUGCFLAGS="-O"
347    ;;
348  esac ],
349  AC_MSG_RESULT(no)
350  DEBUGCXXFLAGS="-O"
351  DEBUGCFLAGS="-O"
352)
353
354dnl -------------------------------------------------------
355dnl Check for thread support
356dnl -------------------------------------------------------
357
358THREADSUPPORT="auto"
359AC_MSG_CHECKING(whether to enable thread support)
360AC_ARG_ENABLE(threads,
361[  --enable-threads=TYPE   compile with MT support (posix/solaris/auto=default)
362  --disable-threads       compile without MT support],
363[ case "$enableval" in
364  yes|auto)
365    AC_MSG_RESULT(automatic detection)
366    ;;
367  posix)
368    AC_MSG_RESULT([yes, type=posix])
369    THREADSUPPORT="posix"
370    ;;
371  solaris)
372    AC_MSG_RESULT([yes, type=solaris])
373    THREADSUPPORT="solaris"
374    ;;
375  no)
376    AC_MSG_RESULT(no)
377    THREADSUPPORT="no"
378    ;;
379  *)
380    AC_MSG_RESULT([yes - type $enableval is unknown - using automatic detection])
381    ;;
382  esac ],
383  AC_MSG_RESULT(automatic detection)
384)
385
386dnl -------------------------------------------------------
387dnl Check for large file support
388dnl -------------------------------------------------------
389
390LFSSUPPORT="auto"
391AC_MSG_CHECKING(whether to enable large file support)
392AC_ARG_ENABLE(lfs,
393[  --enable-lfs=TYPE       compile with LFS support (lfs/lfs64/auto=default)
394  --disable-lfs           compile without LFS support],
395[ case "$enableval" in
396  yes|auto)
397    AC_MSG_RESULT(automatic detection)
398    ;;
399  lfs)
400    AC_MSG_RESULT([yes, type=LFS])
401    LFSSUPPORT="lfs"
402    ;;
403  lfs64)
404    AC_MSG_RESULT([yes, type=LFS64])
405    LFSSUPPORT="lfs64"
406    ;;
407  no)
408    AC_MSG_RESULT(no)
409    LFSSUPPORT="no"
410    ;;
411  *)
412    AC_MSG_RESULT([yes - type $enableval is unknown - using automatic detection])
413    ;;
414  esac ],
415  AC_MSG_RESULT(automatic detection)
416)
417
418dnl -------------------------------------------------------
419dnl Checks for libraries.
420dnl -------------------------------------------------------
421
422AC_CHECK_GXXLIB
423AC_CHECK_LIB(iostream, main)
424dnl Some C++ compilers have problems with recursive main calls
425dnl (e.g. Sun C++ 4.2). In this case we must test another function
426dnl to link.
427AC_CHECK_LIB(nsl, main)
428if test $ac_cv_lib_nsl_main = no ; then
429AC_CHECK_LIB(nsl, gethostbyname)
430fi
431AC_CHECK_LIB(socket, main)
432if test $ac_cv_lib_socket_main = no ; then
433AC_CHECK_LIB(socket, socket)
434fi
435
436dnl Some newer versions of OpenSSL must be linked against libdl.
437dnl We just check whether libdl exists and in this case always
438dnl add -ldl to OPENSSLLIBS. The same applies for OPENJPEG.
439OPENSSLLIBS=""
440OPENJPEGLIBS=""
441AC_CHECK_LIB(dl, main,[
442OPENSSLLIBS="-ldl"
443OPENJPEGLIBS="-ldl"
444])
445if test $ac_cv_lib_dl_main = no ; then
446AC_CHECK_LIB(dl, dlopen,[
447OPENSSLLIBS="-ldl"
448OPENJPEGLIBS="-ldl"
449])
450fi
451
452MATHLIBS=""
453AC_CHECK_LIB(m, main,[
454MATHLIBS="-lm"
455])
456if test $ac_cv_lib_m_main = no ; then
457AC_CHECK_LIB(m, sin,[
458MATHLIBS="-lm"
459])
460fi
461
462dnl On MinGW we have to link against the winsock32 library
463dnl
464AC_CHECK_LIB(wsock32, main,[
465LIBS="$LIBS -lwsock32"
466])
467
468dnl On MinGW we have to link against the netapi32 library
469dnl
470AC_CHECK_LIB(netapi32, main,[
471LIBS="$LIBS -lnetapi32"
472])
473
474dnl -------------------------------------------------------
475dnl Checks for header files.
476dnl -------------------------------------------------------
477
478AC_HEADER_STDC
479AC_HEADER_SYS_WAIT
480AC_HEADER_DIRENT
481AC_CHECK_TCP_H
482AC_CHECK_HEADERS(alloca.h)
483AC_CHECK_HEADERS(arpa/inet.h)
484AC_CHECK_HEADERS(assert.h)
485AC_CHECK_HEADERS(ctype.h)
486AC_CHECK_HEADERS(errno.h)
487AC_CHECK_HEADERS(fcntl.h)
488AC_CHECK_HEADERS(float.h)
489AC_CHECK_HEADERS(fnmatch.h)
490AC_CHECK_HEADERS(fstream)
491AC_CHECK_HEADERS(fstream.h)
492AC_CHECK_HEADERS(grp.h)
493AC_CHECK_HEADERS(ieeefp.h)
494AC_CHECK_HEADERS(io.h)
495AC_CHECK_HEADERS(iomanip)
496AC_CHECK_HEADERS(iomanip.h)
497AC_CHECK_HEADERS(iostream)
498AC_CHECK_HEADERS(iostream.h)
499AC_CHECK_HEADERS(iso646.h)
500AC_CHECK_HEADERS(libc.h)
501AC_CHECK_HEADERS(limits.h)
502AC_CHECK_HEADERS(climits)
503AC_CHECK_HEADERS(locale.h)
504AC_CHECK_HEADERS(malloc.h)
505AC_CHECK_HEADERS(math.h)
506AC_CHECK_HEADERS(cmath)
507AC_CHECK_HEADERS(new)
508AC_CHECK_HEADERS(new.h)
509AC_CHECK_HEADERS(netdb.h)
510AC_CHECK_HEADERS(pthread.h)
511AC_CHECK_HEADERS(pwd.h)
512AC_CHECK_HEADERS(semaphore.h)
513AC_CHECK_HEADERS(setjmp.h)
514AC_CHECK_HEADERS(signal.h)
515AC_CHECK_HEADERS(sstream)
516AC_CHECK_HEADERS(sstream.h)
517AC_CHECK_HEADERS(stat.h)
518AC_CHECK_HEADERS(cstdarg)
519AC_CHECK_HEADERS(stdarg.h)
520AC_CHECK_HEADERS(stddef.h)
521AC_CHECK_HEADERS(cstddef)
522AC_CHECK_HEADERS(cstdio)
523AC_CHECK_HEADERS(stdio.h)
524AC_CHECK_HEADERS(stdint.h)
525AC_CHECK_HEADERS(stdlib.h)
526AC_CHECK_HEADERS(streambuf.h)
527AC_CHECK_HEADERS(string.h)
528AC_CHECK_HEADERS(strings.h)
529AC_CHECK_HEADERS(strstrea.h)
530AC_CHECK_HEADERS(strstream)
531AC_CHECK_HEADERS(strstream.h)
532AC_CHECK_HEADERS(synch.h)
533AC_CHECK_HEADERS(sys/errno.h)
534AC_CHECK_HEADERS(sys/file.h)
535AC_CHECK_HEADERS(sys/param.h)
536AC_CHECK_HEADERS(sys/resource.h)
537AC_CHECK_HEADERS(sys/select.h)
538AC_CHECK_HEADERS(sys/socket.h)
539AC_CHECK_HEADERS(sys/stat.h)
540AC_CHECK_HEADERS(sys/syscall.h)
541AC_CHECK_HEADERS(sys/systeminfo.h)
542AC_CHECK_HEADERS(sys/time.h)
543AC_CHECK_HEADERS(sys/timeb.h)
544AC_CHECK_HEADERS(sys/types.h)
545AC_CHECK_HEADERS(sys/utime.h)
546AC_CHECK_HEADERS(sys/utsname.h)
547AC_CHECK_HEADERS(thread.h)
548AC_CHECK_HEADERS(time.h)
549AC_CHECK_HEADERS(unistd.h)
550AC_CHECK_HEADERS(unix.h)
551AC_CHECK_HEADERS(utime.h)
552AC_CHECK_HEADERS(wchar.h)
553AC_CHECK_HEADERS(wctype.h)
554AC_CHECK_HEADERS(fenv.h)
555AC_CHECK_HEADER(iterator,
556    [AC_DEFINE([HAVE_ITERATOR_HEADER], 1, [Define to 1 if you have the <iterator> header file.])]
557)
558
559AC_CHECK_POLL_H
560
561if test $ac_cv_header_libc_h = yes ; then
562  if test $ac_cv_header_math_h = yes ; then
563    AC_CXX_LIBC_H_EXTERN_C
564  fi
565fi
566
567dnl -------------------------------------------------------
568dnl Tests for pointer vs. integer types
569dnl These tests REQUIRE as a prerequisite AC_CXX_STATIC_CAST
570dnl -------------------------------------------------------
571
572if test $ac_cv_header_pthread_h = yes ; then
573  AC_CHECK_POINTER_TYPE(pthread_t, pthread.h)
574fi
575
576dnl -------------------------------------------------------
577dnl Check for thread support
578dnl -------------------------------------------------------
579
580dnl
581dnl in auto mode, check whether we use solaris or posix threads
582dnl
583if test $THREADSUPPORT = auto ; then
584  if test $ac_cv_header_synch_h = yes ; then
585    THREADSUPPORT="solaris"
586  fi
587fi
588if test $THREADSUPPORT = auto ; then
589  if test $ac_cv_header_pthread_h = yes ; then
590    THREADSUPPORT="posix"
591  fi
592fi
593if test $THREADSUPPORT = auto ; then
594  THREADSUPPORT="no"
595fi
596
597dnl
598dnl in solaris mode, check for -lthread
599dnl
600
601if test $THREADSUPPORT = solaris ; then
602  AC_CHECK_LIB(thread, sema_init, [
603  ac_tr_lib=HAVE_LIBTHREAD
604  AC_DEFINE_UNQUOTED($ac_tr_lib)
605  LIBS="-lthread $LIBS"
606  ])
607fi
608
609if test $THREADSUPPORT = posix ; then
610  dnl
611  dnl check Posix MT libraries -lrt and -lpthread
612  dnl OSF/1 re-#defines most of the pthread function names.
613  dnl This is why we use pthread_key_create for the test.
614  dnl
615  AC_CHECK_LIB(pthread, pthread_key_create, [
616  ac_tr_lib=HAVE_LIBPTHREAD
617  AC_DEFINE_UNQUOTED($ac_tr_lib)
618  LIBS="-lpthread $LIBS"
619  ])
620
621  AC_CHECK_LIB(rt, sem_init, [
622  ac_tr_lib=HAVE_LIBRT
623  AC_DEFINE_UNQUOTED($ac_tr_lib)
624  LIBS="-lrt $LIBS"
625  ], , $LIBS )
626
627  dnl
628  dnl check whether the compiler required the -pthread option
629  dnl to correctly link code containing posix thread calls.
630  dnl This is true on FreeBSD.
631  dnl
632  AC_CHECK_PTHREAD_OPTION
633
634  dnl
635  dnl check whether Posix read/write locks are available
636  dnl
637  POSIXRWLOCKSAVAILABLE="no"
638  AC_CHECK_LIB(pthread, pthread_rwlock_init, [
639    AC_DEFINE(HAVE_PTHREAD_RWLOCK, , [Define if your system supports POSIX read/write locks.])
640    dnl
641    dnl we're going to use POSIX threads with read/write locks.
642    dnl Linux 2.2.x only declares all prototypes if _XOPEN_SOURCE=500 and _BSD_SOURCE
643    dnl OSF/1 requires _XOPEN_SOURCE=500, _XOPEN_SOURCE_EXTENDED, _OSF_SOURCE and _POSIX_C_SOURCE=199506L
644    dnl Irix 6.x does not like _XOPEN_SOURCE=500 and _POSIX_C_SOURCE=199506L
645    dnl
646    POSIXRWLOCKSAVAILABLE="yes"
647    case "${host}" in
648	mips-sgi-irix6*)
649	  CXXFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT $CXXFLAGS"
650	  CFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT $CFLAGS"
651	  ;;
652	*-*-openbsd3*)
653	  CXXFLAGS="-D_POSIX_C_SOURCE=199506L $CXXFLAGS"
654	  CFLAGS="-D_POSIX_C_SOURCE=199506L $CFLAGS"
655	  ;;
656	*-*-openbsd4*)
657	  ;;
658	*-*-openbsd5*)
659	  ;;
660	*-*-freebsd*)
661	  ;;
662	*-*-netbsdelf2*)
663	  ;;
664	*-*-netbsd*)
665	  CXXFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_NETBSD_SOURCE -D_BSD_COMPAT $CXXFLAGS"
666	  CFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_NETBSD_SOURCE -D_BSD_COMPAT $CFLAGS"
667	  ;;
668	*-*-darwin*)
669	  dnl On Mac OS X we need to have _DARWIN_C_SOURCE defined to enable UNIX standard API for system headers
670	  CXXFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_DARWIN_C_SOURCE $CXXFLAGS"
671	  CFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_DARWIN_C_SOURCE $CXXFLAGS"
672	  ;;
673	*)
674	  CXXFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L $CXXFLAGS"
675	  CFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L $CFLAGS"
676	  ;;
677    esac
678  ],
679  [
680    dnl
681    dnl We did not find pthread_rwlock_init in libpthread. Maybe it is somewhere else, e.g. in libc_r on FreeBSD.
682    dnl We give it another try by just linking against the default libraries.
683    dnl
684    AC_MSG_CHECKING(for pthread_rwlock_init in default libraries)
685    AC_TRY_LINK([extern "C" int pthread_rwlock_init(void *rwlock, void *attr);
686      ] , [(void) pthread_rwlock_init(NULL, NULL);], [
687    AC_MSG_RESULT(yes)
688    AC_DEFINE(HAVE_PTHREAD_RWLOCK, , [Define if your system supports POSIX read/write locks.])
689    dnl
690    dnl we're going to use POSIX threads with read/write locks.
691    dnl Linux 2.2.x only declares all prototypes if _XOPEN_SOURCE=500 and _BSD_SOURCE
692    dnl OSF/1 requires _XOPEN_SOURCE=500, _XOPEN_SOURCE_EXTENDED, _OSF_SOURCE and _POSIX_C_SOURCE=199506L
693    dnl Irix 6.x does not like _XOPEN_SOURCE=500 and _POSIX_C_SOURCE=199506L
694    dnl
695    POSIXRWLOCKSAVAILABLE="yes"
696    case "${host}" in
697	mips-sgi-irix6*)
698	  CXXFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT $CXXFLAGS"
699	  CFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT $CFLAGS"
700	  ;;
701	*-*-openbsd3*)
702	  CXXFLAGS="-D_POSIX_C_SOURCE=199506L $CXXFLAGS"
703	  CFLAGS="-D_POSIX_C_SOURCE=199506L $CFLAGS"
704	  ;;
705	*-*-openbsd4*)
706	  ;;
707	*-*-openbsd5*)
708	  ;;
709	*-*-freebsd*)
710	  ;;
711	*-*-netbsdelf2*)
712	  ;;
713	*-*-netbsd*)
714	  CXXFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_NETBSD_SOURCE -D_BSD_COMPAT $CXXFLAGS"
715	  CFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_NETBSD_SOURCE -D_BSD_COMPAT $CFLAGS"
716	  ;;
717	*-*-darwin*)
718	  dnl On Mac OS X we need to have _DARWIN_C_SOURCE source defined to enable UNIX standard API for system headers
719	  CXXFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_DARWIN_C_SOURCE $CXXFLAGS"
720	  CFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_BSD_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_DARWIN_C_SOURCE $CXXFLAGS"
721	  ;;
722	*)
723	  CXXFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L $CXXFLAGS"
724	  CFLAGS="-D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L $CFLAGS"
725	  ;;
726    esac
727    ], AC_MSG_RESULT(no))
728  ]
729  )
730fi
731
732AC_MSG_CHECKING(multi-thread support)
733case "$THREADSUPPORT" in
734  solaris)
735    AC_MSG_RESULT([yes, solaris threads])
736    CXXFLAGS="-D_REENTRANT $CXXFLAGS"
737    CFLAGS="-D_REENTRANT $CFLAGS"
738    AC_DEFINE(WITH_THREADS, , [Define if we are compiling with any type of multi-thread support.])
739    ;;
740  posix)
741    if test $POSIXRWLOCKSAVAILABLE = yes ; then
742      AC_MSG_RESULT([yes, posix threads with rwlock])
743    else
744      AC_MSG_RESULT([yes, posix threads without rwlock])
745    fi
746    CXXFLAGS="-D_REENTRANT $CXXFLAGS"
747    CFLAGS="-D_REENTRANT $CFLAGS"
748    AC_DEFINE(WITH_THREADS, , [Define if we are compiling with any type of multi-thread support.])
749    ;;
750  *)
751    AC_MSG_RESULT(none)
752    ;;
753esac
754
755dnl -------------------------------------------------------
756dnl Check for LFS support
757dnl -------------------------------------------------------
758
759if test $LFSSUPPORT = auto -o $LFSSUPPORT = lfs64; then
760  AC_LFS64
761  if test $ac_cv_lfs64_support = yes ; then
762    LFSSUPPORT="lfs64"
763  fi
764fi
765
766if test $LFSSUPPORT = auto -o $LFSSUPPORT = lfs; then
767  MY_AC_SYS_LARGEFILE
768fi
769
770dnl -------------------------------------------------------
771dnl Checks for typedefs, structures, and compiler characteristics.
772dnl -------------------------------------------------------
773
774AC_TYPEDEF(size_t, unsigned)
775AC_TYPEDEF(ssize_t, long)
776AC_TYPEDEF(pid_t, int)
777AC_C_CHAR_UNSIGNED
778AC_CHECK_SIZEOF(char)
779AC_CHECK_SIZEOF(short)
780AC_CHECK_SIZEOF(int)
781AC_CHECK_SIZEOF(long)
782AC_CHECK_SIZEOF(float)
783AC_CHECK_SIZEOF(double)
784AC_CHECK_SIZEOF(void *)
785AC_STRUCT_TM
786AC_MY_SYMBOL_EXISTS([__FUNCTION__])
787AC_MY_SYMBOL_EXISTS([__PRETTY_FUNCTION__])
788AC_MY_SYMBOL_EXISTS([__func__])
789
790dnl -------------------------------------------------------
791dnl Checks for prototypes
792dnl -------------------------------------------------------
793dnl
794dnl The following AC_CHECK_* macros _must_ have corresponding entries in
795dnl the acconfig.h file.  This is because the macros are specific to the
796dnl DCMTK project and are not supported by GNU autoheader.
797
798AC_CHECK_PROTOTYPE(feenableexcept, fenv.h)
799AC_CHECK_PROTOTYPE(_stricmp, string.h)
800AC_CHECK_PROTOTYPE(accept, sys/types.h sys/socket.h)
801if test $ac_cv_prototype_accept = yes ; then
802AC_CHECK_INTP_ACCEPT(sys/types.h sys/socket.h)
803fi
804AC_CHECK_PROTOTYPE(bind, sys/types.h sys/socket.h)
805AC_CHECK_PROTOTYPE(bzero, string.h strings.h libc.h unistd.h stdlib.h)
806AC_CHECK_PROTOTYPE(connect, sys/types.h sys/socket.h)
807AC_CHECK_PROTOTYPE(finite, math.h)
808AC_CHECK_PROTOTYPE(isinf, math.h)
809AC_CHECK_PROTOTYPE(isnan, math.h)
810AC_CHECK_PROTOTYPE(std::finite, cmath)
811AC_CHECK_PROTOTYPE(std::isinf, cmath)
812AC_CHECK_PROTOTYPE(std::isnan, cmath)
813AC_CHECK_PROTOTYPE(flock, sys/file.h)
814AC_CHECK_PROTOTYPE(gethostbyname, libc.h unistd.h stdlib.h netdb.h)
815AC_CHECK_PROTOTYPE(gethostbyname_r, libc.h unistd.h stdlib.h netdb.h)
816AC_CHECK_PROTOTYPE(gethostbyaddr_r, libc.h unistd.h stdlib.h netdb.h)
817AC_CHECK_PROTOTYPE(gethostid, libc.h unistd.h stdlib.h netdb.h)
818AC_CHECK_PROTOTYPE(gethostname, unistd.h libc.h stdlib.h netdb.h)
819AC_CHECK_PROTOTYPE(getsockname, sys/types.h sys/socket.h)
820AC_CHECK_PROTOTYPE(getsockopt, sys/types.h sys/socket.h)
821AC_CHECK_PROTOTYPE(strerror_r, string.h)
822if test $ac_cv_prototype_strerror_r = yes ; then
823AC_CHECK_CHARP_STRERROR_R(string.h)
824fi
825if test $ac_cv_prototype_getsockopt = yes ; then
826AC_CHECK_INTP_GETSOCKOPT(sys/types.h sys/socket.h)
827fi
828AC_CHECK_PROTOTYPE(gettimeofday, sys/time.h unistd.h)
829AC_CHECK_PROTOTYPE(listen, sys/types.h sys/socket.h)
830AC_CHECK_PROTOTYPE(mktemp, libc.h unistd.h stdlib.h)
831AC_CHECK_PROTOTYPE(mkstemp, libc.h unistd.h stdlib.h)
832AC_CHECK_PROTOTYPE(select, sys/select.h sys/types.h sys/socket.h sys/time.h)
833if test $ac_cv_prototype_select = yes ; then
834AC_CHECK_INTP_SELECT(sys/select.h sys/types.h sys/socket.h sys/time.h)
835fi
836AC_CHECK_PROTOTYPE(setsockopt, sys/types.h sys/socket.h)
837AC_CHECK_PROTOTYPE(socket, sys/types.h sys/socket.h)
838AC_CHECK_PROTOTYPE(strcasecmp, string.h)
839AC_CHECK_PROTOTYPE(strncasecmp, string.h)
840AC_CHECK_PROTOTYPE(usleep, libc.h unistd.h stdlib.h)
841AC_CHECK_PROTOTYPE(vsnprintf, stdio.h stdarg.h)
842AC_CHECK_PROTOTYPE(wait3, libc.h sys/wait.h sys/time.h sys/resource.h)
843AC_CHECK_PROTOTYPE(waitpid, sys/wait.h sys/time.h sys/resource.h)
844AC_CHECK_DECLARATION(struct utimbuf, sys/types.h utime.h sys/utime.h)
845AC_CHECK_DECLARATION(socklen_t, sys/types.h sys/socket.h)
846AC_CHECK_OLD_READDIR_R
847AC_CHECK_ELLIPSE_SIGNAL_HANDLER(signal.h)
848if test $ac_cv_header_math_h = yes ; then
849AC_INCLUDE_MATH_H_AS_CXX
850fi
851
852
853dnl -------------------------------------------------------
854dnl Checks for the usage of standard C++ headers.
855dnl -------------------------------------------------------
856
857AC_MSG_CHECKING(whether to use C++ standard includes)
858ac_use_std_includes="auto"
859AC_ARG_ENABLE(std-includes,
860[  --enable-std-includes   use C++ ANSI standard includes (default: auto)
861  --disable-std-includes  use old C++ includes ],
862[ case "$enableval" in
863  yes)
864   ac_use_std_includes="yes"
865   ;;
866
867  *)
868    ac_use_std_includes="no"
869    ;;
870  esac ]
871)
872
873if test "$ac_cv_header_fstream" = "yes" -a "$ac_cv_header_iostream" = "yes" -a "$ac_cv_header_iomanip" = "yes"; then
874   ac_have_std_includes="yes"
875else
876   ac_have_std_includes="no"
877fi
878
879if test "$ac_cv_header_fstream_h" = "yes" -a "$ac_cv_header_iostream_h" = "yes" -a "$ac_cv_header_iomanip_h" = "yes"; then
880   ac_have_old_includes="yes"
881else
882   ac_have_old_includes="no"
883fi
884
885if test "$ac_use_std_includes" = "yes"; then
886   AC_MSG_RESULT(yes)
887   AC_DEFINE(USE_STD_CXX_INCLUDES, , [Define if ANSI standard C++ includes are used.])
888elif test "$ac_use_std_includes" = "no"; then
889   AC_MSG_RESULT(no)
890elif test "$ac_have_std_includes" = "yes"; then
891   AC_MSG_RESULT(yes)
892   AC_DEFINE(USE_STD_CXX_INCLUDES, , [Define if ANSI standard C++ includes are used.])
893   ac_use_std_includes="yes"
894else
895   AC_MSG_RESULT(no)
896   ac_use_std_includes="no"
897fi
898
899if test "$ac_use_std_includes" = "yes"; then
900   AC_CHECK_STD_NAMESPACE
901   AC_CHECK_DECLARATION(std::ios_base::openmode, , iostream)
902   AC_CHECK_IOS_NOCREATE(std::ios, fstream)
903   AC_CHECK_COMPILES(std::vfprintf, cstdarg cstdio,
904     [FILE *stream; va_list ap; std::vfprintf(stream, "", ap);])
905   AC_CHECK_COMPILES(std::vsnprintf, cstdarg cstdio,
906     [char buf[256]; va_list ap; std::vsnprintf(buf, 0, "", ap);])
907else
908   AC_CHECK_DECLARATION(std::ios_base::openmode, , iostream.h)
909   AC_CHECK_IOS_NOCREATE(ios, fstream.h)
910   AC_CHECK_COMPILES(std::vfprintf, stdarg.h stdio.h,
911     [FILE *stream; va_list ap; std::vfprintf(stream, "", ap);])
912   AC_CHECK_COMPILES(std::vsnprintf, stdarg.h stdio.h,
913     [char buf[256]; va_list ap; std::vsnprintf(buf, 0, "", ap);])
914fi
915
916AC_CHECK_CLASS_TEMPLATE
917AC_CHECK_STATIC_TEMPLATE_METHOD
918AC_CHECK_FUNCTION_TEMPLATE
919AC_CHECK_EXPLICIT_TEMPLATE_SPECIALIZATION
920AC_CHECK_CXX_VOLATILE
921AC_CXX_TYPENAME
922AC_STDIO_NAMESPACE
923
924dnl -------------------------------------------------------
925dnl Check for Private Tag support
926dnl -------------------------------------------------------
927
928AC_MSG_CHECKING(whether to enable private tag dictionary)
929AC_ARG_ENABLE(private-tags,
930[  --enable-private-tags   enable private tag dictionary
931  --disable-private-tags  don't enable private tag dictionary (default)],
932[ case "$enableval" in
933  yes)
934    AC_MSG_RESULT(yes)
935    AC_DEFINE(ENABLE_PRIVATE_TAGS, , [Define if we are compiling for enabling external private tag dictionary.])
936    AC_DEFINE_UNQUOTED(DCM_DICT_DEFAULT_PATH, "${DATA_DIR}/dicom.dic:${DATA_DIR}/private.dic", [Define the default data dictionary path for the dcmdata library package.])
937    ;;
938  *)
939    AC_MSG_RESULT(no)
940    ;;
941  esac ],
942  AC_MSG_RESULT(no)
943)
944
945dnl -------------------------------------------------------
946dnl Check for External Dictionary support
947dnl -------------------------------------------------------
948
949AC_MSG_CHECKING(whether to enable loading external dictionary from default path)
950AC_ARG_ENABLE(external-dict,
951[  --enable-external-dict  enable loading of external dictionary (default)
952  --disable-external-dict don't load external dictionary],
953[ case "$enableval" in
954  yes)
955    AC_MSG_RESULT(yes)
956    AC_DEFINE(ENABLE_EXTERNAL_DICTIONARY, , [Define if we are compiling for loading external dictionary from default path.])
957    ;;
958  *)
959    AC_MSG_RESULT(no)
960    dnl Reset default path so the dictionary is not loaded automatically on startup
961    AC_DEFINE_UNQUOTED(DCM_DICT_DEFAULT_PATH, "", [Define the default data dictionary path for the dcmdata library package.])
962    ;;
963  esac ],
964  AC_MSG_RESULT(yes)
965  AC_DEFINE(ENABLE_EXTERNAL_DICTIONARY, , [Define if we are compiling for loading external dictionary from default path.])
966)
967
968dnl -------------------------------------------------------
969dnl Check for Built-in (compiled-in) Dictionary support
970dnl -------------------------------------------------------
971
972AC_MSG_CHECKING(whether to enable built-in dictionary loading)
973AC_ARG_ENABLE(builtin-dict,
974[  --enable-builtin-dict   enable loading of built-in dictionary
975  --disable-builtin-dict  don't load built-in dictionary (default)],
976[ case "$enableval" in
977  yes)
978    AC_MSG_RESULT(yes)
979    AC_DEFINE(ENABLE_BUILTIN_DICTIONARY, , [Define if we are compiling with built-in (compiled-in) dictionary enabled.])
980    ;;
981  *)
982    AC_MSG_RESULT(no)
983    ;;
984  esac ],
985  AC_MSG_RESULT(no)
986)
987
988dnl -------------------------------------------------------
989dnl Check for OpenSSL support
990dnl -------------------------------------------------------
991
992AC_MY_LIB_PATH([openssl], [OpenSSL])
993
994AC_MSG_CHECKING([whether to include OpenSSL support])
995AC_ARG_WITH(openssl,
996[AS_HELP_STRING([--with-openssl], [include OpenSSL support (default: auto)])
997AS_HELP_STRING([--without-openssl], [don't include OpenSSL support])],
998[ case "$withval" in
999  yes)
1000      AC_TRY_COMPILE([#include <openssl/ssl.h>], [
1001#if OPENSSL_VERSION_NUMBER < 0x10001000L
1002#error OpenSSL too old
1003#endif
1004],
1005   [ AC_MSG_RESULT(yes)
1006    AC_DEFINE(WITH_OPENSSL, , [Define if we are compiling with OpenSSL support.])
1007    OPENSSLLIBS="-lssl -lcrypto $OPENSSLLIBS" ],
1008    [AC_MSG_RESULT(no - DCMTK requires OpenSSL version 1.0.1 or newer)] )
1009    ;;
1010  *)
1011    AC_MSG_RESULT(no)
1012    ;;
1013  esac ],
1014[ SAVELIBS="$LIBS"
1015  LIBS="$LIBS $OPENSSLLIBS -lssl -lcrypto"
1016  AC_TRY_LINK([#include <openssl/ssl.h>], [(void) TLSv1_method()],
1017    [
1018      AC_TRY_COMPILE([#include <openssl/ssl.h>], [
1019#if OPENSSL_VERSION_NUMBER < 0x10001000L
1020#error OpenSSL too old
1021#endif
1022],
1023      [ AC_MSG_RESULT(yes)
1024      AC_DEFINE(WITH_OPENSSL, , [Define if we are compiling with OpenSSL support.])
1025      OPENSSLLIBS="-lssl -lcrypto $OPENSSLLIBS" ],
1026     [AC_MSG_RESULT(no - DCMTK requires OpenSSL version 1.0.1 or newer)] )],
1027    [AC_MSG_RESULT(no)])
1028  LIBS="$SAVELIBS"] )
1029
1030AC_CHECK_SSL_CTX_GET0_PARAM
1031AC_CHECK_RAND_EGD
1032
1033dnl -------------------------------------------------------
1034dnl Check for libjpeg, which is needed by libtiff on some platforms
1035dnl -------------------------------------------------------
1036
1037JPEGLIBS=""
1038AC_CHECK_LIB(jpeg, jpeg_set_defaults,[
1039JPEGLIBS="-ljpeg"
1040])
1041if test $ac_cv_lib_jpeg_jpeg_set_defaults = no ; then
1042AC_CHECK_LIB(jpeg, jSetDefaults,[
1043JPEGLIBS="-ljpeg"
1044])
1045fi
1046
1047dnl -------------------------------------------------------
1048dnl Check for zlib support
1049dnl -------------------------------------------------------
1050
1051AC_MY_LIB_PATH([zlib])
1052
1053ZLIBLIBS=""
1054AC_MSG_CHECKING(whether to include zlib support)
1055AC_ARG_WITH(zlib,
1056[AS_HELP_STRING([--with-zlib], [include zlib support (default: auto)])
1057AS_HELP_STRING([--without-zlib], [don't include zlib support])],
1058[ case "$withval" in
1059  yes)
1060    AC_MSG_RESULT(yes)
1061    AC_DEFINE(WITH_ZLIB, , [Define if we are compiling with zlib support.])
1062    ZLIBLIBS="-lz"
1063    ;;
1064  *)
1065    AC_MSG_RESULT(no)
1066    ;;
1067  esac ],
1068[ SAVELIBS="$LIBS"
1069  LIBS="$LIBS -lz"
1070  AC_TRY_LINK([#include <zlib.h>], [(void) zlibVersion()],
1071    [ AC_MSG_RESULT(yes)
1072      AC_DEFINE(WITH_ZLIB, , [Define if we are compiling with zlib support.])
1073      ZLIBLIBS="-lz" ],
1074    [AC_MSG_RESULT(no)])
1075  LIBS="$SAVELIBS"] )
1076
1077dnl -------------------------------------------------------
1078dnl Check for libtiff support
1079dnl -------------------------------------------------------
1080
1081AC_MY_LIB_PATH([libtiff])
1082
1083TIFFLIBS=""
1084AC_MSG_CHECKING(whether to include libtiff support)
1085AC_ARG_WITH(libtiff,
1086[AS_HELP_STRING([--with-libtiff], [include libtiff support (default: auto)])
1087AS_HELP_STRING([--without-libtiff], [don't include libtiff support])],
1088[ case "$withval" in
1089  yes)
1090    AC_MSG_RESULT(yes)
1091    AC_DEFINE(WITH_LIBTIFF, , [Define if we are compiling with libtiff support.])
1092    TIFFLIBS="-ltiff $JPEGLIBS $ZLIBLIBS"
1093    ;;
1094  *)
1095    AC_MSG_RESULT(no)
1096    ;;
1097  esac ],
1098[ SAVELIBS="$LIBS"
1099  LIBS="$LIBS -ltiff $JPEGLIBS $ZLIBLIBS"
1100  AC_TRY_LINK([#include <tiffio.h>], [(void) TIFFGetVersion()],
1101    [ AC_MSG_RESULT(yes)
1102      AC_DEFINE(WITH_LIBTIFF, , [Define if we are compiling with libtiff support.])
1103      TIFFLIBS="-ltiff $JPEGLIBS $ZLIBLIBS"
1104    ],
1105    [AC_MSG_RESULT(no)])
1106  LIBS="$SAVELIBS"] )
1107
1108
1109dnl -------------------------------------------------------
1110dnl Check for libpng support
1111dnl -------------------------------------------------------
1112
1113AC_MY_LIB_PATH([libpng])
1114
1115dnl perform check for <libpng/png.h> only after we have evaluated --with-libpnginc
1116AC_CHECK_HEADERS(libpng/png.h)
1117
1118PNGLIBS=""
1119AC_MSG_CHECKING(whether to include libpng support)
1120AC_ARG_WITH(libpng,
1121[AS_HELP_STRING([--with-libpng], [include libpng support (default: auto)])
1122AS_HELP_STRING([--without-libpng], [don't include libpng support])],
1123[ case "$withval" in
1124  yes)
1125    if test "x$ZLIBLIBS" != x; then
1126        AC_MSG_RESULT(yes)
1127        AC_DEFINE(WITH_LIBPNG, , [Define if we are compiling with libpng support.])
1128        PNGLIBS="-lpng"
1129    else
1130        AC_MSG_RESULT(no because libpng requires zlib)
1131    fi
1132    ;;
1133  *)
1134    AC_MSG_RESULT(no)
1135    ;;
1136  esac ],
1137[ if test "x$ZLIBLIBS" != x; then
1138      SAVELIBS="$LIBS"
1139      LIBS="$LIBS -lpng $ZLIBLIBS"
1140
1141      AC_TRY_LINK([#ifdef HAVE_LIBPNG_PNG_H
1142#include <libpng/png.h>
1143#else
1144#include <png.h>
1145#endif], [(void) png_access_version_number()],
1146        [ AC_MSG_RESULT(yes)
1147          AC_DEFINE(WITH_LIBPNG, , [Define if we are compiling with libpng support.])
1148          PNGLIBS="-lpng" ],
1149        [AC_MSG_RESULT(no)])
1150
1151      LIBS="$SAVELIBS"
1152  else
1153      AC_MSG_RESULT(no because libpng requires zlib)
1154  fi
1155] )
1156
1157dnl -------------------------------------------------------
1158dnl Check for libxml support
1159dnl -------------------------------------------------------
1160
1161AC_MY_LIB_PATH([libxml])
1162
1163LIBXMLCFLAGS=`xml2-config --cflags 2>/dev/null`
1164if test "${LIBXMLCFLAGS+set}" = set; then
1165  CXXFLAGS="$LIBXMLCFLAGS $CXXFLAGS"
1166  CFLAGS="$LIBXMLCFLAGS $CFLAGS"
1167fi
1168LIBXMLLIBS=`xml2-config --libs 2>/dev/null`
1169
1170XMLLIBS=""
1171AC_MSG_CHECKING(whether to include libxml support)
1172AC_ARG_WITH(libxml,
1173[AS_HELP_STRING([--with-libxml], [include libxml support (default: auto)])
1174AS_HELP_STRING([--without-libxml], [don't include libxml support])],
1175[ case "$withval" in
1176  yes)
1177    AC_MSG_RESULT(yes)
1178    AC_DEFINE(WITH_LIBXML, , [Define if we are compiling with libxml support.])
1179    XMLLIBS=$LIBXMLLIBS
1180    ;;
1181  *)
1182    AC_MSG_RESULT(no)
1183    ;;
1184  esac ],
1185[ SAVELIBS="$LIBS"
1186  LIBS="$LIBS $LIBXMLLIBS"
1187  AC_TRY_LINK([#include <libxml/parser.h>], [(void) xmlInitParser()],
1188    [ AC_MSG_RESULT(yes)
1189      AC_DEFINE(WITH_LIBXML, , [Define if we are compiling with libxml support.])
1190      XMLLIBS=$LIBXMLLIBS ],
1191    [AC_MSG_RESULT(no)])
1192  LIBS="$SAVELIBS"] )
1193
1194dnl -------------------------------------------------------
1195dnl Check for libwrap (TCP wrapper) support
1196dnl -------------------------------------------------------
1197
1198AC_MY_LIB_PATH([libwrap])
1199
1200TCPWRAPPERLIBS=""
1201AC_MSG_CHECKING(whether to include libwrap support)
1202AC_ARG_WITH(libwrap,
1203[AS_HELP_STRING([--with-libwrap], [include libwrap support (default: auto)])
1204AS_HELP_STRING([--without-libwrap], [don't include libwrap support])],
1205[ case "$withval" in
1206  yes)
1207    AC_MSG_RESULT(yes)
1208    AC_DEFINE(WITH_TCPWRAPPER, , [Define if we are compiling with libwrap (TCP wrapper) support.])
1209    TCPWRAPPERLIBS="-lwrap"
1210    ;;
1211  *)
1212    AC_MSG_RESULT(no)
1213    ;;
1214  esac ],
1215[ SAVELIBS="$LIBS"
1216  LIBS="-lwrap $LIBS"
1217  AC_TRY_LINK(
1218    [#ifdef __cplusplus
1219    extern "C" {
1220    #endif
1221    #ifdef HAVE_STDIO_H
1222    /* on some platforms, tcpd.h needs stdio.h */
1223    #include <stdio.h>
1224    #endif
1225    #ifdef HAVE_SYS_TYPES_H
1226    /* on some platforms, tcpd.h needs sys/types.h */
1227    #include <sys/types.h>
1228    #endif
1229    #include <tcpd.h>
1230    #ifdef __cplusplus
1231    }
1232    #endif
1233    int deny_severity = 0;
1234    int allow_severity = 0;], [struct request_info r; (void) hosts_access(&r)],
1235    [ AC_MSG_RESULT(yes)
1236      AC_DEFINE(WITH_TCPWRAPPER, , [Define if we are compiling with libwrap (TCP wrapper) support.])
1237    TCPWRAPPERLIBS="-lwrap" ],
1238    [AC_MSG_RESULT(no)])
1239  LIBS="$SAVELIBS"] )
1240
1241
1242dnl -------------------------------------------------------
1243dnl Check for OpenJPEG support
1244dnl -------------------------------------------------------
1245
1246AC_MY_OPENJPEG_PATH()
1247
1248AC_MSG_CHECKING(whether to include OpenJPEG support)
1249AC_ARG_WITH(libwrap,
1250[AS_HELP_STRING([--with-openjpeg], [include OpenJPEG support (default: auto)])
1251AS_HELP_STRING([--without-openjpeg], [don't include OpenJPEG support])],
1252[ case "$withval" in
1253  yes)
1254    AC_MSG_RESULT(yes)
1255    AC_DEFINE(WITH_OPENJPEG, , [Define if we are compiling with OpenJPEG support.])
1256    OPENJPEGLIBS="-lopenjp2 $OPENJPEGLIBS"
1257    ;;
1258  *)
1259    AC_MSG_RESULT(no)
1260    ;;
1261  esac ],
1262[ SAVELIBS="$LIBS"
1263  LIBS="-lopenjp2 $OPENJPEGLIBS $LIBS"
1264  AC_TRY_LINK([#include <openjpeg.h>], [(void) opj_version()],
1265    [ AC_MSG_RESULT(yes)
1266      AC_DEFINE(WITH_OPENJPEG, , [Define if we are compiling with OpenJPEG support.])
1267    OPENJPEGLIBS="-lopenjp2 $OPENJPEGLIBS" ],
1268    [AC_MSG_RESULT(no)])
1269  LIBS="$SAVELIBS"] )
1270
1271
1272dnl -------------------------------------------------------
1273dnl Check for libsndfile support
1274dnl -------------------------------------------------------
1275
1276AC_MY_LIB_PATH([libsndfile])
1277
1278SNDFILELIBS=""
1279AC_MSG_CHECKING(whether to include libsndfile support)
1280AC_ARG_WITH(libsndfile,
1281  [AS_HELP_STRING([--with-libsndfile], [include libsndfile support (default: auto)])
1282AS_HELP_STRING([--without-libsndfile], [don't include libsndfile support])],
1283  [ case "$withval" in
1284    yes)
1285      AC_MSG_RESULT(yes)
1286      AC_DEFINE(WITH_SNDFILE, , [Define if we are compiling with libsndfile support.])
1287      SNDFILELIBS="-lsndfile"
1288      ;;
1289    *)
1290      AC_MSG_RESULT(no)
1291      ;;
1292    esac ],
1293  [ SAVELIBS="$LIBS"
1294    LIBS="$LIBS -lsndfile"
1295    AC_TRY_LINK([#include <sndfile.h>], [char buffer [128]; sf_command (NULL, SFC_GET_LIB_VERSION, buffer, sizeof (buffer));],
1296      [ AC_MSG_RESULT(yes)
1297        AC_DEFINE(WITH_SNDFILE, , [Define if we are compiling with libsndfile support.])
1298        SNDFILELIBS="-lsndfile" ],
1299      [AC_MSG_RESULT(no)])
1300    LIBS="$SAVELIBS"]
1301)
1302
1303dnl -------------------------------------------------------
1304dnl Check for libiconv support
1305dnl -------------------------------------------------------
1306
1307AC_MY_LIB_PATH([libiconv])
1308AH_TEMPLATE(WITH_LIBICONV, [Define if we are compiling with libiconv support.])
1309WITH_LIBICONV=no
1310ICONVLIBS=""
1311AC_MSG_CHECKING(whether to include libiconv support)
1312AC_ARG_WITH(libiconv,
1313[AS_HELP_STRING([--with-libiconv], [include libiconv support (default: auto)])
1314AS_HELP_STRING([--without-libiconv], [don't include libiconv support])],
1315[ case "$withval" in
1316  yes)
1317    WITH_LIBICONV=yes
1318    AC_DEFINE(WITH_LIBICONV)
1319    ICONVLIBS="-liconv -lcharset"
1320    ;;
1321  *)
1322    ;;
1323  esac ],
1324[ SAVELIBS="$LIBS"
1325  LIBS="$LIBS -liconv -lcharset"
1326  AC_TRY_LINK([#include <iconv.h>], [iconv_t cd = iconv_open("", ""); iconv(cd, 0, 0, 0, 0); iconv_close(cd);],
1327    [ WITH_LIBICONV=yes
1328      AC_DEFINE(WITH_LIBICONV)
1329      ICONVLIBS="-liconv -lcharset" ])
1330  LIBS="$SAVELIBS"] )
1331AC_MSG_RESULT($WITH_LIBICONV)
1332
1333AC_MSG_CHECKING(whether the second argument to iconv() is const)
1334SAVELIBS="$LIBS"
1335LIBS="$LIBS $ICONVLIBS"
1336AC_TRY_COMPILE([#include <iconv.h>], [iconv_t cd = iconv_open("", ""); const char *in = 0; iconv(cd, &in, 0, 0, 0); iconv_close(cd);],
1337  [ AC_MSG_RESULT(yes)
1338    AC_DEFINE(LIBICONV_SECOND_ARGUMENT_CONST, , [Define if the second argument to iconv() is const.]) ],
1339  [AC_MSG_RESULT(no)])
1340LIBS="$SAVELIBS"
1341
1342dnl -------------------------------------------------------
1343dnl Check for iconv inside C standard library
1344dnl -------------------------------------------------------
1345
1346AH_TEMPLATE([WITH_STDLIBC_ICONV], [Define if the C standard library has iconv builtin.])dnl
1347WITH_STDLIBC_ICONV=no
1348AC_MSG_CHECKING([whether the C standard library provides iconv functionality])
1349SAVELIBS="$LIBS"
1350LIBS=""
1351AC_TRY_LINK([#include <iconv.h>], [iconv_t cd=iconv_open("","");iconv(cd,0,0,0,0);iconv_close(cd);],
1352    [WITH_STDLIBC_ICONV=yes
1353     AC_DEFINE(WITH_STDLIBC_ICONV)])
1354AC_MSG_RESULT($WITH_STDLIBC_ICONV)
1355LIBS="$SAVELIBS"
1356
1357dnl -------------------------------------------------------
1358dnl Check for libicu support
1359dnl -------------------------------------------------------
1360
1361AC_MY_LIB_PATH([libicu])
1362AH_TEMPLATE([WITH_LIBICU], [Define if we are compiling with ICU support.])
1363WITH_LIBICU=no
1364AC_ARG_WITH(libicu,
1365[AS_HELP_STRING([--with-libicu], [include libicu support (default: auto)])
1366AS_HELP_STRING([--without-libicu], [don't include libicu support])],
1367[ AC_MSG_CHECKING(whether to include ICU support)
1368  case "$withval" in
1369  yes)
1370    WITH_LIBICU=yes
1371    AC_DEFINE(WITH_LIBICU)
1372    ICULIBS="-licui18n -licuuc -licudata"
1373    ;;
1374  *)
1375    ;;
1376  esac ],
1377[
1378  if test -z "$ICU_CONFIG"; then
1379    AC_PATH_PROG(ICU_CONFIG, icu-config, no)
1380    AC_MSG_CHECKING(whether to include ICU support)
1381  fi
1382  if [[ ! "$ICU_CONFIG" = "no" ]]; then
1383    ICU_VERSION=`$ICU_CONFIG --version`
1384        VERSION_CHECK=`expr $ICU_VERSION \>\= 3.4.1`
1385        if test VERSION_CHECK=1; then
1386            WITH_LIBICU=yes
1387            AC_DEFINE(WITH_LIBICU)
1388            ICUINCLUDES=`$ICU_CONFIG --cppflags`
1389            ICULIBS=`$ICU_CONFIG --ldflags`
1390        fi
1391  fi
1392])
1393AC_MSG_RESULT($WITH_LIBICU)
1394
1395dnl -------------------------------------------------------
1396dnl character set conversion support
1397dnl -------------------------------------------------------
1398
1399AH_VERBATIM([DCMTK_CHARSET_CONVERSION_CONSTANTS], [/* character set conversion constants. */
1400#define DCMTK_CHARSET_CONVERSION_ICU 1
1401#define DCMTK_CHARSET_CONVERSION_ICONV 2
1402#define DCMTK_CHARSET_CONVERSION_STDLIBC_ICONV 3
1403
1404/* LFS mode constants. */
1405#define DCMTK_LFS 1
1406#define DCMTK_LFS64 2])
1407
1408CHARCONVINCLUDES=""
1409CHARCONVLIBS=""
1410
1411AC_DEFUN([AC_CHOOSE_CHARSET_LIBICONV],
1412[
1413    AC_MSG_RESULT([yes, type=libiconv])
1414    CHARCONVLIBS="$ICONVLIBS"
1415    DCMTK_ENABLE_CHARSET_CONVERSION="DCMTK_CHARSET_CONVERSION_ICONV"
1416])
1417
1418AC_DEFUN([AC_CHOOSE_CHARSET_LIBICU],
1419[
1420    AC_MSG_RESULT([yes, type=libicu])
1421    CHARCONVINCLUDES="$ICUINCLUDES"
1422    CHARCONVLIBS="$ICULIBS"
1423    DCMTK_ENABLE_CHARSET_CONVERSION="DCMTK_CHARSET_CONVERSION_ICU"
1424])
1425
1426AC_DEFUN([AC_CHOOSE_CHARSET_STDLIBC_ICONV],
1427[
1428    AC_MSG_RESULT([yes, type=stdlibc])
1429    DCMTK_ENABLE_CHARSET_CONVERSION="DCMTK_CHARSET_CONVERSION_STDLIBC_ICONV"
1430])
1431
1432AC_DEFUN([AC_CHOOSE_CHARSET_IMPL],
1433[
1434if test "$WITH_LIBICONV" = "yes"; then
1435    AC_CHOOSE_CHARSET_LIBICONV()
1436elif test "$WITH_LIBICU" = "yes"; then
1437    AC_CHOOSE_CHARSET_LIBICU()
1438elif test "$WITH_STDLIBC_ICONV" = "yes"; then
1439    AC_CHOOSE_CHARSET_STDLIBC_ICONV()
1440else
1441    AC_MSG_RESULT(no)
1442fi
1443])
1444
1445AC_MSG_CHECKING(fixed iconv conversion flags)
1446if test "$WITH_STDLIBC_ICONV" != "yes"; then
1447    SAVELIBS="$LIBS"
1448    LIBS="$LIBS $ICONVLIBS"
1449fi
1450AC_RUN_IFELSE(
1451    [AC_LANG_SOURCE([[#include "tests/iconv.cc"]])],
1452    [
1453        AC_DEFINE_UNQUOTED(DCMTK_FIXED_ICONV_CONVERSION_FLAGS, [`./conftest$EXEEXT`], [Try to define the iconv behavior as conversion flags])
1454        AC_MSG_RESULT()
1455    ],
1456    [AC_MSG_RESULT([unknown])]
1457)
1458if test "$WITH_STDLIBC_ICONV" != "yes"; then
1459    LIBS="$SAVELIBS"
1460fi
1461
1462if test "$WITH_STDLIBC_ICONV" == "yes"; then
1463    AC_MSG_CHECKING([whether iconv_open() accepts "" as an argument])
1464    AC_RUN_IFELSE(
1465        [AC_LANG_SOURCE([[#include "tests/lciconv.cc"]])],
1466        [
1467            AC_DEFINE(DCMTK_STDLIBC_ICONV_HAS_DEFAULT_ENCODING, 1, [Define if iconv_open() accepts "" as an argument])
1468            AC_MSG_RESULT(yes)
1469        ],
1470        [AC_MSG_RESULT(no)]
1471    )
1472fi
1473
1474AC_MSG_CHECKING(whether to enable character set conversion support)
1475AC_ARG_ENABLE(charconv,
1476[  --enable-charconv=TYPE  enable character set conversion support
1477                          (libiconv/libicu/stdlibc/auto=default)
1478  --disable-charconv      disable character set conversion support],
1479[ case "$enableval" in
1480  yes|auto)
1481    AC_CHOOSE_CHARSET_IMPL()
1482    ;;
1483  libiconv)
1484    AC_CHOOSE_CHARSET_LIBICONV()
1485    ;;
1486  libicu)
1487    AC_CHOOSE_CHARSET_LIBICU()
1488    ;;
1489  stdlibc)
1490    AC_CHOOSE_CHARSET_STDLIBC_ICONV()
1491    ;;
1492  no)
1493    AC_MSG_RESULT(no)
1494    ;;
1495  *)
1496    AC_CHOOSE_CHARSET_IMPL()
1497    ;;
1498  esac ],
1499  [AC_CHOOSE_CHARSET_IMPL()]
1500)
1501
1502AC_SUBST(CHARCONVINCLUDES)
1503AC_SUBST(CHARCONVLIBS)
1504
1505if [[ ! -z "$DCMTK_ENABLE_CHARSET_CONVERSION" ]]; then
1506  AC_DEFINE_UNQUOTED(DCMTK_ENABLE_CHARSET_CONVERSION,
1507    [$DCMTK_ENABLE_CHARSET_CONVERSION],
1508    [Define to select character set conversion implementation.])
1509fi
1510
1511
1512dnl -------------------------------------------------------
1513dnl include config test code from config/tests
1514dnl -------------------------------------------------------
1515
1516ac_enable_cxx11="no"
1517AC_MSG_CHECKING(whether to enable C++11 support)
1518AC_ARG_ENABLE(cxx11,
1519[  --enable-cxx11          use C++11
1520  --disable-cxx11         do not use C++11 (default)],
1521[ case "$enableval" in
1522  yes)
1523   AC_MSG_RESULT()
1524   AX_CXX_COMPILE_STDCXX([11], [noext], [optional])
1525   if test "$HAVE_CXX11 == 1"; then
1526     ac_enable_cxx11="yes"
1527   fi
1528   AC_MSG_CHECKING(whether to enable C++11 support)
1529   ;;
1530
1531  *)
1532   ac_enable_cxx11="no"
1533   ;;
1534  esac ]
1535)
1536AC_MSG_RESULT($ac_enable_cxx11)
1537
1538
1539dnl -------------------------------------------------------
1540dnl Enable/disable STL support.
1541dnl -------------------------------------------------------
1542
1543ac_enable_stl="no"
1544AC_MSG_CHECKING(whether to enable STL support)
1545AC_ARG_ENABLE(stl,
1546[  --enable-stl            use C++ STL
1547  --disable-stl           do not use C++ STL (default)],
1548[ case "$enableval" in
1549  yes)
1550   ac_enable_stl="yes"
1551   ;;
1552
1553  *)
1554    ac_enable_stl="no"
1555    ;;
1556  esac ]
1557)
1558AC_MSG_RESULT($ac_enable_stl)
1559
1560
1561ac_enable_stl_vector="auto"
1562AC_MSG_CHECKING(whether to enable STL vector support)
1563AC_ARG_ENABLE(stl-vector,
1564[  --enable-stl-vector     use C++ STL vector
1565  --disable-stl-vector    do not use C++ STL vector],
1566[ case "$enableval" in
1567  yes)
1568   ac_enable_stl_vector="yes"
1569   ;;
1570
1571  *)
1572    ac_enable_stl_vector="no"
1573    ;;
1574  esac]
1575)
1576if test "$ac_enable_stl_vector" = "auto"; then
1577  ac_enable_stl_vector="$ac_enable_stl"
1578fi
1579if test "$ac_enable_stl_vector" = "yes"; then
1580  AC_RUN_IFELSE([AC_LANG_SOURCE([[#include "tests/vector.cc"]])], [AC_DEFINE(HAVE_STL_VECTOR, , [Define if STL's vector should be used.])], [ac_enable_stl_vector="unsupported -> no"])
1581fi
1582AC_MSG_RESULT($ac_enable_stl_vector)
1583
1584ac_enable_stl_algorithm="auto"
1585AC_MSG_CHECKING(whether to enable STL algorithm support)
1586AC_ARG_ENABLE(stl-algorithm,
1587[  --enable-stl-algorithm  use C++ STL algorithm
1588  --disable-stl-algorithm do not use C++ STL algorithm],
1589[ case "$enableval" in
1590  yes)
1591   ac_enable_stl_algorithm="yes"
1592   ;;
1593
1594  *)
1595    ac_enable_stl_algorithm="no"
1596    ;;
1597  esac ]
1598)
1599if test "$ac_enable_stl_algorithm" = "auto"; then
1600  ac_enable_stl_algorithm="$ac_enable_stl"
1601fi
1602if test "$ac_enable_stl_algorithm" = "yes"; then
1603  AC_RUN_IFELSE([AC_LANG_SOURCE([[#include "tests/algo.cc"]])], [AC_DEFINE(HAVE_STL_ALGORITHM, , [Define if STL's algorithm should be used.])], [ac_enable_stl_algorithm="unsupported -> no"])
1604fi
1605AC_MSG_RESULT($ac_enable_stl_algorithm)
1606
1607ac_enable_stl_limits="auto"
1608AC_MSG_CHECKING(whether to enable STL limits support)
1609AC_ARG_ENABLE(stl-limits,
1610[  --enable-stl-limits     use C++ STL limits
1611  --disable-stl-limits    do not use C++ STL limits],
1612[ case "$enableval" in
1613  yes)
1614   ac_enable_stl_limits="yes"
1615   ;;
1616
1617  *)
1618    ac_enable_stl_limits="no"
1619    ;;
1620  esac ]
1621)
1622if test "$ac_enable_stl_limits" = "auto"; then
1623  ac_enable_stl_limits="$ac_enable_stl"
1624fi
1625if test "$ac_enable_stl_limits" = "yes"; then
1626  AC_RUN_IFELSE([AC_LANG_SOURCE([[#include "tests/limits.cc"]])], [AC_DEFINE(HAVE_STL_LIMITS, , [Define if STL's limits should be used.])], [ac_enable_stl_limits="unsupported -> no"])
1627fi
1628AC_MSG_RESULT($ac_enable_stl_limits)
1629
1630ac_enable_stl_list="auto"
1631AC_MSG_CHECKING(whether to enable STL list support)
1632AC_ARG_ENABLE(stl-list,
1633[  --enable-stl-list       use C++ STL list
1634  --disable-stl-list      do not use C++ STL list],
1635[ case "$enableval" in
1636  yes)
1637   ac_enable_stl_list="yes"
1638   ;;
1639
1640  *)
1641    ac_enable_stl_list="no"
1642    ;;
1643  esac ]
1644)
1645if test "$ac_enable_stl_list" = "auto"; then
1646  ac_enable_stl_list="$ac_enable_stl"
1647fi
1648if test "$ac_enable_stl_list" = "yes"; then
1649  AC_RUN_IFELSE([AC_LANG_SOURCE([[#include "tests/list.cc"]])], [AC_DEFINE(HAVE_STL_LIST, , [Define if STL's list should be used.])], [ac_enable_stl_list="unsupported -> no"])
1650fi
1651AC_MSG_RESULT($ac_enable_stl_list)
1652
1653ac_enable_stl_map="auto"
1654AC_MSG_CHECKING(whether to enable STL map support)
1655AC_ARG_ENABLE(stl-map,
1656[  --enable-stl-map        use C++ STL map
1657  --disable-stl-map       do not use C++ STL map],
1658[ case "$enableval" in
1659  yes)
1660   ac_enable_stl_map="yes"
1661   ;;
1662
1663  *)
1664    ac_enable_stl_map="no"
1665    ;;
1666  esac ]
1667)
1668if test "$ac_enable_stl_map" = "auto"; then
1669  ac_enable_stl_map="$ac_enable_stl"
1670fi
1671if test "$ac_enable_stl_map" = "yes"; then
1672  AC_RUN_IFELSE([AC_LANG_SOURCE([[#include "tests/map.cc"]])], [AC_DEFINE(HAVE_STL_MAP, , [Define if STL's map should be used.])], [ac_enable_stl_map="unsupported -> no"])
1673fi
1674AC_MSG_RESULT($ac_enable_stl_map)
1675
1676ac_enable_stl_memory="auto"
1677AC_MSG_CHECKING(whether to enable STL memory support)
1678AC_ARG_ENABLE(stl-memory,
1679[  --enable-stl-memory     use C++ STL memory
1680  --disable-stl-memory    do not use C++ STL memory],
1681[ case "$enableval" in
1682  yes)
1683   ac_enable_stl_memory="yes"
1684   ;;
1685
1686  *)
1687    ac_enable_stl_memory="no"
1688    ;;
1689  esac ]
1690)
1691if test "$ac_enable_stl_memory" = "auto"; then
1692  ac_enable_stl_memory="$ac_enable_stl"
1693fi
1694if test "$ac_enable_stl_memory" = "yes"; then
1695  AC_RUN_IFELSE([AC_LANG_SOURCE([[#include "tests/memory.cc"]])], [AC_DEFINE(HAVE_STL_MEMORY, , [Define if STL's memory should be used.])], [ac_enable_stl_memory="unsupported -> no"])
1696fi
1697AC_MSG_RESULT($ac_enable_stl_memory)
1698
1699ac_enable_stl_stack="auto"
1700AC_MSG_CHECKING(whether to enable STL stack support)
1701AC_ARG_ENABLE(stl-stack,
1702[  --enable-stl-stack      use C++ STL stack
1703  --disable-stl-stack     do not use C++ STL stack],
1704[ case "$enableval" in
1705  yes)
1706   ac_enable_stl_stack="yes"
1707   ;;
1708
1709  *)
1710    ac_enable_stl_stack="no"
1711    ;;
1712  esac ]
1713)
1714if test "$ac_enable_stl_stack" = "auto"; then
1715  ac_enable_stl_stack="$ac_enable_stl"
1716fi
1717if test "$ac_enable_stl_stack" = "yes"; then
1718  AC_RUN_IFELSE([AC_LANG_SOURCE([[#include "tests/stack.cc"]])], [AC_DEFINE(HAVE_STL_STACK, , [Define if STL's stack should be used.])], []ac_enable_stl_stack="unsupported -> no")
1719fi
1720AC_MSG_RESULT($ac_enable_stl_stack)
1721
1722ac_enable_stl_string="auto"
1723AC_MSG_CHECKING(whether to enable STL string support)
1724AC_ARG_ENABLE(stl-string,
1725[  --enable-stl-string     use C++ STL string
1726  --disable-stl-string    do not use C++ STL string],
1727[ case "$enableval" in
1728  yes)
1729   ac_enable_stl_string="yes"
1730   ;;
1731
1732  *)
1733    ac_enable_stl_string="no"
1734    ;;
1735  esac ]
1736)
1737if test "$ac_enable_stl_string" = "auto"; then
1738  ac_enable_stl_string="$ac_enable_stl"
1739fi
1740if test "$ac_enable_stl_string" = "yes"; then
1741  AC_RUN_IFELSE([AC_LANG_SOURCE([[#include "tests/string.cc"]])], [AC_DEFINE(HAVE_STL_STRING, , [Define if STL's string should be used.])], [ac_enable_stl_string="unsupported -> no"])
1742fi
1743AC_MSG_RESULT($ac_enable_stl_string)
1744
1745ac_enable_stl_type_traits="auto"
1746AC_MSG_CHECKING(whether to enable STL type-traits support)
1747AC_ARG_ENABLE(stl-type-traits,
1748[  --enable-stl-type-traits
1749                          use C++ STL type-traits
1750  --disable-stl-type-traits
1751                          do not use C++ STL type-traits],
1752[ case "$enableval" in
1753  yes)
1754   ac_enable_stl_type_traits="yes"
1755   ;;
1756
1757  *)
1758    ac_enable_stl_type_traits="no"
1759    ;;
1760  esac ]
1761)
1762if test "$ac_enable_stl_type_traits" = "auto"; then
1763  ac_enable_stl_type_traits="$ac_enable_stl"
1764fi
1765if test "$ac_enable_stl_type_traits" = "yes"; then
1766  AC_RUN_IFELSE([AC_LANG_SOURCE([[#include "tests/ttraits.cc"]])], [AC_DEFINE(HAVE_STL_TYPE_TRAITS, , [Define if STL's type traits should be used.])], [ac_enable_stl_type_traits="unsupported -> no"])
1767fi
1768AC_MSG_RESULT($ac_enable_stl_type_traits)
1769
1770ac_enable_stl_tuple="auto"
1771AC_MSG_CHECKING(whether to enable STL tuple support)
1772AC_ARG_ENABLE(stl-tuple,
1773[  --enable-stl-tuple      use C++ STL tuple
1774  --disable-stl-tuple     do not use C++ STL tuple],
1775[ case "$enableval" in
1776  yes)
1777   ac_enable_stl_tuple="yes"
1778   ;;
1779
1780  *)
1781    ac_enable_stl_tuple="no"
1782    ;;
1783  esac ]
1784)
1785if test "$ac_enable_stl_tuple" = "auto"; then
1786  ac_enable_stl_tuple="$ac_enable_stl"
1787fi
1788if test "$ac_enable_stl_tuple" = "yes"; then
1789  AC_RUN_IFELSE([AC_LANG_SOURCE([[#include "tests/tuple.cc"]])], [AC_DEFINE(HAVE_STL_TUPLE, , [Define if STL's tuple should be used.])], [ac_enable_stl_tuple="unsupported -> no"])
1790fi
1791AC_MSG_RESULT($ac_enable_stl_tuple)
1792
1793ac_enable_stl_system_error="auto"
1794AC_MSG_CHECKING(whether to enable STL system_error support)
1795AC_ARG_ENABLE(stl-system-error,
1796[  --enable-stl-system-error
1797                          use C++ STL system_error
1798  --disable-stl-system_error
1799                          do not use C++ STL system_error],
1800[ case "$enableval" in
1801  yes)
1802   ac_enable_stl_system_error="yes"
1803   ;;
1804
1805  *)
1806    ac_enable_stl_system_error="no"
1807    ;;
1808  esac ]
1809)
1810if test "$ac_enable_stl_system_error" = "auto"; then
1811  ac_enable_stl_system_error="$ac_enable_stl"
1812fi
1813if test "$ac_enable_stl_system_error" = "yes"; then
1814  AC_RUN_IFELSE([AC_LANG_SOURCE([[#include "tests/syserr.cc"]])], [AC_DEFINE(HAVE_STL_SYSTEM_ERROR, , [Define if STL's system_error should be used.])], [ac_enable_stl_system_error="unsupported -> no"])
1815fi
1816AC_MSG_RESULT($ac_enable_stl_system_error)
1817
1818
1819dnl -------------------------------------------------------
1820dnl Test for some additional functions and keywords
1821dnl -------------------------------------------------------
1822
1823AC_CHECK_SYNC_FN([__sync_add_and_fetch],[HAVE_SYNC_ADD_AND_FETCH])
1824AC_CHECK_SYNC_FN([__sync_sub_and_fetch],[HAVE_SYNC_SUB_AND_FETCH])
1825AC_CHECK_ALIGNOF([HAVE_GNU_ALIGNOF])
1826AC_CHECK_ATTRIBUTE_ALIGNED([HAVE_ATTRIBUTE_ALIGNED])
1827AC_CHECK_ATTRIBUTE_ALIGNED_SUPPORTS_TEMPLATES([ATTRIBUTE_ALIGNED_SUPPORTS_TEMPLATES])
1828AC_CHECK_DEFAULT_CONSTRUCTOR_DETECTION_VIA_SFINAE([HAVE_DEFAULT_CONSTRUCTOR_DETECTION_VIA_SFINAE])
1829
1830dnl -------------------------------------------------------
1831dnl Test if passwd has the pw_gecos field
1832dnl -------------------------------------------------------
1833
1834AC_MSG_CHECKING(whether struct pwd contains the field pw_gecos)
1835AC_TRY_COMPILE([#include <pwd.h>],
1836  [&passwd::pw_gecos;],
1837  [ AC_MSG_RESULT(yes)
1838    AC_DEFINE(HAVE_PASSWD_GECOS, , [Define if passwd::pw_gecos is available.]) ],
1839  [AC_MSG_RESULT(no)])
1840
1841dnl -------------------------------------------------------
1842dnl Test if SYS_gettid is available
1843dnl -------------------------------------------------------
1844
1845AC_MSG_CHECKING(for SYS_gettid in sys/syscall.h)
1846AC_TRY_COMPILE([#include <sys/syscall.h>],
1847  [SYS_gettid;],
1848  [ AC_MSG_RESULT(yes)
1849    AC_DEFINE(HAVE_SYS_GETTID, , [Define if your system has a prototype for gettid.]) ],
1850  [AC_MSG_RESULT(no)])
1851
1852
1853dnl -------------------------------------------------------
1854dnl Test for defined iterator categories
1855dnl -------------------------------------------------------
1856
1857AC_CHECK_ITERATOR_CATEGORY([input],[HAVE_INPUT_ITERATOR_CATEGORY])
1858AC_CHECK_ITERATOR_CATEGORY([output],[HAVE_OUTPUT_ITERATOR_CATEGORY])
1859AC_CHECK_ITERATOR_CATEGORY([forward],[HAVE_FORWARD_ITERATOR_CATEGORY])
1860AC_CHECK_ITERATOR_CATEGORY([bidirectional],[HAVE_BIDIRECTIONAL_ITERATOR_CATEGORY])
1861AC_CHECK_ITERATOR_CATEGORY([random_access],[HAVE_RANDOM_ACCESS_ITERATOR_CATEGORY])
1862AC_CHECK_ITERATOR_CATEGORY([contiguous],[HAVE_CONTIGUOUS_ITERATOR_CATEGORY])
1863
1864
1865dnl -------------------------------------------------------
1866dnl Set optimizer and debug compiler flags
1867dnl -------------------------------------------------------
1868CFLAGS="$DEBUGCFLAGS $CFLAGS"
1869CXXFLAGS="$DEBUGCXXFLAGS $CXXFLAGS"
1870
1871dnl -------------------------------------------------------
1872dnl Special Definitions for output
1873dnl -------------------------------------------------------
1874AC_SUBST(CXXFLAGS)
1875AC_SUBST(OPENSSLLIBS)
1876AC_SUBST(TIFFLIBS)
1877AC_SUBST(PNGLIBS)
1878AC_SUBST(MATHLIBS)
1879AC_SUBST(ZLIBLIBS)
1880AC_SUBST(XMLLIBS)
1881AC_SUBST(TCPWRAPPERLIBS)
1882AC_SUBST(SNDFILELIBS)
1883AC_SUBST(ICONVLIBS)
1884AC_SUBST(OPENJPEGLIBS)
1885AC_SUBST(DEBUG)
1886
1887AC_OUTPUT(Makefile.def Makefile)
1888
1889dnl disabled: AC_ARG_PROGRAM
1890