[erlang-questions] autoconf and erlang

jm <>
Thu Nov 8 04:53:31 CET 2007


In attempting to package up my inotify port for erlang I'm using or 
rather trying to use autoconf and automake. I've sort of got it working 
for the C part of the code but not for the erlang parts. Based on Romain 
Lenglet's "Using GNU Autoconf to Configure Erlang Programs" EUC 2006 
presentation slides I've ended up with the configure.ac shown below.

My questions are:

1) How do I work out where to put the beam files and the compiled c-port?
2) What is the best way to alter the code so that the open_port() 
function knowns what to execute? At the moment, there's a

    -define(PORTPROG, "./inotify").

near the top of the erlang source file. Include file? How do i go about 
finding the correct path and inserting this automatically?

3) Any good similar examples out there that can be used as a reference 
for a starting point?

4) Any other suggestions?

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

AC_PREREQ(2.61)
AC_INIT(erlang-notify, 0.1, )
AC_CONFIG_SRCDIR([src])
#AC_CONFIG_HEADER([config.h])

AM_INIT_AUTOMAKE(1.9.5)

# Checks for programs.
AC_PROG_CC

# Checks for libraries.
# FIXME: Replace `main' with a function in `-lei':
AC_CHECK_LIB([ei], [ei_decode_atom])
# FIXME: Replace `main' with a function in `-lerl_interface':
AC_CHECK_LIB([erl_interface], [erl_connect_init])

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h stdint.h stdlib.h string.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_HEADER_TIME
AC_TYPE_UINT32_T

# Checks for library functions.
AC_FUNC_LSTAT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_CHECK_FUNCS([memset select strerror])

AC_ERLANG_NEED_ERLC
#AC_ERLANG_CHECK_LIB()
AC_ERLANG_CHECK_LIB(erl_interface)

AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT

--- Makefile.am in basedir
SUBDIRS = src


-- Makefile.am in src
bin_PROGRAMS = inotify_erlang
inotify_erlang_SOURCES = erl_comm.c inotify_driver.c inotify_erlang.c



More information about the erlang-questions mailing list