Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

header-only ntl interface #1489

Merged
merged 3 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 7 additions & 28 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ CPPFLAGS2:=-L$(FLINT_DIR) $(CPPFLAGS)
LIB_CPPFLAGS:=@LIB_CPPFLAGS@
CXXFLAGS:=@CXXFLAGS@
LIBS:=@LIBS@
ifneq ($(WANT_NTL), 0)
LIBS += -lstdc++ -lntl
endif
LIBS2:=$(LIBS) -lflint
PIC_FLAG:=@PIC_FLAG@

Expand Down Expand Up @@ -227,10 +230,8 @@ SINGLE_HEADERS := \
fq_types.h fq_nmod_types.h \
fq_zech_types.h \
arf_types.h acf_types.h \
arb_types.h acb_types.h
ifneq ($(WANT_NTL), 0)
SINGLE_HEADERS += NTL-interface.h
endif
arb_types.h acb_types.h \
NTL-interface.h

HEADERS := $(patsubst %,$(SRC_DIR)/%, \
$(patsubst %,%,$(SINGLE_HEADERS)) \
Expand All @@ -247,11 +248,6 @@ $(1)_SOURCES := $(wildcard $(SRC_DIR)/$(1)/*.c)
endef
$(foreach dir, $(DIRS), $(eval $(call xxx_SOURCES,$(dir))))
SOURCES := $(foreach dir,$(DIRS),$($(dir)_SOURCES))
# NOTE: We do not add CPP files to C files in SOURCES in order to not screw up
# the `patsubst' in the object files.
ifneq ($(WANT_NTL), 0)
interfaces_SOURCES := $(SRC_DIR)/interfaces/NTL-interface.cpp
endif

define xxx_PROF_SOURCES
$(1)_PROF_SOURCES := $(wildcard $(SRC_DIR)/$(1)/profile/*.c)
Expand All @@ -268,6 +264,8 @@ endef
_TEST_SOURCES := $(wildcard $(SRC_DIR)/test/*.c)
$(foreach dir, $(DIRS), $(eval $(call xxx_TEST_SOURCES,$(dir))))
TEST_SOURCES := $(foreach dir,$(DIRS),$($(dir)_TEST_SOURCES)) $(_TEST_SOURCES) $(fq_zech_vec_TEST_SOURCES)
# NOTE: We do not add CPP files to C files in SOURCES in order to not screw up
# the `patsubst' in the object files.
ifneq ($(WANT_NTL), 0)
interfaces_TEST_SOURCES := $(SRC_DIR)/interfaces/test/t-NTL-interface.cpp
endif
Expand All @@ -291,9 +289,6 @@ $(1)_OBJS := $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$($(1)_SOURCES))
endef
$(foreach dir, $(DIRS), $(eval $(call xxx_OBJS,$(dir))))
OBJS := $(foreach dir, $(DIRS), $($(dir)_OBJS))
ifneq ($(WANT_NTL), 0)
OBJS += $(BUILD_DIR)/interfaces/NTL-interface.o
endif
endif

################################################################################
Expand All @@ -305,10 +300,6 @@ define xxx_LOBJS
$(1)_LOBJS := $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.lo,$($(1)_SOURCES))
endef
$(foreach dir, $(DIRS), $(eval $(call xxx_LOBJS,$(dir))))
LOBJS := $(foreach dir, $(DIRS), $($(dir)_LOBJS))
ifneq ($(WANT_NTL), 0)
LOBJS += $(BUILD_DIR)/interfaces/NTL-interface.lo
endif
endif

################################################################################
Expand Down Expand Up @@ -525,12 +516,6 @@ $(BUILD_DIR)/$(1)/%.o: $(SRC_DIR)/$(1)/%.c | $(BUILD_DIR)/$(1)
endef

$(foreach dir, $(DIRS), $(eval $(call xxx_OBJS_rule,$(dir))))

ifneq ($(WANT_NTL), 0)
$(BUILD_DIR)/interfaces/NTL-interface.o: $(SRC_DIR)/interfaces/test/t-NTL-interface.cpp | $(BUILD_DIR)/interfaces
@echo " CXX $(@:$(BUILD_DIR)/%=%)"
@$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LIB_CPPFLAGS) -c $< -o $@ -MMD -MF $(@:%=%.d)
endif
endif

################################################################################
Expand All @@ -545,12 +530,6 @@ $(BUILD_DIR)/$(1)/%.lo: $(SRC_DIR)/$(1)/%.c | $(BUILD_DIR)/$(1)
endef

$(foreach dir, $(DIRS), $(eval $(call xxx_LOBJS_rule,$(dir))))

ifneq ($(WANT_NTL), 0)
$(BUILD_DIR)/interfaces/NTL-interface.lo: $(SRC_DIR)/interfaces/test/t-NTL-interface.cpp | $(BUILD_DIR)/interfaces
@echo " CXX $(@:$(BUILD_DIR)/%=%)"
@$(CXX) $(PIC_FLAG) $(CXXFLAGS) $(CPPFLAGS) $(LIB_CPPFLAGS) -c $< -o $@ -MMD -MF $(@:%=.d)
endif
endif

################################################################################
Expand Down
6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -411,19 +411,19 @@ then
fi

AC_ARG_WITH(ntl_include,
[AS_HELP_STRING([--with-ntl-include=DIR],[Use NTL and specify its include directory])],
[AS_HELP_STRING([--with-ntl-include=DIR],[Use NTL (in tests) and specify its include directory])],
CPPFLAGS="$CPPFLAGS -I$withval"
ntl_include_path="$withval"
)

AC_ARG_WITH(ntl_lib,
[AS_HELP_STRING([--with-ntl-lib=DIR],[Use NTL and specify its library directory])],
[AS_HELP_STRING([--with-ntl-lib=DIR],[Use NTL (in tests) and specify its library directory])],
LDFLAGS="$LDFLAGS -L$withval"
ntl_lib_path="$withval"
)

AC_ARG_WITH(ntl,
[AS_HELP_STRING([--with-ntl[[=DIR]]],[Use NTL and optionally specify its install directory])],
[AS_HELP_STRING([--with-ntl[[=DIR]]],[Use NTL (in tests) and optionally specify its install directory])],
if test "$with_ntl" = "yes";
then
:
Expand Down
Loading