[ghemical-devel] configure script(s) should call PKG_PROG_PKG_CONFIG

Daniel Leidert daniel.leidert.spam at gmx.net
Sun Oct 5 06:51:56 EDT 2008


Am Sonntag, den 05.10.2008, 00:07 +0200 schrieb Daniel Leidert:

> Attached to this are updated ones for libghemical and ghemical
> (liboglappth will follow soon).

Attached is some new one for libghemical. It fixes a small typo I made
and it checks for GL/gl.h. This defines HAVE_GL_GL_H, which could
replace HAVE_GL_H in src/typedef.h if you include libghemicalconfig2.h
(this patch is not attached, as it is simple).

Regards, Daniel
-------------- next part --------------
# Configuration for libghemical.
# Copyright (c) 2000- Geoff Hutchison, Michael Banck, Jean Brefort,
# Tommi Hassinen.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# Process this file with aclocal/autoconf to produce a configure script.

AC_INIT([libghemical], [2.98])

AC_DEFINE([LIBVERSION], ["2.98"], [This is the version of libghemical to be built--it is set in the configure.ac])
AC_SUBST([LIBVERSION], ["2.98"])

##################################################################
## also see src/Makefile.am when you change the version number!!!
##################################################################

AC_DEFINE([LIBRELEASEDATE], ["2008-07-31"], [This is the releasedate of libghemical--it is set in the configure.ac])
AC_SUBST([LIBRELEASEDATE], ["2008-07-31"])

AC_PREREQ([2.48])
AC_CONFIG_SRCDIR([src/model.cpp])
AM_CONFIG_HEADER([src/libghemicalconfig.h])

##########################################################################################
dnl ... and this one is a small subset, maintained manually, which will be installed.

## this is for automake-1.4:
AM_CONFIG_HEADER([src/libghemical-features.h])

## this is for later versions:
##AC_CONFIG_HEADERS([src/libghemical-features.h])

dnl Make sure these two won't clash. Put the following to libghemicalconfig.h:
AH_BOTTOM([/* Don't include libghemical-features.h, it's a subset of libghemicalconfig.h. */
#define LIBGHEMICAL_FEATURES_H])
##########################################################################################

AM_INIT_AUTOMAKE([-Wall])

AC_CANONICAL_HOST

top_builddir_=`pwd`
AC_SUBST(top_builddir_)

AC_DEFINE_DIR([LIBDATA_PATH], [datadir/libghemical], [Where the data files are ; set in the configure.ac])

# create a version of config.h where the PACKAGE definitions are stripped away.
AC_CONFIG_COMMANDS([src/libghemicalconfig2.h],[cat src/libghemicalconfig.h | grep -v PACKAGE > src/libghemicalconfig2.h])

# Get any build/host and enable/disable flags now.
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

# if a mingw32 host is specified, then ???
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
##case $host in
##	*-*-mingw32*)
##		CPPFLAGS="-Dmno-cygwin -Dmms_bitfields $CPPFLAGS"
##		LIBS="$LIBS -mwindows"
##		;;
##esac

AC_ARG_ENABLE(
	[mpqc],
	AS_HELP_STRING([--enable-mpqc],
		       [compile with MPQC support @<:@default=no@:>@]
	),
	[enable_mpqc=$enableval],
	[enable_mpqc=no]
)
AC_ARG_ENABLE(
	[mopac7],
	AS_HELP_STRING([--enable-mopac7],
		       [compile with MOPAC7 support @<:@default=no@:>@]
	),
	[enable_mopac7=$enableval],
	[enable_mopac7=no]
)

# Checks for programs.
# ^^^^^^^^^^^^^^^^^^^^

AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_CXXCPP
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PATH_PROG([AR], [ar], [ar])
AC_PATH_PROG([SHELL], [sh], [/bin/sh])
AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG

AM_SANITY_CHECK

REQUISITIONS=

# Checks for libraries.
# ^^^^^^^^^^^^^^^^^^^^^

AC_CHECK_LIB([m], [acos],, AC_MSG_ERROR([math library missing]))

if test $enable_mpqc = yes; then
	AC_CHECK_LIB([blas], [main],, AC_MSG_ERROR([Cannot find blas library needed for MPQC support]))
	AC_CHECK_LIB([lapack], [main],, AC_MSG_ERROR([Cannot find lapack library needed for MPQC support]))
	AM_PATH_SC(1.2.5, HAVE_MPQC="yes", HAVE_MPQC="no")
	if test "${HAVE_MPQC}" = "yes"; then
		AC_DEFINE([ENABLE_MPQC],, [Define if you are building a version that interfaces directly with MPQC])
		AC_DEFINE_UNQUOTED([SC_MAJOR_VERSION], [$SC_MAJOR_VERSION], [This is the major version of SC (MPQC's underlying library) found by configure])
		AC_DEFINE_UNQUOTED([SC_MINOR_VERSION], [$SC_MINOR_VERSION], [This is the minor version of SC (MPQC's underlying library) found by configure])
		AC_DEFINE_UNQUOTED([SC_MICRO_VERSION], [$SC_MICRO_VERSION], [This is the micro version of SC (MPQC's underlying library) found by configure])
		CPPFLAGS="$CPPFLAGS $SC_CPPFLAGS"
		LIBS="$LIBS $SC_LIBS"
	else AC_MSG_ERROR([Cannot find proper SC version])
	fi
fi

if test $enable_mopac7 = yes; then
	AC_DEFINE([ENABLE_MOPAC7],, [Define if you are building a version that interfaces directly with MOPAC7])
	
	#PKG_CHECK_MODULES([MOPAC7], [libmopac7 >= 1.13])
	MOPAC7_CFLAGS=`$PKG_CONFIG --cflags libmopac7`
	MOPAC7_LIBS=`$PKG_CONFIG --libs libmopac7`
	
	##AC_SUBST(MOPAC7_CFLAGS)	not necessary???
	##AC_SUBST(MOPAC7_LIBS)		not necessary???
	
	CPPFLAGS="$CPPFLAGS $MOPAC7_CFLAGS"
	LIBS="$LIBS $MOPAC7_LIBS"
	
	REQUISITIONS="$REQUISITIONS libmopac7"
fi

# Checks for header files.
# ^^^^^^^^^^^^^^^^^^^^^^^^

AC_CHECK_HEADERS([GL/gl.h])

# Checks for typedefs, structures, and compiler characteristics.
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

AC_PROG_CC_STDC
AC_C_INLINE
AC_C_CONST

AC_SUBST([CXXFLAGS])
AC_SUBST([LDFLAGS])

AC_SUBST([REQUISITIONS])

# Checks for library functions.
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

AC_HEADER_STDC

AC_CONFIG_FILES([
	libghemical.pc
	Makefile
	bin/Makefile
	bin/amber/Makefile
	bin/builder/Makefile
	bin/param_mm/Makefile
	bin/param_mm/default/Makefile
	bin/param_mm/prmfit/Makefile
	bin/param_mm/tripos52/Makefile
	bin/param_sf/Makefile
	bin/param_sf/default/Makefile
	src/Makefile
])
AC_OUTPUT

AC_MSG_NOTICE([

build options:
^^^^^^^^^^^^^^
enable MPQC : $enable_mpqc
enable MOPAC7 : $enable_mopac7
])

AC_CONFIG_COMMANDS([stamp.h], [echo timestamp > stamp.h])


More information about the ghemical-devel mailing list