From e3243ab9dc38a7c3f595dfcc559779790400989b Mon Sep 17 00:00:00 2001 From: Steffen Daode Nurpmeso Date: Wed, 23 May 2012 17:39:01 +0200 Subject: [PATCH] makeconfig, Makefile: extend to support variable INCLUDES.. The great plain automatic configuration system (i would never dare to call that something with an Auto prefix though, how could i) that Gunnar Ritter has written did yet not support the addition of preprocessor conditionals, but only supports conditional addition of libraries. This is a pity since that disallows the automatic configuration of GSSAPI under OpenBSD (and maybe others), since there all the Kerberos stuff is under /usr/include/kerberosV! This is a rather bizarre situation. (I've also checked the OpenBSD nail package, and even that doesn't patch it up.) So extend the present infrastructure and allow the conditional definition of something else than libraries. --- Makefile | 5 +++-- makeconfig | 22 ++++++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 1dcd8fb1..77644e00 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,8 @@ OBJ = aux.o base64.o cache.o cmd1.o cmd2.o cmd3.o cmdtab.o collect.o \ .SUFFIXES: .o .c .x .c.o: - $(CC) $(CFLAGS) $(CPPFLAGS) $(FEATURES) $(INCLUDES) $(WARN) -c $< + $(CC) $(CFLAGS) $(CPPFLAGS) $(FEATURES) \ + `grep '^[^#]' INCS` $(INCLUDES) $(WARN) -c $< .c.x: $(CC) $(CFLAGS) $(CPPFLAGS) $(FEATURES) $(INCLUDES) $(WARN) -E $< >$@ @@ -119,5 +120,5 @@ clean: rm -f $(OBJ) s-nail *~ core log distclean: clean - rm -f config.h config.log LIBS + rm -f config.h config.log LIBS INCS diff --git a/makeconfig b/makeconfig index 0ab36b8c..39b1c2b3 100644 --- a/makeconfig +++ b/makeconfig @@ -9,12 +9,13 @@ tmp2=___tmp$$ out=config.h log=config.log lib=LIBS +inc=INCS make="${MAKE-make}" exec 5>&2 >$log 2>&1 -rm -f $out $lib +rm -f $out $lib $inc echo "\ /* * Auto-generated by $0. @@ -29,8 +30,16 @@ echo " # to make grep happy ">$lib +echo " +# Auto-generated by $0. +# Changes are lost when $0 is run again. +# +# need one non-empty line + +# to make grep happy +">$inc -trap "rm -f $out $lib; exit" 1 2 15 +trap "rm -f $out $lib $inc; exit" 1 2 15 trap "rm -f $tmp.? $tmp $tmp2.? $tmp2" 0 msg() { @@ -74,11 +83,11 @@ link_check() { topic=$2 define=$3 libs=$4 + incs=$5 echo '************************************************************' msg "checking $topic ... " echo "/* checked $topic */" >>$out - cp $lib $tmp2 rm -f $tmp $tmp.o echo '*** test program is' tee $tmp.c @@ -86,12 +95,17 @@ link_check() { #$make $tmp.x #cat $tmp.x echo '*** results are' - if $make $tmp LIBS="$LIBS $libs" && test -f $tmp + if $make $tmp INCLUDES="$INCLUDES $incs" LIBS="$LIBS $libs" && + test -f $tmp then msg "okay\\n" echo "$define" >>$out + cp $lib $tmp2 echo "$libs" >$lib cat $tmp2 >>$lib + cp $inc $tmp2 + echo "$incs" >$inc + cat $tmp2 >>$inc eval have_$variable=yes return 0 else -- 2.11.4.GIT