--- src/configure.ac.orig 2003-04-16 22:59:56.000000000 +0900 +++ src/configure.ac 2015-08-22 02:03:41.246954000 +0900 @@ -8,6 +8,46 @@ AC_PREREQ(2.52) AC_CONFIG_SRCDIR(src/gs.c) +CFLAGS="${CFLAGS:=}" +CPPFLAGS="${CPPFLAGS:=}" +CXXFLAGS="${CXXFLAGS:=}" +LDFLAGS="${LDFLAGS:=}" + +dnl -------------------------------------------------- +dnl Local utilities +dnl -------------------------------------------------- + +dnl GS_SPLIT_LIBS( LIBS, LINKLINE ) +dnl Split a unix-style link line into a list of +dnl bare library names. For example, the line +dnl '-L/usr/X11R6/lib -lX11 -lXt' splits into +dnl LIB='X11 Xt' +dnl +AC_DEFUN([GS_SPLIT_LIBS], [ +# the makefile wants a list of just the library names +for gs_item in $2; do + gs_stripped_item=`echo "$gs_item" | sed -e 's/^-l//'` + if test "x$gs_stripped_item" != "x$gs_item"; then + $1="$[$1] $gs_stripped_item" + fi +done +]) + +dnl GS_SPLIT_LIBPATHS( LIBPATHS, LINKLINE ) +dnl Split a unix-style link line into a list of +dnl bare search path entries. For example, +dnl '-L/usr/X11R6/lib -lX11 -L/opt/lib -lXt' +dnl splits to LIBPATHS='/usr/X11R6/lib /opt/lib' +dnl +AC_DEFUN([GS_SPLIT_LIBPATHS], [ +for gs_item in $2; do + gs_stripped_item=`echo "$gs_item" | sed -e 's/-L//'` + if test "x$gs_stripped_item" != "x$gs_item"; then + $1="$[$1] $gs_stripped_item" + fi +done +]) + dnl -------------------------------------------------- dnl Check for programs dnl -------------------------------------------------- @@ -94,7 +134,14 @@ dnl -------------------------------------------------- AC_CHECK_LIB(m, cos) -dnl AC_CHECK_LIB(pthread, pthread_create) +SYNC="nosync" +PTHREAD_LIBS="" +AC_CHECK_LIB(pthread, pthread_create, [ + SYNC=posync; + PTHREAD_LIBS="-lpthread" +]) +AC_SUBST(SYNC) +AC_SUBST(PTHREAD_LIBS) AC_MSG_CHECKING([for local jpeg library source]) dnl At present, we give the local source priority over the shared @@ -211,15 +258,68 @@ AC_SUBST(STPLIB) AC_SUBST(STPDEVS) +SOC_CFLAGS="" +SOC_LIBS="" +SOC_LOADER="dxmainc.c" + +AC_SUBST(SOC_CFLAGS) +AC_SUBST(SOC_LIBS) +AC_SUBST(SOC_LOADER) + dnl optional X11 for display devices AC_PATH_XTRA -if test x"$no_x" = x"yes"; then - AC_MSG_NOTICE([disabling X11 output devices]) - X11DEVS='' -else - X11DEVS='$(DD)x11.dev $(DD)x11alpha.dev $(DD)x11cmyk.dev $(DD)x11gray2.dev $(DD)x11gray4.dev $(DD)x11mono.dev' + +X_LDFLAGS="" +X_CFLAGS="" +X_DEVS="" +X_LIBS="" + +if test x$with_x != xno; then + if test "$x_libraries" = "/usr/lib"; then + echo "Ignoring X library directory \"$x_libraries\" requested by configure." + x_libraries="NONE" + fi + if test ! "$x_libraries" = "NONE" -a ! "$x_libraries" = ""; then + X_LDFLAGS="-L$x_libraries" + if test "$uname" = "SunOS"; then + X_LDFLAGS="$X_LDFLAGS -R$x_libraries" + fi + fi + + if test "$x_includes" = "/usr/include"; then + echo "Ignoring X include directory \"$x_includes\" requested by configure." + x_includes="NONE" + fi + if test ! "$x_includes" = "NONE" -a ! "$x_includes" = ""; then + X_CFLAGS="-I$x_includes" + fi + + SAVELIBS="$LIBS" + SAVELDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $X_LDFLAGS" + + AC_CHECK_LIB(X11,XOpenDisplay) + AC_CHECK_LIB(Xext,XdbeQueryExtension) + AC_CHECK_LIB(Xt,XtAppCreateShell) + + LDFLAGS="$SAVELDFLAGS" + LIBS="$SAVELIBS" + + if test "$ac_cv_lib_Xt_XtAppCreateShell" = yes; then + X11DEVS="\$(DD)x11.dev \$(DD)x11alpha.dev \$(DD)x11cmyk.dev \$(DD)x11mono.dev \$(DD)x11_.dev \$(DD)x11alt_.dev \$(DD)x11cmyk2.dev \$(DD)x11cmyk4.dev \$(DD)x11cmyk8.dev \$(DD)x11rg16x.dev \$(DD)x11rg32x.dev \$(DD)x11gray2.dev \$(DD)x11gray4.dev" + X_DEVS=$X11DEVS + # the makefile wants a list of just the library names in X_LIBS + GS_SPLIT_LIBS([X_LIBS], + [-lXt $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS]) + fi fi + +AC_SUBST(X_LDFLAGS) +AC_SUBST(X_CFLAGS) +AC_SUBST(X_LIBS) +AC_SUBST(X_DEVS) AC_SUBST(X11DEVS) +AC_SUBST(XLIBS) dnl executible name AC_ARG_WITH(gs, AC_HELP_STRING([--with-gs=NAME], @@ -236,6 +336,32 @@ fi]) AC_SUBST(COMPILE_INITS) +dnl Dynamic device support. +DYNAMIC_CFLAGS="" +DYNAMIC_DEVS="" +DYNAMIC_FLAGS="" +DYNAMIC_LDFLAGS="" +DYNAMIC_LIBS="" +INSTALL_SHARED="" + +AC_ARG_ENABLE([dynamic], AC_HELP_STRING([--enable-dynamic], + [Enable dynamically loaded drivers]), +[ + DYNAMIC_CFLAGS="-fPIC" + DYNAMIC_DEVS="\$(GLOBJDIR)/X11.so" + DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\"" + DYNAMIC_LDFLAGS="-fPIC -shared" + DYNAMIC_LIBS="" + X_DEVS="" +]) + +AC_SUBST(DYNAMIC_CFLAGS) +AC_SUBST(DYNAMIC_DEVS) +AC_SUBST(DYNAMIC_FLAGS) +AC_SUBST(DYNAMIC_LDFLAGS) +AC_SUBST(DYNAMIC_LIBS) +AC_SUBST(INSTALL_SHARED) + dnl -------------------------------------------------- dnl Check for library functions dnl --------------------------------------------------