We got nominated! Help us out and vote for GitHub as Best Bootstrapped Startup of 2008. (You can vote once a day.) [ hide ]

public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
Do not look for apr-1-config in PATH if we're building against OS X's 
default Apache.
Hongli Lai (Phusion) (author)
Sat Apr 19 10:13:39 -0700 2008
commit  e58be5382e07e29c9a12c19fa69dd22ca0e2c611
tree    90e1ea4af14287c51a82344b17712b5972126881
parent  08760b6a13af477368c0f84b7f63eda6b8049803
...
33
34
35
36
 
37
38
39
...
101
102
103
104
 
105
106
107
...
128
129
130
131
 
132
133
134
...
179
180
181
182
 
183
184
185
...
239
240
241
242
 
243
244
245
...
33
34
35
 
36
37
38
39
...
101
102
103
 
104
105
106
107
...
128
129
130
 
131
132
133
134
...
179
180
181
 
182
183
184
185
...
239
240
241
 
242
243
244
245
0
@@ -33,7 +33,7 @@ include PlatformInfo
0
 APXS2.nil? and raise "Could not find 'apxs' or 'apxs2'."
0
 APACHE2CTL.nil? and raise "Could not find 'apachectl' or 'apache2ctl'."
0
 HTTPD.nil? and raise "Could not find the Apache web server binary."
0
-APR1_FLAGS.nil? and raise "Could not find Apache Portable Runtime (APR)."
0
+APR_FLAGS.nil? and raise "Could not find Apache Portable Runtime (APR)."
0
 
0
 CXX = "g++"
0
 THREADING_FLAGS = "-D_REENTRANT"
0
@@ -101,7 +101,7 @@ end
0
 ##### Apache module
0
 
0
 class APACHE2
