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
# 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
#
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
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)
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 +++
#
--- /dev/null
+// 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;
+}
--- /dev/null
+// 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;
+}