summaryrefslogtreecommitdiff
path: root/dwarfdump/configure.in
blob: 753a1b46fdcb2126f979e1e87a4f648b7d69b47c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
dnl Process this file with autoconf to produce a configure script.
AC_INIT(dwarfdump.c)
AC_CONFIG_HEADER(config.h)

AC_PROG_CC
AC_GCC_TRADITIONAL
AC_PROG_INSTALL
AC_CHECK_TOOL(RANLIB, ranlib, :)
AC_CHECK_TOOL(AR, ar)
dnl AC_ARFLAGS

AC_CHECK_HEADERS(elf.h getopt.h libelf.h libelf/libelf.h sgidefs.h sys/types.h)
AC_CHECK_LIB(elf,elf64_getehdr,
  AC_DEFINE(HAVE_ELF64_GETEHDR,1, 
	[Define to 1 if the elf64_getehdr function is in libelf.a.]))

dnl Find out where the elf header is.
if test "$ac_cv_header_elf_h" = yes; then
 AC_DEFINE(LOCATION_OF_LIBELFHEADER,[<elf.h>], [Define to header that first defines elf])
elif test "$ac_cv_header_libelf_h" = yes; then
 AC_DEFINE(LOCATION_OF_LIBELFHEADER, [<libelf.h>],
	[Define to header that first defines elf.])
elif test "$ac_cv_header_libelf_libelf_h" = yes; then
 AC_DEFINE(LOCATION_OF_LIBELFHEADER,[<libelf/libelf.h>],
	[Define to header that first defines elf.])
fi

AC_TRY_COMPILE([#include "stdafx.h"],[  int p; p = 27;] ,
  AC_DEFINE(HAVE_STDAFX_H,1,
        [Define 1 if we have the Windows specific header stdafx.h]))

AC_TRY_COMPILE([#include LOCATION_OF_LIBELFHEADER],  Elf64_Rel *p; int i; i = p->r_info; ,AC_DEFINE(HAVE_ELF64_R_INFO,1,
	[Define to 1 if the Elf64_Rel structure has r_info field.]))
AC_TRY_COMPILE([],  __uint32_t p; p = 3; ,AC_DEFINE(HAVE___UINT32_T,
	1,[See if __uint32_t is predefined in the compiler.  ]))
AC_TRY_COMPILE([],  __uint64_t p; p = 3; ,AC_DEFINE(HAVE___UINT64_T,
	1,[See if __uint64_t is predefined in the compiler. ]))
AC_TRY_COMPILE([#include <sys/types.h>],[  __uint32_t p; p = 3]; ,
	AC_DEFINE(HAVE___UINT32_T_IN_SYS_TYPES_H,1,
		[Define 1 if sys/types.h defines __uint32_t.]))
AC_TRY_COMPILE([#include <sys/types.h>
        #include <regex.h>],[  int i; 
        regex_t r;
        int cflags = REG_EXTENDED;
        const char *s = "abc";
        i = regcomp(&r,s,cflags);
        regfree(&r);
        ]; ,
	AC_DEFINE(HAVE_REGEX,1,
		[Define 1 if regex seems to be defined]))
AC_TRY_LINK([#include <stdio.h>
#include <stdlib.h>
/* On Ubuntu 10.x, tsearch is in package libc6-dev. */
/* The tdestroy function is GNU, not POSIX. */
#define __USE_GNU 1
#include <search.h>
struct my_tentry {
    long mt_key;
    char * mt_name;
};
struct my_tentry * make_my_tentry(long k,char *name) { return 0; }
void mt_free_func(void *mt_data) { return; }
int mt_compare_func(const void *l, const void *r) { return 0; }],[
    long i = 1;
    void *tree1 = 0;
    char *dbuf = 0;
    struct my_tentry *mt = 0;
    struct my_tentry *retval = 0;
    mt = make_my_tentry(i,dbuf);
    retval = tsearch(mt,&tree1, mt_compare_func  );
    tdestroy(tree1,mt_free_func);
    exit(0);
];,
	AC_DEFINE(HAVE_TSEARCH,1,
		[Define 1 if the tsearch functions seem to be defined]))


AC_ARG_ENABLE(nonstandardprintf,AC_HELP_STRING([--enable-nonstandardprintf],
                [Use a special printf format for 64bit (default is NO)]),
                [ AC_DEFINE([HAVE_NONSTANDARD_PRINTF_64_FORMAT],[1],
                   [Define 1 if need nonstandard printf format for  64bit] )],
                [])

AC_TRY_COMPILE([
#include <libelf.h>
],[  int p; p = 0; ] ,
  AC_DEFINE(HAVE_RAW_LIBELF_OK,1,
        [Define 1 if plain libelf builds.]))
AC_TRY_COMPILE([
#define _GNU_SOURCE
#include <libelf.h>
],[  off64_t  p; p = 0;] ,
  AC_DEFINE(HAVE_LIBELF_OFF64_OK,1,
        [Define 1 if  off64 is defined via libelf with GNU_SOURCE.]))



AC_OUTPUT(Makefile)