1dnl Process this file with autoconf to produce a configure script.
2AC_INIT(libdwarf.h)
3AC_CONFIG_HEADER(config.h)
4
5AC_PROG_CC
6AC_C_BIGENDIAN
7AC_GCC_TRADITIONAL
8AC_PROG_INSTALL
9AC_CHECK_TOOL(RANLIB, ranlib, :)
10AC_CHECK_TOOL(AR, ar)
11
12dnl AC_ARFLAGS
13
14AC_CHECK_HEADERS(alloca.h elf.h elfaccess.h libelf.h libelf/libelf.h  sys/types.h sys/ia64/elf.h)
15
16AC_CHECK_LIB(elf,elf64_getehdr,
17  AC_DEFINE(HAVE_ELF64_GETEHDR,1,
18	[Define to 1 if the elf64_getehdr function is in libelf.a.]))
19AC_CHECK_LIB(elf,elf64_getshdr,
20  AC_DEFINE(HAVE_ELF64_GETSHDR,1,
21	[Define to 1 if the elf64_getshdr function is in libelf.a.]))
22AC_TRY_COMPILE( ,  __uint32_t p; p = 3; ,AC_DEFINE(HAVE___UINT32_T,1,
23	[See if __uint32_t is predefined in the compiler.]))
24AC_TRY_COMPILE( ,  __uint64_t p; p = 3; ,AC_DEFINE(HAVE___UINT64_T,1,
25	[See if __uint64_t is predefined in the compiler.]))
26AC_TRY_COMPILE([#include <sys/types.h>],[  __uint32_t p; p = 3;] ,
27  AC_DEFINE(HAVE___UINT32_T_IN_SYS_TYPES_H,1,
28	[Define 1 if sys/types.h defines __uint32_t.]))
29AC_TRY_COMPILE([#include <sys/types.h>],[  __uint64_t p; p = 3;] ,
30  AC_DEFINE(HAVE___UINT64_T_IN_SYS_TYPES_H,1,
31	[Define 1 if sys/types.h defines __uint64_t.]))
32dnl checking for ia 64 types, which might be enums, using HAVE_R_IA_64_DIR32LSB
33dnl to stand in for a small set.
34AC_TRY_COMPILE([#include <elf.h>],[  int p; p = R_IA_64_DIR32LSB;] ,
35  AC_DEFINE(HAVE_R_IA_64_DIR32LSB,1,
36	[Define 1 if  R_IA_64_DIR32LSB is defined (might be enum value).]))
37
38dnl the existence of sgidefs.h does not prove it's truly SGI, nor
39dnl prove that __uint32_t or __uint64_t lis defined therein.
40AC_TRY_COMPILE([#include <sgidefs.h>],[  __uint32_t p; p = 27;] ,
41  AC_DEFINE(HAVE___UINT32_T_IN_SGIDEFS_H,1,
42        [Define 1 if __uint32_t is in sgidefs.h.])) 
43AC_TRY_COMPILE([#include <sgidefs.h>],[  __uint64_t p; p = 27;] ,
44  AC_DEFINE(HAVE___UINT64_T_IN_SGIDEFS_H,1,
45        [Define 1 if __uint64_t is in sgidefs.h.])) 
46
47AC_SUBST(build_shared,[])
48AC_SUBST(build_nonshared,[libdwarf.a])
49AC_ARG_ENABLE(shared,AC_HELP_STRING([--enable-shared],
50		[build shared library libdwarf.so (default is NO)]),
51		[ AC_SUBST(build_shared,[libdwarf.so]) ],
52		[  AC_SUBST(build_shared,[none]) ])
53AC_ARG_ENABLE(nonshared,AC_HELP_STRING([--enable-nonshared],
54		[build archive library libdwarf.a (default is YES)]),
55		[ AC_SUBST(build_nonshared,[libdwarf.a]) ]
56		[ AC_SUBST(build_nonshared,[none]) ])
57
58
59dnl Just assume, if old ia64 R_IA_64_DIR32LSB name present, 
60dnl compatibility with cygnus before
61dnl HAVE_DWARF2_99_EXTENSION defined.
62dnl Only applies to producer code, as consumer adapts itself.
63dnl This is not the right test, really.
64AC_TRY_COMPILE([#include <elf.h>],[  int p; p = R_IA_64_DIR32LSB;] ,
65  AC_DEFINE(HAVE_OLD_DWARF2_32BIT_OFFSET,1,
66	[Define 1 if want producer to build with only 32bit section offsets per strict dwarf2] ),
67  AC_DEFINE(HAVE_DWARF2_99_EXTENSION,1,
68	[Define 1 if want producer to build with 32/64bit section offsets per dwarf3] )) 
69
70AC_OUTPUT(Makefile)
71