xref: /freebsd-src/contrib/ntp/sntp/m4/define_dir.m4 (revision 416ba5c74546f32a993436a99516d35008e9f384)
1*2b15cb3dSCy Schubertdnl @synopsis AC_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION])
2*2b15cb3dSCy Schubertdnl
3*2b15cb3dSCy Schubertdnl This macro sets VARNAME to the expansion of the DIR variable,
4*2b15cb3dSCy Schubertdnl taking care of fixing up ${prefix} and such.
5*2b15cb3dSCy Schubertdnl
6*2b15cb3dSCy Schubertdnl VARNAME is then offered as both an output variable and a C
7*2b15cb3dSCy Schubertdnl preprocessor symbol.
8*2b15cb3dSCy Schubertdnl
9*2b15cb3dSCy Schubertdnl Example:
10*2b15cb3dSCy Schubertdnl
11*2b15cb3dSCy Schubertdnl    AC_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.])
12*2b15cb3dSCy Schubertdnl
13*2b15cb3dSCy Schubertdnl @category Misc
14*2b15cb3dSCy Schubertdnl @author Stepan Kasal <kasal@ucw.cz>
15*2b15cb3dSCy Schubertdnl @author Andreas Schwab <schwab@suse.de>
16*2b15cb3dSCy Schubertdnl @author Guido U. Draheim <guidod@gmx.de>
17*2b15cb3dSCy Schubertdnl @author Alexandre Oliva
18*2b15cb3dSCy Schubertdnl @version 2006-10-13
19*2b15cb3dSCy Schubertdnl @license AllPermissive
20*2b15cb3dSCy Schubert
21*2b15cb3dSCy SchubertAC_DEFUN([AC_DEFINE_DIR], [
22*2b15cb3dSCy Schubert  prefix_NONE=
23*2b15cb3dSCy Schubert  exec_prefix_NONE=
24*2b15cb3dSCy Schubert  test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix
25*2b15cb3dSCy Schubert  test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix
26*2b15cb3dSCy Schubertdnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn
27*2b15cb3dSCy Schubertdnl refers to ${prefix}.  Thus we have to use `eval' twice.
28*2b15cb3dSCy Schubert  eval ac_define_dir="\"[$]$2\""
29*2b15cb3dSCy Schubert  eval ac_define_dir="\"$ac_define_dir\""
30*2b15cb3dSCy Schubert  AC_SUBST($1, "$ac_define_dir")
31*2b15cb3dSCy Schubert  AC_DEFINE_UNQUOTED($1, "$ac_define_dir", [$3])
32*2b15cb3dSCy Schubert  test "$prefix_NONE" && prefix=NONE
33*2b15cb3dSCy Schubert  test "$exec_prefix_NONE" && exec_prefix=NONE
34*2b15cb3dSCy Schubert])
35*2b15cb3dSCy Schubert
36