diff --git a/Makefile.in b/Makefile.in index 0a81ef0..06b9a28 100644 --- a/Makefile.in +++ b/Makefile.in @@ -8,7 +8,10 @@ VERSION=7.3.0w FLORIST_VERSION=$(VERSION) GNATPREPFLAGS = -c -r -GCCFLAGS = -O2 +ADAFLAGS = @ADAFLAGS@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ TARGET=@host_alias@ ifneq ($(TARGET),) @@ -32,13 +35,17 @@ PREFIX = @prefix@ ENABLE_SHARED = @ENABLE_SHARED@ PROJECT_FLAGS = @BUILD_TYPE_OPTION@ @THREADS_OPTION@ @RTS_OPTION@ \ + $(foreach v,ADAFLAGS CFLAGS CPPFLAGS LDFLAGS LIBS\ + ,'-X$(v)=$($(v))') \ $(TARGET_OPTION) # Scenario variables and RTS selection must be passed consistently to # project-aware tools gprbuild, gprinstall, and gprclean. +# *FLAGS usually only influence gprbuild, but stay on the safe side. +# For example gprinstall may copy LIBS into the installed project. GNATPREP = $(TARGET_PREFIX)gnatprep GPRBUILD = gprbuild -GPRBUILD_FLAGS = $(GCCFLAGS) $(PROJECT_FLAGS) +GPRBUILD_FLAGS = $(PROJECT_FLAGS) GENDIR = gensrc GENDIR_ON_TARGET=$(GENDIR) @@ -108,12 +115,12 @@ configure: configure.in aclocal.m4 # If you are unlucky, it will require fixes to c-posix.c. # c-posix: c-posix.c confsrc/config.h confsrc/pconfig.h - $(CC) $(GCCFLAGS) -DVERSION="\"$(VERSION)\"" -DLIBS="\"$(LIBS)\"" -DGENDIR="\"$(GENDIR_ON_TARGET)\"" -o c-posix c-posix.c $(LIBS) + $(CC) -O2 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -DVERSION="\"$(VERSION)\"" -DLIBS="\"$(LIBS)\"" -DGENDIR="\"$(GENDIR_ON_TARGET)\"" -o c-posix c-posix.c $(LIBS) # # Program c-posix-signals generates another Ada package spec. # c-posix-signals: c-posix-signals.c - $(CC) $(GCCFLAGS) -DGENDIR="\"$(GENDIR_ON_TARGET)\"" -o c-posix-signals c-posix-signals.c $(LIBS) + $(CC) -O2 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -DGENDIR="\"$(GENDIR_ON_TARGET)\"" -o c-posix-signals c-posix-signals.c $(LIBS) # # generate Ada source files using "c-posix" program # @@ -140,7 +147,7 @@ $(GENDIR)/%.ads: libsrc/%.gps gnatprep.config $(GENDIR)/%.adb: libsrc/%.gpb gnatprep.config mkdir -p `dirname $@` && $(GNATPREP) $< $@ gnatprep.config $(GNATPREPFLAGS) .c.o: - $(CC) -c $(GCCFLAGS) $< + $(CC) -c -O2 $(CFLAGS) $(CPPFLAGS) $< # # ------------------------------------ diff --git a/configure.in b/configure.in index a5d8040..53d469e 100644 --- a/configure.in +++ b/configure.in @@ -13,6 +13,8 @@ AC_PROG_CC rm -f pconfig.h +AC_ARG_VAR(ADAFLAGS,[Debugging and optimization options for the Ada compiler.]) + AC_ARG_ENABLE(threads, AS_HELP_STRING([--disable-threads], [Do not try to build pthread support]),, [use_pthread=yes]) diff --git a/florist.gpr b/florist.gpr index faa6ca4..1bad7f0 100644 --- a/florist.gpr +++ b/florist.gpr @@ -15,16 +15,24 @@ library project Florist is for Source_Dirs use Common_Source_Dirs & Threads_Source_Dirs; end case; - for Object_Dir use "obj"; - for Library_Dir use "lib"; - - Version := "1"; + Version := External ("florist_shared_object_version", "1"); for Library_version use "libflorist.so." & Version; type Library_Type_Type is ("relocatable", "static"); Library_Type : Library_Type_Type := external ("LIBRARY_TYPE", "static"); for Library_Kind use Library_Type; + for Object_Dir use "obj/" & Library_Type; + for Library_Dir use "lib/" & Library_Type; + + case Library_Type is + when "relocatable" => + for Leading_Library_Options use External_As_List ("LDFLAGS", " "); + for Library_Options use External_As_List ("LIBS", " "); + when "static" => + null; + end case; + type Build_Type is ("Debug", "Production"); Build : Build_Type := External ("Build", "Production"); @@ -41,12 +49,20 @@ library project Florist is GNAT_Flags := ("-g", "-O2", "-gnatpg"); end case; + -- Always let ADAFLAGS take priority. + Adaflags := External_As_List ("ADAFLAGS", " "); + Ada_Flags := Ada_Flags & Adaflags; + GNAT_Flags := GNAT_Flags & Adaflags; + for Switches ("posix-signals.adb") use GNAT_Flags; for Switches ("posix-implementation.adb") use GNAT_Flags; for Switches ("posix-supplement_to_ada_io.adb") use GNAT_Flags; for Switches ("posix-unsafe_process_primitives.adb") use GNAT_Flags; for Default_Switches ("Ada") use Ada_Flags; + for Default_Switches ("C") use ("-O2") + & External_As_List ("CFLAGS", " ") + & External_As_List ("CPPFLAGS", " "); end Compiler; end Florist;