aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
blob: 71d303a0ce0c1997bc99c4eedd261783414578e8 (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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# file      : configure.ac
# copyright : Copyright (c) 2009-2018 Code Synthesis Tools CC
# license   : GNU GPL v3; see accompanying LICENSE file

AC_PREREQ(2.60)
AC_INIT([odb], [__value__(version)], [odb-users@codesynthesis.com])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([odb/version.hxx])

AM_INIT_AUTOMAKE([-Wall -Werror foreign nostdinc subdir-objects dist-bzip2 dist-zip tar-ustar])
m4_equote()[m4_ifdef]m4_dquote()([AM_PROG_AR], [AM_PROG_AR]) # Required by automake 1.12.

LT_INIT([disable-static])

AC_CANONICAL_HOST

# Check for C++ compiler and use it to compile the tests.
#
AC_PROG_CXX
AC_LANG(C++)

# Create the libtool executable so that we can use it in further tests.
#
LT_OUTPUT

# Test for plugin support in GCC.
#
GCC_PLUGIN

# See if we are building static plugin. Static build should only be
# used if you are building a custom version of GCC with the ODB
# plugin linked-in statically. This is primarily useful on Windows
# where GCC plugins are not (yet) supported due to dynamic loading
# limitations. In this case the headers normally come from the GCC
# build directly via CPPFLAGS.
#
if test x$static_plugin = xyes; then
  AC_WARN([Building static plugin for direct linking into GCC executable!])
  AC_DEFINE([ODB_STATIC_PLUGIN], [1], [Building static plugin.])
  plugindir='$(pkglibexecdir)'

# Otherwise, see if we should install the plugin into the GCC plugin dir.
#
elif test x$gcc_plugin_dir != xno; then
  AC_DEFINE([ODB_GCC_PLUGIN_DIR], [1], [Plugin is in GCC plugin directory.])
  plugindir=$gcc_plugin_dir

# Otherwise, try to figure out a relative path from the driver (bindir) to
# the plugin (libexecdir).
#
elif test x$static_plugin = xno; then
  # Get the expanded values for bindir and libexecdir.
  #
  if test x$exec_prefix = xNONE; then
    if test x$prefix = xNONE; then
      e_exec_prefix=$ac_default_prefix
     else
      e_exec_prefix=$prefix
    fi
  else
    e_exec_prefix=$exec_prefix
  fi

  e_pkglibexecdir=`echo "$libexecdir/$PACKAGE_NAME" | sed "s?^\\\${exec_prefix}?$e_exec_prefix?"`
  e_bindir=`echo "$bindir" | sed "s?^\\\${exec_prefix}?$e_exec_prefix?"`

  # Try to find a common prefix.
  #
  common=$e_bindir
  rel_plugindir=$e_pkglibexecdir

  while test x$common != x/; do
    suffix=`echo "$e_pkglibexecdir" | sed "s?^$common/*??"`
    if test x$suffix != x$e_pkglibexecdir; then
      # Replace all the remaining directories in bindir with ".."
      # and append the suffix.
      rel_plugindir=`echo "$e_bindir" | sed "s?^$common/*??"`
      rel_plugindir=`echo "$rel_plugindir" | sed ['s?[^/][^/]*?..?g']`
      if test x$rel_plugindir != x -a x$suffix != x; then
        rel_plugindir="$rel_plugindir/$suffix"
      else
        rel_plugindir="$rel_plugindir$suffix"
      fi
      break
    fi
    common=`AS_DIRNAME(["$common"])`
  done
  AC_DEFINE_UNQUOTED([ODB_PLUGIN_PATH], ["$rel_plugindir"], [Plugin path.])
  plugindir='$(pkglibexecdir)'
fi

AC_SUBST([plugindir])

# G++ name.
#
AC_ARG_WITH(
  [gxx-name],
  [AC_HELP_STRING([--with-gxx-name=NAME], [g++ executable name to embed in the ODB compiler driver])],
  [case $withval in
     no)
       gxx_name=
       ;;
     yes)
       gxx_name=$CXX
       ;;
     *)
       gxx_name="$withval"
       ;;
   esac],
  [gxx_name=$CXX])

AS_IF(
  [test "x$gxx_name" != x],
  [AC_DEFINE_UNQUOTED([ODB_GXX_NAME], ["$gxx_name"], [g++ binary.])])

# Default options file.
#
AC_ARG_WITH(
  [options-file],
  [AC_HELP_STRING([--with-options-file=PATH], [default options file path to embed in the driver])],
  [case $withval in
     no)
       options_file=
       ;;
     yes)
       options_file=../etc/odb/default.options
       ;;
     *)
       options_file="$withval"
       ;;
   esac],
  [options_file=])

AS_IF(
  [test "x$options_file" != x],
  [AC_DEFINE_UNQUOTED([ODB_DEFAULT_OPTIONS_FILE], ["$options_file"], [default options file path.])])

# Check for libcutl.
#
LIBCUTL([],[AC_MSG_ERROR([libcutl is not found; consider using --with-libcutl=DIR])])

# Check if we should disable rpath.
#
DISABLE_RPATH

# Output.
#
AC_CONFIG_HEADERS([odb/config.h])
AC_CONFIG_FILES([__path__(config_files)])
AC_OUTPUT