[tor-bugs] #6311 [Tor]: Migrate TOR_SEARCH_LIBRARY to use pkg-config

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Jul 11 21:03:40 UTC 2013

#6311: Migrate TOR_SEARCH_LIBRARY to use pkg-config
 Reporter:  nickm            |          Owner:  nickm             
     Type:  enhancement      |         Status:  assigned          
 Priority:  major            |      Milestone:  Tor: 0.2.5.x-final
Component:  Tor              |        Version:                    
 Keywords:  tor-relay build  |         Parent:                    
   Points:                   |   Actualpoints:                    

Comment(by nickm):

 Replying to [comment:7 nickm]:
 > Returning to look at this again, I think I actually need to do some
 design here.  So let's see.  The current behavior is, more or less:
 >  * Check the command line for a --with-libraryname-dir=xxx option. If
 so, set trylibrarydir to xxx.
 >  * Save the initial values of LDFLAGS, LIBS, and CPPFLAGS.
 >  * Iterating over $trylibrarydir, "", /usr/local, /usr/pkg, and other
 directories optionally specified in $8:
 >    * Try to extend the saved LDFLAGS and CPPFLAGS with appropriate -L
 and -I options for that directory.
 >    * Extend LIBS with the library options specified in $3
 >    * See if we can build and link a program that includes no headers for
 the library, and tries to require one of its identifiers
 >    * If so, see if we can compile a program that does include headers
 for the library
 >    * If so, this is the one we want: remember that directory, and break
 out of the loop.
 >  * Then, extend LDFLAGS and CPPFLAGS with the options given by the
 chosen directory, and extend LIBS with the chosen libs.
 >  * Additionally, set TOR_LDFLAGS_libraryname and
 TOR_CPPFLAGS_libraryname and TOR_LIBDIR_libraryname to appropriate values,
 and AC_SUBST the CPPDLAGS and LDFLAGS variables.
 >  * Then, see whether we need any rpath-style options to link the program
 by iterating over various possibilities and seeing if they make the test
 program runnable.

   * Then, roll back all of CPPFLAGS, LDFLAGS, and LIBS to their original

 > So right now our outputs are a series of changes to LDFLAGS and CPPFLAGS
 and LIBS that carry across all the things we build (although some callers
 immediately roll them back), as well as the TOR_CPPFLAGS_* / TOR_LDFLAGS_*
 / TOR_LIBDIR_* values.

 Actually, LDFLAGS and CPPFLAGS and LIBS are rolled back in all cases.  The
 TOR_{CPPFLAGS,LDFLAGS,LIBDIR}_* values are the only outputs.

Ticket URL: <https://trac.torproject.org/projects/tor/ticket/6311#comment:8>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online

More information about the tor-bugs mailing list