Solved

question about autoconf

Posted on 2004-03-20
5
192 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now