From d59b05e531051524e079bf4e103e9abecc46bdaa Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 4 Mar 2010 11:10:32 +0100 Subject: Configure script improvements --- config.h.in | 3 + configure | 282 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- configure.ac | 15 +++- 3 files changed, 284 insertions(+), 16 deletions(-) diff --git a/config.h.in b/config.h.in index e58d569f..f1436fd0 100644 --- a/config.h.in +++ b/config.h.in @@ -3,6 +3,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H +/* Define to 1 if you have the `forkpty' function. */ +#undef HAVE_FORKPTY + /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H diff --git a/configure b/configure index 65c1873f..ea4abd75 100755 --- a/configure +++ b/configure @@ -639,13 +639,13 @@ ac_includes_default="\ ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS -HAVE_OPENCL_FALSE -HAVE_OPENCL_TRUE HAVE_GTK_FALSE HAVE_GTK_TRUE GTK_LIBS GTK_CFLAGS PKG_CONFIG +HAVE_OPENCL_FALSE +HAVE_OPENCL_TRUE LIBOBJS EGREP GREP @@ -3638,6 +3638,7 @@ fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -4926,6 +4927,7 @@ done + # Check whether --with-hdf5 was given. if test "${with_hdf5+set}" = set; then withval=$with_hdf5; HDF5_CFLAGS="-I$withval/include" @@ -4936,6 +4938,7 @@ fi + # Check whether --with-gsl was given. if test "${with_gsl+set}" = set; then withval=$with_gsl; GSL_CFLAGS="-I$withval/include" @@ -5130,6 +5133,14 @@ $as_echo "no" >&6; } fi + if test x$have_opencl = xtrue; then + HAVE_OPENCL_TRUE= + HAVE_OPENCL_FALSE='#' +else + HAVE_OPENCL_TRUE='#' + HAVE_OPENCL_FALSE= +fi + # Check whether --enable-gtk was given. @@ -5477,7 +5488,6 @@ $as_echo "no" >&6; } fi - if test x$havegtk = xtrue; then HAVE_GTK_TRUE= HAVE_GTK_FALSE='#' @@ -5486,14 +5496,258 @@ else HAVE_GTK_FALSE= fi - if test x$have_opencl = xtrue; then - HAVE_OPENCL_TRUE= - HAVE_OPENCL_FALSE='#' + + + +for ac_func in forkpty +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 else - HAVE_OPENCL_TRUE='#' - HAVE_OPENCL_FALSE= + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" fi +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +else + { $as_echo "$as_me:$LINENO: checking for forkpty in -lutil" >&5 +$as_echo_n "checking for forkpty in -lutil... " >&6; } +if test "${ac_cv_lib_util_forkpty+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lutil $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char forkpty (); +int +main () +{ +return forkpty (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_util_forkpty=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_util_forkpty=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_util_forkpty" >&5 +$as_echo "$ac_cv_lib_util_forkpty" >&6; } +if test "x$ac_cv_lib_util_forkpty" = x""yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_FORKPTY 1 +_ACEOF + LIBS="$LIBS -lutil" +else + { $as_echo "$as_me:$LINENO: checking for forkpty in -lbsd" >&5 +$as_echo_n "checking for forkpty in -lbsd... " >&6; } +if test "${ac_cv_lib_bsd_forkpty+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lbsd $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char forkpty (); +int +main () +{ +return forkpty (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_bsd_forkpty=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_bsd_forkpty=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_forkpty" >&5 +$as_echo "$ac_cv_lib_bsd_forkpty" >&6; } +if test "x$ac_cv_lib_bsd_forkpty" = x""yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_FORKPTY 1 +_ACEOF + LIBS="$LIBS -lbsd" +fi + + +fi + + +fi +done + + CFLAGS="$CFLAGS $HDF5_CFLAGS $GTK_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS" LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -lutil" @@ -5619,17 +5873,17 @@ $as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi -if test -z "${HAVE_GTK_TRUE}" && test -z "${HAVE_GTK_FALSE}"; then - { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_GTK\" was never defined. +if test -z "${HAVE_OPENCL_TRUE}" && test -z "${HAVE_OPENCL_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_OPENCL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 -$as_echo "$as_me: error: conditional \"HAVE_GTK\" was never defined. +$as_echo "$as_me: error: conditional \"HAVE_OPENCL\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi -if test -z "${HAVE_OPENCL_TRUE}" && test -z "${HAVE_OPENCL_FALSE}"; then - { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_OPENCL\" was never defined. +if test -z "${HAVE_GTK_TRUE}" && test -z "${HAVE_GTK_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_GTK\" was never defined. Usually this means the macro was only invoked conditionally." >&5 -$as_echo "$as_me: error: conditional \"HAVE_OPENCL\" was never defined. +$as_echo "$as_me: error: conditional \"HAVE_GTK\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi diff --git a/configure.ac b/configure.ac index 1911f67d..95aebd31 100644 --- a/configure.ac +++ b/configure.ac @@ -11,6 +11,7 @@ AC_PROG_AWK AC_PROG_INSTALL AC_PROG_LN_S + AC_HEADER_STDC AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h]) AC_C_CONST @@ -18,12 +19,14 @@ AC_FUNC_MALLOC AC_TYPE_SIGNAL AC_CHECK_FUNCS([strdup]) + AC_ARG_WITH(hdf5, [AS_HELP_STRING([--with-hdf5], [specify location of HDF5 library])], [HDF5_CFLAGS="-I$withval/include" HDF5_LIBS="-L$withval/lib -lhdf5"], [HDF5_LIBS="-lhdf5"]) + AC_ARG_WITH(gsl, [AS_HELP_STRING([--with-gsl], [specify location of GSL])], [GSL_CFLAGS="-I$withval/include" @@ -51,6 +54,7 @@ AS_IF([test "x$enable_opencl" == "xyes"], [ AC_MSG_RESULT([no]) ]) +AM_CONDITIONAL([HAVE_OPENCL], test x$have_opencl = xtrue) AC_ARG_ENABLE(gtk, AS_HELP_STRING([--disable-gtk], [Disable GTK+/GLib])) @@ -71,9 +75,16 @@ AS_IF([test "x$enable_gtk" != "xno"], [ AC_MSG_RESULT([no]) ]) - AM_CONDITIONAL([HAVE_GTK], test x$havegtk = xtrue) -AM_CONDITIONAL([HAVE_OPENCL], test x$have_opencl = xtrue) + + +AC_CHECK_FUNCS(forkpty,, + AC_CHECK_LIB(util,forkpty, + [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lutil"], + AC_CHECK_LIB(bsd,forkpty, [AC_DEFINE(HAVE_FORKPTY) LIBS="$LIBS -lbsd"]) + ) +) + CFLAGS="$CFLAGS $HDF5_CFLAGS $GTK_CFLAGS $GSL_CFLAGS $OPENCL_CFLAGS" LIBS="$LIBS $HDF5_LIBS -lm -lz $GSL_LIBS $GTK_LIBS $OPENCL_LIBS -lutil" -- cgit v1.2.3