diff --git a/meson.build b/meson.build index 76ddde723284a7214cd5e3a29357a2a4262e7bb9..696e973f463963509d055566a33b0ce3ab710f19 100644 --- a/meson.build +++ b/meson.build @@ -462,6 +462,33 @@ if get_option('generic') == false endforeach endif + +############################################################ +# make a list of include directories +# We do this so that $HOME/include is searched (e.g. for +# libgsl) +# +my_incdirs = [] +found = false +_include_search_paths = [ + homedir + '/include', + '/usr/include', + '/usr/local/include', +] +foreach idir : _include_search_paths + if run_command('sh','-c','meson/directory_exists.sh',idir).returncode() == 0 + inc_arg = idir + _Inc_arg = '-I' + idir + if not found and compiler.has_header('gsl/gsl_blas.h', + args: _Inc_arg) + my_incdirs += [inc_arg] + found = true + endif + endif +endforeach + +incdirs += [ my_incdirs ] + ############################################################ # features which are converted into preprocessor flags (-D) # @@ -469,7 +496,10 @@ endif ########### # drand48 # # -if compiler.has_header('stdlib.h') and \ +if compiler.has_header('stdlib.h', + args: cflags, + include_directories: include_directories(incdirs)\ + ) and \ compiler.sizeof('drand48_r', prefix : '#include <stdlib.h>') > 0 cflags += '-D__HAVE_DRAND48__' @@ -478,18 +508,23 @@ endif ############ # malloc.h # # -if compiler.has_header('malloc.h') +if compiler.has_header('malloc.h', + args: cflags, + include_directories: include_directories(incdirs)) cflags += '-D__HAVE_MALLOC_H__' endif ############ # setitimer # -if compiler.has_header('sys/time.h') and \ +if compiler.has_header('sys/time.h', + args: cflags, + include_directories: include_directories(incdirs)) and \ compiler.has_function('setitimer') cflags += '-D__HAVE_SETITIMER__' endif + ################################# # pkg-config (external command) # # @@ -500,7 +535,9 @@ endif ########################### # valgrind (header files) # # -if compiler.has_header('valgrind/valgrind.h') +if compiler.has_header('valgrind/valgrind.h', + args: cflags, + include_directories: include_directories(incdirs)) cflags += '-D__HAVE_VALGRIND__' endif @@ -525,31 +562,22 @@ if compiler.get_id() != 'gcc' and compiler.get_id() != 'clang' cflags += '-UBACKTRACE' endif -############################################################ -# make a list of include directories -# We do this so that $HOME/include is searched (e.g. for -# libgsl) -# -my_incdirs = [] -found = false -_include_search_paths = [ - homedir + '/include', - '/usr/include', - '/usr/local/include', -] -foreach idir : _include_search_paths - if run_command('sh','-c','meson/directory_exists.sh',idir).returncode() == 0 - inc_arg = idir - _Inc_arg = '-I' + idir - if not found and compiler.has_header('gsl/gsl_blas.h', - args: _Inc_arg) - my_incdirs += [inc_arg] - found = true - endif - endif -endforeach - -incdirs += [ my_incdirs ] +########################## +# location of libiberty.h +# +if compiler.has_header('libiberty.h', + args: cflags, + include_directories: include_directories(incdirs)) + # Fedora + cflags += '-D__HAVE_LIBIBERTYH__' +elif compiler.has_header('libiberty/libiberty.h', + args: cflags, + include_directories: include_directories(incdirs)) + # Debian and derivatives e.g. Ubuntu + cflags += '-D__HAVE_LIBIBERTY_LIBIBERTYH__' +else + error('cannot find libiberty.h at either <libiberty.h> or <libiberty/libiberty.h>') +endif ############################################################ # data objects diff --git a/src/debug/backtrace-symbols.c b/src/debug/backtrace-symbols.c index 87b56e81d727b48937ce321af61637799dc39e5e..6d91eb40453f7f583457317758e8b2911adf9bb7 100644 --- a/src/debug/backtrace-symbols.c +++ b/src/debug/backtrace-symbols.c @@ -33,9 +33,19 @@ */ #define _GNU_SOURCE +/* + * Test if we have libiberty, and find where it its + * header file should be (meson checks). We need to know + * because Debian and Fedora use different locations. + */ #ifdef __HAVE_LIBIBERTY__ +#ifdef __HAVE_LIBIBERTYH__ +#include <libiberty.h> +#endif // __HAVE_LIBIBERTYH__ +#ifdef __HAVE_LIBIBERTY_LIBIBERTYH__ #include <libiberty/libiberty.h> -#endif +#endif // __HAVE_LIBIBERTY_LIBIBERTYH__ +#endif // __HAVE_LIBIBERTY__ #include <string.h> #include <malloc.h> #include <stdio.h> diff --git a/src/main.c b/src/main.c index 43bf4583c38b3144ada1254664d9ca75023523b2..d73c004fcc168bf17472f3c8a83cd0514c8b4800 100644 --- a/src/main.c +++ b/src/main.c @@ -38,7 +38,6 @@ int main (int argc, * options, make a stardata, then call binary_c main * with the stardata. */ - printf("ok\n"); #if !defined SEGFAULTS char * altstack = setup_segfaults(); #endif diff --git a/src/setup/version.c b/src/setup/version.c index 86d40c36ad21aa697ccf3f11ba6dc40e93249030..00a1fa44b0655e1cf0998a0305115eb52b6b40d1 100644 --- a/src/setup/version.c +++ b/src/setup/version.c @@ -961,6 +961,8 @@ void version(struct stardata_t * RESTRICT const stardata) Macrotest(__HAVE_LIBBFD__); Macrotest(__HAVE_LIBBSD__); Macrotest(__HAVE_LIBIBERTY__); + Macrotest(__HAVE_LIBIBERTYH__); + Macrotest(__HAVE_LIBIBERTY_LIBIBERTYH__); Macrotest(__HAVE_LIBBACKTRACE__); Macrotest(__HAVE_MALLOC_H__); Macrotest(__HAVE_DRAND48__);