0
- CXXFLAGS = "-I.. -fPIC -g -DPASSENGER_DEBUG #{APR1_FLAGS} #{APXS2_FLAGS} #{CXXFLAGS}"
0
+ CXXFLAGS = "-I.. -fPIC -g -DPASSENGER_DEBUG #{APR_FLAGS} #{APXS2_FLAGS} #{CXXFLAGS}"
0
   OBJECTS = {
0
     'Configuration.o' => %w(Configuration.cpp Configuration.h),
0
     'Hooks.o' => %w(Hooks.cpp Hooks.h
0
@@ -128,7 +128,7 @@ subdir 'ext/apache2' do
0
     #
0
     # Oh, and libtool sucks too. Do we even need it anymore in 2008?
0
     linkflags = "#{LDFLAGS} #{MULTI_ARCH_FLAGS}"
0
- linkflags << " -lstdc++ -lpthread ../boost/src/libboost_thread.a #{APR1_LIBS}"
0
+ linkflags << " -lstdc++ -lpthread ../boost/src/libboost_thread.a #{APR_LIBS}"
0
     create_shared_library 'mod_passenger.so',
0
       APACHE2::OBJECTS.keys.join(' ') << ' mod_passenger.o',
0
       linkflags
0
@@ -179,7 +179,7 @@ end
0
 
0
 class TEST
0
   CXXFLAGS = ::CXXFLAGS + " -Isupport -DTESTING_SPAWN_MANAGER -DTESTING_APPLICATION_POOL "
0
- AP2_FLAGS = "-I../ext/apache2 -I../ext #{APR1_FLAGS}"
0
+ AP2_FLAGS = "-I../ext/apache2 -I../ext #{APR_FLAGS}"
0
   
0
   AP2_OBJECTS = {
0
     'CxxTestMain.o' => %w(CxxTestMain.cpp),
0
@@ -239,7 +239,7 @@ subdir 'test' do
0
       " ../ext/apache2/Utils.o" <<
0
       " ../ext/apache2/Logging.o"
0
     create_executable "Apache2ModuleTests", objects,
0
- "#{LDFLAGS} #{APR1_LIBS} #{MULTI_ARCH_FLAGS} " <<
0
+ "#{LDFLAGS} #{APR_LIBS} #{MULTI_ARCH_FLAGS} " <<
0
       "../ext/boost/src/libboost_thread.a -lpthread"
0
   end
0
   
...
248
249
250
251
 
252
253
254
...
248
249
250
 
251
252
253
254
0
@@ -248,7 +248,7 @@ module Dependencies # :nodoc: all
0
   APR_DevHeaders = Dependency.new do |dep|
0
     dep.name = "Apache Portable Runtime (APR) development headers"
0
     dep.define_checker do |result|
0
- result.found(!APR1_FLAGS.nil?)
0
+ result.found(APR_CONFIG)
0
     end
0
     if RUBY_PLATFORM =~ /linux/
0
       case LINUX_DISTRO
...
120
121
122
123
 
124
125
126
127
128
129
130
131
132
133
134
135
136
 
 
 
137
138
 
 
 
 
 
139
140
141
142
143
144
145
 
 
 
 
 
146
147
148
149
 
 
150
151
152
...
240
241
242
 
 
243
244
245
246
247
 
248
249
250
...
120
121
122
 
123
124
125
126
127
128
 
 
129
130
131
 
 
 
132
133
134
135
136
137
138
139
140
141
142
 
 
 
 
 
 
143
144
145
146
147
148
149
 
 
150
151
152
153
154
...
242
243
244
245
246
247
248
249
250
 
251
252
253
254
0
@@ -120,33 +120,35 @@ private
0
     end
0
   end
0
   
0
- def self.determine_apr1_info
0
+ def self.find_apr_config
0
     # If we're on MacOS X, and we're compiling against the
0
     # default provided Apache, then we'll want to query the
0
     # correct 'apr-1-config' command. However, that command
0
     # is not in $PATH by default. Instead, it lives in
0
     # /Developer/SDKs/MacOSX*sdk/usr/bin.
0
- # So we forcefully add this path to $PATH, if we notice
0
- # that we're compiling against the default Apache.
0
     if RUBY_PLATFORM =~ /darwin/ && HTTPD == "/usr/sbin/httpd"
0
       sdk_dir = Dir["/Developer/SDKs/MacOSX*sdk"].sort.last
0
       if sdk_dir
0
- sdk_bindir = "#{sdk_dir}/usr/bin"
0
- if !ENV['PATH'].split(':').include?(sdk_bindir)
0
- ENV['PATH'] = "#{sdk_bindir}:#{ENV['PATH']}"
0
+ apr_config = "#{sdk_dir}/usr/bin/apr-1-config"
0
+ if !File.executable?(apr_config)
0
+ apr_config = nil
0
         end
0
       end
0
+ else
0
+ apr_config = find_command('apr-1-config')
0
+ if apr_config.nil?
0
+ apr_config = find_command('apr-config')
0
+ end
0
     end
0
-
0
- apr_config = find_command('apr-1-config')
0
- if apr_config.nil?
0
- apr_config = find_command('apr-config')
0
- end
0
- if apr_config.nil?
0
+ return apr_config
0
+ end
0
+
0
+ def self.determine_apr_info
0
+ if APR_CONFIG.nil?
0
       return nil
0
     else
0
- flags = `#{apr_config} --cppflags --includes`.strip
0
- libs = `#{apr_config} --link-ld`.strip
0
+ flags = `#{APR_CONFIG} --cppflags --includes`.strip
0
+ libs = `#{APR_CONFIG} --link-ld`.strip
0
       flags.gsub!(/-O\d? /, '')
0
       return [flags, libs]
0
     end
0
@@ -240,11 +242,13 @@ public
0
   APACHE2CTL = find_apache2ctl
0
   # The absolute path to the Apache binary (that is, 'httpd', 'httpd2', 'apache' or 'apache2').
0
   HTTPD = find_httpd
0
+ # The absolute path to the 'apr-config' or 'apr-1-config' executable.
0
+ APR_CONFIG = find_apr_config
0
   
0
   # The C compiler flags that are necessary to compile an Apache module.
0
   APXS2_FLAGS = determine_apxs2_flags
0
   # The C compiler flags that are necessary for programs that use APR.
0
- APR1_FLAGS, APR1_LIBS = determine_apr1_info
0
+ APR_FLAGS, APR_LIBS = determine_apr_info
0
   
0
   # The C compiler flags that are necessary for building binaries in the same architecture(s) as Apache.
0
   MULTI_ARCH_FLAGS = determine_multi_arch_flags

Comments

    No one has commented yet.