macros/define_dir.m4
author Mikael Berthe <mikael@lilotux.net>
Sun, 07 Mar 2010 15:13:49 +0100
changeset 2 b6516e8751bb
permissions -rw-r--r--
More autotools tweaking...
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     1
dnl define_dir.m4
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     2
dnl http://autoconf-archive.cryp.to/ac_define_dir.html
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     3
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     4
#  AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION])
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     5
# This macro sets VARNAME to the expansion of the DIR variable, taking care
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     6
# of fixing up ${prefix} and such.
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     7
# VARNAME is then offered as both an output variable and a C preprocessor
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     8
# symbol.
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
     9
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    10
# Authors
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    11
# Stepan Kasal <kasal@ucw.cz>, Andreas Schwab <schwab@suse.de>,
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    12
# Guido Draheim <guidod@gmx.de>, Alexandre Oliva
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    13
# (Slightly modified -- Mikael Berthe)
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    14
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    15
AC_DEFUN([AC_DEFINE_DIR], [
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    16
  prefix_NONE=
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    17
  exec_prefix_NONE=
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    18
  test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    19
  test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    20
dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    21
dnl refers to ${prefix}.  Thus we have to use `eval' twice.
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    22
  ac_define_dir=`eval echo [$]$2`
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    23
  ac_define_dir=`eval echo [$]ac_define_dir`
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    24
  AC_SUBST($1, "$ac_define_dir")
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    25
  ifelse($3, ,
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    26
    AC_DEFINE_UNQUOTED($1, "$ac_define_dir"),
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    27
    AC_DEFINE_UNQUOTED($1, "$ac_define_dir", $3))
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    28
  test "$prefix_NONE" && prefix=NONE
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    29
  test "$exec_prefix_NONE" && exec_prefix=NONE
b6516e8751bb More autotools tweaking...
Mikael Berthe <mikael@lilotux.net>
parents:
diff changeset
    30
])