diff options
author | Ken Raeburn <raeburn@mit.edu> | 2007-10-29 22:00:53 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2007-10-29 22:00:53 +0000 |
commit | 6ced4e0fa11dc0e2752ad03f8264a531470495b4 (patch) | |
tree | 254772143b0bc337a7bef0cc8e6bb333fe20aedb /src | |
parent | cd98f2bff6fdebd46f90c556502499341ae2888f (diff) | |
download | krb5-6ced4e0fa11dc0e2752ad03f8264a531470495b4.zip krb5-6ced4e0fa11dc0e2752ad03f8264a531470495b4.tar.gz krb5-6ced4e0fa11dc0e2752ad03f8264a531470495b4.tar.bz2 |
Test that C++ code can use our installed headers
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20149 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r-- | src/config/pre.in | 12 | ||||
-rw-r--r-- | src/configure.in | 2 | ||||
-rw-r--r-- | src/tests/misc/Makefile.in | 16 | ||||
-rw-r--r-- | src/tests/misc/test_cxx_gss.cpp | 10 | ||||
-rw-r--r-- | src/tests/misc/test_cxx_krb5.cpp | 16 |
5 files changed, 53 insertions, 3 deletions
diff --git a/src/config/pre.in b/src/config/pre.in index 023e846..0747853 100644 --- a/src/config/pre.in +++ b/src/config/pre.in @@ -160,14 +160,19 @@ FAKELIBDIR=$(FAKEPREFIX)/lib ALL_CFLAGS = $(DEFS) $(DEFINES) $(KRB_INCLUDES) $(LOCALINCLUDES) \ -DKRB5_DEPRECATED=1 \ $(CPPFLAGS) $(CFLAGS) $(PTHREAD_CFLAGS) +ALL_CXXFLAGS = $(DEFS) $(DEFINES) $(KRB_INCLUDES) $(LOCALINCLUDES) \ + -DKRB5_DEPRECATED=1 \ + $(CPPFLAGS) $(CXXFLAGS) $(PTHREAD_CFLAGS) CFLAGS = @CFLAGS@ +CXXFLAGS = @CXXFLAGS@ PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ PTHREAD_LIBS = @PTHREAD_LIBS@ THREAD_LINKOPTS = $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) CPPFLAGS = @CPPFLAGS@ DEFS = @DEFS@ CC = @CC@ +CXX = @CXX@ LD = $(PURE) @LD@ DEPLIBS = @DEPLIBS@ KRB_INCLUDES = -I$(BUILDTOP)/include -I$(SRCTOP)/include @@ -457,9 +462,14 @@ COMPILE_ET-k5= $(BUILDTOP)/util/et/compile_et -d $(SRCTOP)/util/et # rule to make object files # -.SUFFIXES: .c .o +.SUFFIXES: .cpp .c .o .c.o: $(CC) $(ALL_CFLAGS) -c $< +# Use .cpp because that's what autoconf uses in its test. +# If the compiler doesn't accept a .cpp suffix here, it wouldn't +# have accepted it when autoconf tested it. +.cpp.o: + $(CXX) $(ALL_CXXFLAGS) -c $< # ss command table rules # diff --git a/src/configure.in b/src/configure.in index d010d03..f1f415e 100644 --- a/src/configure.in +++ b/src/configure.in @@ -1057,6 +1057,8 @@ AC_SUBST(ldap_plugin_dir) AC_CHECK_HEADERS(Python.h python2.3/Python.h) +AC_PROG_CXX + dnl dnl Kludge for simple server --- FIXME is this the best way to do this? dnl diff --git a/src/tests/misc/Makefile.in b/src/tests/misc/Makefile.in index 0dc4260..a6fa1a4 100644 --- a/src/tests/misc/Makefile.in +++ b/src/tests/misc/Makefile.in @@ -11,8 +11,10 @@ SRCS=$(srcdir)/test_getpw.c all:: test_getpw -check:: test_getpw +check:: test_getpw test_cxx_krb5 test_cxx_gss $(RUN_SETUP) $(VALGRIND) ./test_getpw + $(RUN_SETUP) $(VALGRIND) ./test_cxx_krb5 + $(RUN_SETUP) $(VALGRIND) ./test_cxx_gss test_getpw: $(OUTPRE)test_getpw.$(OBJEXT) $(SUPPORT_DEPLIB) $(CC_LINK) $(ALL_CFLAGS) -o test_getpw $(OUTPRE)test_getpw.$(OBJEXT) $(SUPPORT_LIB) @@ -20,10 +22,20 @@ test_getpw: $(OUTPRE)test_getpw.$(OBJEXT) $(SUPPORT_DEPLIB) test_getsockname: $(OUTPRE)test_getsockname.$(OBJEXT) $(CC_LINK) $(ALL_CFLAGS) -o test_getsockname $(OUTPRE)test_getsockname.$(OBJEXT) $(LIBS) +CXX_LINK=$(CC_LINK) # hack! +test_cxx_krb5 test_cxx_gss: CC=$(CXX) +test_cxx_krb5: $(OUTPRE)test_cxx_krb5.$(OBJEXT) $(KRB5_DEPLIB) + $(CXX_LINK) $(ALL_CXXFLAGS) -o test_cxx_krb5 $(OUTPRE)test_cxx_krb5.$(OBJEXT) $(KRB5_LIB) $(LIBS) +test_cxx_gss: $(OUTPRE)test_cxx_gss.$(OBJEXT) + $(CXX_LINK) $(ALL_CXXFLAGS) -o test_cxx_gss $(OUTPRE)test_cxx_gss.$(OBJEXT) $(LIBS) + +test_cxx_krb5.$(OBJEXT): test_cxx_krb5.cpp +test_cxx_gss.$(OBJEXT): test_cxx_gss.cpp + install:: clean:: - $(RM) test_getpw + $(RM) test_getpw test_cxx_krb5 test_cxx_gss *.o # +++ Dependency line eater +++ # diff --git a/src/tests/misc/test_cxx_gss.cpp b/src/tests/misc/test_cxx_gss.cpp new file mode 100644 index 0000000..6602c83 --- /dev/null +++ b/src/tests/misc/test_cxx_gss.cpp @@ -0,0 +1,10 @@ +// Test that the krb5.h header is compatible with C++ application code. + +#include <stdio.h> +#include "gssapi/gssapi.h" + +int main () +{ + printf("hello, world\n"); + return 0; +} diff --git a/src/tests/misc/test_cxx_krb5.cpp b/src/tests/misc/test_cxx_krb5.cpp new file mode 100644 index 0000000..906c21d --- /dev/null +++ b/src/tests/misc/test_cxx_krb5.cpp @@ -0,0 +1,16 @@ +// Test that the krb5.h header is compatible with C++ application code. + +#include <stdio.h> +#include "krb5.h" + +int main (int argc, char *argv[]) +{ + krb5_context ctx; + + if (krb5_init_context(&ctx) != 0) { + printf("krb5_init_context returned an error\n"); + return 1; + } + printf("hello, world\n"); + return 0; +} |