View Issue Details

IDProjectCategoryView StatusLast Update
0023445Open CASCADEOCCT:WOKpublic2012-11-16 13:17
ReportervsrAssigned Tobugmaster  
PriorityhighSeveritytweak 
Status closedResolutionfixed 
PlatformLinux 
Target Version6.5.4Fixed in Version6.5.4 
Summary0023445: Improve configure.ac script to check native products properly
DescriptionCurrently, configure script properly detects pre-requisite products natively installed on target Linux platform only if corresponding options are explicitly specified in the command line; for example to use native freetype and ftgl, it is necessary to run configure as:

./configure --with-freetype=/usr --with-ftgl=/usr

However, at least for mandatory products, check for native products should be done automatically by configure script without explicit specifying of the corresponding options.

Tested on the following configuration:
* Debian 6.0 Squeeze
* native freetype: 2.4.2
* native ftgl: 2.1.3

It is proposed to improve configure.ac script to detect native products automatically (at least mandatory ones).
TagsNo tags attached.
Test case number

Activities

vsr

2012-09-25 14:03

developer   ~0021549

Patch 1: improved procedure for freetype detection

#---------------------------------------------------------------------
#
# Check for FREETYPE Libraries
#
#
#---------------------------------------------------------------------
AC_ARG_WITH([freetype],
  [AC_HELP_STRING([--with-freetype=DIR],[Location of FREETYPE])],
  [freetype="${withval}"],[freetype=yes])

CSF_FREETYPE_INCLUDES=""
CSF_FREETYPE_LIB=""
HAVE_FREETYPE=no

if test "xyes" = "x${HAVE_GL}"; then
  AC_LANG([C++])
  if test "xno" = "x${freetype}"; then
    dnl freetype check is explicitly disabled by --without-freetype or --with-freetype=no
    AC_MSG_NOTICE([freetype check is explicitly disabled])
    DISABLE_FREETYPE_REASON="(freetype check was explicitly disabled)"
  else
    if test "xyes" = "x${freetype}" -o "x/usr" = "x${freetype}"; then
      dnl try native freetype (default)
      AC_MSG_NOTICE(try system freetype)
      FREETYPE_INCLUDES="-I/usr/include/freetype2"
      FREETYPE_LIBS="-lfreetype"
      FREETYPE_OPT_INC="/usr/include/freetype2"
      FREETYPE_OPT_LIB=
    else
      AC_MSG_NOTICE(try freetype in $freetype)
      if test ! -d ${freetype}; then
    DISABLE_FREETYPE_REASON="(${freetype} directory does not exists)"
    AC_MSG_ERROR([${freetype} directory does not exists])
      fi
      FREETYPE_INCLUDES="-I${freetype}/include -I${freetype}/include/freetype2"
      FREETYPE_LIBS="-L${freetype}/lib -lfreetype"
      FREETYPE_OPT_INC="${freetype}/include:${freetype}/include/freetype2"
      FREETYPE_OPT_LIB="${freetype}/lib"
    fi
    CPPFLAGS_old=${CPPFLAGS}
    LDFLAGS_old=${LDFLAGS}
    CPPFLAGS="${FREETYPE_INCLUDES} $CPPFLAGS"
    LDFLAGS="${FREETYPE_LIBS} $LDFLAGS"
    AC_CHECK_HEADER( [ft2build.h], [HAVE_FREETYPE_INC=yes], [HAVE_FREETYPE_INC=no] )
    if test "x${HAVE_FREETYPE_INC}" = "xyes"; then
      AC_CHECK_LIB(freetype, FT_Init_FreeType,
      [
    HAVE_FREETYPE=yes
        CSF_FREETYPE_INCLUDES="${FREETYPE_INCLUDES}"
    CSF_FREETYPE_LIB="${FREETYPE_LIBS}"
        LIBS="$CSF_FREETYPE_LIB $LIBS"
        CSF_OPT_INC="${FREETYPE_OPT_INC}:${CSF_OPT_INC}"
        CSF_OPT_LIB="${FREETYPE_OPT_LIB}:${CSF_OPT_LIB}"
      ],
      [
    DISABLE_FREETYPE_REASON="(freetype was not found)"
    AC_MSG_ERROR([Unable to locate the required FreeType library])
      ])
    else
      DISABLE_FREETYPE_REASON="(freetype was not found)"
    fi
    CPPFLAGS=${CPPFLAGS_old}
    LDFLAGS=${LDFLAGS_old}
  fi
