Compiling and linking on Unix.

Home Download News Documentation FAQ Tutorial API reference Examples XML Digital Signature Online Verifier XML Encryption XML Canonicalization Reporting Bugs Mailing list Related Authors
- # Compiling and linking on Unix. There are several ways to get necessary compilation and linking information on Unix and application can use any of these methods to do crypto engine selection either at linking or run time. PKG_CHECK_MODULES() macro Example 2. Using PKG_CHECK_MODULES() macro in a configure.in file to select crypto engine (openssl) at linking time.
      dnl
      dnl Check for xmlsec and friends
      dnl
      PKG_CHECK_MODULES(XMLSEC, xmlsec1-openssl >= 1.0.0 xml2 libxslt,,exit)
      CFLAGS="$CFLAGS $XMLSEC_CFLAGS"
      CPPFLAGS="$CPPFLAGS $XMLSEC_CFLAGS"
      LDFLAGS="$LDFLAGS $XMLSEC_LIBS"
  Example 3. Using PKG_CHECK_MODULES() macro in a configure.in file to enable dynamical loading of xmlsec-crypto library.
      dnl
      dnl Check for xmlsec and friends
      dnl
      PKG_CHECK_MODULES(XMLSEC, xmlsec1 >= 1.0.0 xml2 libxslt,,exit)
      CFLAGS="$CFLAGS $XMLSEC_CFLAGS"
      CPPFLAGS="$CPPFLAGS $XMLSEC_CFLAGS"
      LDFLAGS="$LDFLAGS $XMLSEC_LIBS"
- pkg-config script Example 4. Using pkg-config script in a Makefile to select crypto engine (nss) at linking time.
      PROGRAM = test
      PROGRAM_FILES = test.c

      CFLAGS	+= -g $(shell pkg-config --cflags xmlsec1-nss)
      LDFLAGS	+= -g
      LIBS 	+= $(shell pkg-config --libs xmlsec1-nss)

      all: $(PROGRAM)

      %: %.c
      	$(cc) $(PROGRAM_FILES) $(CFLAGS) $(LDFLAGS) -o $(PROGRAM) $(LIBS)

      clean:
      	@rm -rf $(PROGRAM)
  Example 5. Using pkg-config script in a Makefile to enable dynamical loading of xmlsec-crypto library.
      PROGRAM = test
      PROGRAM_FILES = test.c

      CFLAGS	+= -g $(shell pkg-config --cflags xmlsec1)
      LDFLAGS	+= -g
      LIBS 	+= $(shell pkg-config --libs xmlsec1)

      all: $(PROGRAM)

      %: %.c
      	$(cc) $(PROGRAM_FILES) $(CFLAGS) $(LDFLAGS) -o $(PROGRAM) $(LIBS)

      clean:
      	@rm -rf $(PROGRAM)
- xmlsec1-config script Example 6. Using xmlsec1-config script in a Makefile to select crypto engine (gnutls) at linking time.
      PROGRAM = test
      PROGRAM_FILES = test.c

      CFLAGS	+= -g $(shell xmlsec1-config --crypto gnutls --cflags)
      LDFLAGS	+= -g
      LIBS 	+= $(shell xmlsec1-config --crypto gnutls --libs)

      all: $(PROGRAM)

      %: %.c
      	$(cc) $(PROGRAM_FILES) $(CFLAGS) $(LDFLAGS) -o $(PROGRAM) $(LIBS)

      clean:
      	@rm -rf $(PROGRAM)
  Example 7. Using xmlsec1-config script in a Makefile to enable dynamical loading of xmlsec-crypto library.
      PROGRAM = test
      PROGRAM_FILES = test.c

      CFLAGS	+= -g $(shell xmlsec1-config --cflags)
      LDFLAGS	+= -g
      LIBS 	+= $(shell xmlsec1-config --libs)

      all: $(PROGRAM)

      %: %.c
      	$(cc) $(PROGRAM_FILES) $(CFLAGS) $(LDFLAGS) -o $(PROGRAM) $(LIBS)

      clean:
      	@rm -rf $(PROGRAM)