1dnl ================================================================== 2dnl FILE: "/home/y1zln/pub/zimg/configure.in" 3dnl LAST MODIFIED: "Fr, 26 Aug 2005 13:50:48 CEST (y1zln)" 4dnl (C) 1999 - 2003 by Johannes Zellner <johannes@zellner.org> 5dnl $Id: configure.in,v 1.106 2005/08/27 12:46:20 joze Exp $ 6dnl --- 7dnl Copyright (c) 1999 - 2003, Johannes Zellner <johannes@zellner.org> 8dnl All rights reserved. 9dnl 10dnl Redistribution and use in source and binary forms, with or without 11dnl modification, are permitted provided that the following conditions 12dnl are met: 13dnl 14dnl * Redistributions of source code must retain the above copyright 15dnl notice, this list of conditions and the following disclaimer. 16dnl * Redistributions in binary form must reproduce the above copyright 17dnl notice, this list of conditions and the following disclaimer in the 18dnl documentation and/or other materials provided with the distribution. 19dnl * Neither the name of Johannes Zellner nor the names of contributors 20dnl to this software may be used to endorse or promote products derived 21dnl from this software without specific prior written permission. 22dnl 23dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24dnl ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26dnl A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR 27dnl CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28dnl EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29dnl PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30dnl PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31dnl LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32dnl NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33dnl SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34dnl ================================================================== 35 36dnl Process this file with autoconf to produce a configure script. 37 38AC_INIT(zimg.h) 39AM_CONFIG_HEADER(config.h) 40AC_PREREQ(1.12) 41AC_REVISION($Revision: 1.106 $) 42AC_CONFIG_AUX_DIR(.) 43 44VERSION=`head -1 VERSION` 45AC_SUBST(VERSION) 46 47AM_INIT_AUTOMAKE(zimg, $VERSION) 48 49AC_PROG_MAKE_SET 50 51dnl Report system info 52dnl ------------------ 53uname -mrsv 2>/dev/null 54 55 56dnl Checks for programs 57dnl ------------------- 58 59AC_PROG_CC 60dnl AM_C_PROTOTYPES 61AC_PROG_LN_S 62AC_CHECK_PROG(STRIP, strip, strip, :) 63 64LIBS="-lm" 65AC_C_BIGENDIAN 66 67dnl libtool 68AC_LIBTOOL_DLOPEN 69AM_PROG_LIBTOOL 70AC_SUBST(LIBTOOL_DEPS) 71 72if ${CONFIG_SHELL} ./libtool --features | grep "enable static" >/dev/null; then 73 STATIC=-static 74else 75 STATIC= 76fi 77AC_SUBST(STATIC) 78 79 80dnl Process configuration options 81dnl -------------------------------- 82 83dnl TODO use $shlibpath_var as set by autoconf 84[paths=`echo $LD_LIBRARY_PATH | sed 's/lib[/]\{0,1\}:/ /g;s/://g'`] 85paths="${paths} /usr/local /usr" 86 87AC_MSG_CHECKING(--with-gd-includes argument) 88AC_ARG_WITH( 89 [gd-includes], 90 [ --with-gd-includes=path where to look for the gd header files.], 91 [path_gd_includes="${withval}"], 92 [ 93 dnl action if not given 94 dnl search 95 for dir in $paths; do 96 if test -r "${dir}/include/gd.h"; then 97 path_gd_includes="${dir}/include/" 98 break 99 fi 100 done 101 ] 102) 103if test "x" = "x${path_gd_includes}"; then 104 AC_MSG_RESULT(gd headers not found) 105 exit 1 106fi 107AC_MSG_RESULT(${path_gd_includes}) 108if test "x/usr/include/" = "x${path_gd_includes}"; then 109 gd_includes="" 110else 111 gd_includes="-I${path_gd_includes}" 112fi 113AC_SUBST(gd_includes) 114 115save_cpp_flags=${CPPFLAGS} 116CPPFLAGS=${gd_includes} 117AC_CHECK_HEADERS(gd.h gdfontt.h gdfonts.h gdfontmb.h gdfontl.h gdfontg.h) 118CPPFLAGS=${save_cpp_flags} 119 120gd_lib="-lgd" 121AC_ARG_WITH( 122 [gd-lib], 123 [ --with-gd-lib=path where to look for libgd.], 124 [gd_lib="-L${withval} -lgd"], 125 [ 126 dnl search 127 dnl TODO use LD_LIBRARY_PATH 128 olibs="${LIBS}" 129 for dir in $paths; do 130 if test "x" = "x${dir}"; then 131 gdlibspec="" 132 else 133 gdlibspec="-L${dir}/lib" 134 fi 135 AC_MSG_CHECKING([for libgd in ${gdlibspec}]) 136 LIBS="${olibs} ${gdlibspec} -lgd -lm" 137 AC_TRY_LINK( 138 [ 139 ], 140 [ 141 extern void gdImageCreate(); 142 gdImageCreate(); 143 ], 144 [ 145 dnl action if found 146 AC_MSG_RESULT([yes]) 147 gd_lib="${gdlibspec} -lgd" 148 break 149 ], 150 [ 151 dnl action if not found 152 AC_MSG_RESULT([no]) 153 ] 154 ) 155 done 156 LIBS="${olibs}" 157 ] 158) 159AC_SUBST(gd_lib) 160 161 162dnl check, if libgd can write gif 163dnl 164olibs=${LIBS} 165LIBS="${gd_lib} -lm" 166 167AC_MSG_CHECKING([for gdImageGif in -lgd]) 168AC_TRY_LINK(,[ 169 extern void gdImageGif(); 170 gdImageGif(); 171 ], 172 [dnl yes 173 AC_MSG_RESULT(yes); 174 AC_DEFINE(GD_HAS_GIF, 1, 175 [ Define if libgd can write gif ]) 176 ], 177 [dnl no, writes png 178 AC_MSG_RESULT(no.) 179 ] 180) 181 182dnl check, if libgd can write png 183dnl 184AC_MSG_CHECKING([for gdImagePng in -lgd]) 185AC_TRY_LINK(,[ 186 extern void gdImagePng(); 187 gdImagePng(); 188 ], 189 [dnl yes 190 AC_MSG_RESULT(yes); 191 AC_DEFINE(GD_HAS_PNG, 1, 192 [ Define if libgd can write png ]) 193 png_libs="-lpng -lz" 194 AC_MSG_CHECKING([for gdImageCreateFromPngSource in -lgd]) 195 LIBS="${LIBS} $png_libs -lm" 196 AC_TRY_LINK(,[ 197 extern void gdImageCreateFromPngSource(); 198 gdImageCreateFromPngSource(); 199 ], 200 [dnl yes 201 AC_MSG_RESULT(yes. PNG can be used as source); 202 AC_DEFINE(ENABLE_PNG_AS_SOURCE, 1, 203 [ Define if png can be used as source. ]) 204 ], 205 [dnl no 206 AC_MSG_RESULT(no. PNG can't be used as source) 207 ] 208 ) 209 ], 210 [dnl no, writes png 211 AC_MSG_RESULT(no.) 212 ] 213) 214 215LIBS=${olibs} 216AC_SUBST(png_libs) 217 218 219dnl JPEG stuff 220dnl default 221AC_MSG_CHECKING(--with-jpeg-lib argument) 222AC_ARG_WITH(jpeg-lib, 223 [ --with-jpeg-lib=path where to look for libjpeg.], 224 [ 225 dnl action if given 226 path_jpeg_lib="${withval}" 227 AC_MSG_RESULT(${path_jpeg_lib}) 228 jpeg_lib_spec="-L${path_jpeg_lib} -ljpeg" 229 ], 230 [ 231 dnl action if not given 232 AC_MSG_RESULT(-ljpeg) 233 jpeg_lib_spec="-ljpeg" 234 ] 235) 236 237dnl check if we want to have jpeg support 238AC_MSG_CHECKING(--disable-jpeg argument) 239AC_ARG_ENABLE(jpeg, 240 [ --disable-jpeg disable jpeg], 241 [ 242 AC_MSG_RESULT(jpeg disabled) 243 ], 244 [ 245 AC_MSG_RESULT(jpeg enabled) 246 dnl check, if libgd supports jpeg 247 dnl (this is true for libgd >= 1.8) 248 olibs=${LIBS} 249 LIBS="${gd_lib} ${png_libs} ${jpeg_lib_spec} -lm" 250 AC_MSG_CHECKING([for gdImageJpeg in -lgd]) 251 AC_TRY_LINK(,[ 252 extern void gdImageJpeg(); 253 gdImageJpeg(); 254 ], 255 [ 256 AC_MSG_RESULT(yes); 257 AC_DEFINE(GD_JPEG_VERSION, 1, 258 [ Define if libgd can write jpeg. ]) 259 jpeg_libs="${jpeg_lib_spec}" 260 ], 261 [ 262 AC_MSG_RESULT(no) 263 ] 264 ) 265 LIBS=${olibs} 266 AC_SUBST(jpeg_libs) 267 ] 268) 269 270 271AC_MSG_CHECKING(--disable-edf argument) 272AC_ARG_ENABLE(edf, 273 [ --disable-edf disable ESRF data format (edf)], 274 AC_MSG_RESULT(yes. edf will *not* be supported.), 275 AC_MSG_RESULT(no. edf support will be compiled in.); 276 AC_DEFINE(ENABLE_EDF, 1, [ Define if we want ESRF data format.]) 277) 278 279dnl Checks for header files 280dnl ----------------------- 281 282AC_CHECK_HEADERS(stdio.h stdlib.h string.h time.h math.h errno.h assert.h) 283AC_CHECK_HEADERS(unistd.h sys/types.h sys/times.h limits.h) 284 285 286dnl Checks for typedefs 287dnl ------------------- 288 289AC_TYPE_SIZE_T 290AC_TYPE_OFF_T 291 292dnl Checks for compiler characteristics 293dnl ----------------------------------- 294 295AC_C_CONST 296 297 298dnl Checks for library functions 299dnl ---------------------------- 300 301AC_REPLACE_FUNCS(strstr) 302 303 304AC_CHECK_FUNCS(strerror opendir) 305AC_CHECK_FUNCS(clock times, break) 306 307# check for log1p in -lm 308 309olibs=${LIBS} 310LIBS="-lm" 311AC_MSG_CHECKING([for log1p in -lm]) 312AC_TRY_LINK(,[ 313 double d = log1p((double) 1.0); 314], 315 AC_MSG_RESULT(yes); 316 AC_DEFINE(HAVE_LOG1P, 1, [ Define if log1p() is present. ]), 317 AC_MSG_RESULT(no)) 318LIBS=${olibs} 319 320# check for popen() 321AC_MSG_CHECKING([for popen()]) 322AC_TRY_LINK([ 323#include <stdio.h> 324],[ 325 FILE* fp = popen("", "r"); 326], 327 AC_MSG_RESULT(yes); 328 AC_DEFINE(HAVE_POPEN, 1, [ Define if we have popen(). ]), 329 AC_MSG_RESULT(no) 330) 331 332# check for access() 333AC_MSG_CHECKING([for access()]) 334AC_TRY_LINK([ 335#include <unistd.h> 336],[ 337 access("", R_OK); 338], 339 AC_MSG_RESULT(yes); 340 AC_DEFINE(HAVE_ACCESS, 1, [ Define if we have access(). ]), 341 AC_MSG_RESULT(no) 342) 343 344dnl [-- check for getopt_long --] 345build_getopt=yes 346AC_CHECK_HEADERS(getopt.h, 347 AC_MSG_CHECKING([for getopt_long]) 348 AC_TRY_LINK( 349#include <unistd.h> 350#include <getopt.h> 351 ,[ 352 getopt_long(0, 0, 0, 0, 0); 353 ], 354 [ 355 AC_MSG_RESULT(yes); 356 AC_DEFINE(HAVE_GETOPT_LONG, 1, [ Define if we have getopt_long ]) 357 build_getopt=no 358 ], 359 [ 360 AC_MSG_RESULT(no) 361 ] 362)) 363AM_CONDITIONAL(BUILD_GETOPT, test "x$build_getopt" = "xyes") 364 365dnl [-- check for dynamic loaders --] 366have_dynaload=no 367AC_CHECK_HEADER(dlfcn.h,[DLL=dlfcn.h],[AC_CHECK_HEADER(dl.h, DLL=dl.h)]) 368if test x${DLL} = xdlfcn.h; then 369 AC_DEFINE(HAVE_DLFCN_H, 1, [ Define if we have dlfcn.h. ]) 370 AC_MSG_CHECKING([for dlsym()]) 371 have_dlsym=no 372 for lib in "" "-ldl"; do 373 olibs=$LIBS 374 LIBS="$LIBS $lib" 375 AC_TRY_LINK(, 376 [ 377 extern void* dlsym(); 378 dlsym(); 379 ], 380 [ 381 382 dnl [-- yes --] 383 have_dlsym=yes 384 break 385 ], 386 [ 387 dnl restore LIBS 388 LIBS=$olibs 389 ] 390 ) 391 done 392 if test "xno" = "x$have_dlsym"; then 393 AC_MSG_RESULT(no) 394 else 395 AC_DEFINE(HAVE_DLSYM, 1, [ Define if we have dlsym() ]) 396 AC_MSG_RESULT(yes) 397 have_dynaload=yes 398 fi 399elif test x${DLL} = xdl.h; then 400 AC_DEFINE(HAVE_DL_H, 1, [ Define if we have dl.h. ]) 401 AC_MSG_CHECKING([for shl_load()]) 402 have_shl_load=no 403 for lib in "" "-ldld"; do 404 olibs=$LIBS 405 LIBS="$LIBS $lib" 406 AC_TRY_LINK(, 407 [ 408 extern void* shl_load(); 409 shl_load(); 410 ], 411 [ 412 dnl [-- yes --] 413 have_shl_load=yes 414 break 415 ], 416 [ 417 dnl restore LIBS 418 LIBS=$olibs 419 ] 420 ) 421 done 422 if test "xno" = "x$have_shl_load"; then 423 AC_MSG_RESULT(no) 424 else 425 AC_DEFINE(HAVE_SHL_LOAD, 1, [ Define if we have shl_load() ]) 426 AC_MSG_RESULT(yes) 427 have_dynaload=yes 428 fi 429fi 430 431if test "xyes" = "x$have_dynaload"; then 432 433 dnl [-- dynaload CC --] 434 AC_MSG_CHECKING(--with-dynaload-cc) 435 AC_ARG_WITH(dynaload-cc, 436 [ --with-dynaload-cc=prog c compiler for compiling dynaloadable objects.], 437 [ 438 dnl action if given 439 DYNALOAD_CC="${withval}" 440 ], 441 [ 442 dnl action if not given 443 DYNALOAD_CC="$CC" 444 ] 445 ) 446 AC_MSG_RESULT(${DYNALOAD_CC}) 447 448 dnl [-- dynaload CFLAGS --] 449 AC_MSG_CHECKING(--with-dynaload-cflags) 450 AC_ARG_WITH(dynaload-cflags, 451 [ --with-dynaload-cflags=flags CFLAGS for compiling dynaloadable objects.], 452 [ 453 dnl action if given 454 DYNALOAD_CFLAGS="${withval}" 455 ], 456 [ 457 dnl action if not given 458 DYNALOAD_GNU=`${DYNALOAD_CC} --help 2>/dev/null | grep -i '\(gcc\|gnu\)'` 459 if test -n "${DYNALOAD_GNU}"; then 460 DYNALOAD_CFLAGS="-O3 -shared -o" 461 else 462 DYNALOAD_CFLAGS="-O -o" 463 fi 464 ] 465 ) 466 AC_MSG_RESULT(${DYNALOAD_CFLAGS}) 467 468fi 469 470AC_MSG_CHECKING(--with-x-viewer) 471AC_ARG_WITH(x-viewer, 472 [ --with-x-viewer=prog use <prog> instead of [xv -].], 473 [ 474 dnl action if given 475 X_VIEWER="${withval}" 476 ], 477 [ 478 dnl action if not given 479 X_VIEWER="xv -" 480 ] 481) 482AC_MSG_RESULT(${X_VIEWER}) 483 484AC_CHECK_HEADERS(regex.h) 485dnl TODO: check for libgen ? 486 487dnl Output files 488dnl ------------ 489 490if test "xNONE" = "x${prefix}"; then 491 prefix="${ac_default_prefix}" 492fi 493if test "xNONE" = "x${exec_prefix}"; then 494 exec_prefix="${prefix}" 495fi 496 497INCLUDEDIR=`eval echo ${includedir}` 498PKGLIBDIR=`eval echo ${libdir}/${PACKAGE}` 499PKGDATADIR=`eval echo ${datadir}/${PACKAGE}` 500SYSCONFDIR=`eval echo ${sysconfdir}` 501 502if `gdlib-config --features 2>/dev/null | grep -q GD_FREETYPE`; then 503 AC_DEFINE_UNQUOTED(HAVE_GD_FREETYPE, "yes", [libgd is built with freetype support]) 504fi 505 506AC_SUBST(PACKAGE) 507AC_SUBST(VERSION) 508AC_SUBST(DYNALOAD_CFLAGS) 509AC_SUBST(PKGLIBDIR) 510AC_SUBST(PKGDATADIR) 511AC_SUBST(SYSCONFDIR) 512AC_DEFINE_UNQUOTED(DYNALOAD_CC, "$DYNALOAD_CC", [compiler for creating run-time objects]) 513AC_DEFINE_UNQUOTED(DYNALOAD_CFLAGS, "$DYNALOAD_CFLAGS", [cflags for run-time objects]) 514AC_DEFINE_UNQUOTED(PREFIX, "$prefix", [prefix]) 515AC_DEFINE_UNQUOTED(INCLUDEDIR, "$INCLUDEDIR", [where to search for the zimg.h header]) 516AC_DEFINE_UNQUOTED(PKGLIBDIR, "$PKGLIBDIR", [where to search for shared objects etc]) 517AC_DEFINE_UNQUOTED(PKGDATADIR, "$PKGDATADIR", [where to search for colormaps etc]) 518AC_DEFINE_UNQUOTED(SYSCONFDIR, "$SYSCONFDIR", [where to look for the systemwide zimgrc]) 519AC_DEFINE_UNQUOTED(X_VIEWER, "$X_VIEWER", [program to view stdout which would go to a terminal]) 520AC_OUTPUT(Makefile getopt/Makefile zimg.1) 521 522