else
  DISABLE_FREETYPE_REASON="(freetype requires OpenGL support)"
fi
AM_CONDITIONAL( HAVE_FREETYPE, [test "xyes" = "x$HAVE_FREETYPE"] )

vsr

2012-09-25 14:04

developer   ~0021550

Last edited: 2012-09-25 17:53

Patch 2: improved procedure for ftgl detection

#---------------------------------------------------------------------
#
# Check for FTGL Libraries
#
#
#---------------------------------------------------------------------
AC_ARG_WITH([ftgl],
  [AC_HELP_STRING([--with-ftgl=DIR],[Location of FTGL])],
  [ftgl="${withval}"],[ftgl=yes])

CSF_FTGL_INCLUDES=""
CSF_FTGL_LIB=""
HAVE_FTGL=no

if test "xno" = "x${HAVE_FREETYPE}"; then
  DISABLE_FTGL_REASON=$DISABLE_FREETYPE_REASON
else
  AC_LANG([C++])
  if test "xno" = "x${ftgl}"; then
    dnl ftgl check is explicitly disabled by --without-ftgl or --with-ftgl=no
    AC_MSG_NOTICE([ftgl check is explicitly disabled])
    DISABLE_FTGL_REASON="(ftgl check was explicitly disabled)"
  else
    if test "xyes" = "x${ftgl}" -o "x/usr" = "x${ftgl}"; then
      dnl try native ftgl (default)
      ftgl=/usr
      AC_MSG_NOTICE(try system ftgl)
      FTGL_INCLUDES="-I/usr/include/FTGL"
      FTGL_LIBS="-lftgl"
      FTGL_OPT_INC="/usr/include/FTGL"
      FTGL_OPT_LIB=
    else
      AC_MSG_NOTICE(try ftgl in ${ftgl})
      if test ! -d ${ftgl}; then
    DISABLE_FTGL_REASON="(${ftgl} directory does not exists)"
    AC_MSG_ERROR([${ftgl} directory does not exists])
      fi
      FTGL_INCLUDES="-I${ftgl}/include -I${ftgl}/include/FTGL"
      FTGL_LIBS="-L${ftgl}/lib -lftgl"
      FTGL_OPT_INC="${ftgl}/include:${ftgl}/include/FTGL"
      FTGL_OPT_LIB="${ftgl}/lib"
    fi
    for hf in ftgl.h FTGL.h; do
      dnl check presence of ftgl header file in the specified directory
      test -f ${ftgl}/include/FTGL/${hf} -o -f ${ftgl}/include/${hf} && HAVE_FTGL_INC=yes
      test "xyes" = "x${HAVE_FTGL_INC}" -a "${hf}" = "FTGL.h" && HAVE_FTGL_UPPERCASE=-DHAVE_FTGL_UPPERCASE
      test "xyes" = "x${HAVE_FTGL_INC}" && break
    done
    if test "xyes" = "x${HAVE_FTGL_INC}" ; then
      CPPFLAGS_old=${CPPFLAGS}
      LDFLAGS_old=${LDFLAGS}
      CPPFLAGS="${FTGL_INCLUDES} ${HAVE_FTGL_UPPERCASE} ${CSF_FREETYPE_INCLUDES} $CPPFLAGS"
      LDFLAGS="${FTGL_LIBS} ${CSF_FREETYPE_LIB} $LDFLAGS"
      AC_CHECK_HEADERS([${hf}],
      [
        HAVE_FTGL_INC=yes
        break
      ],
      [
        HAVE_FTGL_INC=no
      ])
      if test "x${HAVE_FTGL_INC}" = "xyes"; then
        AC_MSG_CHECKING([for FTGLTextureFont in -lftgl])
        CPPFLAGS="${FTGL_INCLUDES} ${HAVE_FTGL_UPPERCASE} ${CSF_FREETYPE_INCLUDES} ${CPPFLAGS_old}"
        AC_TRY_LINK(
        [
          #ifdef HAVE_FTGL_UPPERCASE
          #include <FTGL/FTGL.h>
          #include <FTGL/FTGLTextureFont.h>
          #else
          #include <FTGL/ftgl.h>
          #endif
        ],
        [
          FTGLTextureFont font("");
        ],
        [
          AC_MSG_RESULT(yes)
          HAVE_FTGL=yes
          CSF_FTGL_INCLUDES="${FTGL_INCLUDES} ${HAVE_FTGL_UPPERCASE}"
          CSF_FTGL_LIB="${FTGL_LIBS}"
          CSF_OPT_INC="${FTGL_OPT_INC}:${CSF_OPT_INC}"
          CSF_OPT_LIB="${FTGL_OPT_LIB}:${CSF_OPT_LIB}"
        ],
        [
          AC_MSG_RESULT(no)
          DISABLE_FTGL_REASON="(ftgl was not found)"
      AC_MSG_ERROR([Unable to locate the required ftgl library])
        ])
      else
        DISABLE_FTGL_REASON="(ftgl was not found)"
      fi
      CPPFLAGS=${CPPFLAGS_old}
      LDFLAGS=${LDFLAGS_old}
    else
      AC_MSG_RESULT([ftgl was not found])
      DISABLE_FTGL_REASON="(ftgl was not found)"
    fi
  fi
