[ptx] libpano12 - build with GNU autoconf, automake and libtool

Douglas Wilkins douglasw at zahav.net.il
Tue Nov 9 11:56:24 GMT 2004


On Tue, 2004-11-09 at 11:12 +0100, Andreas Hirczy wrote: 
> Douglas Wilkins <douglasw at zahav.net.il> writes:
> 
> > One thing that I have not sorted is that the tools are built before the
> > library, which is still a problem :-((
> 
> Sorry for my previous posting; with "SUBDIRS=m4 . tools" tools will be build
> after the library, but fails on a clean machine:
[snip] 
> While I like m4/, i still think its better to have build commands for panoinfo
> and PTOptimizer in a main Makefile.am.

All it needs is one change. In the tools/Makefile.am, change the LDFLAGS
to include -L..

New Makefile.am for ./tools attached with this change and removal of
redundant flags as well.

I have also attached an updated ax_check_java.m4 which should now work
correctly. You will have to rerun bootstrap and configure though.

regards,
Doug


-------------- next part --------------
#SUBDIRS=tools

SUFFIXES    = .rc

RC          = @WINDRES@
RCFLAGS     = --use-temp-file --verbose -O COFF

RCCOMPILE   = $(RC) $(RCFLAGS) \
              `echo $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) |\
	      sed -e 's/-I/--include-dir /g;s/-D/--define /g;s/-m.*//g'`

if HAVE_MINGW
WIN_SRC =  panoinfo.c
else
WIN_SRC =
endif

if HAVE_LINUX
LIN_SRC =  panoinfo_unix.c
LIN_DEFS = -D__Ansi__=1
else
LIN_SRC =
LIN_DEFS = 
endif

if HAVE_DARWIN
DAR_SRC =  panoinfo_unix.c
DAR_DEFS = -D__Ansi__=1
else
DAR_SRC =
DAR_DEFS = 
endif

AM_CPPFLAGS = $(JAVA_FLAGS) $(LIN_DEFS) $(DAR_DEFS)
AM_LDFLAGS  = -L.. 

bin_PROGRAMS = panoinfo PTOptimizer

PTOptimizer_SOURCES = PTOptimizer.c
PTOptimizer_LDADD   = -lpano12

panoinfo_SOURCES    = $(WIN_SRC) $(LIN_SRC) $(DAR_SRC)
panoinfo_LDADD      = -lpano12

EXTRA_DIST = makefile.panoinfo makefile.ptoptimizer

.rc.o:
	$(RCCOMPILE) -i $< -o $@
-------------- next part --------------

dnl Usage:
dnl AX_CHECK_JAVA
dnl Test for java, and defines
dnl - JAVA_CFLAGS (compiler flags)
dnl - LIB_JAVA (linker flags, stripping and path)
dnl prerequisites:

AC_DEFUN([AX_CHECK_JAVA],
[
AC_ARG_WITH([java],
            AC_HELP_STRING([  --with-java=PFX], [prefix where 'java' is installed.]),
            [with_java_prefix=$withval], 
	    [with_java_prefix=${JAVA_INSTALL_PATH:-/usr/java/j2sdk1.4.1_01}])
have_java='no'
LIB_JAVA=''
JAVA_FLAGS=''
JAVA_HOME=''
if test "x$with_java" != 'xno'
then
  AC_MSG_CHECKING([for JAVA installation at ${with_java}])
  AC_MSG_RESULT()

dnl these two lines should let u find most java installations
  java_dirs="/usr /usr/local /usr/lib/j2sdk1.4-sun /opt /mingw"
  java_inc_dirs="include include/libgcj"
  
  if test "x$with_java" != 'x'
  then
    if test -d "$with_java"
    then
      JAVA_HOME="$with_java"
      for j in $java_inc_dirs
      do
        if test -r "$JAVA_HOME/$j/jni.h"; then
	  java_inc_dir="$j"
	  break
        fi
      done
    else
      AC_MSG_WARN([Sorry, $with_java does not exist, checking usual places])
                  with_java=''
    fi
  fi

dnl now find the java dirs

  if test "x$JAVA_HOME" = 'x'
  then
    for i in $java_dirs;
    do
      for j in $java_inc_dirs
      do
        if test -r "$i/$j/jni.h"; then
          JAVA_HOME="$i"
	  java_inc_dir="$j"
	  break
        fi
      done
    done
    if test "x$JAVA_HOME" != 'x'
    then
      AC_MSG_NOTICE([java home set to $JAVA_HOME])
    else
      AC_MSG_NOTICE([cannot find the java directory, assuming it is specified in CFLAGS])
    fi
  fi

  failed=0;
  passed=0;
  JAVA_OLD_CPPFLAGS=$CPPFLAGS
  if test "x$JAVA_HOME" != 'x'
  then
    CPPFLAGS="$CPPFLAGS -I$JAVA_HOME/$java_inc_dir"
  fi
  AC_LANG_SAVE
  AC_LANG_C
  AC_CHECK_HEADER(jni.h,passed=`expr $passed + 1`,failed=`expr $failed + 1`,)
  AC_LANG_RESTORE
  CPPFLAGS="$JAVA_OLD_CPPFLAGS"

  AC_MSG_CHECKING(if JAVA package is complete)
  if test $passed -gt 0
  then
    if test $failed -gt 0
    then
      AC_MSG_RESULT(no -- some components failed test)
      have_java='no (failed tests)'
    else
      if test "x$JAVA_HOME" = 'x'
      then
        JAVA_FLAGS=
      else
        LIB_JAVA="-LJAVA_HOME/lib"
        JAVA_FLAGS="-I$JAVA_HOME/$java_inc_dir -DHasJava"
      fi
      AC_DEFINE(HasJava,1,Define if you have Java)
      AC_MSG_RESULT(yes)
      have_java='yes'
    fi
  else
    AC_MSG_RESULT(no)
  fi
fi
AM_CONDITIONAL(HasJava, test "x$have_java" = 'xyes')
AC_SUBST(LIB_JAVA)
AC_SUBST(JAVA_FLAGS)
])

    


More information about the ptX mailing list