configure.ac 4.43 KB
Newer Older
Axel Simon's avatar
Axel Simon committed
1 2 3
dnl configure file for the GDSL compiler and the decoders shipped with it
AC_INIT([gdsl], [0.9.0], [http://code.google.com/p/gdsl-toolkit/], [gdsl-toolkit])

Axel Simon's avatar
merge  
Axel Simon committed
4
AM_INIT_AUTOMAKE([no-dependencies -Wall foreign no-define])
Axel Simon's avatar
Axel Simon committed
5 6 7 8

AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([LICENSE])

Axel Simon's avatar
merge  
Axel Simon committed
9 10
AM_PROG_CC_C_O()
AM_PROG_AR()
Axel Simon's avatar
Axel Simon committed
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
AC_PROG_LIBTOOL()
AC_PROG_INSTALL()

AC_ARG_VAR(MLTON)
AC_PATH_PROG(MLTON, mlton, ["not-found"])

if test [$MLTON == "not-found"]; then
    echo "You must install MLton."
    exit 1
fi

AC_ARG_VAR(MLULEX)
AC_PATH_PROG(MLULEX, ml-ulex, ["not-found"])

if test [$MLULEX == "not-found"]; then
    echo "You must install MLton (to get ml-ulex)."
    exit 1
fi

AC_ARG_VAR(MLANTLR)
AC_PATH_PROG(MLANTLR, ml-antlr, ["not-found"])

if test [$MLANTLR == "not-found"]; then
    echo "You must install MLton (to get ml-antlr)."
    exit 1
fi

Axel Simon's avatar
Axel Simon committed
38 39 40 41 42 43 44 45 46 47
dnl check if the GDSL compiler should be installed
AC_ARG_ENABLE([install-gdslc],
  [AS_HELP_STRING(
    [--enable-install-gdslc],
    [install the GDSL compiler])],
  [], [enable_install_gdslc=no])
AM_CONDITIONAL([INSTALL_GDSLC],[test x$enable_install_gdslc = xyes])

dnl conditionals for the various decoders, either with or without semantics

Axel Simon's avatar
Axel Simon committed
48
FRONTENDS="x86 x86-rreil avr avr-rreil";
Axel Simon's avatar
Axel Simon committed
49

Axel Simon's avatar
Axel Simon committed
50
AC_ARG_WITH([frontend],
Axel Simon's avatar
Axel Simon committed
51
  [AS_HELP_STRING(
Axel Simon's avatar
Axel Simon committed
52 53 54
    [--with-frontend=frontend],
    [one of: ]$FRONTENDS)],
  [], [with_frontend=x86-rreil])
Axel Simon's avatar
Axel Simon committed
55

Axel Simon's avatar
Axel Simon committed
56
case $with_frontend in
Axel Simon's avatar
Axel Simon committed
57
	x86)
Axel Simon's avatar
Axel Simon committed
58
		AC_DEFINE([USE_X86],[1],[build x86 bare decoder])
Axel Simon's avatar
Axel Simon committed
59
	 	with_frontend=x86;;
Axel Simon's avatar
Axel Simon committed
60
	x86-rreil)
Axel Simon's avatar
Axel Simon committed
61
		AC_DEFINE([USE_X86_RREIL],[1],[build x86 decoder and RReil semantics])
Axel Simon's avatar
Axel Simon committed
62
		with_frontend=x86-rreil;;
Axel Simon's avatar
Axel Simon committed
63 64
	avr)
		AC_DEFINE([USE_AVR],[1],[build AVR bare decoder])
Axel Simon's avatar
Axel Simon committed
65
		with_frontend=avr;;
Axel Simon's avatar
Axel Simon committed
66 67
	avr-rreil)
		AC_DEFINE([USE_AVR_RREIL],[1],[build AVR decoder and RReil semantics])
Axel Simon's avatar
Axel Simon committed
68 69
		with_frontend=avr-rreil;;
	*) AC_MSG_FAILURE([invalid frontend, choose one of ]$FRONTENDS);;
Axel Simon's avatar
Axel Simon committed
70
esac
Axel Simon's avatar
Axel Simon committed
71
case $with_frontend in
72 73 74
	*-rreil) has_rreil=yes;;
	*) has_rreil=no;;
esac
Julian Kranz's avatar
Julian Kranz committed
75
case $with_frontend in
Axel Simon's avatar
merge  
Axel Simon committed
76 77 78
	x86*) has_x86=yes;;
	*) has_x86=no;;
