#
# This file is part of the flashrom project.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#

# Here are functions and macros defined for the Makefile

define mark_unsupported
$(foreach p,$1, \
	$(if $(filter $($(p)),yes), \
		$(eval UNSUPPORTED_FEATURES += $(p)=yes), \
		$(eval override $(p) := no)))
endef

define filter_deps
$(strip $(foreach p,$1, \
	$(if $(filter $($(p)),yes), \
		$(p))))
endef

define disable_all
$(foreach p,$1, \
	$(eval override $(p) := no))
endef

# Run the C Preprocessor with file $1 and return the last line, removing quotes.
define c_macro_test
$(strip $(shell $(CC) -E $1 2>/dev/null | tail -n 1 | tr -d '"'))
endef

define c_compile_test
$(shell $(CC) -c -Wall -Werror -o /dev/null $1 2>/dev/null && echo yes || echo no)
endef

define LIBPCI_TEST
/* Avoid a failing test due to libpci header symbol shadowing breakage */
#define index shadow_workaround_index
#if !defined PCIUTILS_PCI_H
#include <pci/pci.h>
#else
#include <pciutils/pci.h>
#endif
struct pci_access *pacc;
int main(int argc, char **argv)
{
	(void) argc;
	(void) argv;
	pacc = pci_alloc();
	return 0;
}
endef
export LIBPCI_TEST

define PCI_GET_DEV_TEST
/* Avoid a failing test due to libpci header symbol shadowing breakage */
#define index shadow_workaround_index
#if !defined PCIUTILS_PCI_H
#include <pci/pci.h>
#else
#include <pciutils/pci.h>
#endif
struct pci_access *pacc;
struct pci_dev *dev = {0};
int main(int argc, char **argv)
{
	(void) argc;
	(void) argv;
	pacc = pci_alloc();
	dev = pci_get_dev(pacc, dev->domain, dev->bus, dev->dev, 1);
	return 0;
}
endef
export PCI_GET_DEV_TEST

define LIBUSB1_TEST
#include <stddef.h>
#include <libusb.h>
int main(int argc, char **argv)
{
	(void)argc;
	(void)argv;
	libusb_init(NULL);
	return 0;
}
endef
export LIBUSB1_TEST

define LIBJAYLINK_TEST
#include <stddef.h>
#include <libjaylink/libjaylink.h>
int main(int argc, char **argv)
{
	struct jaylink_context *ctx;

	(void)argc;
	(void)argv;

	jaylink_init(&ctx);
	jaylink_exit(ctx);

	return 0;
}
endef
export LIBJAYLINK_TEST

define FTDI_TEST
#include <stdlib.h>
#include <ftdi.h>
struct ftdi_context *ftdic = NULL;
int main(int argc, char **argv)
{
	(void) argc;
	(void) argv;
	return ftdi_init(ftdic);
}
endef
export FTDI_TEST

define FTDI_232H_TEST
#include <ftdi.h>
enum ftdi_chip_type type = TYPE_232H;
endef
export FTDI_232H_TEST

define NI845X_TEST
#include <ni845x.h>

int main(int argc, char **argv)
{
    (void) argc;
    (void) argv;
    char I2C_Device[256];
    NiHandle Dev_Handle;
    uInt32 NumberFound = 0;
    ni845xFindDevice(I2C_Device, &Dev_Handle, &NumberFound);
    ni845xCloseFindDeviceHandle(Dev_Handle);
    return 0;
}
endef
export NI845X_TEST
