autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: what's the effect of test in ac_define_dir.m4


From: Ionutz Borcoman
Subject: Re: what's the effect of test in ac_define_dir.m4
Date: Mon, 24 Jun 2002 16:07:42 +0300
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020214

Hi,

After many trials and failures, here is my final script (see atachement please).

I intend to use it like this:

1. In configure.in put something like:

AC_WITH_DIR(xxx, "$prefix/xxx",
  AC_HELP_STRING([  --with-xxx=something],
  [place binaries in xxx (default to $prefix/xxx)]))

2. In Makefile.am put something like:

address@hidden@

xxx_PROGRAMS = main

main_SOURCES = main.c

3. Call ./configure like this:

./configure --with-xxx="/opt/xxx" -> main goes to /opt/xxx

or like this

./configure -> main goes to /usr/local/xxx

Please tell me if this is OK or how can I improve this, while keeping the present functionality, aka relocate of the main program through the configure script, or put it in some default location set by me, in case ./configure is called without arguments.

TIA,

Ionutz
dnl @synopsis AC_WITH_DIR(VARNAME, DIR [, DESCRIPTION])
dnl
dnl This macro _AC_DEFINEs VARNAME to the expansion of the DIR
dnl variable, taking care of fixing up ${prefix} and such.
dnl
dnl Example:
dnl
dnl    AC_WITH_DIR(mybin, bindir, [Location of installed binaries])
dnl
dnl will create a new option --with-mybin. If this is called with no 
dnl parameter, with without or with no, then it bindir will default 
dnl to bindir.
dnl 
dnl @author Ionutz Borcoman <address@hidden> based on ac_define_dir.m4 by Guido 
Draheim

AC_DEFUN([AC_WITH_DIR], [
        AC_ARG_WITH($1, 
                $3,
                $1=$withval,
                $1=no)
        test "x$prefix" = xNONE && prefix="$ac_default_prefix"
        test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
        ac_with_dir=`eval echo [$]$2`
        ac_with_dir=`eval echo [$]ac_with_dir`
        ac_selection_is=`eval echo [$]$1`
        test "x$ac_selection_is" = "xno" -o "x$ac_selection_is" = "xyes" && 
$1=$ac_with_dir
        AC_SUBST($1, "[$]$1")
])

reply via email to

[Prev in Thread] Current Thread [Next in Thread]