Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

question about autoconf

Posted on 2004-03-20
5
213 Views
Last Modified: 2010-04-01
I've written a package that uses autoconf, and automake.  I am having trouble figuring out how to set my log file for the program though.  I want the program to use the --localstatedir as the log directory.

How do I make the command
%make install
create the localstatedir, and how can I make my program use that for the log directory?  
0
Comment
Question by:lwinkenb
  • 2
  • 2
5 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 10643735
Modify your make file so that the link command includes the "--localstatedir" option.
0
 
LVL 4

Accepted Solution

by:
greyfairer earned 500 total points
ID: 10644568
in your automake.am you could use
CPPFLAGS = -DLOCAL_STATE_DIR=\"$(localstatedir)\"

in your program you should then be able to use
char filename[] = LOCAL_STATE_DIR "/log1.txt"

something like that,

Geert.
0
 
LVL 5

Author Comment

by:lwinkenb
ID: 10644999
Thanks, that works for accessing the localstatedir from my program.  Now do I make sure the directory is created when the user runs 'make install'?
0
 
LVL 4

Expert Comment

by:greyfairer
ID: 10647787
not sure if it's the best solution, but a local install hook should do.

in your Makefile.am:

install-data-local:
     $(mkinstalldirs) $(localstatedir)
0
 
LVL 5

Author Comment

by:lwinkenb
ID: 10655496
Thanks for your help
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question