Commit 5d65bb66d05272b5378209749e03a57189b6072a

Authored by Jürgen Knödlseder
1 parent 6d133475

Use libedit instead of libreadline if available (this is only needed on Mac OS X…

…, partially fixes #1607).

Also removed Python include directory for C++ compilations (fixes #1612).
configure.ac
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 # Configuration for GammaLib - a versatile toolbox for high-level analysis # 2 # Configuration for GammaLib - a versatile toolbox for high-level analysis #
3 # of astronomical gamma-ray data # 3 # of astronomical gamma-ray data #
4 # ------------------------------------------------------------------------- # 4 # ------------------------------------------------------------------------- #
5 -# Copyright (C) 2006-2015 Juergen Knoedlseder # 5 +# Copyright (C) 2006-2016 Juergen Knoedlseder #
6 # ------------------------------------------------------------------------- # 6 # ------------------------------------------------------------------------- #
7 # # 7 # #
8 # This program is free software: you can redistribute it and/or modify # 8 # This program is free software: you can redistribute it and/or modify #
@@ -879,7 +879,7 @@ else @@ -879,7 +879,7 @@ else
879 python_path="-I$python_path" 879 python_path="-I$python_path"
880 fi 880 fi
881 PYTHON_CPPFLAGS=$python_path 881 PYTHON_CPPFLAGS=$python_path
882 - CPPFLAGS="${CPPFLAGS} ${python_path}" 882 + #CPPFLAGS="${CPPFLAGS} ${python_path}"
883 AC_SUBST([PYTHON_CPPFLAGS]) 883 AC_SUBST([PYTHON_CPPFLAGS])
884 884
885 # ... otherwise check for includes relative to exectuable (obsolete?) 885 # ... otherwise check for includes relative to exectuable (obsolete?)
@@ -1059,11 +1059,16 @@ fi @@ -1059,11 +1059,16 @@ fi
1059 # finally we perform system dependent checks. These are: # 1059 # finally we perform system dependent checks. These are: #
1060 # - Darwin: check in /opt/local/lib # 1060 # - Darwin: check in /opt/local/lib #
1061 ############################################################################# 1061 #############################################################################
  1062 +has_editline="no"
1062 has_readline="no" 1063 has_readline="no"
1063 use_readline="no" 1064 use_readline="no"
  1065 +LIB_READLINE=
  1066 +LIB_NCURSES=
1064 LIBS_READLINE= 1067 LIBS_READLINE=
1065 LIBDIR_READLINE= 1068 LIBDIR_READLINE=
1066 INCDIR_READLINE= 1069 INCDIR_READLINE=
  1070 +AC_SUBST(LIB_READLINE)
  1071 +AC_SUBST(LIB_NCURSES)
1067 AC_SUBST(LIBS_READLINE) 1072 AC_SUBST(LIBS_READLINE)
1068 AC_SUBST(LIBDIR_READLINE) 1073 AC_SUBST(LIBDIR_READLINE)
1069 AC_SUBST(INCDIR_READLINE) 1074 AC_SUBST(INCDIR_READLINE)
@@ -1087,18 +1092,30 @@ if [test "x$with_readline" = "xyes";] then @@ -1087,18 +1092,30 @@ if [test "x$with_readline" = "xyes";] then
1087 INCDIR_READLINE="$gammalib_prefix/include/readline" 1092 INCDIR_READLINE="$gammalib_prefix/include/readline"
1088 else 1093 else
1089 1094
1090 - # Next search for readline in standard path  
1091 - AC_CHECK_LIB([readline], [main],  
1092 - [AC_MSG_NOTICE([readline found])  
1093 - AC_CHECK_HEADER([readline/readline.h],  
1094 - [has_readline="yes"  
1095 - AC_MSG_NOTICE([readline headers found])], 1095 + # Next search for editline in standard path (for Mac OS X)
  1096 + AC_CHECK_LIB([edit], [main],
  1097 + [AC_MSG_NOTICE([editline found])
  1098 + AC_CHECK_HEADER([editline/readline.h],
  1099 + [has_editline="yes"
  1100 + AC_MSG_NOTICE([editline headers found])],
1096 [], [])], 1101 [], [])],
1097 - [], [-lncurses])  
1098 -  
1099 - # If not found then make additional checks  
1100 - if [test "x$has_readline" != "xyes";] then  
1101 - case $ac_sys_system in 1102 + [], [-lcurses])
  1103 +
  1104 + # If not found then search now for readline
  1105 + if [test "x$has_editline" != "xyes";] then
  1106 +
  1107 + # Next search for readline in standard path
  1108 + AC_CHECK_LIB([readline], [main],
  1109 + [AC_MSG_NOTICE([readline found])
  1110 + AC_CHECK_HEADER([readline/readline.h],
  1111 + [has_readline="yes"
  1112 + AC_MSG_NOTICE([readline headers found])],
  1113 + [], [])],
  1114 + [], [-lncurses])
  1115 +
  1116 + # If not found then make additional checks
  1117 + if [test "x$has_readline" != "xyes";] then
  1118 + case $ac_sys_system in
1102 Darwin*) 1119 Darwin*)
1103 if [test -f /opt/local/lib/libreadline$SHAREDSUFFIX -a \ 1120 if [test -f /opt/local/lib/libreadline$SHAREDSUFFIX -a \
1104 -f /opt/local/include/readline/readline.h]; then 1121 -f /opt/local/include/readline/readline.h]; then
@@ -1110,17 +1127,25 @@ if [test "x$with_readline" = "xyes";] then @@ -1110,17 +1127,25 @@ if [test "x$with_readline" = "xyes";] then
1110 ;; 1127 ;;
1111 *) 1128 *)
1112 ;; 1129 ;;
1113 - esac 1130 + esac
  1131 + fi
