mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	meson: fix openssl detection issues in 6a30027
				
					
				
			When not detecting openssl via pkg-config, we'd error out if the headers weren't found, even if -Dssl=auto. When detecting via pkg-config, but the headers could not be found, we'd error out because the ssl_int variable would not exist. Reported-by: Nathan Bossart <nathandbossart@gmail.com> Discussion: https://postgr.es/m/20230313180432.GA246741@nathanxps13
This commit is contained in:
		
							
								
								
									
										16
									
								
								meson.build
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								meson.build
									
									
									
									
									
								
							@@ -1189,23 +1189,29 @@ if sslopt in ['auto', 'openssl']
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  # via pkg-config et al
 | 
					  # via pkg-config et al
 | 
				
			||||||
  ssl = dependency('openssl', required: false)
 | 
					  ssl = dependency('openssl', required: false)
 | 
				
			||||||
 | 
					  # only meson >= 0.57 supports declare_dependency() in cc.has_function(), so
 | 
				
			||||||
 | 
					  # we pass cc.find_library() results if necessary
 | 
				
			||||||
 | 
					  ssl_int = []
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # via library + headers
 | 
					  # via library + headers
 | 
				
			||||||
  if not ssl.found()
 | 
					  if not ssl.found()
 | 
				
			||||||
    ssl_lib = cc.find_library('ssl',
 | 
					    ssl_lib = cc.find_library('ssl',
 | 
				
			||||||
      dirs: test_lib_d,
 | 
					      dirs: test_lib_d,
 | 
				
			||||||
      header_include_directories: postgres_inc,
 | 
					      header_include_directories: postgres_inc,
 | 
				
			||||||
      has_headers: ['openssl/ssl.h', 'openssl/err.h'])
 | 
					      has_headers: ['openssl/ssl.h', 'openssl/err.h'],
 | 
				
			||||||
 | 
					      required: openssl_required)
 | 
				
			||||||
    crypto_lib = cc.find_library('crypto',
 | 
					    crypto_lib = cc.find_library('crypto',
 | 
				
			||||||
      dirs: test_lib_d,
 | 
					      dirs: test_lib_d,
 | 
				
			||||||
      header_include_directories: postgres_inc)
 | 
					      required: openssl_required)
 | 
				
			||||||
 | 
					    if ssl_lib.found() and crypto_lib.found()
 | 
				
			||||||
      ssl_int = [ssl_lib, crypto_lib]
 | 
					      ssl_int = [ssl_lib, crypto_lib]
 | 
				
			||||||
 | 
					      ssl = declare_dependency(dependencies: ssl_int, include_directories: postgres_inc)
 | 
				
			||||||
    ssl = declare_dependency(dependencies: ssl_int,
 | 
					    endif
 | 
				
			||||||
                             include_directories: postgres_inc)
 | 
					 | 
				
			||||||
  elif cc.has_header('openssl/ssl.h', args: test_c_args, dependencies: ssl, required: openssl_required) and \
 | 
					  elif cc.has_header('openssl/ssl.h', args: test_c_args, dependencies: ssl, required: openssl_required) and \
 | 
				
			||||||
       cc.has_header('openssl/err.h', args: test_c_args, dependencies: ssl, required: openssl_required)
 | 
					       cc.has_header('openssl/err.h', args: test_c_args, dependencies: ssl, required: openssl_required)
 | 
				
			||||||
    ssl_int = [ssl]
 | 
					    ssl_int = [ssl]
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    ssl = not_found_dep
 | 
				
			||||||
  endif
 | 
					  endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if ssl.found()
 | 
					  if ssl.found()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user