Solved

question about autoconf

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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
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.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

777 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