[Top][All Lists]

[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


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 ( 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 in its top-level directory:

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

AC_INIT([cryptoexamples], [0.1], address@hidden)
AM_INIT_AUTOMAKE(cryptoexamples, 0.1)

# Checks for programs.

# 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 and src/

$ cat

$ cat src/
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 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/ 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.


Tangra Mega Rock:

reply via email to

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