1114 fi 1132 fi
1115 -  
1116 fi 1133 fi
1117 -  
1118 fi 1134 fi
1119 1135
1120 # If we have ncurses and readline then add readline support to GammaLib 1136 # If we have ncurses and readline then add readline support to GammaLib
1121 -if [test "x$has_readline" = "xyes" -a "x$has_ncurses" = "xyes"]; then 1137 +if [test "x$has_editline" = "xyes" -a "x$has_ncurses" = "xyes"]; then
  1138 + use_readline="yes"
  1139 + AC_DEFINE([HAVE_LIBREADLINE], [1], [Define if readline library is available])
  1140 + LIB_READLINE=edit
  1141 + LIB_NCURSES=curses
  1142 + LIBS="${LIBS} -ledit -lcurses"
  1143 + LIBS_READLINE="-ledit -lcurses"
  1144 +elif [test "x$has_readline" = "xyes" -a "x$has_ncurses" = "xyes"]; then
1122 use_readline="yes" 1145 use_readline="yes"
1123 AC_DEFINE([HAVE_LIBREADLINE], [1], [Define if readline library is available]) 1146 AC_DEFINE([HAVE_LIBREADLINE], [1], [Define if readline library is available])
  1147 + LIB_READLINE=readline
  1148 + LIB_NCURSES=ncurses
1124 LIBS="${LIBS} -lreadline -lncurses" 1149 LIBS="${LIBS} -lreadline -lncurses"
1125 LIBS_READLINE="-lreadline -lncurses" 1150 LIBS_READLINE="-lreadline -lncurses"
1126 fi 1151 fi
pyext/setup.py.in
1 ############################################################################# 1 #############################################################################
2 # Disutils setup file for gammalib Python extension module # 2 # Disutils setup file for gammalib Python extension module #
3 # ------------------------------------------------------------------------- # 3 # ------------------------------------------------------------------------- #
4 -# Copyright (C) 2011-2015 Juergen Knoedlseder # 4 +# Copyright (C) 2011-2016 Juergen Knoedlseder #
5 # ------------------------------------------------------------------------- # 5 # ------------------------------------------------------------------------- #
6 # # 6 # #
7 # This program is free software: you can redistribute it and/or modify # 7 # This program is free software: you can redistribute it and/or modify #
@@ -85,8 +85,8 @@ if '@WITH_CFITSIO_TRUE@' != '#': @@ -85,8 +85,8 @@ if '@WITH_CFITSIO_TRUE@' != '#':
85 # Add readline library only if available 85 # Add readline library only if available
86 if '@WITH_READLINE_TRUE@' != '#': 86 if '@WITH_READLINE_TRUE@' != '#':
87 sys.stdout.write("Link readline into Python bindings.\n") 87 sys.stdout.write("Link readline into Python bindings.\n")
88 - libraries.append('readline')  
89 - libraries.append('ncurses') 88 + libraries.append('@LIB_READLINE@')
  89 + libraries.append('@LIB_NCURSES@')
90 90
91 # Add extra libraries 91 # Add extra libraries
92 extra_libs = ('@PYTHON_EXTRA_LIBS@').split(',') 92 extra_libs = ('@PYTHON_EXTRA_LIBS@').split(',')