fi
AM_CONDITIONAL( HAVE_FTGL, [test "xyes" = "x$HAVE_FTGL"] )

vsr

2012-09-25 14:05

developer   ~0021551

Dear bugmaster,

Please revise and test proposed changes.

vsr

2012-09-25 14:08

developer   ~0021552

Last edited: 2012-09-25 17:57

An additional remark.

In configure.ac script there are some automake conditional "HAVE_*" variables, namely (see AM_CONDITIONAL(HAVE_...) lines):
* HAVE_GL
* HAVE_FREETYPE
* HAVE_FTGL
* HAVE_GL2PS
* HAVE_FREEIMAGE
* HAVE_TBB
* HAVE_QT

These variables are supposed to be used in Makefiles (since these are automake conditionals) but they are actually not used anywhere.
I would propose their removal from configure.ac.

vsr

2012-09-25 17:54

developer   ~0021561

Last edited: 2012-09-25 17:56

Patch N2 has been corrected a little: error message has been added (see 0023445:0021550):

      AC_MSG_RESULT([ftgl was not found])

bugmaster

2012-10-01 14:17

administrator   ~0021603

Last edited: 2012-10-01 14:19

template.ac has been updated in accordance with suggested by VSR.
Compilation has been checked with native freetype and ftgl different versions.
products are detected successfully.
OCCT is compiled without problem.

Issue History

Date Modified Username Field Change
2012-09-25 14:01 vsr New Issue
2012-09-25 14:01 vsr Assigned To => vsr
2012-09-25 14:03 vsr Note Added: 0021549
2012-09-25 14:04 vsr Note Added: 0021550
2012-09-25 14:05 vsr Note Added: 0021551
2012-09-25 14:05 vsr Assigned To vsr => bugmaster
2012-09-25 14:05 vsr Status new => assigned
2012-09-25 14:08 vsr Note Added: 0021552
2012-09-25 17:53 vsr Note Edited: 0021550
2012-09-25 17:54 vsr Note Added: 0021561
2012-09-25 17:56 vsr Note Edited: 0021561
2012-09-25 17:57 vsr Note Edited: 0021552
2012-10-01 14:11 bugmaster Status assigned => resolved
2012-10-01 14:12 bugmaster Status resolved => reviewed
2012-10-01 14:17 bugmaster Note Added: 0021603
2012-10-01 14:17 bugmaster Status reviewed => tested
2012-10-01 14:19 bugmaster Note Edited: 0021603
2012-10-01 14:20 bugmaster Status tested => verified
2012-10-01 14:20 bugmaster Resolution open => fixed
2012-10-02 14:54 bugmaster Project Internal => Open CASCADE
2012-11-16 13:14 bugmaster Fixed in Version => 6.5.4
2012-11-16 13:17 bugmaster Status verified => closed