Skip to content

Commit

Permalink
Fix bin/file detection
Browse files Browse the repository at this point in the history
  • Loading branch information
dgsga committed Mar 11, 2024
1 parent 927cd22 commit f8a5d89
Showing 1 changed file with 34 additions and 33 deletions.
67 changes: 34 additions & 33 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -25,37 +25,6 @@ host_os = host_machine.system()
message(host_os)
target_os = target_machine.system()

#
# Check whether to check for 64_bit libraries
#

run_command(
cc,
'-c',
meson.project_source_root() / 'libatalk/dummy.c',
'-o',
meson.global_build_root() / 'dummy.o',
check: true,
)
compiler_mode = run_command(
'/usr/bin/file',
meson.global_build_root() / 'dummy.o',
check: true,
).stdout().strip().contains('ELF 64')

if (cpu in ['ppc64', 's390x', 'sparc64', 'x86_64', 'i386'] and compiler_mode)
if target_os in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
atalk_libname = 'lib'
elif target_os == 'sunos'
atalk_libname = 'lib/64'
else
atalk_libname = 'lib64'
endif
else
atalk_libname = 'lib'
endif
message(atalk_libname)

#########
# Paths #
#########
Expand Down Expand Up @@ -172,10 +141,42 @@ add_global_link_arguments(netatalk_common_link_args, language: 'c')
############

grep = find_program('grep', required: true)
lex = find_program('lex', required: false)
lex = find_program('lex', required: true)
mysql_config = find_program('mysql_config', required: false)
perl = find_program('perl', required: true)
yacc = find_program('yacc', required: false)
yacc = find_program('yacc', required: true)
file = find_program('file', required: true)

#
# Check whether to check for 64_bit libraries
#

run_command(
cc,
'-c',
meson.project_source_root() / 'libatalk/dummy.c',
'-o',
meson.global_build_root() / 'dummy.o',
check: true,
)
compiler_mode = run_command(
file,
meson.global_build_root() / 'dummy.o',
check: true,
).stdout().strip().contains('ELF 64')

if (cpu in ['ppc64', 's390x', 'sparc64', 'x86_64', 'i386'] and compiler_mode)
if target_os in ['dragonfly', 'freebsd', 'netbsd', 'openbsd']
atalk_libname = 'lib'
elif target_os == 'sunos'
atalk_libname = 'lib/64'
else
atalk_libname = 'lib64'
endif
else
atalk_libname = 'lib'
endif
message(atalk_libname)

#################
# Header checks #
Expand Down

0 comments on commit f8a5d89

Please sign in to comment.