autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

First steps with autoconf and autotools - building an OpenSSL app


From: Ivan \"Rambius\" Ivanov
Subject: First steps with autoconf and autotools - building an OpenSSL app
Date: Sat, 10 Jul 2010 04:54:27 +0300

Hello,

I am developing an application that is based on OpenSSL. I am
developing it on Mac OS X (10.5) but I have to build it on other
environments so I would like to use autotools. I am a newbie to
autoconf and autotools. I spent some time reading tutorials and
Autobook (http://sources.redhat.com/autobook/) and while I am able to
build a hello world project with autoconf, I have some difficulties
building and linking my project againts OpenSSL. I would be very
grateful if you provide any hints or pieces of advise.

Here is more information about my project. Its sources live in src/
subdirectory. I have configure.in in its top-level directory:

$ cat configure.in
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_INIT([cryptoexamples], [0.1], address@hidden)
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_SRCDIR([src])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE(cryptoexamples, 0.1)

# Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB

# Checks for libraries.
AC_CHECK_LIB(ssl, SSL_library_init)

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

AC_OUTPUT(Makefile src/Makefile)


I also have Makefile.am and src/Makefile.am:

$ cat Makefile.am
SUBDIRS = src


$ cat src/Makefile.am
bin_PROGRAMS = countnb

countnb_SOURCES = countnb.c

lib_LIBRARIES = libseedprng.a
libseedprng_a_SOURCES = seed_prng.c


Now my questions are:

1) The default locations of openssl headers and libs are /usr/include
and /usr/libs on Mac OS X. However, I have newer version of openssl in
/opt/local with headers in /opt/local/include and libs in
/opt/local/lib. How to instruct autotools to use the version in
/opt/local on Mac OS X?

2) In configure.in I make a check for openssl availability using the macro

AC_CHECK_LIB(ssl, SSL_library_init)

Later, when I run ./configure I get the message

checking for SSL_library_init in -lssl... yes

How can I instruct autoconf to fail if openssl is not found (in /opt/local)?

3) In src/Makefile.am I am trying to build libseedprng.a with

lib_LIBRARIES = libseedprng.a
libseedprng_a_SOURCES = seed_prng.c

How can I instruct it to link it against ssl and crypto libraries;
that is how can I pass -lssl and -lcrypto options to the linker?


Thank you in advance for your responses.

Regards
Rambius


-- 
Tangra Mega Rock: http://www.radiotangra.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]