'test-regex',
        'test-sad']
 
-# for BSD only
-lib_execinfo = cc.find_library('execinfo', required: false)
-
 default_cflags = machine_args + ['-DALLOW_EXPERIMENTAL_API']
 default_ldflags = []
 if get_option('default_library') == 'static' and not is_windows
                        dep_objs += get_variable(get_option('default_library')
                                 + '_rte_' + d)
                endforeach
-               dep_objs += lib_execinfo
 
                link_libs = []
                if get_option('default_library') == 'static'
 
        def_lib = get_option('default_library')
        test_dep_objs += get_variable(def_lib + '_rte_' + d)
 endforeach
-test_dep_objs += cc.find_library('execinfo', required: false)
 
 link_libs = []
 if get_option('default_library') == 'static'
 
        dpdk_extra_ldflags += '-lm'
 endif
 
-# for linux link against dl, for bsd execinfo
 if is_linux
        link_lib = 'dl'
-elif is_freebsd
-       link_lib = 'execinfo'
 else
        link_lib = ''
 endif
        dpdk_extra_ldflags += '-lfdt'
 endif
 
+libexecinfo = cc.find_library('libexecinfo', required: false)
+if libexecinfo.found() and cc.has_header('execinfo.h')
+       add_project_link_arguments('-lexecinfo', language: 'c')
+       dpdk_extra_ldflags += '-lexecinfo'
+endif
+
 # check for libbsd
 libbsd = dependency('libbsd', required: false, method: 'pkg-config')
 if libbsd.found()
 
        link_whole_libs = dpdk_static_libraries + dpdk_drivers
 endif
 
-execinfo = cc.find_library('execinfo', required: false)
-
 # list of all example apps. Keep 1-3 per line, in alphabetical order.
 all_examples = [
        'bbdev_app', 'bond',
        cflags = default_cflags
        ldflags = default_ldflags
 
-       ext_deps = [execinfo]
+       ext_deps = []
        includes = [include_directories(example)]
        deps = ['eal', 'mempool', 'net', 'mbuf', 'ethdev', 'cmdline']
        subdir(example)