automake
[Top][All Lists]
Advanced

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

Re: am I missing something about configuration headers?


From: Tom Howard
Subject: Re: am I missing something about configuration headers?
Date: Mon, 08 Sep 2003 07:39:35 +1000
User-agent: KMail/1.5.1

Hi Dale,

On Saturday 06 September 2003 00:18, Dale E Martin wrote:
> Configure finds "/usr/bin/ssh", and SSH gets defined properly in my
> Makefile, but it FooConfig.h looks like this when it's generated:
> * FooConfig.h.  Generated by configure.  */
> #ifndef FOO_CONFIG_H
> #define FOO_CONFIG_H
>
> inline
> const string &
> getSshPath(){
>   static const string sshPath = "@SSH@";
>   return sshPath;
> }
>
> #endif
>
> What's the missing link here?  The documentation would lead me to believe
> that @SSH@ should be AC_SUBSTed into /usr/bin/ssh.

I know Alexandre Duret-Lutz  has answered your question. but wouldn't it be 
cleaner to add to your configure.ac the following:

AC_DEFINE(SSH, $SSH, [Location of SSH executable])

Then, within you code you would have something like

/* some_file.hpp */

#ifndef SOME_FILE_HPP
#define SOME_FILE_HPP

#include <string>

const std::string&
getSshPath();


#endif // !def SOME_FILE_HPP

/* some_file.cpp */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif //HAVE_CONFIG_H

#include "some_file.hpp"

const std::string&
getSshPath()
{
        static const std::string sshPath = SSH;
        return sshPath;
}

Just my $0.02

Cheers,

-- 
Tom Howard





reply via email to

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