Changeset 823

Show
Ignore:
Timestamp:
08/11/08 07:12:24 (4 months ago)
Author:
mloskot
Message:

Prefer AM_CFLAGS and friends instead of INCLUDES. Refactored ./configure.ac quoting macro params and improving summary output.

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/apps/Makefile.am

    r818 r823  
    1 AM_CFLAGS = @GDAL_INC@ -I../include/liblas/capi -I../include 
    2 AM_CXXFLAGS = @GDAL_INC@ -I../include 
     1if GDAL_IS_CONFIG 
     2GDAL_CPPFLAGS = @GDAL_INC@ -DHAVE_GDAL=1 
     3endif 
     4 
     5AM_CPPFLAGS = $(GDAL_CPPFLAGS) -I../include/liblas/capi -I../include 
    36 
    47lasinfo_SOURCES = lasinfo.c lascommon.c 
  • trunk/configure.ac

    r818 r823  
    1515RELEASE_VERSION=liblas_version 
    1616 
     17dnl ######################################################################### 
    1718dnl Default compilation flags 
     19dnl ######################################################################### 
     20 
    1821debug_default="no" 
    1922CFLAGS="-Wall -Wno-long-long -pedantic $CFLAGS" 
    2023CXXFLAGS="-Wall -Wno-long-long -pedantic -std=c++98 $CXXFLAGS" 
    2124 
     25dnl ######################################################################### 
    2226dnl Checks for programs. 
     27dnl ######################################################################### 
     28 
    2329AM_INIT_AUTOMAKE 
    2430AC_PROG_CXX 
     
    2935AC_PROG_LIBTOOL 
    3036 
     37dnl ######################################################################### 
    3138dnl Check platform endianness 
     39dnl ######################################################################### 
     40 
    3241AC_C_BIGENDIAN 
    3342 
     43dnl ######################################################################### 
    3444dnl Checks for header files. 
     45dnl ######################################################################### 
     46 
    3547AC_CHECK_HEADERS([string.h],, [AC_MSG_ERROR([cannot find string.h, bailing out])]) 
    3648AC_CHECK_HEADERS([stdio.h],, [AC_MSG_ERROR([cannot find stdio.h, bailing out])]) 
    3749AC_CHECK_HEADERS([stdlib.h],, [AC_MSG_ERROR([cannot find stdlib.h, bailing out])]) 
    3850 
    39 LIBS="$LIBS" 
    40  
    41 AC_ARG_ENABLE([debug], [  --enable-debug=[no/yes] turn on debugging [default=$debug_default]],, enable_debug=$debug_default) 
     51 
     52LIBS="${LIBS}" 
     53 
     54 
     55dnl ######################################################################### 
     56dnl Build mode configuration (debug/optimized) 
     57dnl ######################################################################### 
     58 
     59AC_ARG_ENABLE([debug], 
     60    AC_HELP_STRING([--enable-debug=ARG], [Enable debug compilation mode [yes or no, default=${debug_default}]]),,) 
    4261 
    4362if test "x$enable_debug" = "xyes"; then 
     
    5170fi 
    5271 
     72dnl ######################################################################### 
     73dnl Definiion of custom Autoconf macros 
     74dnl ######################################################################### 
     75 
    5376AC_DEFUN([LOC_MSG],[ 
    5477echo "$1" 
     
    5780AC_DEFUN([AC_HAVE_LONG_LONG], 
    5881[ 
    59   AC_MSG_CHECKING([for 64bit integer type]) 
    60  
    61   echo 'int main() { long long off=0; }' >> conftest.c 
    62   if test -z "`${CC} -o conftest conftest.c 2>&1`" ; then 
    63     AC_DEFINE(HAVE_LONG_LONG, 1, [Define to 1, if your compiler supports long long data type]) 
    64     AC_MSG_RESULT([long long]) 
    65   else 
    66     AC_MSG_RESULT([no]) 
    67   fi 
    68   rm -f conftest* 
     82    AC_MSG_CHECKING([for 64bit integer type]) 
     83 
     84    echo 'int main() { long long off=0; }' >> conftest.c 
     85    if test -z "`${CC} -o conftest conftest.c 2>&1`" ; then 
     86        AC_DEFINE(HAVE_LONG_LONG, 1, [Define to 1, if your compiler supports long long data type]) 
     87        AC_MSG_RESULT([long long]) 
     88    else 
     89        AC_MSG_RESULT([no]) 
     90    fi 
     91    rm -f conftest* 
    6992]) 
    7093 
    71 dnl ########################################################### 
    72 dnl GDAL 
    73 dnl ########################################################### 
     94dnl ######################################################################### 
     95dnl Determine GDAL Support 
     96dnl ######################################################################### 
     97 
    7498AC_ARG_WITH([gdal], 
    7599    AC_HELP_STRING([--with-gdal=ARG], [Path to gdal-config]),,) 
     
    79103GDAL_CONFIG="no" 
    80104if test "$with_gdal" = "no" -o "$with_gdal" = "" ; then 
    81   AC_MSG_RESULT([no]) 
     105    AC_MSG_RESULT([no]) 
    82106else 
    83   if test "`basename xx/$with_gdal`" = "gdal-config" ; then 
    84     AC_MSG_RESULT([GDAL enabled with provided gdal-config]) 
    85     GDAL_CONFIG="$with_gdal" 
    86   else 
    87     AC_MSG_ERROR([--with-gdal should have yes or a path to gdal-config]) 
    88   fi 
    89 fi 
     107 
     108    dnl Check if full path to gdal-config provided 
     109    if test "`basename xx/$with_gdal`" = "gdal-config" ; then 
     110        AC_MSG_RESULT([GDAL enabled with provided gdal-config]) 
     111        GDAL_CONFIG="$with_gdal" 
     112    else 
     113        dnl --with-gdal=yes given, so try to find gdal-config in PATH 
     114        GDAL_CONFIG_TMP=`which gdal-config` 
     115        if test "`basename xx/${GDAL_CONFIG_TMP}`" = "gdal-config" ; then 
     116            AC_MSG_RESULT([GDAL enabled with gdal-config found in PATH]) 
     117            GDAL_CONFIG=${GDAL_CONFIG_TMP} 
     118        else 
     119            AC_MSG_ERROR([--with-gdal should have yes or a path to gdal-config]) 
     120        fi 
     121    fi 
     122fi 
     123 
    90124if test "$GDAL_CONFIG" != "no" ; then 
    91   VERSION=`$GDAL_CONFIG --version` 
    92   AC_MSG_RESULT([$GDAL_CONFIG reports version $VERSION]) 
    93   LIBS="`$GDAL_CONFIG --libs` $LIBS" 
    94   GDAL_INC=`$GDAL_CONFIG --cflags` 
    95   GDAL_PREFIX=`$GDAL_CONFIG --prefix` 
    96   OGR=`$GDAL_CONFIG --ogr-enabled` 
    97   if test "$OGR" != "yes" ; then 
    98         AC_MSG_ERROR([$GDAL_CONFIG says OGR is not enabled]) 
    99   fi 
    100    
    101   HAVE_GDAL="yes" 
    102 fi 
     125    VERSION=`$GDAL_CONFIG --version` 
     126    AC_MSG_RESULT([$GDAL_CONFIG reports version $VERSION]) 
     127    LIBS="`$GDAL_CONFIG --libs` $LIBS" 
     128    GDAL_INC=`$GDAL_CONFIG --cflags` 
     129    GDAL_PREFIX=`$GDAL_CONFIG --prefix` 
     130    OGR=`$GDAL_CONFIG --ogr-enabled` 
     131    if test "$OGR" != "yes" ; then 
     132        AC_MSG_ERROR([$GDAL_CONFIG says OGR is not enabled]) 
     133    fi 
     134    HAVE_GDAL="yes" 
     135fi 
     136 
    103137AC_SUBST([GDAL_INC]) 
    104138AC_SUBST([GDAL_PREFIX]) 
    105139AM_CONDITIONAL([GDAL_IS_CONFIG], [test ! x$GDAL_CONFIG = xno]) 
    106140 
    107 dnl --------------------------------------------------------------------------- 
    108 dnl Select a libgeotiff library to use. 
    109 dnl --------------------------------------------------------------------------- 
    110  
    111 AC_ARG_WITH(geotiff,[  --with-geotiff=ARG    Libgeotiff library to use (yes or path)],,) 
     141dnl ######################################################################### 
     142dnl Determine GeoTIFF Support 
     143dnl ######################################################################### 
     144 
     145AC_ARG_WITH([geotiff], 
     146    AC_HELP_STRING([--with-geotiff=ARG], [libgeotiff library to use (yes or path)]),,) 
    112147AC_MSG_CHECKING([for libgeotiff]) 
    113148 
    114149HAVE_GEOTIFF="no" 
    115150GEOTIFF_CONFIG="no" 
     151 
    116152if test "$with_geotiff" = "no" -o "$with_geotiff" = "" ; then 
    117  
    118   AC_MSG_RESULT([no]) 
    119  
     153    AC_MSG_RESULT([no]) 
    120154else 
    121155 
    122   GEOTIFF_CONFIG=external 
    123   dnl We now require libgeotiff 1.2.1 (for XTIFFClientOpen).  
    124   dnl first check if $with_geotiff/lib has the library: 
    125   AC_CHECK_LIB([geotiff], [XTIFFClientOpen], 
    126                [GEOTIFF_CONFIG=external], 
    127                [GEOTIFF_CONFIG=no], 
    128                [-L$with_geotiff/lib]) 
    129 fi 
    130  
    131 if test "$GEOTIFF_CONFIG" != "no" ; then 
    132  
    133   if test $GEOTIFF_CONFIG = "external" ; then 
    134     LIBS="-L$with_geotiff/lib -lgeotiff $LIBS" 
    135     if test  -d $with_geotiff/include ; then 
    136       GEOTIFF_INC="-I$with_geotiff/include" 
    137       AC_MSG_RESULT([using libgeotiff from $with_geotiff/include])  
    138     fi 
    139   fi 
    140  
    141   HAVE_GEOTIFF="yes" 
    142  
    143 fi 
    144  
    145 AC_SUBST(GEOTIFF_INC GEOTIFF_PREFIX) 
     156    GEOTIFF_CONFIG=external 
     157 
     158    dnl We now require libgeotiff 1.2.1 (for XTIFFClientOpen).  
     159    dnl first check if $with_geotiff/lib has the library: 
     160    AC_CHECK_LIB([geotiff], [XTIFFClientOpen], 
     161                 [GEOTIFF_CONFIG=external], [GEOTIFF_CONFIG=no], 
     162                 [-L$with_geotiff/lib]) 
     163fi 
     164 
     165if test "${GEOTIFF_CONFIG}" != "no" ; then 
     166 
     167    if test "${GEOTIFF_CONFIG}" = "external" ; then 
     168        LIBS="-L$with_geotiff/lib -lgeotiff $LIBS" 
     169        if test -d ${with_geotiff}/include ; then 
     170            dnl Second path is for Debian using $prefix/include/geotiff/geotiff.h 
     171            GEOTIFF_INC="-I$with_geotiff/include -I$with_geotiff/include/geotiff" 
     172            AC_MSG_RESULT([using libgeotiff from $with_geotiff/include])  
     173        fi 
     174    fi 
     175    HAVE_GEOTIFF="yes" 
     176fi 
     177 
     178AC_SUBST([GEOTIFF_INC]) 
     179AC_SUBST([GEOTIFF_PREFIX]) 
    146180AM_CONDITIONAL([GEOTIFF_IS_CONFIG], [test ! x$GEOTIFF_CONFIG = xno]) 
    147181 
     182dnl ######################################################################### 
     183dnl Determine other features of compiler 
     184dnl ######################################################################### 
     185 
    148186AC_HAVE_LONG_LONG 
    149187 
     188dnl ######################################################################### 
    150189dnl Checks for library functions. 
     190dnl ######################################################################### 
     191 
    151192AC_CHECK_FUNCS([gettimeofday bzero memset memcpy bcopy]) 
     193 
     194dnl ######################################################################### 
     195dnl Generate makefiles 
     196dnl ######################################################################### 
    152197 
    153198AC_CONFIG_FILES([ 
     
    163208AC_OUTPUT 
    164209 
    165 dnl ------------------------------------------------------------------- 
     210dnl ######################################################################### 
    166211dnl Print configuration summary 
    167 dnl ------------------------------------------------------------------- 
     212dnl ######################################################################### 
     213 
    168214LOC_MSG() 
    169215LOC_MSG([libLAS configuration summary:]) 
     
    193239LOC_MSG([  libLAS - http://liblas.org]) 
    194240LOC_MSG() 
     241 
     242dnl EOF 
  • trunk/src/Makefile.am

    r760 r823  
    22SUBDIRS = detail . 
    33 
    4 INCLUDES = -I../include -I../include/detail 
    5  
    64if GEOTIFF_IS_CONFIG 
    7 AM_CPPFLAGS=@GEOTIFF_INC@ -DHAVE_LIBGEOTIFF=1 
     5GEOTIFF_CPPFLAGS = @GEOTIFF_INC@ -DHAVE_LIBGEOTIFF=1 
    86endif 
    97 
     8AM_CPPFLAGS = $(GEOTIFF_CPPFLAGS) -I../include -I../include/detail 
    109 
    1110lib_LTLIBRARIES = liblas.la