From 8777288b60fd2a6eec7a84484fe7bae51d16ceb6 Mon Sep 17 00:00:00 2001 From: Claus-Justus Heine <Claus-Justus.Heine@IANS.Uni-Stuttgart.DE> Date: Thu, 17 May 2007 16:50:36 +0000 Subject: [PATCH] Convert back to alberta as package name (instead of alberta2). The version is already recorded in the version number of the shared libraries, and all libraries have names different from the ones in release 1.2 anyway. Move ALL inline viewing stuff to a separate library. I just got fed up by the library requirements of OpenDX. This also maskes it easier to separate the core ALBERTA stuff from the graphics business. Also, external viewers will most likely not need the inline viewers (e.g. Grape does not need or want gltools, meshtv does not need or want OpenDX and vice versa and so on). This also simplifies the "disable graphics" kill switch: the core libraries simply stay unchanged, it is just that the add-on libraries alberta_gfx_Xd.[so,la,a] are not compiled. Demo-package is in accordance with this scheme, and "make distcheck" succeeded. So it should be ok, in principle. --- MAINTENANCE | 31 +-- Makefile.am | 11 +- Makefile.am.template | 25 +- README | 20 +- configure.ac | 42 ++-- generate-alberta-automakefiles.sh | 4 +- m4/alberta-check.m4 | 9 +- m4/alberta-dims.m4 | 4 +- m4/check-package.m4 | 371 +++++++++++++++++++++--------- m4/gltools.m4 | 13 +- m4/grapeiface.m4 | 17 +- m4/opendx.m4 | 32 ++- m4/opengl.m4 | 14 +- m4/set-prefix.m4 | 9 +- m4/x-window-system.m4 | 6 + mksnap.sh | 10 +- 16 files changed, 403 insertions(+), 215 deletions(-) create mode 100644 m4/x-window-system.m4 diff --git a/MAINTENANCE b/MAINTENANCE index 37ba724..3ea72f0 100644 --- a/MAINTENANCE +++ b/MAINTENANCE @@ -9,18 +9,18 @@ claus@mathematik.uni-freiburg.de I) Introduction and Maintenance =============================== -The alberta2-2.0 package is currently distributed using GNU "autoconf +The alberta-2.0 package is currently distributed using GNU "autoconf 2.61", "automake 1.10", and "libtool 1.5.22". Since some unusual compilation was necessary, a few hints seemed like a good idea. Here -is the general structure of the alberta2-2.0 packages: +is the general structure of the alberta-2.0 packages: __________ alberta/ __________ src/ ______|--- 1d/ / \ |--- 2d/ / -- doc/ |--- 3d/ / |--- Common/ - / |--- alberta2*/ + / |--- alberta*/ /_____________ demo/ __ src/ _______|--- 1d/ -alberta2-2.0 / |--- 2d/ +alberta-2.0 / |--- 2d/ \ |--- 3d/ \ |--- 4d/ \ |--- 5d/ @@ -72,13 +72,14 @@ and libtool --mode=link gcc ... By default we therefore install a configured version of "libtool", -`PREFIX/libexec/alberta2/' directory. This behaviour can be turned off -by running `configure' with the "--disable-install-libtool" switch. +`PREFIX/libexec/alberta-2.0/' directory. This behaviour can be turned +off by running `configure' with the "--disable-install-libtool" +switch. II) Package contents ==================== -The following subpackages are included in alberta2-2.0: +The following subpackages are included in alberta-2.0: 1) alberta The main package. @@ -89,9 +90,10 @@ A few demonstration programs meant to facilitate the first steps with ALBERTA. This package is not touched by automake and includes several small Makefile.in's in which "configure" substitutes values like installation paths for libraries and headers. This directory is -installed as a tar-ball in `PREFIX/share/alberta2/', but can be copied +installed as a tar-ball in `PREFIX/share/alberta/', but can be copied by users to other locations. The Makefiles in the demo package -include "Makefile.alberta" which resides in `PREFIX/libexec/alberta2/'. +include "Makefile.alberta" which resides in +`PREFIX/libexec/alberta-2.0/'. 3) alberta_util This package contains the old ALBERTA util.c file, now split into @@ -188,10 +190,11 @@ Step 1) Step 2) The next step is to adjust the desired libraries, especially the ALBERTA libraries. Each ALBERTA library has its own directory of the - form "alberta2_[DIM_OF_WORLD]d[_debug]" since compilation is different for - each library version. If these settings are to be changed, make a new - directory, and adapt the files "Makefile.am.template" and - "generate-alberta-automakefiles.sh" in the top directory. + form "alberta_[DIM_OF_WORLD]d[_debug]" since compilation is + different for each library version. If these settings are to be + changed, make a new directory, and adapt the files + "Makefile.am.template" and "generate-alberta-automakefiles.sh" in + the top directory. Step 3) Rebuild the Makefile.am's for the ALBERTA libraries, this is done by @@ -225,7 +228,7 @@ Step 5) ./configure BLABLABLA --enable-maintainer-mode Step 6) - Do "[g]make dist" at the top level. This creates alberta2-?.?.tar.gz + Do "[g]make dist" at the top level. This creates alberta-?.?.tar.gz in which all CVS-directories, ~-files, and other unnecessary components are stripped. To be a bit more precise: diff --git a/Makefile.am b/Makefile.am index 6910928..04d85d2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,7 +11,6 @@ EXTRA_DIST = gen-assemble-fcts.sh if INSTALL_LIBTOOL BUILT_SOURCES = libtool -pkglibexecdir = @libexecdir@/@PACKAGE@ pkglibexec_SCRIPTS = libtool endif @@ -31,7 +30,7 @@ uninstall_code: # make a DEMO tar-ball and install it in pkgdatadir for later use # -DEMO = @PACKAGE_NAME@-@VERSION@-demo +DEMO = @PACKAGE_NAME@-@PACKAGE_VERSION@-demo pkgdata_DATA = $(DEMO).tar.gz demo-tarball: $(DEMO).tar.gz @@ -53,11 +52,11 @@ demo: @DEMOSOURCES@ $(top_builddir)/config.status $(top_builddir)/Makefile $(DEMO): demo mkdir -p $@ $(TAR_PROGRAM) cf - -C $< . | $(TAR_PROGRAM) xf - -C $@ - find $@ \( -name "*~" -o -name "*.o" \) -exec rm -f \{\} \; + find $@ \( -name "*~" -o -name "*.o" -o -name ".#*" \) -exec rm -f \{\} \; for i in `find $@ -name ".svn"`; do rm -rf $$i; done for i in `find $@ -name ".libs"`; do rm -rf $$i; done rm -f $@/src/[0-9]d/Makefile.in - for i in $@/src/[0-9]d/; do ( cd $$i; make realclean ) ; done + for i in $@/src/[0-9]d/; do ( cd $$i; make ALBERTA_LIBEXEC_PATH=$(abs_top_builddir)/alberta/src/Common realclean ) ; done clean-local: -rm -rf $(DEMO) @@ -68,7 +67,7 @@ distclean-local: chmod -R u+rwX demo;\ rm -rf demo;\ fi - rm -f libtool.alberta2 + rm -f libtool.@PACKAGE@-@VERIONS@ if MAINTAINER_MODE @@ -97,7 +96,7 @@ dist-hook: @echo Copying demo directory to $(distdir) cp -pR demo/. $(distdir)/demo/. @echo Cleaning up demo directory in $(distdir) - find $(distdir)/demo \( -name \*~ -o -name \*.o -o -name \*.lo \) -exec /bin/rm -f {} \; + find $(distdir)/demo \( -name \*~ -o -name \*.o -o -name \*.lo -o -name ".#*" \) -exec /bin/rm -f {} \; find $(distdir)/demo \( -name ellipt -o -name heat -o -name nonlin \) -exec /bin/rm -f {} \; find $(distdir)/demo -name Makefile -exec /bin/rm -f {} \; @echo Deleting .svn directories in $(distdir) diff --git a/Makefile.am.template b/Makefile.am.template index 22cafd6..10c1650 100644 --- a/Makefile.am.template +++ b/Makefile.am.template @@ -6,13 +6,32 @@ DIM_OF_WORLD = %DIM_OF_WORLD% ALBERTA_DEBUG = %ALBERTA_DEBUG% -lib_LTLIBRARIES = libalberta2%LIBCODE%.la +lib_LTLIBRARIES = libalberta%LIBCODE%.la include $(srcdir)/../Common/Makefile.am.include AM_CFLAGS = $(ALBERTA_%EFLAGS%_CFLAGS) AM_CXXFLAGS = $(ALBERTA_%EFLAGS%_CXXFLAGS) -nodist_libalberta2%LIBCODE%_la_SOURCES = $(sources) -libalberta2%LIBCODE%_la_CPPFLAGS = \ +nodist_libalberta%LIBCODE%_la_SOURCES = $(sources) +libalberta%LIBCODE%_la_CPPFLAGS = \ $(CPPFLAGS) -DDIM_OF_WORLD=$(DIM_OF_WORLD) -DALBERTA_DEBUG=$(ALBERTA_DEBUG) +libalberta%LIBCODE%_la_LDFLAGS = -version-info 2:0:0 + +if ALBERTA_USE_GRAPHICS +lib_LTLIBRARIES += libalberta_gfx%LIBCODE%.la + +nodist_libalberta_gfx%LIBCODE%_la_SOURCES = $(gfxsources) +libalberta_gfx%LIBCODE%_la_CPPFLAGS = \ + $(CPPFLAGS) -DDIM_OF_WORLD=$(DIM_OF_WORLD) -DALBERTA_DEBUG=$(ALBERTA_DEBUG) +#libalberta_gfx%LIBCODE%_la_LIBADD = @GLTOOLS_ALL_LIBS@ @OPENDX_ALL_LIBS@ @OPENGL_ALL_LIBS@ +libalberta_gfx%LIBCODE%_la_LDFLAGS = -version-info 2:0:0 + +endif + +if MAINTAINER_MODE +$(srcdir)/Makefile.am: \ + $(top_srcdir)/Makefile.am.template \ + $(top_srcdir)/generate-alberta-automakefiles.sh + cd $(top_srcdir) && sh generate-alberta-automakefiles.sh +endif diff --git a/README b/README index eb9cfca..46686f7 100644 --- a/README +++ b/README @@ -61,9 +61,9 @@ Contained in the package are the following sub-packages: / \ |--- 2d/ / -- doc/ |--- 3d/ / |--- Common/ - / |--- alberta2*/ + / |--- alberta*/ /_____________ demo/ __ src/ _______|--- 1d/ -alberta2-2.0 / |--- 2d/ +alberta-2.0 / |--- 2d/ \ |--- 3d/ \ |--- 4d/ \ |--- 5d/ @@ -93,7 +93,7 @@ The main package. 2) demo The sub-directory `demo/' contains a few demonstration programs. After running "make install" (see file `./INSTALL') a tar-ball containing -all demo programs will be installed in `PREFIX/share/alberta2/'. The +all demo programs will be installed in `PREFIX/share/alberta/'. The tar-ball can be extracted elsewhere; the make-files contained in the tar-ball have appropriate defaults for the location of the (installed) ALBERTA libraries and header files. @@ -279,17 +279,17 @@ The libraries will go to the header-files and Makefile.alberta will end up in - /usr/local/include/alberta2/ + /usr/local/include/alberta/ The configured libtool-script will reside in - /usr/local/libexec/alberta2/ + /usr/local/libexec/alberta-2.0/ -and finally the demo package (under the name alberta2-VERSION.demo.tar.gz, -where VERSION denotes the actual version of the alberta2 package) will be -copied to +and finally the demo package (under the name alberta-VERSION.demo.tar.gz, +where VERSION denotes the actual version of the alberta package) will +be copied to - /usr/local/share/alberta2/ + /usr/local/share/alberta/ This will be the layout after running "make install". @@ -300,7 +300,7 @@ This will be the layout after running "make install". Compiling all flavours of the ALBERTA libraries takes a long time. The ALBERTA libraries are all named - libalberta2_<DIM_OF_WORLD>d[_debug] + libalberta_<DIM_OF_WORLD>d[_debug] The options below control which of them are actually created. diff --git a/configure.ac b/configure.ac index ff9c08d..533db49 100644 --- a/configure.ac +++ b/configure.ac @@ -2,14 +2,24 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT([alberta2], [2.0], [Claus.Heine@Mathematik.Uni-Freiburg.DE,kosterdtp@ewi.uwente.nl]) - +AC_INIT([alberta], [2.0], [Claus.Heine@Mathematik.Uni-Freiburg.DE,kosterdtp@ewi.uwente.nl]) AC_CONFIG_SRCDIR([alberta/src/Common/alberta.h]) + AM_MAINTAINER_MODE AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_CANONICAL_TARGET +AM_INIT_AUTOMAKE([1.10 dist-bzip2]) +AM_CONFIG_HEADER([config.h]) + +pkglibexecdir="${libexecdir}/${PACKAGE_NAME}-${PACKAGE_VERSION}" +AC_SUBST([pkglibexecdir]) + +# +# all CONFIG_FILES for the ALBERTA libraries are added through the +# ALBERT_DIMENSION_ENABLE/DISABLE() macros +# AC_CONFIG_FILES([Makefile gnu-compat/Makefile alberta_util/Makefile alberta_util/src/Makefile alberta_util/src/alberta_util_inlines.h.in @@ -33,8 +43,8 @@ AC_CONFIG_FILES([Makefile gnu-compat/Makefile alberta/src/Makefile alberta/src/Common/Makefile alberta/src/Common/Makefile.alberta - alberta/src/alberta2_Nd/Makefile - alberta/src/alberta2_Nd_debug/Makefile]) + alberta/src/alberta_Nd/Makefile + alberta/src/alberta_Nd_debug/Makefile]) AC_CONFIG_COMMANDS([demo], [if ! test "$srcdir" = \. ; then @@ -70,14 +80,6 @@ else alberta_util/src/alberta_util_inlines.h fi]) -# -# all CONFIG_FILES for the ALBERTA libraries are added through the -# ALBERT_DIMENSION_ENABLE/DISABLE() macros -# - -AM_INIT_AUTOMAKE([1.10 dist-bzip2]) -AM_CONFIG_HEADER([config.h]) - # change the installation directory. This could surely be done more elegantly... # # cH: hey, boys and girls, why do we do that? @@ -400,7 +402,8 @@ AC_CHECK_MEMBERS([struct sigaction.sa_sigaction],,,[#include <signal.h>]) # # Let the user decide what it wants (handled by ALBERTA_CHECK_PACKAGE() # -ALBERTA_CHECK_PACKAGE([blas],[blas],[],[${FLIBS}],[],[],[],[required]) +ALBERTA_CHECK_PACKAGE([blas],[blas], + [${DAXPY_F77_FUNC}],[],[${FLIBS}],[],[],[],[required]) ALBERTA_ENABLE_FLAG([graphics], [disable support for visualization, including all add-ons which need graphics.], @@ -409,17 +412,11 @@ ALBERTA_ENABLE_FLAG([graphics], [SUBST cond define]) if test "${ALBERTA_USE_GRAPHICS}" = 1; then - # # check for X11 # - AC_CHECK_HEADERS([X11/Xlib.h X11/Xutil.h],, - [AC_MSG_ERROR([Exiting...])]) + ALBERTA_X_WINDOW_SYSTEM - AC_PATH_X - AC_PATH_XTRA - X_ALL_LIBS="${X_PRE_LIBS} ${X_LIBS} -lX11 ${X_EXTRA_LIBS}" - AC_SUBST(X_ALL_LIBS) else # # disable the packages, but still run the CHECK_PACKAGE() macros, this @@ -456,7 +453,8 @@ ALBERTA_GRAPE_STUFF # # MeshTV interface stuff # -ALBERTA_CHECK_PACKAGE([silo],[silo],[],[],[silo.h],[],[],[optional]) +ALBERTA_CHECK_PACKAGE([silo],[silo],[DBPutUcdmesh], + [],[],[silo.h],[],[],[optional]) # # Geomview interface, should not depend on any other installed @@ -488,7 +486,7 @@ ALBERTA_ENABLE_FLAG([efence], ALBERTA_EFENCE) test "$ALBERTA_EFENCE" = "1" && EFENCE_DISABLE=no test "${BUILD_ALBERTA_DEBUG}" = "0" && EFENCE_DISABLE=yes -ALBERTA_CHECK_PACKAGE([efence],[efence],[],[],[efence.h],[],[], +ALBERTA_CHECK_PACKAGE([efence],[efence],[_eff_malloc],[],[],[efence.h],[],[], [optional disabled]) if test "$ALBERTA_EFENCE" = 1 -a -z "$EFENCE_LIB"; then AC_MSG_RESULT( diff --git a/generate-alberta-automakefiles.sh b/generate-alberta-automakefiles.sh index 623a62b..ed7ea8a 100755 --- a/generate-alberta-automakefiles.sh +++ b/generate-alberta-automakefiles.sh @@ -15,7 +15,7 @@ for ALBERTA_DEBUG in 0 1; do EFLAGS=DEBUG fi - mkdir -p alberta/src/alberta2$LIBCODE - sed -e "s/%DIM_OF_WORLD%/$DIM_OF_WORLD/g" Makefile.am.template -e "s/%DEBUG%/$DEBUG/g" -e "s/%ALBERTA_DEBUG%/$ALBERTA_DEBUG/g" -e "s/%LIBCODE%/$LIBCODE/g" -e "s/%EFLAGS%/$EFLAGS/g" > alberta/src/alberta2$LIBCODE/Makefile.am + mkdir -p alberta/src/alberta$LIBCODE + sed -e "s/%DIM_OF_WORLD%/$DIM_OF_WORLD/g" Makefile.am.template -e "s/%DEBUG%/$DEBUG/g" -e "s/%ALBERTA_DEBUG%/$ALBERTA_DEBUG/g" -e "s/%LIBCODE%/$LIBCODE/g" -e "s/%EFLAGS%/$EFLAGS/g" > alberta/src/alberta$LIBCODE/Makefile.am done done diff --git a/m4/alberta-check.m4 b/m4/alberta-check.m4 index f87340e..51877cd 100644 --- a/m4/alberta-check.m4 +++ b/m4/alberta-check.m4 @@ -131,10 +131,11 @@ dnl dnl Now check for the libraries ALBERTA might depend on. Take into dnl account that we might need gltools and OpenGL dnl -ALBERTA_CHECK_PACKAGE([OpenGL],[GL],[${x_libraries}],[${X_LIBS} -lX11], +ALBERTA_CHECK_PACKAGE([OpenGL],[GL],[glMakeCurrent], + [${x_libraries}],[${X_LIBS} -lX11], [gl.h],[${x_includes}/GL],[${X_CFLAGS}],[optional]) -ALBERTA_CHECK_PACKAGE([gltools],[gltools],[],[$OPENGL_LIB], - [glwin.h],[],[],[optional]) +ALBERTA_CHECK_PACKAGE([gltools],[gltools],[glrCreate],[],[${OPENGL_ALL_LIBS}], + [glwin.h glrnd.h],[],[],[optional]) AC_LANG_PUSH(Fortran 77) AC_CHECK_LIB(blas, dnrm2, [FLIBS="-lblas ${FLIBS}" @@ -143,7 +144,7 @@ AC_CHECK_LIB(blas, dnrm2, AC_LANG_POP(Fortran 77) # Cache check-point AC_CACHE_SAVE -ALBERTA_CHECK_PACKAGE([alberta2_util], +ALBERTA_CHECK_PACKAGE([alberta2_util],[], [alberta2_util],[$ALBERTA_LIB_PATH],[-lm ${FLIBS}], [alberta_util.h],[$ALBERTA_INCLUDE_PATH],[],[required]) ]) \ No newline at end of file diff --git a/m4/alberta-dims.m4 b/m4/alberta-dims.m4 index 7d000fa..00f5651 100644 --- a/m4/alberta-dims.m4 +++ b/m4/alberta-dims.m4 @@ -22,8 +22,8 @@ m4_if(DEFAULT,1, [EXPERIMENTAL: enable building of an ALBERTA library for Finite Elements of dimension $1.], 0, BUILD_ALBERTA_$1)]) m4_if(m4_eval(($1) < 4),1, - [AC_CONFIG_FILES([alberta/src/alberta2_$1d/Makefile]) - AC_CONFIG_FILES([alberta/src/alberta2_$1d_debug/Makefile])]) + [AC_CONFIG_FILES([alberta/src/alberta_$1d/Makefile]) + AC_CONFIG_FILES([alberta/src/alberta_$1d_debug/Makefile])]) ]) # diff --git a/m4/check-package.m4 b/m4/check-package.m4 index 1ee1612..4a4172a 100644 --- a/m4/check-package.m4 +++ b/m4/check-package.m4 @@ -5,13 +5,22 @@ dnl dnl Arguments: dnl dnl $1: symbolic name (fancy) -dnl $2: library name (base name, lib$2[.so|.a] -dnl $3: library path (-L$3) -dnl $4: additional libraries needed (e.g. -lm -lGL) -dnl $5: header name -dnl $6: include path for $5 (-I$6) -dnl $7: additional include paths (e.g. when $5 includes some other headers) -dnl $8: a space separated list of the keywords +dnl $2: space separated list of library names (base name, +dnl lib$2[.so|.a|.la] +dnl $3: Optional space separated list of functions to check for. +dnl We check first for the presence of the libraries listed in $2, +dnl and then for all functions listed in $3, while linking with +dnl all libraries listed in $2, and the additional libraries +dnl listed in $5. +dnl $4: library path (-L$4) +dnl $5: additional libraries needed (e.g. -lm -lGL); if $5 contains the +dnl string libtool, then libtool is used to resolve library +dnl dependencies (works, of course, only if lib$2.la is installed +dnl $6: space separated list of header files to check for +dnl $7: include path(s) for $6 (-I$7). May be a space separated list +dnl of directories. +dnl $8: additional include paths (e.g. when $6 includes some other headers) +dnl $9: a space separated list of the keywords dnl dnl optional, required, disabled, enabled dnl @@ -34,15 +43,15 @@ dnl dnl Makefile-substitution dnl dnl UPNAME[]_INCLUDE_PATH -dnl UPNAME[]_LIB_PATH -dnl UPNAME[]_INCLUDE -dnl UPNAME[]_LIB linker flags excluding $4 -dnl UPNAME[]_ALL_LIB linker flags including $4 +dnl UPNAME[]_LIB_PATHS +dnl UPNAME[]_INCLUDES +dnl UPNAME[]_LIBS libraries and linker flags excluding $5 +dnl UPNAME[]_ALL_LIBS libraries linker flags including $5 dnl dnl config.h preprocessor macros dnl -dnl HAVE_LIB$2 -dnl HAVE_$5_H +dnl HAVE_LIB[name] for all names listed in $2 +dnl HAVE_[name]_H for all names listed in $6 dnl dnl Automake conditional dnl @@ -95,9 +104,13 @@ AC_DEFUN([ALBERTA_CHECK_PKG_HDR_OPT], AC_ARG_WITH($1-headers, m4_if($2,[], [AC_HELP_STRING([--with-$1-headers=DIR], - [use $1 include files below directory DIR (default: PREFIX/include/)])], + [Use $1 include files below directory DIR, DIR may actually be a space + separated list of multiple directories; in this case each is searched + in turn. (default: PREFIX/include/)])], [AC_HELP_STRING([--with-$1-headers=DIR], - [use $1 include files below directory DIR (default: $2)])]), + [Use $1 include files below directory DIR, DIR may actually be a space + separated list of multiple directories; in this case each is searched + in turn. (default: $2)])]), [case "$withval" in yes) AC_MSG_ERROR("option \"--with-$1-headers\" requires an argument") ;; @@ -121,41 +134,58 @@ AC_HELP_STRING([--with-$1-dir=DIR], ;; no) AC_MSG_ERROR("option \"--with-$1-dir\" requires an argument") ;; - *) UPNAME[_LIB_PATH]="$withval" + *) UPNAME[_LIB_PATHS]="$withval" UPNAME[_INCLUDE_PATH]="$withval" ;; esac]) ]) + +dnl *************************************************************************** +dnl *************************************************************************** +dnl *************************************************************************** +dnl *************************************************************************** + dnl dnl the macro itself dnl AC_DEFUN([ALBERTA_CHECK_PACKAGE], -[AC_REQUIRE([ALBERTA_SET_PREFIX]) -dnl m4_if($#,8,, -dnl [m4_if($#,9,, -dnl [errprint([$0] needs eight (8) or nine (9) arguments, but got $# -dnl ) -dnl m4exit(1)])]) +[ + +m4_define([alb_ac_PKGNAME],[$1]) +m4_define([alb_ac_LIBNAMES],[$2]) +m4_define([alb_ac_LIBFCTS],[$3]) +m4_define([alb_ac_LIBPATHS],[$4]) +m4_define([alb_ac_EXTRA_LIB],[$5]) +m4_define([alb_ac_HEADERS],[$6]) +m4_define([alb_ac_INCPATHS],[$7]) +m4_define([alb_ac_EXTRA_INC],[$8]) +m4_define([alb_ac_OPTIONS],[$9]) + +AC_REQUIRE([ALBERTA_SET_PREFIX]) +m4_if($#,8,[], + [m4_if($#,9,[], + [errprint([$0] needs eight (8) or nine (9) arguments, but got $#) + m4exit(1)])]) dnl dnl upcase $1 dnl -m4_define([UPNAME], [m4_bpatsubst(m4_toupper([$1]),-,_)]) +m4_define([UPNAME], [m4_bpatsubst(m4_toupper(alb_ac_PKGNAME),-,_)]) dnl dnl need to use m4_if, the $i arguments are not shell variables dnl m4_define([ENABLED],[enabled]) m4_define([OPTIONAL],[required]) -m4_if($#,8,[ - m4_foreach_w([ac_al_lvar],[$8], - [m4_if(ac_al_lvar,[disabled], - [m4_define([ENABLED],ac_al_lvar)], - ac_al_lvar,[enabled], - [m4_define([ENABLED],ac_al_lvar)], - ac_al_lvar,[optional], - [m4_define([OPTIONAL],ac_al_lvar)], - ac_al_lvar,[required], - [m4_define([OPTIONAL],ac_al_lvar)])])]) -m4_if(OPTIONAL,[optional],[ALBERTA_CHECK_PKG_OPT([$1],[ENABLED])]) +m4_if($#,9,[ + m4_foreach_w([alb_ac_lvar],alb_ac_OPTIONS, + [m4_if(alb_ac_lvar,[disabled], + [m4_define([ENABLED],alb_ac_lvar)], + alb_ac_lvar,[enabled], + [m4_define([ENABLED],alb_ac_lvar)], + alb_ac_lvar,[optional], + [m4_define([OPTIONAL],alb_ac_lvar)], + alb_ac_lvar,[required], + [m4_define([OPTIONAL],alb_ac_lvar)])])]) +m4_if(OPTIONAL,[optional],[ALBERTA_CHECK_PKG_OPT(alb_ac_PKGNAME,[ENABLED])]) dnl dnl bail out if package is completely disabled dnl @@ -163,143 +193,246 @@ if test "${UPNAME[_DISABLE]}" = yes; then : else -m4_if($3,[],[DEFAULT_LIBDIR="${libdir}"], - [DEFAULT_LIBDIR="$3"]) +m4_if(alb_ac_HEADERS,[],[], + [AC_MSG_RESULT([]) + AC_MSG_RESULT([**** Checking for OPTIONAL package alb_ac_PKGNAME ****])]) + +m4_if(alb_ac_LIBPATHS,[],[DEFAULT_LIBDIR="${libdir}"], + [DEFAULT_LIBDIR="alb_ac_LIBPATHS"]) if test "${DEFAULT_LIBDIR}" = '' then DEFAULT_LIBDIR="'${libdir}'" fi - dnl dnl Optionally use an alternate name (e.g. MesaGL instead of GL etc.) dnl -AC_ARG_WITH($1-name, -AC_HELP_STRING([--with-$1-name=NAME], [use NAME as the name of the $1 library (without leading "lib" prefix and trailing suffix). Default: "$2"]), +AC_ARG_WITH(alb_ac_PKGNAME[-name], +AC_HELP_STRING([--with-]alb_ac_PKGNAME[-name=NAME], + [use NAME as the name of the alb_ac_PKGNAME library (without leading "lib" prefix and + trailing suffix). If the default ("alb_ac_LIBNAMES") consists of multiple + libraries, then NAME must be a space separated list of replacement names + -- one name for each library.]), [case "$withval" in - yes) AC_MSG_ERROR("option \"--with-$1-name\" requires an argument") + yes) AC_MSG_ERROR(["option \"--with-]alb_ac_PKGNAME[-name\" requires an argument"]) ;; - no) AC_MSG_ERROR("option \"--with-$1-name\" requires an argument") + no) AC_MSG_ERROR(["option \"--with-]alb_ac_PKGNAME[-name\" requires an argument"]) ;; - *) UPNAME[_NAME]="$withval" + *) UPNAME[_NAMES]="$withval" ;; esac], -UPNAME[_NAME]="$2") +UPNAME[_NAMES]="alb_ac_LIBNAMES") +unset UPNAME[_LINK_NAMES] +for name in ${UPNAME[_NAMES]}; do + if test -z "${UPNAME[_LINK_NAMES]}"; then + UPNAME[_LINK_NAMES]="${name}" + else + UPNAME[_LINK_NAMES]="${UPNAME[_LINK_NAMES]} -l${name}" + fi +done dnl dnl headers and libraries below the same directory :( dnl If we have no header to check for, then this additional option does not dnl make sense, hence the m4_if() dnl -m4_if($5,[],[],[ALBERTA_CHECK_PKG_DIR_OPT([$1])]) +m4_if(alb_ac_HEADERS,[],[],[ALBERTA_CHECK_PKG_DIR_OPT(alb_ac_PKGNAME)]) dnl dnl location of library dnl -AC_ARG_WITH($1-lib, -m4_if($3,[], -[AC_HELP_STRING([--with-$1-lib=DIR], - [use $1 library below directory DIR (default: EPREFIX/lib/)])], -[AC_HELP_STRING([--with-$1-lib=DIR], - [use $1 library below directory DIR (default: $3)])]), +AC_ARG_WITH(alb_ac_PKGNAME[-lib], +m4_if(alb_ac_LIBPATHS,[], +[AC_HELP_STRING([--with-]alb_ac_PKGNAME[-lib=DIR], + [use alb_ac_PKGNAME library below directory DIR. + DIR maybe a space separated directory list. + (default: EPREFIX/lib/)])], +[AC_HELP_STRING([--with-]alb_ac_PKGNAME[-lib=DIR], + [use alb_ac_PKGNAME library below directory DIR. + DIR maybe a space separated directory list. + (default: alb_ac_LIBPATHS)])]), [case "$withval" in - yes) AC_MSG_ERROR("option \"--with-$1-lib\" requires an argument") + yes) AC_MSG_ERROR(["option \"--with-]alb_ac_PKGNAME[-lib\" requires an argument"]) ;; - no) AC_MSG_ERROR("option \"--with-$1-lib\" requires an argument") + no) AC_MSG_ERROR(["option \"--with-]alb_ac_PKGNAME[-lib\" requires an argument"]) ;; - *) UPNAME[_LIB_PATH]="$withval" + *) UPNAME[_LIB_PATHS]="$withval" ;; esac], -test -z "`eval eval eval echo ${UPNAME[_LIB_PATH]}`" && UPNAME[_LIB_PATH]="${DEFAULT_LIBDIR}") +test -z "`eval eval eval echo ${UPNAME[_LIB_PATHS]}`" \ + && UPNAME[_LIB_PATHS]="${DEFAULT_LIBDIR}") +unset alb_ac_tmp +for path in ${UPNAME[_LIB_PATHS]}; do + alb_ac_tmp="${alb_ac_tmp} -L${path}" +done +UPNAME[_LIB_PATHS]="${alb_ac_tmp}" dnl dnl now for the header file dnl -m4_if($5,[],[], - [m4_if($6,[],[DEFAULT_INCDIR="${includedir}" - ALBERTA_CHECK_PKG_HDR_OPT([$1], [PREFIX/include/])], - [DEFAULT_INCDIR="$6" - ALBERTA_CHECK_PKG_HDR_OPT([$1], [$6/])])]) +m4_if(alb_ac_HEADERS,[],[], + [m4_if(alb_ac_INCPATHS,[], + [DEFAULT_INCDIR="${includedir}" + ALBERTA_CHECK_PKG_HDR_OPT(alb_ac_PKGNAME, [PREFIX/include/])], + [DEFAULT_INCDIR="alb_ac_INCPATHS" + ALBERTA_CHECK_PKG_HDR_OPT(alb_ac_PKGNAME, alb_ac_INCPATHS[]/)])]) +m4_define([alb_ac_LINKER],[$CC]) +m4_ifdef([alb_ac_AUXLIBS], [m4_undefine([alb_ac_AUXLIBS])]) +m4_foreach_w([alb_ac_lvar],alb_ac_EXTRA_LIB, + [m4_if(alb_ac_lvar,[libtool], + [AC_LANG_CASE([C],[m4_define([alb_ac_lang_TAG],[CC])], + [C++],[m4_define([alb_ac_lang_TAG],[CXX])], + [Fortran 77],[m4_define([alb_ac_lang_TAG],[F77])]) + m4_define([alb_ac_LINKER], + [libtool --tag=alb_ac_lang_TAG --mode=link ${alb_ac_lang_TAG}])], + [m4_append([alb_ac_AUXLIBS], alb_ac_lvar,[ ])])]) +alb_ac_save_CC="${CC}" +CC="`eval eval eval echo alb_ac_LINKER`" +m4_ifdef([alb_ac_AUXLIBS],[],[m4_define([alb_ac_AUXLIBS],[])]) +UPNAME[_AUXLIBS]="alb_ac_AUXLIBS" dnl dnl now check if the library and header files exist dnl m4_if(OPTIONAL,[optional], - [AC_CHECK_LIB(${UPNAME[_NAME]}, main, - [UPNAME[_LIB]="-L${UPNAME[_LIB_PATH]} -l${UPNAME[_NAME]}" - UPNAME[_ALL_LIB]="-L${UPNAME[_LIB_PATH]} -l${UPNAME[_NAME]} $4"], - [UPNAME[_LIB]="" - UPNAME[_ALL_LIB]="" - UPNAME[_LIB_PATH]="" + [AC_CHECK_LIB(${UPNAME[_LINK_NAMES]}, main, + [UPNAME[_LIBS]="${UPNAME[_LIB_PATHS]} -l${UPNAME[_LINK_NAMES]}" + UPNAME[_ALL_LIBS]="${UPNAME[_LIB_PATHS]} -l${UPNAME[_LINK_NAMES]} ${UPNAME[_AUXLIBS]}"], + [UPNAME[_LIBS]="" + UPNAME[_ALL_LIBS]="" + UPNAME[_LIB_PATHS]="" + UPNAME[_INCLUDES]="" + UPNAME[_ALL_INCLUDES]="" UPNAME[_INCLUDE_PATH]=""], - -L`eval eval eval echo ${UPNAME[_LIB_PATH]}` $4)], - [AC_CHECK_LIB(${UPNAME[_NAME]}, main, - [UPNAME[_LIB]="-L${UPNAME[_LIB_PATH]} -l${UPNAME[_NAME]}" - UPNAME[_ALL_LIB]="-L${UPNAME[_LIB_PATH]} -l${UPNAME[_NAME]} $4"], + [`eval eval eval echo ${UPNAME[_LIB_PATHS]}` \ + `eval eval eval echo ${UPNAME[_AUXLIBS]}`])], + [AC_CHECK_LIB(${UPNAME[_LINK_NAMES]}, main, + [UPNAME[_LIBS]="${UPNAME[_LIB_PATHS]} -l${UPNAME[_LINK_NAMES]}" + UPNAME[_ALL_LIBS]="${UPNAME[_LIB_PATHS]} -l${UPNAME[_LINK_NAMES]} ${UPNAME[_AUXLIBS]}"], [case "$host" in *darwin*) - AC_MSG_RESULT([Running the test for "$1" again with -framework switch]) + AC_MSG_RESULT([Running the test for "alb_ac_PKGNAME" again with -framework switch]) ;; *) - AC_MSG_ERROR([Library "lib${UPNAME[_NAME]}" was not found]) + AC_MSG_ERROR([Failed to find "lib{${UPNAME[_NAMES]}}"]) ;; esac], - -L`eval eval eval echo $UPNAME[_LIB_PATH]` `eval eval eval echo $4`)]) - + [`eval eval eval echo $UPNAME[_LIB_PATHS]` \ + `eval eval eval echo ${UPNAME[_AUXLIBS]}`])]) dnl dnl On MacOS X we have that funky -framework switch ... dnl So just run the test again with the framework switch in case the dnl package was not found. dnl -if test "x${UPNAME[_LIB]}" = "x" ; then - case "$host" in +if test "x${UPNAME[_LIBS]}" = "x" ; then + case "$host" in *darwin*) - eval "unset ac_cv_lib_${UPNAME[_NAME]}___main" + as_ac_Lib=`echo "ac_cv_lib_${BLAS_LINK_NAMES}''_main" | $as_tr_sh` + eval "unset $as_ac_Lib" + unset UPNAME[_LINK_NAMES] + for name in ${UPNAME[_NAMES]}; do + if test -z "${UPNAME[_LINK_NAMES]}"; then + UPNAME[_LINK_NAMES]="${name}" + else + UPNAME[_LINK_NAMES]="${UPNAME[_LINK_NAMES]} -framework ${name}" + fi + done + unset alb_ac_tmp + for path in ${UPNAME[_LIB_PATHS]}; do + alb_ac_tmp="${alb_ac_tmp} -F${path}" + done + UPNAME[_LIB_PATHS]="${alb_ac_tmp}" m4_if(OPTIONAL,[optional], - [AC_CHECK_FRAMEWORK(${UPNAME[_NAME]}, main, - [UPNAME[_LIB]="-F${UPNAME[_LIB_PATH]} -framework ${UPNAME[_NAME]}" - UPNAME[_ALL_LIB]="-F${UPNAME[_LIB_PATH]} -framework ${UPNAME[_NAME]} $4"], - [UPNAME[_LIB]="" - UPNAME[_ALL_LIB]="" - UPNAME[_LIB_PATH]="" + [AC_CHECK_FRAMEWORK(${UPNAME[_LINK_NAMES]}, main, + [UPNAME[_LIBS]="${UPNAME[_LIB_PATHS]} -framework ${UPNAME[_LINK_NAMES]}" + UPNAME[_ALL_LIBS]="${UPNAME[_LIB_PATHS]} -framework ${UPNAME[_LINK_NAMES]} ${UPNAME[_AUXLIBS]}"], + [UPNAME[_LIBS]="" + UPNAME[_ALL_LIBS]="" + UPNAME[_LIB_PATHS]="" + UPNAME[_INCLUDES]="" + UPNAME[_ALL_INCLUDES]="" UPNAME[_INCLUDE_PATH]=""], - -F`eval eval eval echo ${UPNAME[_LIB_PATH]}` `eval eval eval echo $4`)], - [AC_CHECK_FRAMEWORK(${UPNAME[_NAME]}, main, - [UPNAME[_LIB]="-F${UPNAME[_LIB_PATH]} -framework ${UPNAME[_NAME]}" - UPNAME[_ALL_LIB]="-F${UPNAME[_LIB_PATH]} -framework ${UPNAME[_NAME]} $4"], - [AC_MSG_ERROR([Framework "${UPNAME[_NAME]}" was not found])], - -F`eval eval eval echo $UPNAME[_LIB_PATH]` `eval eval eval echo $4`)]) + [`eval eval eval echo ${UPNAME[_LIB_PATHS]}` + `eval eval eval echo ${UPNAME[_AUXLIBS]}`])], + [AC_CHECK_FRAMEWORK(${UPNAME[_NAMES]}, main, + [UPNAME[_LIBS]="${UPNAME[_LIB_PATHS]} -framework ${UPNAME[_LINK_NAMES]}" + UPNAME[_ALL_LIBS]="${UPNAME[_LIB_PATHS]} -framework ${UPNAME[_LINK_NAMES]} ${UPNAME[_AUXLIBS]}"], + [AC_MSG_ERROR([Framework "${UPNAME[_NAMES]}" was not found])], + [`eval eval eval echo $UPNAME[_LIB_PATHS]` \ + `eval eval eval echo ${UPNAME[_AUXLIBS]}`])]) ;; esac fi -if test "x${UPNAME[_LIB]}" = "x" ; then +dnl +dnl Maybe the library seems to exist. Now check for all +dnl functions listed in alb_ac_LIBFCTS. +dnl +m4_if(alb_ac_LIBFCTS, [], [], [ +if test "x${UPNAME[_LIBS]}" = "x" ; then + : +else + UPNAME[_LIB_EXPAND]="`eval eval eval echo ${UPNAME[_LIBS]}`" + AC_MSG_CHECKING([for m4_split(alb_ac_LIBFCTS) in \"${UPNAME[_LIB_EXPAND]}\"]) + AC_MSG_RESULT([]) + alb_ac_save_LIBS="${LIBS}" + LIBS="`eval eval eval echo ${UPNAME[_ALL_LIBS]}` ${LIBS}" + AC_CHECK_FUNCS(alb_ac_LIBFCTS,[], + [m4_if(OPTIONAL,[required], + [AC_MSG_ERROR([Check for library function for required package alb_ac_PKGNAME failed])]) + UPNAME[_LIBS]="" + UPNAME[_ALL_LIBS]="" + UPNAME[_LIB_PATHS]="" + UPNAME[_INCLUDES]="" + UPNAME[_ALL_INCLUDES]="" + UPNAME[_INCLUDE_PATH]=""]) + LIBS="${alb_ac_save_LIBS}" +fi]) + +dnl +dnl restore default linker +dnl +CC="${alb_ac_save_CC}" + +if test "x${UPNAME[_LIBS]}" = "x" ; then : else - m4_if($5,[],,[ + m4_if(alb_ac_HEADERS,[],[],[ dnl - dnl check for the header file + dnl check for the header file(s) dnl [gv_ac_]UPNAME[_save_CPPFLAGS]="$CPPFLAGS" - m4_define([gv_ac_inctemp],[m4_bpatsubst([gv_ac_$5],[[].-[]],_)]) - unset gv_ac_inctemp - for incdir in "${UPNAME[_INCLUDE_PATH]}"; do - if test -n "`eval eval eval echo ${incdir}`"; then - CPPFLAGS="-I`eval eval eval echo ${incdir}` $7 ${[gv_ac_]UPNAME[_save_CPPFLAGS]}" + for alb_ac_incdir in ${UPNAME[_INCLUDE_PATH]} ""; do + unset alb_ac_header_status + unset alb_ac_unset_names + alb_ac_incdir_exp="`eval eval eval echo ${alb_ac_incdir}`" + if test -n "${alb_ac_incdir_exp}"; then + CPPFLAGS="-I${alb_ac_incdir_exp} alb_ac_EXTRA_INC ${[gv_ac_]UPNAME[_save_CPPFLAGS]}" + AC_MSG_CHECKING([for header(s) \"alb_ac_HEADERS\" in \"${alb_ac_incdir_exp}\" and system include path]) + AC_MSG_RESULT([]) + else + AC_MSG_CHECKING([for header(s) \"alb_ac_HEADERS\" in system include path]) + AC_MSG_RESULT([]) fi - AC_CHECK_HEADERS($5,[gv_ac_inctemp="$5"]) - if ! test "${gv_ac_inctemp}" = "$5"; then - eval "[unset ac_cv_header_]m4_bpatsubst([$5],[[].-[]],_)" + AC_CHECK_HEADERS(alb_ac_HEADERS, + [alb_ac_unset_names="${alb_ac_unset_names} $as_ac_Header"], + [alb_ac_unset_names="${alb_ac_unset_names} $as_ac_Header" + alb_ac_header_status=notfound]) + if test "x${alb_ac_header_status}" = "xnotfound"; then + for name in ${alb_ac_unset_names}; do + eval "unset ${name}" + done else break fi done - if ! test "${gv_ac_inctemp}" = "$5"; then + if test "x${alb_ac_header_status}" = "xnotfound"; then m4_if(OPTIONAL,[optional], - [UPNAME[_LIB]="" - UPNAME[_ALL_LIB]="" - UPNAME[_LIB_PATH]="" + [UPNAME[_LIBS]="" + UPNAME[_ALL_LIBS]="" + UPNAME[_LIB_PATHS]="" + UPNAME[_INCLUDES]="" UPNAME[_INCLUDE_PATH]=""], - [AC_MSG_ERROR([Header file "$5" was not found])]) + [AC_MSG_ERROR([Header file(s) \"alb_ac_HEADERS\" were not found])]) else - UPNAME[_ALL_INCLUDES]="-I${incdir} $7" - UPNAME[_INCLUDES]="-I${incdir}" + UPNAME[_ALL_INCLUDES]="-I${alb_ac_incdir} alb_ac_EXTRA_INC" + UPNAME[_INCLUDES]="-I${alb_ac_incdir}" UPNAME[_INCLUDE_PATH]="${incdir}" fi CPPFLAGS="${[gv_ac_]UPNAME[_save_CPPFLAGS]}" @@ -307,22 +440,32 @@ else dnl dnl define makefile substitutions and config.h macros dnl - if test "x${UPNAME[_LIB]}" = "x" ; then + if test "x${UPNAME[_LIBS]}" = "x" ; then : else - AC_DEFINE(m4_bpatsubst(m4_toupper([HAVE_LIB$2]),-,_), - 1, Define to 1 if you have lib$2) + m4_foreach_w([alb_ac_lvar],alb_ac_LIBNAMES, + [AC_DEFINE(m4_bpatsubst(m4_toupper([HAVE_LIB]alb_ac_lvar),-,_), + 1, [Define to 1 if you have lib]alb_ac_lvar)]) + AC_DEFINE([HAVE_PKG_]UPNAME, + 1, [Define to 1 if you have package \"ac_alb_PKGNAME\"]) fi fi +m4_if(alb_ac_HEADERS,[],[],[ +if test -n "$[]UPNAME[_LIBS]"; then + AC_MSG_RESULT([**** Successfully finished checks for OPTIONAL package alb_ac_PKGNAME ****]) +else + AC_MSG_RESULT([**** Checks for OPTIONAL package alb_ac_PKGNAME finished UNSUCCESSFULLY ****]) +fi]) + fi dnl disable fi -AM_CONDITIONAL([HAVE_]UPNAME, [test -n "$[]UPNAME[_LIB]"]) +AM_CONDITIONAL([HAVE_]UPNAME, [test -n "$[]UPNAME[_LIBS]"]) AC_SUBST(UPNAME[_INCLUDE_PATH]) AC_SUBST(UPNAME[_INCLUDES]) AC_SUBST(UPNAME[_ALL_INCLUDES]) -AC_SUBST(UPNAME[_LIB_PATH]) -AC_SUBST(UPNAME[_LIB]) -AC_SUBST(UPNAME[_ALL_LIB]) -AC_SUBST(UPNAME[_NAME]) +AC_SUBST(UPNAME[_LIB_PATHS]) +AC_SUBST(UPNAME[_LIBS]) +AC_SUBST(UPNAME[_ALL_LIBS]) +AC_SUBST(UPNAME[_NAMES]) ]) diff --git a/m4/gltools.m4 b/m4/gltools.m4 index f2ad881..c6dda9c 100644 --- a/m4/gltools.m4 +++ b/m4/gltools.m4 @@ -4,11 +4,11 @@ AC_DEFUN([ALBERTA_GLTOOLS_CHECK], [AC_REQUIRE([ALBERTA_OPENGL_CHECK]) -ALBERTA_CHECK_PACKAGE([gltools],[gltools],[],[$OPENGL_ALL_LIB], - [glwin.h],[],[],[optional enabled]) -if ! test "z${GLTOOLS_LIB}" = "z"; then +AC_LANG_PUSH([C]) +ALBERTA_CHECK_PACKAGE([gltools],[gltools],[glrCreate],[],[${OPENGL_ALL_LIBS}], + [glwin.h glrnd.h],[],[],[optional enabled]) +if ! test "z${GLTOOLS_LIBS}" = "z"; then AC_MSG_CHECKING([for gltools version]) - AC_LANG_PUSH([C]) ac_al_save_CPPFLAGS="${CPPFLAGS}" CPPFLAGS="`eval eval eval echo ${GLTOOLS_ALL_INCLUDES}` ${CPPFLAGS}" AC_COMPILE_IFELSE( @@ -24,6 +24,7 @@ if ! test "z${GLTOOLS_LIB}" = "z"; then AC_DEFINE([HAVE_GLMLOOPCALLBACK_COORDS_ONLY], 0, [Define if glmLoopCallback accepts an "coords_only" argument.])]) CPPFLAGS="${ac_al_save_CPPFLAGS}" - AC_LANG_POP([C]) -fi]) +fi +AC_LANG_POP([C]) +]) diff --git a/m4/grapeiface.m4 b/m4/grapeiface.m4 index ec19e86..b0153ff 100644 --- a/m4/grapeiface.m4 +++ b/m4/grapeiface.m4 @@ -4,21 +4,20 @@ dnl Some defines to enable building of alberta_movi. This is more dnl complicated than necessary so that it is easier to build a dnl stand-alone version of albert_movi. dnl -ALBERTA_CHECK_PACKAGE([grape],[gr],[],[${OPENGL_LIB} ${X_ALL_LIBS}], +ALBERTA_CHECK_PACKAGE([grape],[gr],[grape],[],[${OPENGL_ALL_LIBS}], [grape.h],[],[],[optional]) -AM_CONDITIONAL(GRAPE, test -n "${GRAPE_LIB}") -ALBERTA_LIB_PATH=$prefix/lib -ALBERTA_INCLUDE_PATH='$(top_srcdir)/alberta/src/Common/ -I$(top_srcdir)/alberta_util/src/ -I$(top_builddir)/alberta_util/src/' +ALBERTA_LIB_PATHS=$prefix/lib +ALBERTA_ALL_INCLUDES='-I$(top_srcdir)/alberta/src/Common/ -I$(top_srcdir)/alberta_util/src/ -I$(top_builddir)/alberta_util/src/' -ALBERTA_LIBS_1='$(top_builddir)/alberta/src/alberta2_1d/libalberta2_1d.la $(top_builddir)/alberta_util/src/libalberta2_util.la $(BLAS_ALL_LIB) $(GLTOOLS_ALL_LIB) $(OPENDX_ALL_LIB)' +ALBERTA_LIBS_1='$(top_builddir)/alberta/src/alberta_1d/libalberta_1d.la $(top_builddir)/alberta_util/src/libalberta_util.la $(BLAS_ALL_LIBS)' -ALBERTA_LIBS_2='$(top_builddir)/alberta/src/alberta2_2d/libalberta2_2d.la $(top_builddir)/alberta_util/src/libalberta2_util.la $(BLAS_ALL_LIB) $(GLTOOLS_ALL_LIB) $(OPENDX_ALL_LIB)' +ALBERTA_LIBS_2='$(top_builddir)/alberta/src/alberta_2d/libalberta_2d.la $(top_builddir)/alberta_util/src/libalberta_util.la $(BLAS_ALL_LIBS)' -ALBERTA_LIBS_3='$(top_builddir)/alberta/src/alberta2_3d/libalberta2_3d.la $(top_builddir)/alberta_util/src/libalberta2_util.la $(BLAS_ALL_LIB) $(GLTOOLS_ALL_LIB) $(OPENDX_ALL_LIB)' +ALBERTA_LIBS_3='$(top_builddir)/alberta/src/alberta_3d/libalberta_3d.la $(top_builddir)/alberta_util/src/libalberta_util.la $(BLAS_ALL_LIBS)' ALBERTA_DEBUG= AC_SUBST(ALBERTA_DEBUG) -AC_SUBST(ALBERTA_LIB_PATH) -AC_SUBST(ALBERTA_INCLUDE_PATH) +AC_SUBST(ALBERTA_LIB_PATHS) +AC_SUBST(ALBERTA_ALL_INCLUDES) AC_SUBST(ALBERTA_LIBS_1) AC_SUBST(ALBERTA_LIBS_2) AC_SUBST(ALBERTA_LIBS_3) diff --git a/m4/opendx.m4 b/m4/opendx.m4 index 60bf5ee..5c0a43b 100644 --- a/m4/opendx.m4 +++ b/m4/opendx.m4 @@ -3,16 +3,30 @@ # AC_DEFUN([ALBERTA_OPENDX_CHECK], -[ +[AC_REQUIRE([ALBERTA_OPENGL_CHECK]) if ! test "x${OPENDX_DISABLE}" = "xno"; then - AC_CHECK_LIB([rt],[main],[LIBRT=-lrt],[HAVE_LIBRT=]) - AC_CHECK_HEADERS([unistd.h errno.h Xm/Xm.h Xm/Form.h Xm/DrawingA.h pthread.h], - [], - [AC_MSG_WARN([Headers needed for dxtools not found]) - OPENDX_DISABLE=yes]) - AC_CHECK_TYPE([ulong],[], + AC_CHECK_LIB([rt],[clock_gettime], + [LIBRT=-lrt], + [HAVE_LIBRT= + AC_MSG_RESULT([clock_gettime() not found in librt, disabling OpenDX interface, sorry.]) + OPENDX_DISABLE=yes]) + AC_CHECK_TYPE([ulong],[], [AC_DEFINE([ulong],[unsigned long],[Needed for OpenDX])]) fi - ALBERTA_CHECK_PACKAGE([OpenDX],[DXL],[],[-lDXcallm ${LIBRT}], - [dx/dx.h],[],[],[optional enabled]) +# The entire fuck below is just here to cope with the OpenDX +# installation brain-damagedness. Why is it that some people are so +# damn stupid ass-holes? + if test "`echo ABC | tr '[[]A-Z[]]' '[[]a-z[]]'`" = "abc" ; then + tolower="tr '[[]A-Z[]]' '[[]a-z[]]'" + else + tolower="tr A-Z a-z" + fi + OPENDXARCH=`uname -s | $tolower` # hope uname exists + ALBERTA_CHECK_PACKAGE([OpenDX], + [DXL DXcallm],[DXInitModules], + [${prefix}/dx/lib_${OPENDXARCH} /usr/local/dx/lib_${OPENDXARCH} /usr/dx/lib_${OPENDXARCH}], + [libtool ${LIBRT}], + [dx/dx.h unistd.h errno.h Xm/Xm.h Xm/Form.h Xm/DrawingA.h pthread.h], + [${prefix}/dx/include /usr/dx/include /usr/local/dx/include], + [],[optional enabled]) ]) diff --git a/m4/opengl.m4 b/m4/opengl.m4 index 9ce0c71..155991a 100644 --- a/m4/opengl.m4 +++ b/m4/opengl.m4 @@ -1,11 +1,13 @@ dnl dnl check for OpenGL (tm) -dnl +dnl AC_DEFUN([ALBERTA_OPENGL_CHECK], -[AC_REQUIRE([AC_PATH_X]) -AC_REQUIRE([AC_PATH_XTRA]) -ALBERTA_CHECK_PACKAGE([OpenGL],[GL],[${x_libraries}],[${X_LIBS} -lX11], - [gl.h],[${x_includes}/GL -I/usr/include/GL],[${X_CFLAGS}], - [optional]) +[# ALBERTA_OPENGL_CHECK start +AC_REQUIRE([ALBERTA_X_WINDOW_SYSTEM]) +ALBERTA_CHECK_PACKAGE([OpenGL],[GL],[glXMakeCurrent], + [${x_libraries}],[${X_ALL_LIBS}], + [gl.h],[${x_includes:+${x_includes}/GL} ${includedir}/GL ${oldincludedir}/GL],[${X_CFLAGS}], + [optional]) +# ALBERTA_OPENGL_CHECK stop ]) diff --git a/m4/set-prefix.m4 b/m4/set-prefix.m4 index cc452a1..4200cf4 100644 --- a/m4/set-prefix.m4 +++ b/m4/set-prefix.m4 @@ -1,11 +1,14 @@ dnl set prefix to its proper value, so that one can define substitutions dnl depending on the value of prefix AC_DEFUN([ALBERTA_SET_PREFIX], -[test "x$prefix" = xNONE && prefix=$ac_default_prefix +[AC_ARG_VAR([DEFAULT_PREFIX],[Default installation prefix]) +test "x${DEFAULT_PREFIX}" = "x" && DEFAULT_PREFIX="${ac_default_prefix}" +test "x$prefix" = xNONE && prefix="${DEFAULT_PREFIX}" +PREFIX="${prefix}" # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -expanded_prefix=`eval echo ${prefix}` +expanded_prefix=`eval eval eval echo ${prefix}` AC_SUBST(expanded_prefix) -expanded_exec_prefix=`eval echo ${exec_prefix}` +expanded_exec_prefix=`eval eval eval echo ${exec_prefix}` AC_SUBST(expanded_exec_prefix) ]) diff --git a/m4/x-window-system.m4 b/m4/x-window-system.m4 new file mode 100644 index 0000000..09238a8 --- /dev/null +++ b/m4/x-window-system.m4 @@ -0,0 +1,6 @@ +AC_DEFUN([ALBERTA_X_WINDOW_SYSTEM], +[AC_REQUIRE([AC_PATH_X]) +AC_REQUIRE([AC_PATH_XTRA]) +X_ALL_LIBS="${X_PRE_LIBS} ${X_LIBS} -lX11 ${X_EXTRA_LIBS}" +AC_SUBST(X_ALL_LIBS) +]) \ No newline at end of file diff --git a/mksnap.sh b/mksnap.sh index 25a7318..8aed89a 100755 --- a/mksnap.sh +++ b/mksnap.sh @@ -3,7 +3,7 @@ # Generate a snapshot from svn. This script tries to check-out a new # copy from svn, and then run "autoreconf" and "make distcheck". -MYTMPDIR="${TMPDIR:-/tmp}/alberta2.$$" +MYTMPDIR="${TMPDIR:-/tmp}/alberta.$$" SVNREPOS=svn+ssh://malaga.math.uni-augsburg.de/homes/proj/alberta/ALBERTA_SVN ALBERTADIST=trunk/albertadist DATE=$(date --utc '+%Y%m%d') @@ -52,16 +52,16 @@ fi # attach the time-stamp to the package # VERSTAMP="${DATE}-${HEADREV}" -sed -i -e 's/AC_INIT(\[alberta2\], [^,]\+,/AC_INIT([alberta2], ['"${VERSTAMP}"'],/g' configure.ac +sed -i -e 's/AC_INIT(\[alberta\], [^,]\+,/AC_INIT([alberta], ['"${VERSTAMP}"'],/g' configure.ac ./fromsvnreconf.sh ./configure --enable-maintainer-mode || exit 1 make || exit 1 make distcheck || exit 1 -if test -f "alberta2-${VERSTAMP}.tar.bz2" -a \ - -f "alberta2-${VERSTAMP}.tar.gz"; then +if test -f "alberta-${VERSTAMP}.tar.bz2" -a \ + -f "alberta-${VERSTAMP}.tar.gz"; then mkdir -p ${SNAPSHOTDIR} || true - cp alberta2-${VERSTAMP}.tar.bz2 alberta2-${VERSTAMP}.tar.gz ${SNAPSHOTDIR} + cp alberta-${VERSTAMP}.tar.bz2 alberta-${VERSTAMP}.tar.gz ${SNAPSHOTDIR} rm -f `ls --color=no -C1 ${SNAPSHOTDIR}/*.tar.gz|head -n -${NSNAPSHOTS}` rm -f `ls --color=no -C1 ${SNAPSHOTDIR}/*.tar.bz2|head -n -${NSNAPSHOTS}` chmod -R a+rX ${SNAPSHOTDIR} -- GitLab