diff options
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 301 |
1 files changed, 301 insertions, 0 deletions
diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..c06eb0a --- /dev/null +++ b/configure.in @@ -0,0 +1,301 @@ +dnl Process this file with autoconf to produce a configure script. -*-sh-*- +AC_INIT(include/sane/config.h.in) +AC_CONFIG_HEADER(include/sane/config.h) +# AC_PREREQ(2.10)dnl dnl Minimum Autoconf version required. +# AC_ARG_PROGRAM + +# version code: +V_MAJOR=0 +V_MINOR=50 + +PACKAGE=xsane + +BINPROGS="xsane" + +# languages +ALL_LINGUAS="de fr cs" + +SANE_V_MAJOR=1 +VERSION=${V_MAJOR}.${V_MINOR} +PACKAGE_VERSION="$PACKAGE-$VERSION" +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") +AC_DEFINE_UNQUOTED(VERSION, "$VERSION") +AC_DEFINE_UNQUOTED(PACKAGE_VERSION, "$PACKAGE_VERSION") +AC_SUBST(PACKAGE) +AC_SUBST(VERSION) +AC_SUBST(PACKAGE_VERSION) +AC_SUBST(SANE_MAJOR) + +dnl Check args + +dnl Check for intl patch selection +AC_MSG_CHECKING([whether libintl patch is requested]) +dnl Default is disabled libintl patch +AC_ARG_ENABLE(intl-patch, [ --enable-intl-patch add -lintl to check for sane], ADD_LIBINTL=$enableval, ADD_LIBINTL=no) +AC_MSG_RESULT($ADD_LIBINTL) + +dnl Check for gimp plugin support +AC_MSG_CHECKING([whether GIMP plugin is requested]) +dnl Default is enabled GIMP plugin +AC_ARG_ENABLE(gimp, [ --disable-gimp do not include GIMP plugin mode], USE_GIMP=$enableval, USE_GIMP=yes) +AC_MSG_RESULT($USE_GIMP) + +dnl Check for jpeg support +AC_MSG_CHECKING([whether JPEG support is requested]) +dnl Default is enabled JPEG +AC_ARG_ENABLE(jpeg, [ --disable-jpeg do not include JPEG support], USE_JPEG=$enableval, USE_JPEG=yes) +AC_MSG_RESULT($USE_JPEG) + +dnl Check for png support +AC_MSG_CHECKING([whether PNG support is requested]) +dnl Default is enabled PNG +AC_ARG_ENABLE(png, [ --disable-png do not include PNG support], USE_PNG=$enableval, USE_PNG=yes) +AC_MSG_RESULT($USE_PNG) + +dnl Check for tiff support +AC_MSG_CHECKING([whether TIFF support is requested]) +dnl Default is enabled TIFF +AC_ARG_ENABLE(tiff, [ --disable-tiff do not include TIFF support], USE_TIFF=$enableval, USE_TIFF=yes) +AC_MSG_RESULT($USE_TIFF) + + +dnl Checks for programs. +AC_PROG_CC +AC_AIX +AC_MINIX +AC_ISC_POSIX +AM_PROG_CC_STDC +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AC_PROG_CPP +AC_PROG_GCC_TRADITIONAL + +INCLUDES="${INCLUDES} -I/usr/local/include" +CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE" +if test "${ac_cv_prog_gcc}" = "yes"; then + CFLAGS="${CFLAGS} -Wall" +fi + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(fcntl.h unistd.h libc.h sys/dsreq.h sys/select.h \ + sys/time.h sys/scanio.h sys/socket.h sys/io.h asm/io.h gscdds.h sys/hw.h \ + bsd/dev/scsireg.h io/cam/cam.h camlib.h sys/types.h zlib.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_INLINE +AC_TYPE_SIGNAL +AC_TYPE_SIZE_T +AC_TYPE_PID_T +AC_CHECK_TYPE(ssize_t, long) +AC_CHECK_TYPE(u_char, unsigned char) +AC_CHECK_TYPE(u_int, unsigned int) +AC_CHECK_TYPE(u_long, unsigned long) + +dnl The following libs have to be included because they are forgotten in the sane libs +AC_CHECK_LIB(scsi, scsireq_enter) # FreeBSD needs this +AC_CHECK_LIB(cam, cam_open_device) # FreeBSD 3+ needs this +dnl AC_CHECK_LIB(intl,gettext) + +dnl Checks for libraries. +AC_CHECK_LIB(m, sqrt) +AC_CHECK_LIB(z, deflateInit_) + +if test "${USE_JPEG}" = "yes"; then + AC_CHECK_LIB(jpeg, jpeg_start_decompress) +fi + +# tiff test must stand after test for zlib +if test "${USE_TIFF}" = "yes"; then + AC_CHECK_LIB(tiff, TIFFOpen) +fi + +dnl Checks for library functions. +AM_FUNC_ALLOCA +AC_FUNC_MMAP +AC_CHECK_FUNCS(atexit mkdir sigprocmask strdup strndup strftime strstr strsep strtod snprintf usleep strcasecmp strncasecmp) + +dnl standard dll handling +AC_CHECK_HEADERS(dlfcn.h, [AC_CHECK_LIB(dl,dlopen) AC_CHECK_FUNCS(dlopen, enable_dynamic=yes,)],) + +dnl HP/UX DLL handling +AC_CHECK_HEADERS(dl.h, [AC_CHECK_LIB(dld,shl_load) AC_CHECK_FUNCS(shl_load, enable_dynamic=yes,)],) + +dnl Check for NLS/gettext +AM_GNU_GETTEXT +AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl) + +if test "$USE_NLS" = yes; then + if test "$USE_INCLUDED_LIBINTL" = yes; then + CPPFLAGS="$CPPFLAGS -I\$(top_builddir)/intl" + INTLSUB=intl + fi +fi + +AC_SUBST(INTLSUB) + +#### Choose a window system. + +AC_PATH_X +if test "$no_x" = yes; then + window_system=none +else + window_system=x11 +fi + +AM_PATH_GTK(1.2.0, HAVE_GTK=yes, ) + +# Change CFLAGS temporarily so that C_SWITCH_X_SITE gets used +# for the tests that follow. We set it back to REAL_CFLAGS later on. + +# According to Owen Taylor, GTK_CFLAGS is _guaranteed_ to contain +# -D and -I flags only, i.e., it really is GTK_CPPFLAGS... +saved_CPPFLAGS="${CPPFLAGS}" +saved_LIBS="${LIBS}" +CPPFLAGS="${CPPFLAGS} ${GTK_CFLAGS}" +LIBS="${LIBS} ${GTK_LIBS}" + +if test "${USE_GIMP}" = "yes"; then + AC_CHECK_HEADERS(libgimp/gimp.h, GIMP_LIBS="-lgimp") + AC_CHECK_HEADERS(libgimp/gimpfeatures.h) +fi + +LIBS="${saved_LIBS}" +CPPFLAGS="${saved_CPPFLAGS}" + + +# png test must stand after test for zlib +# png test must stand behind X11-check because it is located in +# the X11 directory on some systems +# so we have to use x_includes and x_libraries to test for png +# and all following checks (=sane) +# saved_CPPFLAGS is still up to date +CPPFLAGS="${CPPFLAGS} -I${x_includes}" +if test "${USE_PNG}" = "yes"; then + AC_CHECK_HEADERS(png.h, [AC_CHECK_LIB(png, png_create_info_struct,,, -L${x_libraries})]) + if test "${ac_cv_lib_png_png_create_info_struct}" = "yes"; then +# remove libpng because if we do not remove it all following +# checks could need x_libraries and x_includes + LIBS=`echo $LIBS | sed -e 's/-lpng//'` + PNG_LIB="-lpng" + fi +fi +CPPFLAGS="${saved_CPPFLAGS}" + +# check for sane must stand after check for dl +# check must stand at end of list because of the missing libintl in libsane.so +# check needs x_libraries and x_includes because they may be needed by png +dnl Check for sane lib +if test "${ADD_LIBINTL}" = "no"; then + AC_CHECK_HEADERS(sane/sane.h, AC_CHECK_LIB(sane,sane_init)) +else + AC_CHECK_HEADERS(sane/sane.h, AC_CHECK_LIB(sane,sane_init,,, -lintl)) +fi + + +# this should be after all checks +# add libpng again +LIBS="${PNG_LIB} ${LIBS}" + +AC_SUBST(INCLUDES) +AC_SUBST(BINPROGS) +AC_SUBST(GTK_CFLAGS) +AC_SUBST(GTK_LIBS) +AC_SUBST(GIMP_LIBS) +CPPFLAGS="${CPPFLAGS} \ + -DPATH_SANE_DATA_DIR=\$(sanedatadir) \ + -DV_MAJOR=${V_MAJOR} -DV_MINOR=${V_MINOR} -DSANE_V_MAJOR=${SANE_V_MAJOR}" + +dnl Print error message if sane or gtk is missing +if test "${ac_cv_lib_sane_sane_init}" != "yes"; then + echo "****************************************************************" + echo "ERROR: SANE is needed for compiling xsane" + echo " - if you installed SANE as rpm make sure you also included" + echo " sane-devel" + echo " - if SANE is installed, try ./configure -enable-intl-patch" + echo "****************************************************************" + rm -f $cache_file + exit -1 +fi + +if test "${HAVE_GTK}" = "no"; then + echo "****************************************************************" + echo "ERROR: GTK-1.2.0 or newer is needed for compiling xsane" + echo " if you installed gtk as rpm make sure you also included" + echo " gtk-devel" + echo "****************************************************************" + rm -f $cache_file + exit -1 +fi + + +AC_SUBST(V_MAJOR) +AC_SUBST(V_MINOR) +AC_SUBST(DLL_PRELOAD) + +AC_ARG_ENABLE(foo1, [ +Used environment variables that can be set by user: + CFLAGS, CPPFLAGS, LDFLAGS, LIBS]) + +AC_ARG_ENABLE(foo2, [ +To add include or library paths call: + [env] CPPFLAGS=\"-I/path/to/foo/include\" LDFLAGS=\"-L/path/to/foo/libs\" ./configure]) + +AC_OUTPUT([Makefile intl/Makefile po/Makefile lib/Makefile + frontend/Makefile include/Makefile doc/Makefile],) + +echo "****************************************************************" +echo "* *" +echo "* XSANE configure status: *" +echo "* ----------------------- *" + +if test "${USE_NLS}" = "yes"; then + if test "$USE_INCLUDED_LIBINTL" = yes; then + echo "* - NLS activated (package internal) *" + else + echo "* - NLS activated (external) *" + fi +else + echo "* - NLS deactivated *" +fi + +if test "${GIMP_LIBS}set" != "set"; then + echo "* - GIMP plugin activated *" +else + echo "* - GIMP plugin deactivated *" +fi + +if test "${ac_cv_lib_jpeg_jpeg_start_decompress}" = "yes"; then + echo "* - JPEG support activated *" +else + echo "* - JPEG support deactivated *" +fi + +if test "${ac_cv_lib_tiff_TIFFOpen}" = "yes"; then + echo "* - TIFF support activated *" +else + echo "* - TIFF support deactivated *" +fi + +if test "${ac_cv_lib_png_png_create_info_struct}" = "yes"; then + echo "* - PNG support activated *" +else + echo "* - PNG support deactivated *" +fi + +echo "* *" +echo "****************************************************************" +echo "* *" +echo "* To compile XSANE: *" +echo "* ----------------- *" +echo "* enter as normal user: *" +echo "* make *" +echo "* and as root: *" +echo "* make install *" +echo "* *" +echo "* ------------------------------------------------------------ *" +echo "* ... PLEASE READ SANE DOCUMENTATION BEFORE STARTING XSANE ... *" +echo "* ------------------------------------------------------------ *" +echo "****************************************************************" +cat xsane.NEWS |