esac
Axel Simon's avatar
Axel Simon committed
79

Julian Kranz's avatar
---  
Julian Kranz committed
80 81 82 83 84 85
has_anon_members=yes
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
    [[;]],
    [[struct inge { union { int a; int b }; }; struct inge i; i.a = 42;]])],
    has_anon_members=no)

Axel Simon's avatar
Axel Simon committed
86 87 88 89
AM_CONDITIONAL([X86_RREIL],[test x$with_frontend = xx86-rreil])
AM_CONDITIONAL([X86],[test x$with_frontend = xx86])
AM_CONDITIONAL([AVR_RREIL],[test x$with_frontend = xavr-rreil])
AM_CONDITIONAL([AVR],[test x$with_frontend = xavr])
Axel Simon's avatar
merge  
Axel Simon committed
90 91
AM_CONDITIONAL([HAVE_RREIL],[test x$has_rreil = xyes])
AM_CONDITIONAL([HAVE_X86], [test x$has_x86 = xyes])
Julian Kranz's avatar
---  
Julian Kranz committed
92 93 94
#AM_CONDITIONAL([HAVE_GNU_C11], [echo "int main(void) { return 0; }" | gcc -std=gnu11 -xc - -o /dev/null])
#AM_CONDITIONAL([HAVE_POSIX200809], [test `getconf _POSIX_VERSION` -ge 200809 >/dev/null 2>&1])
AM_CONDITIONAL([HAVE_ANON_MEMBERS], [test x$has_anon_members = xyes])
Axel Simon's avatar
Axel Simon committed
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

dnl check if the helper executables should be build and/or installed
AC_ARG_ENABLE([install-auxbins],
  [AS_HELP_STRING(
    [--enable-install-auxbins],
    [install auxiliary binaries])],
  [], [enable_install_auxbins=no])
AM_CONDITIONAL([INSTALL_AUXBINS],[test x$enable_install_auxbins = xyes])

AC_ARG_ENABLE([build-auxbins],
  [AS_HELP_STRING(
    [--enable-build-auxbins],
    [build auxiliary binaries])],
  [], [enable_build_auxbins=yes])
AM_CONDITIONAL([BUILD_AUXBINS],[test x$enable_build_auxbins = xyes])

dnl check if the helper libraries should be build and/or installed
AC_ARG_ENABLE([install-auxlibs],
  [AS_HELP_STRING(
    [--enable-install-auxlibs],
    [install auxiliary libraries])],
  [], [enable_install_auxlibs=no])
AM_CONDITIONAL([INSTALL_AUXLIBS],[test x$enable_install_auxlibs = xyes])

if test [x$enable_install_auxlibs = xyes] || test [x$enable_build_auxbins = xyes]; then
  default_build_auxlibs=yes;
Axel Simon's avatar
Axel Simon committed
121 122
else
  default_build_auxlibs=no;
Axel Simon's avatar
Axel Simon committed
123 124 125 126 127 128 129 130 131 132
fi

AC_ARG_ENABLE([build-auxlibs],
  [AS_HELP_STRING(
    [--enable-build-auxlibs],
    [build auxiliary libraries])],
  [], [enable_build_auxlibs=$default_build_auxlibs])
AM_CONDITIONAL([BUILD_AUXLIBS],[test x$enable_build_auxlibs = xyes])

AC_CONFIG_HEADERS([config.h])
Axel Simon's avatar
Axel Simon committed
133 134 135 136 137
AC_CONFIG_FILES([
  Makefile
])

AC_OUTPUT()
Axel Simon's avatar
Axel Simon committed
138
cat <<EOF
Axel Simon's avatar
Axel Simon committed
139

Axel Simon's avatar
Axel Simon committed
140 141 142
GDSL toolkit configuration:
  directory prefix:             $prefix
  C flags:                      $CFLAGS
Axel Simon's avatar
Axel Simon committed
143
  front-end to build:          	$with_frontend
Axel Simon's avatar
Axel Simon committed
144 145 146 147 148 149 150
  install compiler:             $enable_install_gdslc
  build auxiliary libraries:    $enable_build_auxlibs
  install auxiliary libraries:  $enable_install_auxlibs
  build auxiliary programs:     $enable_build_auxbins
  install auxiliary programs:   $enable_install_auxbins
  version:                      $VERSION
EOF